diff --git a/ChangeLog b/ChangeLog index a76ce7dd..6dfb2fc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - all tools support `--version` - add vips_svgload_string() convenience function - fix thumbnail with small image plus crop plus no upsize [Andrewsville] +- rename speed / reduction-effort / etc. params as "effort" 14/7/21 started 8.11.3 - build threadpool later [kleisauke] diff --git a/libvips/foreign/pforeign.h b/libvips/foreign/pforeign.h index d0773caa..ff1dbd48 100644 --- a/libvips/foreign/pforeign.h +++ b/libvips/foreign/pforeign.h @@ -211,7 +211,7 @@ int vips__webp_read_source( VipsSource *source, VipsImage *out, int vips__webp_write_target( VipsImage *image, VipsTarget *target, int Q, gboolean lossless, VipsForeignWebpPreset preset, gboolean smart_subsample, gboolean near_lossless, - int alpha_q, int reduction_effort, + int alpha_q, int effort, gboolean min_size, int kmin, int kmax, gboolean strip, const char *profile ); diff --git a/libvips/foreign/pngsave.c b/libvips/foreign/pngsave.c index ecdbb3a2..ecf0f575 100644 --- a/libvips/foreign/pngsave.c +++ b/libvips/foreign/pngsave.c @@ -472,8 +472,8 @@ vips_foreign_save_png_buffer_init( VipsForeignSavePngBuffer *buffer ) * * @palette: %gboolean, enable quantisation to 8bpp palette * * @Q: %gint, quality for 8bpp quantisation * * @dither: %gdouble, amount of dithering for 8bpp quantization - * * @bitdepth: %int, set write bit depth to 1, 2, 4 or 8 - * * @effort: %int, quantisation CPU effort + * * @bitdepth: %gint, set write bit depth to 1, 2, 4 or 8 + * * @effort: %gint, quantisation CPU effort * * Write a VIPS image to a file as PNG. * @@ -546,8 +546,8 @@ vips_pngsave( VipsImage *in, const char *filename, ... ) * * @palette: %gboolean, enable quantisation to 8bpp palette * * @Q: %gint, quality for 8bpp quantisation * * @dither: %gdouble, amount of dithering for 8bpp quantization - * * @bitdepth: %int, set write bit depth to 1, 2, 4 or 8 - * * @effort: %int, quantisation CPU effort + * * @bitdepth: %gint, set write bit depth to 1, 2, 4 or 8 + * * @effort: %gint, quantisation CPU effort * * As vips_pngsave(), but save to a memory buffer. * @@ -602,8 +602,8 @@ vips_pngsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) * * @palette: enable quantisation to 8bpp palette * * @Q: quality for 8bpp quantisation * * @dither: amount of dithering for 8bpp quantization - * * @bitdepth: %int, set write bit depth to 1, 2, 4 or 8 - * * @effort: %int, quantisation CPU effort + * * @bitdepth: %gint, set write bit depth to 1, 2, 4 or 8 + * * @effort: %gint, quantisation CPU effort * * As vips_pngsave(), but save to a target. * diff --git a/libvips/foreign/vips2webp.c b/libvips/foreign/vips2webp.c index 96beade0..77539d4b 100644 --- a/libvips/foreign/vips2webp.c +++ b/libvips/foreign/vips2webp.c @@ -85,7 +85,7 @@ typedef struct { gboolean smart_subsample; gboolean near_lossless; int alpha_q; - int reduction_effort; + int effort; gboolean min_size; int kmin; int kmax; @@ -147,7 +147,7 @@ static int vips_webp_write_init( VipsWebPWrite *write, VipsImage *image, int Q, gboolean lossless, VipsForeignWebpPreset preset, gboolean smart_subsample, gboolean near_lossless, - int alpha_q, int reduction_effort, + int alpha_q, int effort, gboolean min_size, int kmin, int kmax, gboolean strip, const char *profile ) { @@ -158,7 +158,7 @@ vips_webp_write_init( VipsWebPWrite *write, VipsImage *image, write->smart_subsample = smart_subsample; write->near_lossless = near_lossless; write->alpha_q = alpha_q; - write->reduction_effort = reduction_effort; + write->effort = effort; write->min_size = min_size; write->kmin = kmin; write->kmax = kmax; @@ -196,7 +196,7 @@ vips_webp_write_init( VipsWebPWrite *write, VipsImage *image, write->config.lossless = lossless || near_lossless; write->config.alpha_quality = alpha_q; - write->config.method = reduction_effort; + write->config.method = effort; if( lossless ) write->config.quality = Q; @@ -554,7 +554,7 @@ int vips__webp_write_target( VipsImage *image, VipsTarget *target, int Q, gboolean lossless, VipsForeignWebpPreset preset, gboolean smart_subsample, gboolean near_lossless, - int alpha_q, int reduction_effort, + int alpha_q, int effort, gboolean min_size, int kmin, int kmax, gboolean strip, const char *profile ) { @@ -562,7 +562,7 @@ vips__webp_write_target( VipsImage *image, VipsTarget *target, if( vips_webp_write_init( &write, image, Q, lossless, preset, smart_subsample, near_lossless, - alpha_q, reduction_effort, min_size, kmin, kmax, strip, + alpha_q, effort, min_size, kmin, kmax, strip, profile ) ) return( -1 ); diff --git a/libvips/foreign/webpsave.c b/libvips/foreign/webpsave.c index e969fd00..b96bd2c9 100644 --- a/libvips/foreign/webpsave.c +++ b/libvips/foreign/webpsave.c @@ -5,9 +5,11 @@ * 29/10/18 * - add animated webp support * 15/1/19 lovell - * - add @reduction_effort + * - add @effort * 18/7/20 * - add @profile param to match tiff, jpg, etc. + * 30/7/21 + * - rename "reduction-effort" as "effort" */ /* @@ -84,7 +86,7 @@ typedef struct _VipsForeignSaveWebp { /* Level of CPU effort to reduce file size. */ - int reduction_effort; + int effort; /* Animated webp options. */ @@ -204,11 +206,11 @@ vips_foreign_save_webp_class_init( VipsForeignSaveWebpClass *class ) G_STRUCT_OFFSET( VipsForeignSaveWebp, kmax ), 0, INT_MAX, INT_MAX ); - VIPS_ARG_INT( class, "reduction_effort", 19, - _( "Reduction effort" ), + VIPS_ARG_INT( class, "effort", 19, + _( "Effort" ), _( "Level of CPU effort to reduce file size" ), VIPS_ARGUMENT_OPTIONAL_INPUT, - G_STRUCT_OFFSET( VipsForeignSaveWebp, reduction_effort ), + G_STRUCT_OFFSET( VipsForeignSaveWebp, effort ), 0, 6, 4 ); VIPS_ARG_STRING( class, "profile", 20, @@ -217,6 +219,13 @@ vips_foreign_save_webp_class_init( VipsForeignSaveWebpClass *class ) VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsForeignSaveWebp, profile ), NULL ); + + VIPS_ARG_INT( class, "reduction-effort", 21, + _( "Reduction effort" ), + _( "Level of CPU effort to reduce file size" ), + VIPS_ARGUMENT_OPTIONAL_INPUT | VIPS_ARGUMENT_DEPRECATED, + G_STRUCT_OFFSET( VipsForeignSaveWebp, effort ), + 0, 6, 4 ); } static void @@ -224,7 +233,7 @@ vips_foreign_save_webp_init( VipsForeignSaveWebp *webp ) { webp->Q = 75; webp->alpha_q = 100; - webp->reduction_effort = 4; + webp->effort = 4; /* ie. keyframes disabled by default. */ @@ -259,7 +268,7 @@ vips_foreign_save_webp_target_build( VipsObject *object ) if( vips__webp_write_target( save->ready, target->target, webp->Q, webp->lossless, webp->preset, webp->smart_subsample, webp->near_lossless, - webp->alpha_q, webp->reduction_effort, + webp->alpha_q, webp->effort, webp->min_size, webp->kmin, webp->kmax, save->strip, webp->profile ) ) return( -1 ); @@ -327,7 +336,7 @@ vips_foreign_save_webp_file_build( VipsObject *object ) if( vips__webp_write_target( save->ready, target, webp->Q, webp->lossless, webp->preset, webp->smart_subsample, webp->near_lossless, - webp->alpha_q, webp->reduction_effort, + webp->alpha_q, webp->effort, webp->min_size, webp->kmin, webp->kmax, save->strip, webp->profile ) ) { VIPS_UNREF( target ); @@ -399,7 +408,7 @@ vips_foreign_save_webp_buffer_build( VipsObject *object ) if( vips__webp_write_target( save->ready, target, webp->Q, webp->lossless, webp->preset, webp->smart_subsample, webp->near_lossless, - webp->alpha_q, webp->reduction_effort, + webp->alpha_q, webp->effort, webp->min_size, webp->kmin, webp->kmax, save->strip, webp->profile ) ) { VIPS_UNREF( target ); @@ -473,7 +482,7 @@ vips_foreign_save_webp_mime_build( VipsObject *object ) if( vips__webp_write_target( save->ready, target, webp->Q, webp->lossless, webp->preset, webp->smart_subsample, webp->near_lossless, - webp->alpha_q, webp->reduction_effort, + webp->alpha_q, webp->effort, webp->min_size, webp->kmin, webp->kmax, save->strip, webp->profile ) ) { VIPS_UNREF( target ); @@ -528,7 +537,7 @@ vips_foreign_save_webp_mime_init( VipsForeignSaveWebpMime *mime ) * * @smart_subsample: %gboolean, enables high quality chroma subsampling * * @near_lossless: %gboolean, preprocess in lossless mode (controlled by Q) * * @alpha_q: %gint, set alpha quality in lossless mode - * * @reduction_effort: %gint, level of CPU effort to reduce file size + * * @effort: %gint, level of CPU effort to reduce file size * * @min_size: %gboolean, minimise size * * @kmin: %gint, minimum number of frames between keyframes * * @kmax: %gint, maximum number of frames between keyframes @@ -549,7 +558,7 @@ vips_foreign_save_webp_mime_init( VipsForeignSaveWebpMime *mime ) * Use @alpha_q to set the quality for the alpha channel in lossy mode. It has * the range 1 - 100, with the default 100. * - * Use @reduction_effort to control how much CPU time to spend attempting to + * Use @effort to control how much CPU time to spend attempting to * reduce file size. A higher value means more effort and therefore CPU time * should be spent. It has the range 0-6 and a default value of 4. * @@ -606,7 +615,7 @@ vips_webpsave( VipsImage *in, const char *filename, ... ) * * @smart_subsample: %gboolean, enables high quality chroma subsampling * * @near_lossless: %gboolean, preprocess in lossless mode (controlled by Q) * * @alpha_q: %gint, set alpha quality in lossless mode - * * @reduction_effort: %gint, level of CPU effort to reduce file size + * * @effort: %gint, level of CPU effort to reduce file size * * @min_size: %gboolean, minimise size * * @kmin: %gint, minimum number of frames between keyframes * * @kmax: %gint, maximum number of frames between keyframes @@ -664,7 +673,7 @@ vips_webpsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) * * @smart_subsample: %gboolean, enables high quality chroma subsampling * * @near_lossless: %gboolean, preprocess in lossless mode (controlled by Q) * * @alpha_q: %gint, set alpha quality in lossless mode - * * @reduction_effort: %gint, level of CPU effort to reduce file size + * * @effort: %gint, level of CPU effort to reduce file size * * @min_size: %gboolean, minimise size * * @kmin: %gint, minimum number of frames between keyframes * * @kmax: %gint, maximum number of frames between keyframes @@ -704,7 +713,7 @@ vips_webpsave_mime( VipsImage *in, ... ) * * @smart_subsample: %gboolean, enables high quality chroma subsampling * * @near_lossless: %gboolean, preprocess in lossless mode (controlled by Q) * * @alpha_q: %gint, set alpha quality in lossless mode - * * @reduction_effort: %gint, level of CPU effort to reduce file size + * * @effort: %gint, level of CPU effort to reduce file size * * @min_size: %gboolean, minimise size * * @kmin: %gint, minimum number of frames between keyframes * * @kmax: %gint, maximum number of frames between keyframes