From 0fcff235b3eaea5e8d8795a97327ddfe9e758ec5 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 2 Oct 2013 10:36:00 +0100 Subject: [PATCH] deprecate im_tone_map() and im_tone_analyze() too trivial and specialised to be worth redoing --- ChangeLog | 1 + libvips/create/tonelut.c | 4 +--- libvips/deprecated/Makefile.am | 1 + libvips/{histogram => deprecated}/tone.c | 7 +++---- libvips/deprecated/vips7compat.c | 2 +- libvips/histogram/Makefile.am | 4 +--- libvips/include/vips/histogram.h | 4 ---- libvips/include/vips/vips7compat.h | 4 ++++ 8 files changed, 12 insertions(+), 15 deletions(-) rename libvips/{histogram => deprecated}/tone.c (95%) diff --git a/ChangeLog b/ChangeLog index c916f548..de1e593d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ - vips_conv() is a simple wrapper over the old convolution functions - new optimize_coding param for jpeg write produces optimal Huffman tables, thanks Lovell +- im_tone_map() and im_tone_analyse() deprecated 3/7/13 started 7.34.2 - lower priority for Matlab load to reduce segvs from Mat_Open(), thanks diff --git a/libvips/create/tonelut.c b/libvips/create/tonelut.c index c1ce41ee..096221ae 100644 --- a/libvips/create/tonelut.c +++ b/libvips/create/tonelut.c @@ -328,7 +328,7 @@ vips_tonelut_init( VipsTonelut *lut ) * * vips_tonelut() generates a tone curve for the adjustment of image * levels. It is mostly designed for adjusting the L* part of a LAB image in - * way suitable for print work, but you can use it for other things too. + * a way suitable for print work, but you can use it for other things too. * * The curve is an unsigned 16-bit image with (@in_max + 1) entries, * each in the range [0, @out_max]. @@ -337,8 +337,6 @@ vips_tonelut_init( VipsTonelut *lut ) * specify the scaling for the input and output images with the @in_max and * @out_max parameters. * - * See also: vips_tone_map(), vips_tone_analyse(). - * * Returns: 0 on success, -1 on error */ int diff --git a/libvips/deprecated/Makefile.am b/libvips/deprecated/Makefile.am index 87700b32..c61a6f82 100644 --- a/libvips/deprecated/Makefile.am +++ b/libvips/deprecated/Makefile.am @@ -1,6 +1,7 @@ noinst_LTLIBRARIES = libdeprecated.la libdeprecated_la_SOURCES = \ + tone.c \ im_linreg.c \ im_point_bilinear.c \ resample_dispatch.c \ diff --git a/libvips/histogram/tone.c b/libvips/deprecated/tone.c similarity index 95% rename from libvips/histogram/tone.c rename to libvips/deprecated/tone.c index 2969406c..b0d735cc 100644 --- a/libvips/histogram/tone.c +++ b/libvips/deprecated/tone.c @@ -171,12 +171,11 @@ im_tone_analyse( return( -1 ); if( im_extract_band( t[0], t[1], 0 ) || - im_clip2fmt( t[1], t[2], IM_BANDFMT_USHORT ) || - im_histgr( t[2], t[3], -1 ) ) + im_clip2fmt( t[1], t[2], IM_BANDFMT_USHORT ) ) return( -1 ); - if( im_mpercent_hist( t[3], 0.1 / 100.0, &high ) || - im_mpercent_hist( t[3], 99.9 / 100.0, &low ) ) + if( im_mpercent( t[2], 0.1 / 100.0, &high ) || + im_mpercent( t[2], 99.9 / 100.0, &low ) ) return( -1 ); Lb = 100 * low / 32768; diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 5ab023a7..77fa0317 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -3642,7 +3642,7 @@ im_profile( IMAGE *in, IMAGE *out, int dir ) int im_mpercent( IMAGE *in, double percent, int *out ) { - if( vips_hist_percent( in, percent, out, NULL ) ) + if( vips_hist_percent( in, percent / 100.0, out, NULL ) ) return( -1 ); return( 0 ); diff --git a/libvips/histogram/Makefile.am b/libvips/histogram/Makefile.am index 33291d5e..4ceba837 100644 --- a/libvips/histogram/Makefile.am +++ b/libvips/histogram/Makefile.am @@ -14,8 +14,6 @@ libhistogram_la_SOURCES = \ hist_local.c \ percent.c \ hist_ismonotonic.c \ - stdif.c \ - \ - tone.c + stdif.c AM_CPPFLAGS = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@ diff --git a/libvips/include/vips/histogram.h b/libvips/include/vips/histogram.h index f85ecba1..06945fbe 100644 --- a/libvips/include/vips/histogram.h +++ b/libvips/include/vips/histogram.h @@ -60,10 +60,6 @@ int vips_stdif( VipsImage *in, VipsImage **out, int width, int height, ... ) int vips_hist_ismonotonic( VipsImage *in, int *monotonic, ... ) __attribute__((sentinel)); -int im_tone_analyse( VipsImage *in, VipsImage *out, - double Ps, double Pm, double Ph, double S, double M, double H ); -int im_tone_map( VipsImage *in, VipsImage *out, VipsImage *lut ); - #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/include/vips/vips7compat.h b/libvips/include/vips/vips7compat.h index 2f9b293d..32c3d88d 100644 --- a/libvips/include/vips/vips7compat.h +++ b/libvips/include/vips/vips7compat.h @@ -881,6 +881,10 @@ int im_mpercent( VipsImage *in, double percent, int *out ); int im_mpercent_hist( VipsImage *hist, double percent, int *out ); int im_ismonotonic( VipsImage *lut, int *out ); +int im_tone_analyse( VipsImage *in, VipsImage *out, + double Ps, double Pm, double Ph, double S, double M, double H ); +int im_tone_map( VipsImage *in, VipsImage *out, VipsImage *lut ); + /* Not really correct, but who uses these. */ #define im_lhisteq_raw im_lhisteq