small cleanups

This commit is contained in:
John Cupitt 2012-12-07 11:32:33 +00:00
parent 3dc10831c1
commit ee8d11ec6b
4 changed files with 25 additions and 22 deletions

4
TODO
View File

@ -1,9 +1,5 @@
- vips_invert() on complex should just invert real part - vips_invert() on complex should just invert real part
- boolean.c ... operator member should be called @operation, not @boolean
- add vips_band()/vips_bor()
- now we've removed round-to-nearest from NN, we need something extra in the - now we've removed round-to-nearest from NN, we need something extra in the
affine transform to displace the input cods affine transform to displace the input cods

View File

@ -79,7 +79,7 @@
typedef struct _VipsBoolean { typedef struct _VipsBoolean {
VipsBinary parent_instance; VipsBinary parent_instance;
VipsOperationBoolean boolean; VipsOperationBoolean operation;
} VipsBoolean; } VipsBoolean;
@ -149,7 +149,7 @@ vips_boolean_buffer( VipsArithmetic *arithmetic,
int x; int x;
switch( boolean->boolean ) { switch( boolean->operation ) {
case VIPS_OPERATION_BOOLEAN_AND: case VIPS_OPERATION_BOOLEAN_AND:
SWITCH( LOOP, FLOOP, & ); SWITCH( LOOP, FLOOP, & );
break; break;
@ -217,7 +217,7 @@ vips_boolean_class_init( VipsBooleanClass *class )
_( "Operation" ), _( "Operation" ),
_( "boolean to perform" ), _( "boolean to perform" ),
VIPS_ARGUMENT_REQUIRED_INPUT, VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsBoolean, boolean ), G_STRUCT_OFFSET( VipsBoolean, operation ),
VIPS_TYPE_OPERATION_BOOLEAN, VIPS_TYPE_OPERATION_BOOLEAN,
VIPS_OPERATION_BOOLEAN_AND ); VIPS_OPERATION_BOOLEAN_AND );
} }
@ -229,10 +229,10 @@ vips_boolean_init( VipsBoolean *boolean )
static int static int
vips_booleanv( VipsImage *left, VipsImage *right, VipsImage **out, vips_booleanv( VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationBoolean boolean, va_list ap ) VipsOperationBoolean operation, va_list ap )
{ {
return( vips_call_split( "boolean", ap, left, right, out, return( vips_call_split( "boolean", ap, left, right, out,
boolean ) ); operation ) );
} }
/** /**
@ -240,7 +240,7 @@ vips_booleanv( VipsImage *left, VipsImage *right, VipsImage **out,
* @left: left-hand input #VipsImage * @left: left-hand input #VipsImage
* @right: right-hand input #VipsImage * @right: right-hand input #VipsImage
* @out: output #VipsImage * @out: output #VipsImage
* @boolean: boolean operation to perform * @operation: boolean operation to perform
* @...: %NULL-terminated list of optional named arguments * @...: %NULL-terminated list of optional named arguments
* *
* Perform various boolean operations on pairs of images. * Perform various boolean operations on pairs of images.
@ -267,13 +267,13 @@ vips_booleanv( VipsImage *left, VipsImage *right, VipsImage **out,
*/ */
int int
vips_boolean( VipsImage *left, VipsImage *right, VipsImage **out, vips_boolean( VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationBoolean boolean, ... ) VipsOperationBoolean operation, ... )
{ {
va_list ap; va_list ap;
int result; int result;
va_start( ap, boolean ); va_start( ap, operation );
result = vips_booleanv( left, right, out, boolean, ap ); result = vips_booleanv( left, right, out, operation, ap );
va_end( ap ); va_end( ap );
return( result ); return( result );
@ -412,7 +412,7 @@ vips_rshift( VipsImage *left, VipsImage *right, VipsImage **out, ... )
typedef struct _VipsBooleanConst { typedef struct _VipsBooleanConst {
VipsUnaryConst parent_instance; VipsUnaryConst parent_instance;
VipsOperationBoolean boolean; VipsOperationBoolean operation;
} VipsBooleanConst; } VipsBooleanConst;
typedef VipsUnaryConstClass VipsBooleanConstClass; typedef VipsUnaryConstClass VipsBooleanConstClass;
@ -471,7 +471,7 @@ vips_boolean_const_buffer( VipsArithmetic *arithmetic,
int i, x, b; int i, x, b;
switch( bconst->boolean ) { switch( bconst->operation ) {
case VIPS_OPERATION_BOOLEAN_AND: case VIPS_OPERATION_BOOLEAN_AND:
SWITCH( LOOPC, FLOOPC, & ); SWITCH( LOOPC, FLOOPC, & );
break; break;
@ -520,7 +520,7 @@ vips_boolean_const_class_init( VipsBooleanConstClass *class )
_( "Operation" ), _( "Operation" ),
_( "boolean to perform" ), _( "boolean to perform" ),
VIPS_ARGUMENT_REQUIRED_INPUT, VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsBooleanConst, boolean ), G_STRUCT_OFFSET( VipsBooleanConst, operation ),
VIPS_TYPE_OPERATION_BOOLEAN, VIPS_TYPE_OPERATION_BOOLEAN,
VIPS_OPERATION_BOOLEAN_AND ); VIPS_OPERATION_BOOLEAN_AND );
} }
@ -532,7 +532,7 @@ vips_boolean_const_init( VipsBooleanConst *boolean_const )
static int static int
vips_boolean_constv( VipsImage *in, VipsImage **out, vips_boolean_constv( VipsImage *in, VipsImage **out,
VipsOperationBoolean boolean, double *c, int n, va_list ap ) VipsOperationBoolean operation, double *c, int n, va_list ap )
{ {
VipsArea *area_c; VipsArea *area_c;
double *array; double *array;
@ -545,7 +545,7 @@ vips_boolean_constv( VipsImage *in, VipsImage **out,
array[i] = c[i]; array[i] = c[i];
result = vips_call_split( "boolean_const", ap, result = vips_call_split( "boolean_const", ap,
in, out, boolean, area_c ); in, out, operation, area_c );
vips_area_unref( area_c ); vips_area_unref( area_c );
@ -556,7 +556,7 @@ vips_boolean_constv( VipsImage *in, VipsImage **out,
* vips_boolean_const: * vips_boolean_const:
* @in: input image * @in: input image
* @out: output image * @out: output image
* @boolean: boolean operation to perform * @operation: boolean operation to perform
* @c: array of constants * @c: array of constants
* @n: number of constants in @c * @n: number of constants in @c
* @...: %NULL-terminated list of optional named arguments * @...: %NULL-terminated list of optional named arguments
@ -579,13 +579,13 @@ vips_boolean_constv( VipsImage *in, VipsImage **out,
*/ */
int int
vips_boolean_const( VipsImage *in, VipsImage **out, vips_boolean_const( VipsImage *in, VipsImage **out,
VipsOperationBoolean boolean, double *c, int n, ... ) VipsOperationBoolean operation, double *c, int n, ... )
{ {
va_list ap; va_list ap;
int result; int result;
va_start( ap, n ); va_start( ap, n );
result = vips_boolean_constv( in, out, boolean, c, n, ap ); result = vips_boolean_constv( in, out, operation, c, n, ap );
va_end( ap ); va_end( ap );
return( result ); return( result );

View File

@ -271,7 +271,11 @@ vips_relationalv( VipsImage *left, VipsImage *right, VipsImage **out,
* Smallest common format in * Smallest common format in
* <link linkend="VIPS-arithmetic">arithmetic</link>). * <link linkend="VIPS-arithmetic">arithmetic</link>).
* *
* See also: vips_boolean(), vips_relational_const(). * To decide if pixels match exactly, that is have the same value in every
* band, use vips_bandbool() after this operation to AND or OR image bands
* together.
*
* See also: vips_boolean(), vips_bandbool(), vips_relational_const().
* *
* Returns: 0 on success, -1 on error * Returns: 0 on success, -1 on error
*/ */

View File

@ -254,6 +254,9 @@ vips_bandboolv( VipsImage *in, VipsImage **out,
* *
* The output image always has one band. * The output image always has one band.
* *
* This operation is useful in conjuction with vips_relational(). You can use
* it to see if all image bands match exactly.
*
* See also: vips_boolean_const(). * See also: vips_boolean_const().
* *
* Returns: 0 on success, -1 on error * Returns: 0 on success, -1 on error