more gtkdoc

This commit is contained in:
John Cupitt 2009-09-02 15:34:21 +00:00
parent 3e043b0d6f
commit 72e9094048
14 changed files with 186 additions and 129 deletions

2
TODO
View File

@ -1,5 +1,7 @@
- im_stats() needs a rewrite ... scrap the stupid 42 thing
- move im_fav4() etc. to a "deprecated" package
- 1-bit PNG read is broken?
> The bug is that 1bit depth PNG addresses are incorrectly interpreted. At

View File

@ -1,16 +1,4 @@
/* @(#) Find the phase of the cross power spectrum of two complex images,
* @(#) expressed as a complex image where the modulus of each pixel is
* @(#) one.
* @(#)
* @(#) I.E. find (a.b*)/|a.b*| where
* @(#) . represents complex multiplication
* @(#) * represents the complex conjugate
* @(#) || represents the complex modulus
* @(#)
* @(#) int im_cross_phase( IMAGE *a, IMAGE *b, IMAGE *out );
* @(#)
* @(#) All functions return 0 on success and -1 on error
* @(#)
/* im_cross_phase.c
*
* Copyright: 2008, Nottingham Trent University
*
@ -20,7 +8,8 @@
* 2008-02-04 tcv:
* - exp( i.th ) == cos(th)+i.sin(th) NOT sin(th)+i.cos(th)
* - add quadratic version (ifdef'd out ATM - still using trigonometric one)
*
* 2/9/09
* - gtk-doc comment
*/
/*
@ -127,6 +116,25 @@ complex_phase_ ## TYPE ( void *in1, void *in2, void *out, int n, void *im, void
COMPLEX_PHASE_FN( float, fabsf )
COMPLEX_PHASE_FN( double, fabs )
/**
* im_cross_phase:
* @a: input #IMAGE 1
* @b: input #IMAGE 2
* @out: output #IMAGE
*
* Find the phase of the cross power spectrum of two complex images,
* expressed as a complex image where the modulus of each pixel is
* one.
*
* I.E. find (a.b*)/|a.b*| where
* . represents complex multiplication
* * represents the complex conjugate
* || represents the complex modulus
*
* See also: im_multiply(), im_sign().
*
* Returns: 0 on success, -1 on error
*/
int im_cross_phase( IMAGE *a, IMAGE *b, IMAGE *out ){
#define FUNCTION_NAME "im_phase"

View File

@ -1,12 +1,4 @@
/* @(#) Find the standard deviation of an image. Takes any non-complex image
* @(#) format, returns a double. Finds the deviation of all bands.
* @(#)
* @(#) int
* @(#) im_deviate( im, out )
* @(#) IMAGE *im;
* @(#) double *out;
* @(#)
* @(#) Returns 0 on success and -1 on error.
/* im_deviate.c
*
* Copyright: 1990, J. Cupitt
*
@ -30,6 +22,9 @@
* - use 64 bit arithmetic
* 8/12/06
* - add liboil support
* 2/9/09
* - gtk-doc comment
* - minor reformatting
*/
/*
@ -66,7 +61,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <vips/vips.h>
#include <vips/internal.h>
@ -109,6 +103,23 @@ stop_fn( void *seq, void *a, void *b )
return( 0 );
}
/* Sum pels in this section.
*/
#define LOOP( TYPE ) { \
TYPE *p; \
\
for( y = to; y < bo; y++ ) { \
p = (TYPE *) IM_REGION_ADDR( reg, le, y ); \
\
for( x = 0; x < sz; x++ ) { \
TYPE v = p[x]; \
\
s += v; \
s2 += (double) v * (double) v; \
} \
} \
}
/* Loop over region, adding information to the appropriate fields of tmp.
*/
static int
@ -125,33 +136,16 @@ scan_fn( REGION *reg, void *seq, void *a, void *b )
double s2 = 0.0;
int x, y;
/* Sum pels in this section.
*/
#define loop(TYPE) \
{ TYPE *p; \
\
for( y = to; y < bo; y++ ) { \
p = (TYPE *) IM_REGION_ADDR( reg, le, y ); \
\
for( x = 0; x < sz; x++ ) { \
TYPE v = p[x]; \
\
s += v; \
s2 += (double) v * (double) v; \
}\
}\
}
/* Now generate code for all types.
*/
switch( im->BandFmt ) {
case IM_BANDFMT_UCHAR: loop(unsigned char); break;
case IM_BANDFMT_CHAR: loop(signed char); break;
case IM_BANDFMT_USHORT: loop(unsigned short); break;
case IM_BANDFMT_SHORT: loop(signed short); break;
case IM_BANDFMT_UINT: loop(unsigned int); break;
case IM_BANDFMT_INT: loop(signed int); break;
case IM_BANDFMT_FLOAT: loop(float); break;
case IM_BANDFMT_UCHAR: LOOP( unsigned char ); break;
case IM_BANDFMT_CHAR: LOOP( signed char ); break;
case IM_BANDFMT_USHORT: LOOP( unsigned short ); break;
case IM_BANDFMT_SHORT: LOOP( signed short ); break;
case IM_BANDFMT_UINT: LOOP( unsigned int ); break;
case IM_BANDFMT_INT: LOOP( signed int ); break;
case IM_BANDFMT_FLOAT: LOOP( float ); break;
case IM_BANDFMT_DOUBLE:
#ifdef HAVE_LIBOIL
@ -167,12 +161,12 @@ scan_fn( REGION *reg, void *seq, void *a, void *b )
s2 += t2;
}
#else /*!HAVE_LIBOIL*/
loop(double);
LOOP( double );
#endif /*HAVE_LIBOIL*/
break;
default:
assert( 0 );
g_assert( 0 );
}
/* Add to sum for this sequence.
@ -183,11 +177,24 @@ scan_fn( REGION *reg, void *seq, void *a, void *b )
return( 0 );
}
/* Find the average of an image.
/**
* im_deviate:
* @in: input #IMAGE
* @out: output pixel standard deviation
*
* This operation finds the standard deviation of all pixels in @in. It
* operates on all bands of the input image: use im_stats() if you need
* to calculate an average for each band.
*
* Non-complex images only.
*
* See also: im_stats(), im_bandmean(), im_avg(), im_rank()
*
* Returns: 0 on success, -1 on error
*/
int
im_deviate( IMAGE *in, double *out )
{
{
double sum[2] = { 0.0, 0.0 };
gint64 N;

View File

@ -177,7 +177,7 @@ expntran_gen( PEL *in, PEL *out, int width, IMAGE *im, ExpntraInfo *inf )
* @in: input #IMAGE
* @out: output #IMAGE
* @n: number of elements in array
* @b: array of constants
* @e: array of constants
*
* im_expntra_vec() transforms element x of input to
* <function>pow</function>(@b, x) in output.
@ -243,7 +243,7 @@ im_expntra_vec( IMAGE *in, IMAGE *out, int n, double *e )
* im_expntra:
* @in: input #IMAGE
* @out: output #IMAGE
* @b: base
* @e: base
*
* im_expntra() transforms element x of input to
* <function>pow</function>(@b, x) in output.
@ -255,9 +255,9 @@ im_expntra_vec( IMAGE *in, IMAGE *out, int n, double *e )
* Returns: 0 on success, -1 on error
*/
int
im_expntra( IMAGE *in, IMAGE *out, double b )
im_expntra( IMAGE *in, IMAGE *out, double e )
{
return( im_expntra_vec( in, out, 1, &b ) );
return( im_expntra_vec( in, out, 1, &e ) );
}
/**

View File

@ -45,10 +45,14 @@ Copyright (C) 1992, Kirk Martinez, History of Art Dept, Birkbeck College
#define ARGS "fav4: frame average 4 frames\nARGS: im1 im2 im3 im4 outfile"
#define NFRAMES 4
/* @(#) Optimised 4 frame average
Copyright (C) 1992, Kirk Martinez, History of Art Dept, Birkbeck College
CHAR images only!
ARGS: array of 4 source images and output image
/**
* im_fav4:
* @in: array of 4 input #IMAGE s
* @out: output #IMAGE
*
* Average four identical images.
*
* Deprecated.
*/
int
im_fav4( IMAGE **in, IMAGE *out)

View File

@ -1,16 +1,12 @@
/* @(#) floor() an image ... no promotion, so output type == input type
* @(#)
* @(#) int
* @(#) im_floor( in, out )
* @(#) IMAGE *in, *out;
* @(#)
* @(#) Returns 0 on success and -1 on error
* @(#)
/* im_floor.c
*
* 20/6/02 JC
* - adapted from im_abs()
* 8/12/06
* - add liboil support
* 2/9/09
* - gtkdoc
* - tiny cleanups
*/
/*
@ -47,7 +43,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <vips/vips.h>
#include <vips/internal.h>
@ -60,52 +55,64 @@
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
#define floor_loop(TYPE)\
{\
TYPE *p = (TYPE *) in;\
TYPE *q = (TYPE *) out;\
\
for( x = 0; x < sz; x++ )\
q[x] = floor( p[x] );\
}
#define FLOOR( TYPE ) { \
TYPE *p = (TYPE *) in; \
TYPE *q = (TYPE *) out; \
\
for( x = 0; x < sz; x++ ) \
q[x] = floor( p[x] ); \
}
/* Ceil a buffer of PELs.
*/
static void
floor_gen( PEL *in, PEL *out, int width, IMAGE *im )
{
/* Complex just doubles the size.
*/
const int sz = width * im->Bands * (im_iscomplex( im ) ? 2 : 1);
int x;
int sz = width * im->Bands;
switch( im->BandFmt ) {
case IM_BANDFMT_COMPLEX:
case IM_BANDFMT_FLOAT:
#ifdef HAVE_LIBOIL
oil_floor_f32( (float *) out, (float *) in, sz );
#else /*!HAVE_LIBOIL*/
floor_loop(float);
FLOOR( float );
#endif /*HAVE_LIBOIL*/
break;
case IM_BANDFMT_DOUBLE: floor_loop(double); break;
case IM_BANDFMT_COMPLEX: sz *= 2; floor_loop(float); break;
case IM_BANDFMT_DPCOMPLEX: sz *= 2; floor_loop(double); break;
case IM_BANDFMT_DOUBLE:
case IM_BANDFMT_DPCOMPLEX:
FLOOR( double );
break;
default:
assert( 0 );
}
}
/* Ceil of image.
/**
* im_floor:
* @in: input #IMAGE
* @out: output #IMAGE
*
* For each pixel, find the largest integral value not less than.
* Copy for integer types, call <function>floor()</function> for float and
* complex types.
* Output type == input type.
*
* See also: im_ceil(), im_rint(), im_clip2fmt()
*
* Returns: 0 on success, -1 on error
*/
int
im_floor( IMAGE *in, IMAGE *out )
{
/* Check args.
*/
if( in->Coding != IM_CODING_NONE ) {
im_error( "im_floor", "%s", _( "not uncoded" ) );
{
if( im_check_uncoded( "im_floor", in ) )
return( -1 );
}
/* Is this one of the int types? Degenerate to im_copy() if it
* is.

View File

@ -67,6 +67,11 @@ extern int im_gaddim();
/* This function works on either mmaped files or on images in buffer
*/
/**
* im_gadd:
*
* Deprecated.
*/
int im_gadd(a, in1, b, in2, c, out)
IMAGE *in1, *in2, *out;
double a, b, c;

View File

@ -115,6 +115,12 @@ static int array[6][6] = {
/**
* im_gaddim:
*
* Deprecated.
*/
int im_gaddim(a, in1, b, in2, c, out)
IMAGE *in1, *in2, *out;
double a, b, c;

View File

@ -126,6 +126,11 @@ static int array[8][8] = {
#define outfloat_2float(IN2, OUT)\
case IM_BANDFMT_FLOAT: loop(float, IN2, OUT); break;
/**
* im_gfadd:
*
* Deprecated.
*/
int im_gfadd(a, in1, b, in2, c, out)
double a, b, c;
IMAGE *in1, *in2, *out;

View File

@ -1,13 +1,4 @@
/* @(#) Invert a UCHAR image. Very simple new-style VIPS routine. See
* @(#) im_exptra() for the next level of complexity. This function is not
* @(#) as quick as it could be - it is intended to be an example rather than
* @(#) to be useful. This should really be written with im_wrapone().
* @(#)
* @(#) int
* @(#) im_invert( IMAGE *in, IMAGE *out )
* @(#)
* @(#) All functions return 0 on success and -1 on error
* @(#)
/* im_invert.c
*
* Copyright: 1990, N. Dessipris.
*
@ -20,6 +11,8 @@
* - ANSIfied
* 22/2/95 JC
* - tidied up again
* 2/9/09
* - gtk-doc comment
*/
/*
@ -83,8 +76,8 @@ invert_gen( REGION *or, void *seq, void *a, void *b )
*/
if( im_prepare( ir, &or->valid ) )
return( -1 );
/* Loop over output, writing input.
/* Loop over output.
*/
for( y = to; y < bo; y++ ) {
/* Point p and q at the start of the line of pels we must
@ -106,24 +99,32 @@ invert_gen( REGION *or, void *seq, void *a, void *b )
return( 0 );
}
/* Invert IMAGE in to IMAGE out. Any number of bands, unsigned char pels
* only. See im_exptra() for an example of a VIPS function which can process
/**
* im_invert:
* @in: input #IMAGE
* @out: output #IMAGE
*
* this operation calculates (255 - @in).
* The operation works on uchar images only. The input can have any no of
* channels.
*
* This is not a generally useful program -- it is included as an example of
* a very simple new-style IO function.
* See im_exptra() for an example of a VIPS function which can process
* any input image type.
*
* See also: im_exptra(), im_lintra().
*
* Returns: 0 on success, -1 on error
*/
int
im_invert( IMAGE *in, IMAGE *out )
{
/* Check args.
*/
if( in->Coding != IM_CODING_NONE ) {
im_error( "im_invert", "%s", _( "not uncoded" ) );
return( -1 );
}
if( in->BandFmt != IM_BANDFMT_UCHAR ) {
im_error( "im_invert", "%s", _( "not UCHAR" ) );
return( -1 );
}
if( im_piocheck( in, out ) )
if( im_check_uncoded( "im_invert", in ) ||
im_check_uchar( "im_invert", in ) ||
im_piocheck( in, out ) )
return( -1 );
/* Prepare the output header.

View File

@ -176,7 +176,7 @@ powtran_gen( PEL *in, PEL *out, int width, IMAGE *im, PowtraInfo *inf )
* @in: input #IMAGE
* @out: output #IMAGE
* @n: number of elements in array
* @b: array of constants
* @e: array of constants
*
* im_powtra_vec() transforms element x of input to
* <function>pow</function>(x, @b) in output.

View File

@ -65,24 +65,24 @@ int im_powtra( IMAGE *in, IMAGE *out, double e );
int im_powtra_vec( IMAGE *in, IMAGE *out, int n, double *e );
int im_exptra( IMAGE *in, IMAGE *out );
int im_exp10tra( IMAGE *in, IMAGE *out );
int im_expntra( IMAGE *, IMAGE *, double );
int im_expntra( IMAGE *in, IMAGE *out, double e );
int im_expntra_vec( IMAGE *in, IMAGE *out, int n, double *e );
int im_logtra( IMAGE *, IMAGE * );
int im_log10tra( IMAGE *, IMAGE * );
int im_remainder( IMAGE *, IMAGE *, IMAGE * );
int im_remainderconst( IMAGE *, IMAGE *, double );
int im_remainderconst_vec( IMAGE *, IMAGE *, int, double * );
int im_floor( IMAGE *, IMAGE * );
int im_rint( IMAGE *, IMAGE * );
int im_ceil( IMAGE *, IMAGE * );
int im_sintra( IMAGE *, IMAGE * );
int im_logtra( IMAGE *in, IMAGE *out );
int im_log10tra( IMAGE *in, IMAGE *out );
int im_remainder( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_remainderconst( IMAGE *in, IMAGE *out, double c );
int im_remainderconst_vec( IMAGE *in, IMAGE *out, int n, double *c );
int im_floor( IMAGE *in, IMAGE *out );
int im_rint( IMAGE *in, IMAGE *out );
int im_ceil( IMAGE *in, IMAGE *out );
int im_sintra( IMAGE *in, IMAGE *out );
int im_sign( IMAGE *in, IMAGE *out );
int im_costra( IMAGE *, IMAGE * );
int im_tantra( IMAGE *, IMAGE * );
int im_asintra( IMAGE *, IMAGE * );
int im_acostra( IMAGE *, IMAGE * );
int im_atantra( IMAGE *, IMAGE * );
int im_cmulnorm( IMAGE *, IMAGE *, IMAGE * );
int im_costra( IMAGE *in, IMAGE *out );
int im_tantra( IMAGE *in, IMAGE *out );
int im_asintra( IMAGE *in, IMAGE *out );
int im_acostra( IMAGE *in, IMAGE *out );
int im_atantra( IMAGE *in, IMAGE *out );
int im_cmulnorm( IMAGE *in1, IMAGE *in2, IMAGE *out );
int im_fav4( IMAGE **, IMAGE * );
int im_gadd( double, IMAGE *, double, IMAGE *, double, IMAGE *);
int im_litecor( IMAGE *, IMAGE *, IMAGE *, int, double );

View File

@ -140,6 +140,7 @@ int im_check_uncoded( const char *domain, IMAGE *im );
int im_check_bands_1orn( const char *domain, IMAGE *im1, IMAGE *im2 );
int im_check_noncomplex( const char *domain, IMAGE *im );
int im_check_complex( const char *domain, IMAGE *im );
int im_check_uchar( const char *domain, IMAGE *im );
int im_check_int( const char *domain, IMAGE *im );
int im_check_size( const char *domain, IMAGE *im1, IMAGE *im2 );
int im_check_bands( const char *domain, IMAGE *im1, IMAGE *im2 );

View File

@ -406,6 +406,17 @@ im_check_complex( const char *domain, IMAGE *im )
return( 0 );
}
int
im_check_uchar( const char *domain, IMAGE *im )
{
if( im->BandFmt != IM_FORMAT_UCHAR ) {
im_error( domain, "%s", _( "image must be uchar" ) );
return( -1 );
}
return( 0 );
}
int
im_check_int( const char *domain, IMAGE *im )
{