From af95502d82577af31f6782ae2a2eb1e32f1dde8b Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 2 Feb 2011 17:17:05 +0000 Subject: [PATCH] final operators gtk-doc'd All done! Good Lord. Just some parts of iofuncs/ still to do. --- ChangeLog | 3 + configure.in | 1 - doc/reference/libvips-docs.sgml.in | 5 -- libvips/Makefile.am | 2 - libvips/acquire/Makefile.am | 7 -- libvips/deprecated/Makefile.am | 2 + libvips/{acquire => deprecated}/im_clamp.c | 0 .../{resample => deprecated}/im_stretch3.c | 0 libvips/include/vips/almostdeprecated.h | 2 + libvips/include/vips/resample.h | 2 - libvips/resample/Makefile.am | 2 - libvips/resample/im_rightshift_size.c | 42 +++--------- libvips/resample/im_shrink.c | 64 ++++++++++--------- libvips/video/im_video_test.c | 10 +++ libvips/video/im_video_v4l1.c | 28 ++++++++ 15 files changed, 88 insertions(+), 82 deletions(-) delete mode 100644 libvips/acquire/Makefile.am rename libvips/{acquire => deprecated}/im_clamp.c (100%) rename libvips/{resample => deprecated}/im_stretch3.c (100%) diff --git a/ChangeLog b/ChangeLog index 67bec6ca..69ecc86e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,9 @@ - done gtk-doc for other - --vips-progress tells you about nthreads, tile size, nlines - gtk-doc for interpolate +- move im_stretch3() to deprecated +- move im_clamp() to deprecated +- gtk-doc for video ... all operators done! amazing argh 30/11/10 started 7.24.0 - bump for new stable diff --git a/configure.in b/configure.in index 6b984d7f..0c8d522f 100644 --- a/configure.in +++ b/configure.in @@ -620,7 +620,6 @@ AC_OUTPUT([ libvips/include/Makefile libvips/include/vips/Makefile libvips/Makefile - libvips/acquire/Makefile libvips/arithmetic/Makefile libvips/boolean/Makefile libvips/cimg/Makefile diff --git a/doc/reference/libvips-docs.sgml.in b/doc/reference/libvips-docs.sgml.in index af3ff48d..b7d23e06 100644 --- a/doc/reference/libvips-docs.sgml.in +++ b/doc/reference/libvips-docs.sgml.in @@ -47,13 +47,8 @@ - - - - VIPS operation API by section (no gtkdoc comments yet) - diff --git a/libvips/Makefile.am b/libvips/Makefile.am index 16c2caee..3b5eb417 100644 --- a/libvips/Makefile.am +++ b/libvips/Makefile.am @@ -11,7 +11,6 @@ endif SUBDIRS = \ include \ - acquire \ arithmetic \ resample \ boolean \ @@ -42,7 +41,6 @@ endif # DLLs need dependant libs there too ... put @VIPS_LIBS@ at the end libvips_la_LIBADD = \ - acquire/libacquire.la \ resample/libresample.la \ arithmetic/libarithmetic.la \ boolean/libboolean.la \ diff --git a/libvips/acquire/Makefile.am b/libvips/acquire/Makefile.am deleted file mode 100644 index 849f96a3..00000000 --- a/libvips/acquire/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -noinst_LTLIBRARIES = libacquire.la - -libacquire_la_SOURCES = \ - im_clamp.c - -INCLUDES = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@ - diff --git a/libvips/deprecated/Makefile.am b/libvips/deprecated/Makefile.am index ebec85fa..24113c03 100644 --- a/libvips/deprecated/Makefile.am +++ b/libvips/deprecated/Makefile.am @@ -5,6 +5,8 @@ libdeprecated_la_SOURCES = \ im_dif_std.c \ im_simcontr.c \ im_spatres.c \ + im_stretch3.c \ + im_clamp.c \ cooc_funcs.c \ glds_funcs.c \ im_fav4.c \ diff --git a/libvips/acquire/im_clamp.c b/libvips/deprecated/im_clamp.c similarity index 100% rename from libvips/acquire/im_clamp.c rename to libvips/deprecated/im_clamp.c diff --git a/libvips/resample/im_stretch3.c b/libvips/deprecated/im_stretch3.c similarity index 100% rename from libvips/resample/im_stretch3.c rename to libvips/deprecated/im_stretch3.c diff --git a/libvips/include/vips/almostdeprecated.h b/libvips/include/vips/almostdeprecated.h index 444e217c..b9e655b7 100644 --- a/libvips/include/vips/almostdeprecated.h +++ b/libvips/include/vips/almostdeprecated.h @@ -169,6 +169,8 @@ int im_dif_std(); int im_simcontr( IMAGE *out, int xsize, int ysize ); int im_spatres( IMAGE *in, IMAGE *out, int step ); +int im_stretch3( IMAGE *in, IMAGE *out, double dx, double dy ); + /* Renamed operations. */ diff --git a/libvips/include/vips/resample.h b/libvips/include/vips/resample.h index b169916b..d0b6bfd8 100644 --- a/libvips/include/vips/resample.h +++ b/libvips/include/vips/resample.h @@ -44,8 +44,6 @@ int im_affinei( IMAGE *in, IMAGE *out, 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 ); diff --git a/libvips/resample/Makefile.am b/libvips/resample/Makefile.am index be626846..351bcd4c 100644 --- a/libvips/resample/Makefile.am +++ b/libvips/resample/Makefile.am @@ -8,7 +8,6 @@ libresample_la_SOURCES = \ im_affine.c \ interpolate.c \ im_shrink.c \ - im_stretch3.c \ im_rightshift_size.c \ transform.c \ resample_dispatch.c \ @@ -24,7 +23,6 @@ libresample_la_SOURCES = \ im_affine.c \ interpolate.c \ im_shrink.c \ - im_stretch3.c \ im_rightshift_size.c \ transform.c \ resample_dispatch.c diff --git a/libvips/resample/im_rightshift_size.c b/libvips/resample/im_rightshift_size.c index 65e123f9..90567506 100644 --- a/libvips/resample/im_rightshift_size.c +++ b/libvips/resample/im_rightshift_size.c @@ -1,16 +1,4 @@ -/* @(#) Decrease the size of an image by a power-of-two factor, summing the - * @(#) values of pixels, and shifting to give output of the specified band - * @(#) format. - * @(#) - * @(#) int - * @(#) im_rightshift_size( - * @(#) IMAGE *in, - * @(#) IMAGE *out, - * @(#) int xshift, - * @(#) int yshift, - * @(#) int band_fmt - * @(#) ); - * @(#) +/* fast shrink by a power of two * * Copyright: 2006, Tom Vajzovic * @@ -24,6 +12,8 @@ * 2007-02-02 jc * - added return 0; on success * - FUNCTION_NAME updated + * 2/2/11 + * - gtk-doc */ /* @@ -109,10 +99,10 @@ GEN_FUNCS_SIGN( guint ) * @yshift: vertical shrink * @band_fmt: output format * - * Shrink an image by a pair of power-of-two factors and shifting to give + * Shrink @in by a pair of power-of-two factors, shifting to give * output of the specified band format. This is faster than im_shrink(). * - * See also: im_shrink(), im_affine(). + * See also: im_shrink(), im_affinei(). * * Returns: 0 on success, -1 on error */ @@ -138,25 +128,13 @@ im_rightshift_size( IMAGE *in, IMAGE *out, int xshift, int yshift, int band_fmt im_error( FUNCTION_NAME, "%s", _( "would result in zero size output image" ) ); return -1; } - if( ! vips_bandfmt_isint( in->BandFmt ) ){ - im_error( FUNCTION_NAME, "%s", _( "integer type images only" ) ); + if( im_check_int( FUNCTION_NAME, in ) || + im_check_uncoded( FUNCTION_NAME, in ) ) return -1; - } - if( IM_CODING_NONE != in->Coding ){ - im_error( FUNCTION_NAME, "%s", _( "uncoded images only" ) ); - return -1; - } - if( vips_bandfmt_isuint( in->BandFmt ) ){ - if( IM_BANDFMT_UCHAR != band_fmt && IM_BANDFMT_USHORT != band_fmt && IM_BANDFMT_UINT != band_fmt ){ - im_error( FUNCTION_NAME, "%s", _( "unsigned input means that output must be unsigned int, short or char" ) ); + if( vips_bandfmt_isuint( in->BandFmt ) != vips_bandfmt_isuint( band_fmt ) ) { + im_error( FUNCTION_NAME, "%s", + _( "image and band_fmt must match in sign" ) ); return -1; - } - } - else { - if( IM_BANDFMT_CHAR != band_fmt && IM_BANDFMT_SHORT != band_fmt && IM_BANDFMT_INT != band_fmt ){ - im_error( FUNCTION_NAME, "%s", _( "signed input means that output must be signed int, short or char" ) ); - return -1; - } } outbits= im_bits_of_fmt( band_fmt ); diff --git a/libvips/resample/im_shrink.c b/libvips/resample/im_shrink.c index 5ff459a1..cfd6df62 100644 --- a/libvips/resample/im_shrink.c +++ b/libvips/resample/im_shrink.c @@ -1,13 +1,4 @@ -/* @(#) Shrink any non-complex image by some x, y, factor. No interpolation! - * @(#) Just average an area. Suitable for making quicklooks only! - * @(#) - * @(#) int - * @(#) im_shrink( in, out, xshrink, yshrink ) - * @(#) IMAGE *in, *out; - * @(#) double xshrink, yshrink; - * @(#) - * @(#) Returns either 0 (success) or -1 (fail) - * @(#) +/* shrink with a box filter * * Copyright: 1990, N. Dessipris. * @@ -34,6 +25,8 @@ * - IM_CODING_LABQ handling added here * 20/12/08 * - fall back to im_copy() for 1/1 shrink + * 2/2/11 + * - gtk-doc */ /* @@ -240,20 +233,6 @@ shrink( IMAGE *in, IMAGE *out, double xshrink, double yshrink ) { ShrinkInfo *st; - /* Check parameters. - */ - if( !in || vips_bandfmt_iscomplex( in->BandFmt ) ) { - im_error( "im_shrink", "%s", _( "non-complex input only" ) ); - return( -1 ); - } - if( xshrink < 1.0 || yshrink < 1.0 ) { - im_error( "im_shrink", - "%s", _( "shrink factors should both be >1" ) ); - return( -1 ); - } - if( im_piocheck( in, out ) ) - return( -1 ); - /* Prepare output. Note: we round the output width down! */ if( im_cp_desc( out, in ) ) @@ -293,11 +272,39 @@ shrink( IMAGE *in, IMAGE *out, double xshrink, double yshrink ) return( 0 ); } -/* Wrap up the above: do IM_CODING_LABQ as well. +/** + * im_shrink: + * @in: input image + * @out: output image + * @xshrink: horizontal shrink + * @yshrink: vertical shrink + * + * Shrink @in by a pair of factors with a simple box filter. + * + * You will get aliasing for non-integer shrinks. In this case, shrink with + * this function to the nearest integer size above the target shrink, then + * downsample to the exact size with im_affinei() and your choice of + * interpolator. + * + * im_rightshift_size() is faster for factors which are integer powers of two. + * + * See also: im_rightshift_size(), im_affinei(). + * + * Returns: 0 on success, -1 on error */ int im_shrink( IMAGE *in, IMAGE *out, double xshrink, double yshrink ) { + if( im_check_noncomplex( "im_shrink", in ) || + im_check_coding_known( "im_shrink", in ) || + im_piocheck( in, out ) ) + return( -1 ); + if( xshrink < 1.0 || yshrink < 1.0 ) { + im_error( "im_shrink", + "%s", _( "shrink factors should be >= 1" ) ); + return( -1 ); + } + if( xshrink == 1 && yshrink == 1 ) { return( im_copy( in, out ) ); } @@ -310,14 +317,9 @@ im_shrink( IMAGE *in, IMAGE *out, double xshrink, double yshrink ) im_LabS2LabQ( t[1], out ) ) return( -1 ); } - else if( in->Coding == IM_CODING_NONE ) { + else if( shrink( in, out, xshrink, yshrink ) ) return( -1 ); - } - else { - im_error( "im_shrink", "%s", _( "unknown coding type" ) ); - return( -1 ); - } return( 0 ); } diff --git a/libvips/video/im_video_test.c b/libvips/video/im_video_test.c index 31f81e53..c00eaffc 100644 --- a/libvips/video/im_video_test.c +++ b/libvips/video/im_video_test.c @@ -38,6 +38,16 @@ #include #endif /*WITH_DMALLOC*/ +/** + * im_video_test: + * @im: write image here + * @brightness: brightness setting + * @error: set this to make the function return an error + * + * Make a test video image. Set @error to trigger an error. + * + * Returns: 0 on success, -1 on error + */ int im_video_test( IMAGE *im, int brightness, int error ) { diff --git a/libvips/video/im_video_v4l1.c b/libvips/video/im_video_v4l1.c index 112d86b6..5e5816f0 100644 --- a/libvips/video/im_video_v4l1.c +++ b/libvips/video/im_video_v4l1.c @@ -629,6 +629,34 @@ lgrab_capture( LGrab *lg, IMAGE *im ) return( 0 ); } +/** + * im_video_v4l1: + * @im: write image here + * @device: device to grab from + * @channel: channel to grab + * @brightness: brightness setting + * @colour: colour setting + * @contrast: contrast setting + * @hue: hue setting + * @ngrabs: average this many frames + * + * Grab an image from a device using the Video4Linux1 interface. It grabs + * 24-bit RGB at the maximum size your card allows. + * + * @device should typically be "/dev/video". + * @channel selects the channel to acquire: usually 0 is TV, and 1 is + * composite video. @brightness, @colour, @contrast and @hue + * set grab parameters. Each should be in the range (0 - 32768). + * 32768 is usually the value you want. @ngrabs + * sets the number of frames the card should average. + * Higher values are slower, but typically less noisy (and slightly softer). + * + * This function needs updating to newer video standards. + * + * See also: im_video_test(). + * + * Returns: 0 on success, -1 on error + */ int im_video_v4l1( IMAGE *im, const char *device, int channel, int brightness, int colour, int contrast, int hue,