mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-12 22:14:29 +02:00
add alpha dithering for lossy
new options: dwebp -alpha_dither vwebp -noalphadither When the source was marked as quantized, we use a threshold-averaging filter to smooth the decoded alpha plane. Note: this option forces the decoding of alpha data in one pass, and might slow the decoding a bit. The new field in WebPDecoderOptions struct is 'alpha_dithering_strength' (0 by default, means: off). Max strength value is '100'. Change-Id: I218e21af96360d4781587fede95f8ea4e2b7287a
This commit is contained in:
@ -557,6 +557,7 @@ static void Help(void) {
|
||||
" -nofilter .... disable in-loop filtering\n"
|
||||
" -nodither .... disable dithering\n"
|
||||
" -dither <d> .. dithering strength (in 0..100)\n"
|
||||
" -alpha_dither use alpha-plane dithering if needed.\n"
|
||||
" -mt .......... use multi-threading\n"
|
||||
" -crop <x> <y> <w> <h> ... crop output with the given rectangle\n"
|
||||
" -scale <w> <h> .......... scale the output (*after* any cropping)\n"
|
||||
@ -623,6 +624,8 @@ int main(int argc, const char *argv[]) {
|
||||
format = YUV;
|
||||
} else if (!strcmp(argv[c], "-mt")) {
|
||||
config.options.use_threads = 1;
|
||||
} else if (!strcmp(argv[c], "-alpha_dither")) {
|
||||
config.options.alpha_dithering_strength = 100;
|
||||
} else if (!strcmp(argv[c], "-nodither")) {
|
||||
config.options.dithering_strength = 0;
|
||||
} else if (!strcmp(argv[c], "-dither") && c < argc - 1) {
|
||||
|
@ -377,6 +377,7 @@ static void Help(void) {
|
||||
" -nofancy ..... don't use the fancy YUV420 upscaler.\n"
|
||||
" -nofilter .... disable in-loop filtering.\n"
|
||||
" -dither <int> dithering strength (0..100). Default=50.\n"
|
||||
" -noalphadither disable alpha plane dithering.\n"
|
||||
" -mt .......... use multi-threading.\n"
|
||||
" -info ........ print info.\n"
|
||||
" -h ....... this help message.\n"
|
||||
@ -399,6 +400,7 @@ int main(int argc, char *argv[]) {
|
||||
return -1;
|
||||
}
|
||||
config->options.dithering_strength = 50;
|
||||
config->options.alpha_dithering_strength = 100;
|
||||
kParams.use_color_profile = 1;
|
||||
|
||||
for (c = 1; c < argc; ++c) {
|
||||
@ -411,6 +413,8 @@ int main(int argc, char *argv[]) {
|
||||
config->options.no_fancy_upsampling = 1;
|
||||
} else if (!strcmp(argv[c], "-nofilter")) {
|
||||
config->options.bypass_filtering = 1;
|
||||
} else if (!strcmp(argv[c], "-noalphadither")) {
|
||||
config->options.alpha_dithering_strength = 0;
|
||||
} else if (!strcmp(argv[c], "-dither") && c + 1 < argc) {
|
||||
config->options.dithering_strength = strtol(argv[++c], NULL, 0);
|
||||
} else if (!strcmp(argv[c], "-info")) {
|
||||
|
Reference in New Issue
Block a user