From 8200afcbb6627dd65962ce599b20e62093f78deb Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 4 Nov 2009 17:20:23 +0000 Subject: [PATCH] stuff --- TODO | 4 ++ doc/reference/libvips-docs.sgml.in | 2 +- libvips/colour/disp.c | 2 +- libvips/deprecated/Makefile.am | 1 + libvips/deprecated/deprecated_dispatch.c | 32 +++++++++ .../im_resize_linear.c | 0 libvips/include/vips/deprecated.h | 2 + libvips/include/vips/internal.h | 19 ++++++ libvips/include/vips/mask.h | 67 +++++++------------ libvips/include/vips/morphology.h | 7 +- libvips/include/vips/resample.h | 25 ++++--- libvips/mask/mask_dispatch.c | 13 ++++ libvips/morphology/morph_dispatch.c | 11 +++ libvips/mosaicing/im_clinear.c | 1 + libvips/mosaicing/mosaicing_dispatch.c | 10 +++ libvips/other/other_dispatch.c | 10 +++ libvips/resample/Makefile.am | 1 - libvips/resample/interpolate.c | 9 +++ libvips/resample/resample_dispatch.c | 42 +++--------- 19 files changed, 164 insertions(+), 94 deletions(-) rename libvips/{resample => deprecated}/im_resize_linear.c (100%) diff --git a/TODO b/TODO index eb3a5b23..42efe4a0 100644 --- a/TODO +++ b/TODO @@ -2,6 +2,10 @@ avg is different? used to 120.134, now 120.151 +- segment should be in morph + +- insertplaceset should be with insert in conversion + - _raw() variants should be deprecated? - look through more sections for stuff in the wrong place diff --git a/doc/reference/libvips-docs.sgml.in b/doc/reference/libvips-docs.sgml.in index 10785f23..cd9b09c3 100644 --- a/doc/reference/libvips-docs.sgml.in +++ b/doc/reference/libvips-docs.sgml.in @@ -53,11 +53,11 @@ + Other API (no gtkdoc comments yet) - diff --git a/libvips/colour/disp.c b/libvips/colour/disp.c index c648a02d..65895dcc 100644 --- a/libvips/colour/disp.c +++ b/libvips/colour/disp.c @@ -41,7 +41,7 @@ #include #include -#include +#include #ifdef WITH_DMALLOC #include diff --git a/libvips/deprecated/Makefile.am b/libvips/deprecated/Makefile.am index b0fad69e..233f3527 100644 --- a/libvips/deprecated/Makefile.am +++ b/libvips/deprecated/Makefile.am @@ -9,6 +9,7 @@ libdeprecated_la_SOURCES = \ im_printlines.c \ im_convsub.c \ im_line.c \ + im_resize_linear.c \ im_debugim.c \ im_gfadd.c \ im_setbox.c \ diff --git a/libvips/deprecated/deprecated_dispatch.c b/libvips/deprecated/deprecated_dispatch.c index d870efcc..a7519979 100644 --- a/libvips/deprecated/deprecated_dispatch.c +++ b/libvips/deprecated/deprecated_dispatch.c @@ -723,9 +723,41 @@ static im_function line_desc = { line_args /* Arg list */ }; +/* Args for im_resize_linear. + */ +static im_arg_desc resize_linear_args[] = { + IM_INPUT_IMAGE( "in" ), + IM_OUTPUT_IMAGE( "out" ), + IM_INPUT_INT( "X" ), + IM_INPUT_INT( "Y" ) +}; + +/* Call im_resize_linear via arg vector. + */ +static int +resize_linear_vec( im_object *argv ) +{ + int X = *((int *) argv[2]); + int Y = *((int *) argv[3]); + + return( im_resize_linear( argv[0], argv[1], X, Y ) ); +} + +/* Description of im_resize_linear. + */ +static im_function resize_linear_desc = { + "im_resize_linear", /* Name */ + "resize to X by Y pixels with linear interpolation", + 0, /* Flags */ + resize_linear_vec, /* Dispatch function */ + IM_NUMBER( resize_linear_args ), /* Size of arg list */ + resize_linear_args /* Arg list */ +}; + /* Package up all these functions. */ static im_function *deprecated_list[] = { + &resize_linear_desc, &cmulnorm_desc, &remainderconst_vec_desc, &fav4_desc, diff --git a/libvips/resample/im_resize_linear.c b/libvips/deprecated/im_resize_linear.c similarity index 100% rename from libvips/resample/im_resize_linear.c rename to libvips/deprecated/im_resize_linear.c diff --git a/libvips/include/vips/deprecated.h b/libvips/include/vips/deprecated.h index d3930f3f..1244d5d0 100644 --- a/libvips/include/vips/deprecated.h +++ b/libvips/include/vips/deprecated.h @@ -347,6 +347,8 @@ int im_convsub( IMAGE *in, IMAGE *out, INTMASK *mask, int xskip, int yskip ); int im_bernd( const char *tiffname, int x, int y, int w, int h ); +int im_resize_linear( IMAGE *, IMAGE *, int, int ); + int im_line( IMAGE *, int, int, int, int, int ); #ifdef __cplusplus diff --git a/libvips/include/vips/internal.h b/libvips/include/vips/internal.h index 43753c38..3fae6603 100644 --- a/libvips/include/vips/internal.h +++ b/libvips/include/vips/internal.h @@ -226,6 +226,25 @@ void imb_Lab2LabQ( float *, PEL *, int ); void imb_LabS2Lab( signed short *, float *, int ); void imb_Lab2LabS( float *, signed short *, int n ); +void im_copy_dmask_matrix( DOUBLEMASK *mask, double **matrix ); +void im_copy_matrix_dmask( double **matrix, DOUBLEMASK *mask ); + +int *im_ivector(); +float *im_fvector(); +double *im_dvector(); +void im_free_ivector(); +void im_free_fvector(); +void im_free_dvector(); + +int **im_imat_alloc(); +float **im_fmat_alloc(); +double **im_dmat_alloc(); +void im_free_imat(); +void im_free_fmat(); +void im_free_dmat(); + +int im_invmat( double **, int ); + #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/include/vips/mask.h b/libvips/include/vips/mask.h index 5e5db843..b98e356c 100644 --- a/libvips/include/vips/mask.h +++ b/libvips/include/vips/mask.h @@ -55,26 +55,11 @@ typedef struct im__DOUBLEMASK { char *filename; } DOUBLEMASK; -void im_copy_dmask_matrix( DOUBLEMASK *mask, double **matrix ); -void im_copy_matrix_dmask( double **matrix, DOUBLEMASK *mask ); - INTMASK *im_create_imask( const char *name, int width, int height ); INTMASK *im_create_imaskv( const char *name, int width, int height, ... ); DOUBLEMASK *im_create_dmask( const char *name, int width, int height ); DOUBLEMASK *im_create_dmaskv( const char *name, int width, int height, ... ); -INTMASK *im_log_imask( const char *name, double, double ); -DOUBLEMASK *im_log_dmask( const char *name, double, double ); -INTMASK *im_gauss_imask( const char *name, double, double ); -INTMASK *im_gauss_imask_sep( const char *name, double, double ); -DOUBLEMASK *im_gauss_dmask( const char *name, double, double ); - -INTMASK *im_dup_imask( INTMASK *m, const char *name ); -DOUBLEMASK *im_dup_dmask( DOUBLEMASK *m, const char *name ); - -int im_free_imask( INTMASK *m ); -int im_free_dmask( DOUBLEMASK *m ); - INTMASK *im_read_imask( const char *filename ); DOUBLEMASK *im_read_dmask( const char *filename ); @@ -86,40 +71,38 @@ int im_write_dmask( DOUBLEMASK *m ); int im_write_imask_name( INTMASK *m, const char *filename ); int im_write_dmask_name( DOUBLEMASK *m, const char *filename ); -INTMASK *im_scale_dmask( DOUBLEMASK *m, const char *name ); -void im_norm_dmask( DOUBLEMASK *mask ); -int *im_offsets45( int ); -int *im_offsets90( int ); -INTMASK *im_rotate_imask90( INTMASK *m, const char *name ); -INTMASK *im_rotate_imask45( INTMASK *m, const char *name ); -DOUBLEMASK *im_rotate_dmask90( DOUBLEMASK *m, const char *name ); -DOUBLEMASK *im_rotate_dmask45( DOUBLEMASK *m, const char *name ); +int im_free_imask( INTMASK *m ); +int im_free_dmask( DOUBLEMASK *m ); -DOUBLEMASK *im_mattrn( DOUBLEMASK *, const char * ); -DOUBLEMASK *im_matcat( DOUBLEMASK *, DOUBLEMASK *, const char * ); -DOUBLEMASK *im_matmul( DOUBLEMASK *, DOUBLEMASK *, const char * ); +INTMASK *im_log_imask( const char *filename, double sigma, double min_ampl ); +DOUBLEMASK *im_log_dmask( const char *filename, double sigma, double min_ampl ); +INTMASK *im_gauss_imask( const char *filename, double sigma, double min_ampl ); +INTMASK *im_gauss_imask_sep( const char *filename, + double sigma, double min_ampl ); +DOUBLEMASK *im_gauss_dmask( const char *filename, + double sigma, double min_ampl ); + +INTMASK *im_dup_imask( INTMASK *m, const char *name ); +DOUBLEMASK *im_dup_dmask( DOUBLEMASK *m, const char *name ); + +INTMASK *im_scale_dmask( DOUBLEMASK *m, const char *filename ); +void im_norm_dmask( DOUBLEMASK *mask ); +int *im_offsets45( int size ); +int *im_offsets90( int size ); +INTMASK *im_rotate_imask90( INTMASK *m, const char *filename ); +INTMASK *im_rotate_imask45( INTMASK *m, const char *filename ); +DOUBLEMASK *im_rotate_dmask90( DOUBLEMASK *m, const char *filename ); +DOUBLEMASK *im_rotate_dmask45( DOUBLEMASK *m, const char *filename ); + +DOUBLEMASK *im_mattrn( DOUBLEMASK *in, const char *name ); +DOUBLEMASK *im_matcat( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *name ); +DOUBLEMASK *im_matmul( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *name ); DOUBLEMASK *im_lu_decomp( const DOUBLEMASK *mat, const char *name ); int im_lu_solve( const DOUBLEMASK *lu, double *vec ); DOUBLEMASK *im_matinv( const DOUBLEMASK *mat, const char *name ); int im_matinv_inplace( DOUBLEMASK *mat ); -int *im_ivector(); -float *im_fvector(); -double *im_dvector(); -void im_free_ivector(); -void im_free_fvector(); -void im_free_dvector(); - -int **im_imat_alloc(); -float **im_fmat_alloc(); -double **im_dmat_alloc(); -void im_free_imat(); -void im_free_fmat(); -void im_free_dmat(); - -int im_invmat( double **, int ); - #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/include/vips/morphology.h b/libvips/include/vips/morphology.h index f0069fb2..1a6ac7cb 100644 --- a/libvips/include/vips/morphology.h +++ b/libvips/include/vips/morphology.h @@ -42,14 +42,13 @@ int im_dilate_raw( IMAGE *in, IMAGE *out, INTMASK *m ); int im_erode( IMAGE *in, IMAGE *out, INTMASK *m ); int im_erode_raw( IMAGE *in, IMAGE *out, INTMASK *m ); -int im_rank( IMAGE *in, IMAGE *out, int width, int height, int rank ); -int im_rank_raw( IMAGE *in, IMAGE *out, int xsize, int ysize, int n ); +int im_rank( IMAGE *in, IMAGE *out, int xsize, int ysize, int order ); +int im_rank_raw( IMAGE *in, IMAGE *out, int xsize, int ysize, int order ); int im_rank_image( IMAGE **in, IMAGE *out, int n, int index ); int im_maxvalue( IMAGE **in, IMAGE *out, int n ); int im_cntlines( IMAGE *im, double *nolines, int flag ); -int im_zerox( IMAGE *, IMAGE *, int ); - +int im_zerox( IMAGE *in, IMAGE *out, int flag ); int im_profile( IMAGE *in, IMAGE *out, int dir ); #ifdef __cplusplus diff --git a/libvips/include/vips/resample.h b/libvips/include/vips/resample.h index ee3e61da..b169916b 100644 --- a/libvips/include/vips/resample.h +++ b/libvips/include/vips/resample.h @@ -37,6 +37,18 @@ extern "C" { #endif /*__cplusplus*/ +int im_affinei( IMAGE *in, IMAGE *out, + VipsInterpolate *interpolate, + double a, double b, double c, double d, double dx, double dy, + int ox, int oy, int ow, int oh ); +int im_affinei_all( IMAGE *in, IMAGE *out, VipsInterpolate *interpolate, + double a, double b, double c, double d, double dx, double dy ) ; + +int im_stretch3( IMAGE *in, IMAGE *out, double dx, double dy ); + +int im_shrink( IMAGE *in, IMAGE *out, double xshrink, double yshrink ); +int im_rightshift_size( IMAGE *in, IMAGE *out, int xshift, int yshift, int band_fmt ); + int im_match_linear( IMAGE *ref, IMAGE *sec, IMAGE *out, int xr1, int yr1, int xs1, int ys1, int xr2, int yr2, int xs2, int ys2 ); @@ -45,19 +57,6 @@ int im_match_linear_search( IMAGE *ref, IMAGE *sec, IMAGE *out, int xr2, int yr2, int xs2, int ys2, int hwindowsize, int hsearchsize ); -int im_affinei( IMAGE *in, IMAGE *out, - VipsInterpolate *interpolate, - double a, double b, double c, double d, double dx, double dy, - int ox, int oy, int ow, int oh ); -int im_affinei_all( IMAGE *in, IMAGE *out, VipsInterpolate *interpolate, - double a, double b, double c, double d, double dx, double dy ) ; - -int im_resize_linear( IMAGE *, IMAGE *, int, int ); -int im_stretch3( IMAGE *in, IMAGE *out, double dx, double dy ); -int im_shrink( IMAGE *, IMAGE *, double, double ); - -int im_rightshift_size( IMAGE *in, IMAGE *out, int xshift, int yshift, int band_fmt ); - #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/mask/mask_dispatch.c b/libvips/mask/mask_dispatch.c index ea011e7a..3e246381 100644 --- a/libvips/mask/mask_dispatch.c +++ b/libvips/mask/mask_dispatch.c @@ -42,6 +42,19 @@ #include #endif /*WITH_DMALLOC*/ +/** + * SECTION: mask + * @short_description: load, save and process mask (matrix) objects + * @stability: Stable + * @include: vips/vips.h + * + * These operations load, save and process mask objects. Masks are used as + * paramaters to convolution and morphology operators, and to represent + * matrices. + * + * This API is horrible and clunky. Surely it will be replaced soon. + */ + /* One matrix in, one out. */ static im_arg_desc one_in_one_out[] = { diff --git a/libvips/morphology/morph_dispatch.c b/libvips/morphology/morph_dispatch.c index 8d3281ea..fda7907a 100644 --- a/libvips/morphology/morph_dispatch.c +++ b/libvips/morphology/morph_dispatch.c @@ -42,6 +42,17 @@ #include #endif /*WITH_DMALLOC*/ +/** + * SECTION: morphology + * @short_description: morphological operators, rank filters and related image + * analysis + * @see_also: boolean + * @stability: Stable + * @include: vips/vips.h + * + * Erode, dilate, rank, count lines, number regions, etc. + */ + /* Args to im_profile. */ static im_arg_desc profile_args[] = { diff --git a/libvips/mosaicing/im_clinear.c b/libvips/mosaicing/im_clinear.c index 3fa3ac79..eae8d6df 100644 --- a/libvips/mosaicing/im_clinear.c +++ b/libvips/mosaicing/im_clinear.c @@ -56,6 +56,7 @@ #include #include +#include #include "mosaic.h" diff --git a/libvips/mosaicing/mosaicing_dispatch.c b/libvips/mosaicing/mosaicing_dispatch.c index 777c878f..754c66ed 100644 --- a/libvips/mosaicing/mosaicing_dispatch.c +++ b/libvips/mosaicing/mosaicing_dispatch.c @@ -46,6 +46,16 @@ #include #endif /*WITH_DMALLOC*/ +/** + * SECTION: mosaicing + * @short_description: build image mosaics + * @stability: Stable + * @include: vips/vips.h + * + * A set of operations for assembling large image mosaics. + * + */ + /* Merge args. */ static im_arg_desc merge_args[] = { diff --git a/libvips/other/other_dispatch.c b/libvips/other/other_dispatch.c index 33bf5f5b..3f64ed30 100644 --- a/libvips/other/other_dispatch.c +++ b/libvips/other/other_dispatch.c @@ -42,6 +42,16 @@ #include #endif /*WITH_DMALLOC*/ +/** + * SECTION: other + * @short_description: miscellaneous operators + * @stability: Stable + * @include: vips/vips.h + * + * Various small things. + * + */ + /* Args for im_eye. */ static im_arg_desc eye_args[] = { diff --git a/libvips/resample/Makefile.am b/libvips/resample/Makefile.am index 6a08b1a2..2c6f6dfc 100644 --- a/libvips/resample/Makefile.am +++ b/libvips/resample/Makefile.am @@ -5,7 +5,6 @@ libresample_la_SOURCES = \ bicubic.cpp \ interpolate.c \ yafrsmooth.cpp \ - im_resize_linear.c \ im_shrink.c \ im_stretch3.c \ im_rightshift_size.c \ diff --git a/libvips/resample/interpolate.c b/libvips/resample/interpolate.c index 82e53429..53379c5d 100644 --- a/libvips/resample/interpolate.c +++ b/libvips/resample/interpolate.c @@ -48,6 +48,15 @@ #include #endif /*WITH_DMALLOC*/ +/** + * SECTION: interpolate + * @short_description: shrink, expand, rotate with a choice of interpolators + * @stability: Stable + * @include: vips/vips.h + * + * A number of image interpolators. + */ + /* * FAST_PSEUDO_FLOOR is a floor and floorf replacement which has been * found to be faster on several linux boxes than the library diff --git a/libvips/resample/resample_dispatch.c b/libvips/resample/resample_dispatch.c index 4a5a1be2..163eabf0 100644 --- a/libvips/resample/resample_dispatch.c +++ b/libvips/resample/resample_dispatch.c @@ -44,6 +44,16 @@ #include #endif /*WITH_DMALLOC*/ +/** + * SECTION: resample + * @short_description: shrink, expand, rotate with a choice of interpolators + * @stability: Stable + * @include: vips/vips.h + * + * Resample an image in various ways, using a #VipsInterpolator to generate + * intermediate values. + */ + /* Args to im_rightshift_size. */ static im_arg_desc rightshift_size_args[] = { @@ -202,37 +212,6 @@ static im_function shrink_desc = { shrink_args /* Arg list */ }; -/* Args for im_resize_linear. - */ -static im_arg_desc resize_linear_args[] = { - IM_INPUT_IMAGE( "in" ), - IM_OUTPUT_IMAGE( "out" ), - IM_INPUT_INT( "X" ), - IM_INPUT_INT( "Y" ) -}; - -/* Call im_resize_linear via arg vector. - */ -static int -resize_linear_vec( im_object *argv ) -{ - int X = *((int *) argv[2]); - int Y = *((int *) argv[3]); - - return( im_resize_linear( argv[0], argv[1], X, Y ) ); -} - -/* Description of im_resize_linear. - */ -static im_function resize_linear_desc = { - "im_resize_linear", /* Name */ - "resize to X by Y pixels with linear interpolation", - 0, /* Flags */ - resize_linear_vec, /* Dispatch function */ - IM_NUMBER( resize_linear_args ), /* Size of arg list */ - resize_linear_args /* Arg list */ -}; - /* Args to im_stretch3. */ static im_arg_desc stretch3_args[] = { @@ -267,7 +246,6 @@ static im_function stretch3_desc = { /* Package up all these functions. */ static im_function *resample_list[] = { - &resize_linear_desc, &rightshift_size_desc, &shrink_desc, &stretch3_desc,