mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Merge changes I25711dd5,I43188fab
* changes: Fix assertions in WebPRescalerExportRow() Add descriptions of default configuration in help info.
This commit is contained in:
commit
9d4f209f80
23
README
23
README
@ -220,8 +220,9 @@ assumed to be a PNG, JPEG, TIFF or WebP file.
|
|||||||
Options:
|
Options:
|
||||||
-h / -help ............. short help
|
-h / -help ............. short help
|
||||||
-H / -longhelp ......... long help
|
-H / -longhelp ......... long help
|
||||||
-q <float> ............. quality factor (0:small..100:big)
|
-q <float> ............. quality factor (0:small..100:big), default=75
|
||||||
-alpha_q <int> ......... transparency-compression quality (0..100)
|
-alpha_q <int> ......... transparency-compression quality (0..100),
|
||||||
|
default=100
|
||||||
-preset <string> ....... preset setting, one of:
|
-preset <string> ....... preset setting, one of:
|
||||||
default, photo, picture,
|
default, photo, picture,
|
||||||
drawing, icon, text
|
drawing, icon, text
|
||||||
@ -229,15 +230,15 @@ Options:
|
|||||||
-z <int> ............... activates lossless preset with given
|
-z <int> ............... activates lossless preset with given
|
||||||
level in [0:fast, ..., 9:slowest]
|
level in [0:fast, ..., 9:slowest]
|
||||||
|
|
||||||
-m <int> ............... compression method (0=fast, 6=slowest)
|
-m <int> ............... compression method (0=fast, 6=slowest), default=4
|
||||||
-segments <int> ........ number of segments to use (1..4)
|
-segments <int> ........ number of segments to use (1..4), default=4
|
||||||
-size <int> ............ target size (in bytes)
|
-size <int> ............ target size (in bytes)
|
||||||
-psnr <float> .......... target PSNR (in dB. typically: 42)
|
-psnr <float> .......... target PSNR (in dB. typically: 42)
|
||||||
|
|
||||||
-s <int> <int> ......... input size (width x height) for YUV
|
-s <int> <int> ......... input size (width x height) for YUV
|
||||||
-sns <int> ............. spatial noise shaping (0:off, 100:max)
|
-sns <int> ............. spatial noise shaping (0:off, 100:max), default=50
|
||||||
-f <int> ............... filter strength (0=off..100)
|
-f <int> ............... filter strength (0=off..100), default=60
|
||||||
-sharpness <int> ....... filter sharpness (0:most .. 7:least sharp)
|
-sharpness <int> ....... filter sharpness (0:most .. 7:least sharp), default=0
|
||||||
-strong ................ use strong filter instead of simple (default)
|
-strong ................ use strong filter instead of simple (default)
|
||||||
-nostrong .............. use simple filter instead of strong
|
-nostrong .............. use simple filter instead of strong
|
||||||
-partition_limit <int> . limit quality to fit the 512k limit on
|
-partition_limit <int> . limit quality to fit the 512k limit on
|
||||||
@ -252,18 +253,18 @@ Options:
|
|||||||
-print_ssim ............ prints averaged SSIM distortion
|
-print_ssim ............ prints averaged SSIM distortion
|
||||||
-print_lsim ............ prints local-similarity distortion
|
-print_lsim ............ prints local-similarity distortion
|
||||||
-d <file.pgm> .......... dump the compressed output (PGM file)
|
-d <file.pgm> .......... dump the compressed output (PGM file)
|
||||||
-alpha_method <int> .... transparency-compression method (0..1)
|
-alpha_method <int> .... transparency-compression method (0..1), default=1
|
||||||
-alpha_filter <string> . predictive filtering for alpha plane,
|
-alpha_filter <string> . predictive filtering for alpha plane,
|
||||||
one of: none, fast (default) or best
|
one of: none, fast (default) or best
|
||||||
-exact ................. preserve RGB values in transparent area
|
-exact ................. preserve RGB values in transparent area, default=off
|
||||||
-blend_alpha <hex> ..... blend colors against background color
|
-blend_alpha <hex> ..... blend colors against background color
|
||||||
expressed as RGB values written in
|
expressed as RGB values written in
|
||||||
hexadecimal, e.g. 0xc0e0d0 for red=0xc0
|
hexadecimal, e.g. 0xc0e0d0 for red=0xc0
|
||||||
green=0xe0 and blue=0xd0
|
green=0xe0 and blue=0xd0
|
||||||
-noalpha ............... discard any transparency information
|
-noalpha ............... discard any transparency information
|
||||||
-lossless .............. encode image losslessly
|
-lossless .............. encode image losslessly, default=off
|
||||||
-near_lossless <int> ... use near-lossless image
|
-near_lossless <int> ... use near-lossless image
|
||||||
preprocessing (0..100=off)
|
preprocessing (0..100=off), default=100
|
||||||
-hint <string> ......... specify image characteristics hint,
|
-hint <string> ......... specify image characteristics hint,
|
||||||
one of: photo, picture or graph
|
one of: photo, picture or graph
|
||||||
|
|
||||||
|
@ -521,9 +521,10 @@ static void HelpLong(void) {
|
|||||||
printf("\nOptions:\n");
|
printf("\nOptions:\n");
|
||||||
printf(" -h / -help ............. short help\n");
|
printf(" -h / -help ............. short help\n");
|
||||||
printf(" -H / -longhelp ......... long help\n");
|
printf(" -H / -longhelp ......... long help\n");
|
||||||
printf(" -q <float> ............. quality factor (0:small..100:big)\n");
|
printf(" -q <float> ............. quality factor (0:small..100:big), "
|
||||||
printf(" -alpha_q <int> ......... transparency-compression quality "
|
"default=75\n");
|
||||||
"(0..100)\n");
|
printf(" -alpha_q <int> ......... transparency-compression quality (0..100),"
|
||||||
|
"\n default=100\n");
|
||||||
printf(" -preset <string> ....... preset setting, one of:\n");
|
printf(" -preset <string> ....... preset setting, one of:\n");
|
||||||
printf(" default, photo, picture,\n");
|
printf(" default, photo, picture,\n");
|
||||||
printf(" drawing, icon, text\n");
|
printf(" drawing, icon, text\n");
|
||||||
@ -531,16 +532,20 @@ static void HelpLong(void) {
|
|||||||
printf(" -z <int> ............... activates lossless preset with given\n"
|
printf(" -z <int> ............... activates lossless preset with given\n"
|
||||||
" level in [0:fast, ..., 9:slowest]\n");
|
" level in [0:fast, ..., 9:slowest]\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" -m <int> ............... compression method (0=fast, 6=slowest)\n");
|
printf(" -m <int> ............... compression method (0=fast, 6=slowest), "
|
||||||
printf(" -segments <int> ........ number of segments to use (1..4)\n");
|
"default=4\n");
|
||||||
|
printf(" -segments <int> ........ number of segments to use (1..4), "
|
||||||
|
"default=4\n");
|
||||||
printf(" -size <int> ............ target size (in bytes)\n");
|
printf(" -size <int> ............ target size (in bytes)\n");
|
||||||
printf(" -psnr <float> .......... target PSNR (in dB. typically: 42)\n");
|
printf(" -psnr <float> .......... target PSNR (in dB. typically: 42)\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" -s <int> <int> ......... input size (width x height) for YUV\n");
|
printf(" -s <int> <int> ......... input size (width x height) for YUV\n");
|
||||||
printf(" -sns <int> ............. spatial noise shaping (0:off, 100:max)\n");
|
printf(" -sns <int> ............. spatial noise shaping (0:off, 100:max), "
|
||||||
printf(" -f <int> ............... filter strength (0=off..100)\n");
|
"default=50\n");
|
||||||
|
printf(" -f <int> ............... filter strength (0=off..100), "
|
||||||
|
"default=60\n");
|
||||||
printf(" -sharpness <int> ....... "
|
printf(" -sharpness <int> ....... "
|
||||||
"filter sharpness (0:most .. 7:least sharp)\n");
|
"filter sharpness (0:most .. 7:least sharp), default=0\n");
|
||||||
printf(" -strong ................ use strong filter instead "
|
printf(" -strong ................ use strong filter instead "
|
||||||
"of simple (default)\n");
|
"of simple (default)\n");
|
||||||
printf(" -nostrong .............. use simple filter instead of strong\n");
|
printf(" -nostrong .............. use simple filter instead of strong\n");
|
||||||
@ -557,19 +562,21 @@ static void HelpLong(void) {
|
|||||||
printf(" -print_ssim ............ prints averaged SSIM distortion\n");
|
printf(" -print_ssim ............ prints averaged SSIM distortion\n");
|
||||||
printf(" -print_lsim ............ prints local-similarity distortion\n");
|
printf(" -print_lsim ............ prints local-similarity distortion\n");
|
||||||
printf(" -d <file.pgm> .......... dump the compressed output (PGM file)\n");
|
printf(" -d <file.pgm> .......... dump the compressed output (PGM file)\n");
|
||||||
printf(" -alpha_method <int> .... transparency-compression method (0..1)\n");
|
printf(" -alpha_method <int> .... transparency-compression method (0..1), "
|
||||||
|
"default=1\n");
|
||||||
printf(" -alpha_filter <string> . predictive filtering for alpha plane,\n");
|
printf(" -alpha_filter <string> . predictive filtering for alpha plane,\n");
|
||||||
printf(" one of: none, fast (default) or best\n");
|
printf(" one of: none, fast (default) or best\n");
|
||||||
printf(" -exact ................. preserve RGB values in transparent area"
|
printf(" -exact ................. preserve RGB values in transparent area, "
|
||||||
"\n");
|
"default=off\n");
|
||||||
printf(" -blend_alpha <hex> ..... blend colors against background color\n"
|
printf(" -blend_alpha <hex> ..... blend colors against background color\n"
|
||||||
" expressed as RGB values written in\n"
|
" expressed as RGB values written in\n"
|
||||||
" hexadecimal, e.g. 0xc0e0d0 for red=0xc0\n"
|
" hexadecimal, e.g. 0xc0e0d0 for red=0xc0\n"
|
||||||
" green=0xe0 and blue=0xd0\n");
|
" green=0xe0 and blue=0xd0\n");
|
||||||
printf(" -noalpha ............... discard any transparency information\n");
|
printf(" -noalpha ............... discard any transparency information\n");
|
||||||
printf(" -lossless .............. encode image losslessly\n");
|
printf(" -lossless .............. encode image losslessly, default=off\n");
|
||||||
printf(" -near_lossless <int> ... use near-lossless image\n"
|
printf(" -near_lossless <int> ... use near-lossless image\n"
|
||||||
" preprocessing (0..100=off)\n");
|
" preprocessing (0..100=off), "
|
||||||
|
"default=100\n");
|
||||||
#ifdef WEBP_EXPERIMENTAL_FEATURES
|
#ifdef WEBP_EXPERIMENTAL_FEATURES
|
||||||
printf(" -delta_palettization ... use delta palettization\n");
|
printf(" -delta_palettization ... use delta palettization\n");
|
||||||
#endif // WEBP_EXPERIMENTAL_FEATURES
|
#endif // WEBP_EXPERIMENTAL_FEATURES
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.\" Hey, EMACS: -*- nroff -*-
|
.\" Hey, EMACS: -*- nroff -*-
|
||||||
.TH CWEBP 1 "June 23, 2016"
|
.TH CWEBP 1 "August 05, 2016"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
cwebp \- compress an image file to a WebP file
|
cwebp \- compress an image file to a WebP file
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -171,7 +171,7 @@ Specify the amplitude of the spatial noise shaping. Spatial noise shaping
|
|||||||
(or \fBsns\fP for short) refers to a general collection of built\-in algorithms
|
(or \fBsns\fP for short) refers to a general collection of built\-in algorithms
|
||||||
used to decide which area of the picture should use relatively less bits,
|
used to decide which area of the picture should use relatively less bits,
|
||||||
and where else to better transfer these bits. The possible range goes from
|
and where else to better transfer these bits. The possible range goes from
|
||||||
0 (algorithm is off) to 100 (the maximal effect). The default value is 80.
|
0 (algorithm is off) to 100 (the maximal effect). The default value is 50.
|
||||||
.TP
|
.TP
|
||||||
.BI \-segments " int
|
.BI \-segments " int
|
||||||
Change the number of partitions to use during the segmentation of the
|
Change the number of partitions to use during the segmentation of the
|
||||||
|
@ -173,10 +173,10 @@ void WebPRescalerExportRow(WebPRescaler* const wrk) {
|
|||||||
WebPRescalerExportRowExpand(wrk);
|
WebPRescalerExportRowExpand(wrk);
|
||||||
} else if (wrk->fxy_scale) {
|
} else if (wrk->fxy_scale) {
|
||||||
WebPRescalerExportRowShrink(wrk);
|
WebPRescalerExportRowShrink(wrk);
|
||||||
} else { // very special case for src = dst = 1x1
|
} else { // special case
|
||||||
int i;
|
int i;
|
||||||
|
assert(wrk->src_height == wrk->dst_height && wrk->x_add == 1);
|
||||||
assert(wrk->src_width == 1 && wrk->dst_width <= 2);
|
assert(wrk->src_width == 1 && wrk->dst_width <= 2);
|
||||||
assert(wrk->src_height == 1 && wrk->dst_height == 1);
|
|
||||||
for (i = 0; i < wrk->num_channels * wrk->dst_width; ++i) {
|
for (i = 0; i < wrk->num_channels * wrk->dst_width; ++i) {
|
||||||
wrk->dst[i] = wrk->irow[i];
|
wrk->dst[i] = wrk->irow[i];
|
||||||
wrk->irow[i] = 0;
|
wrk->irow[i] = 0;
|
||||||
|
@ -48,11 +48,15 @@ void WebPRescalerInit(WebPRescaler* const wrk, int src_width, int src_height,
|
|||||||
wrk->y_sub = wrk->y_expand ? y_sub - 1 : y_sub;
|
wrk->y_sub = wrk->y_expand ? y_sub - 1 : y_sub;
|
||||||
wrk->y_accum = wrk->y_expand ? wrk->y_sub : wrk->y_add;
|
wrk->y_accum = wrk->y_expand ? wrk->y_sub : wrk->y_add;
|
||||||
if (!wrk->y_expand) {
|
if (!wrk->y_expand) {
|
||||||
// this is WEBP_RESCALER_FRAC(dst_height, x_add * y_add) without the cast.
|
// This is WEBP_RESCALER_FRAC(dst_height, x_add * y_add) without the cast.
|
||||||
|
// Its value is <= WEBP_RESCALER_ONE, because dst_height <= wrk->y_add, and
|
||||||
|
// wrk->x_add >= 1;
|
||||||
const uint64_t ratio =
|
const uint64_t ratio =
|
||||||
(uint64_t)dst_height * WEBP_RESCALER_ONE / (wrk->x_add * wrk->y_add);
|
(uint64_t)dst_height * WEBP_RESCALER_ONE / (wrk->x_add * wrk->y_add);
|
||||||
if (ratio != (uint32_t)ratio) {
|
if (ratio != (uint32_t)ratio) {
|
||||||
// We can't represent the ratio with the current fixed-point precision.
|
// When ratio == WEBP_RESCALER_ONE, we can't represent the ratio with the
|
||||||
|
// current fixed-point precision. This happens when src_height ==
|
||||||
|
// wrk->y_add (which == src_height), and wrk->x_add == 1.
|
||||||
// => We special-case fxy_scale = 0, in WebPRescalerExportRow().
|
// => We special-case fxy_scale = 0, in WebPRescalerExportRow().
|
||||||
wrk->fxy_scale = 0;
|
wrk->fxy_scale = 0;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user