Merge branch 'remove-seq-stalling' of github.com:jcupitt/libvips into remove-seq-stalling

This commit is contained in:
John Cupitt 2017-03-10 13:22:13 +00:00
commit f8cc9533b3
20 changed files with 241 additions and 143 deletions

View File

@ -35,6 +35,10 @@
- use expat, not libxml, for XML load ... removes a required dependency, since
we get expat as part of glib
- new sequential mode infrastructure is faster and more flexible
- the C functions vips_math2_const(), vips_boolean_const() and
vips_relational_const() have changed argument order to match
Python/CLI/C++ ... sorry
- added vips_rot90() etc. convenience functions
8/12/16 started 8.4.5
- allow libgsf-1.14.26 to help centos, thanks tdiprima

18
TODO
View File

@ -1,21 +1,3 @@
- vips_object_class_install_argument() should check for duplicate priorities,
it's been behind a few nasty bugs
- add vips_rot90() / _rot180() / _rot270(), cf. vips_sin() etc.
it's currently
vips_rot( smartcrop->sobel, &smartcrop->sobel90, VIPS_ANGLE_D90, NULL )
-vips linecache has access there twice!
$ vips linecache
...
- not sure about utf8 error messages on win
- strange:

View File

@ -533,7 +533,7 @@ vips_boolean_const_init( VipsBooleanConst *boolean_const )
static int
vips_boolean_constv( VipsImage *in, VipsImage **out,
VipsOperationBoolean operation, double *c, int n, va_list ap )
double *c, int n, VipsOperationBoolean operation, va_list ap )
{
VipsArea *area_c;
double *array;
@ -546,7 +546,7 @@ vips_boolean_constv( VipsImage *in, VipsImage **out,
array[i] = c[i];
result = vips_call_split( "boolean_const", ap,
in, out, operation, area_c );
in, out, area_c, operation );
vips_area_unref( area_c );
@ -557,9 +557,9 @@ vips_boolean_constv( VipsImage *in, VipsImage **out,
* vips_boolean_const:
* @in: input image
* @out: output image
* @boolean: boolean operation to perform
* @c: array of constants
* @n: number of constants in @c
* @boolean: boolean operation to perform
* @...: %NULL-terminated list of optional named arguments
*
* Perform various boolean operations on an image against an array of
@ -580,13 +580,13 @@ vips_boolean_constv( VipsImage *in, VipsImage **out,
*/
int
vips_boolean_const( VipsImage *in, VipsImage **out,
VipsOperationBoolean boolean, double *c, int n, ... )
double *c, int n, VipsOperationBoolean boolean, ... )
{
va_list ap;
int result;
va_start( ap, n );
result = vips_boolean_constv( in, out, boolean, c, n, ap );
va_start( ap, boolean );
result = vips_boolean_constv( in, out, c, n, boolean, ap );
va_end( ap );
return( result );
@ -615,7 +615,7 @@ vips_andimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_boolean_constv( in, out,
VIPS_OPERATION_BOOLEAN_AND, c, n, ap );
c, n, VIPS_OPERATION_BOOLEAN_AND, ap );
va_end( ap );
return( result );
@ -644,7 +644,7 @@ vips_orimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_boolean_constv( in, out,
VIPS_OPERATION_BOOLEAN_OR, c, n, ap );
c, n, VIPS_OPERATION_BOOLEAN_OR, ap );
va_end( ap );
return( result );
@ -673,7 +673,7 @@ vips_eorimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_boolean_constv( in, out,
VIPS_OPERATION_BOOLEAN_EOR, c, n, ap );
c, n, VIPS_OPERATION_BOOLEAN_EOR, ap );
va_end( ap );
return( result );
@ -702,7 +702,7 @@ vips_lshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_boolean_constv( in, out,
VIPS_OPERATION_BOOLEAN_LSHIFT, c, n, ap );
c, n, VIPS_OPERATION_BOOLEAN_LSHIFT, ap );
va_end( ap );
return( result );
@ -731,7 +731,7 @@ vips_rshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_boolean_constv( in, out,
VIPS_OPERATION_BOOLEAN_RSHIFT, c, n, ap );
c, n, VIPS_OPERATION_BOOLEAN_RSHIFT, ap );
va_end( ap );
return( result );
@ -754,13 +754,13 @@ vips_rshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
*/
int
vips_boolean_const1( VipsImage *in, VipsImage **out,
VipsOperationBoolean boolean, double c, ... )
double c, VipsOperationBoolean boolean, ... )
{
va_list ap;
int result;
va_start( ap, c );
result = vips_boolean_constv( in, out, boolean, &c, 1, ap );
va_start( ap, boolean );
result = vips_boolean_constv( in, out, &c, 1, boolean, ap );
va_end( ap );
return( result );
@ -788,7 +788,7 @@ vips_andimage_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_boolean_constv( in, out,
VIPS_OPERATION_BOOLEAN_AND, &c, 1, ap );
&c, 1, VIPS_OPERATION_BOOLEAN_AND, ap );
va_end( ap );
return( result );
@ -816,7 +816,7 @@ vips_orimage_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_boolean_constv( in, out,
VIPS_OPERATION_BOOLEAN_OR, &c, 1, ap );
&c, 1, VIPS_OPERATION_BOOLEAN_OR, ap );
va_end( ap );
return( result );
@ -844,7 +844,7 @@ vips_eorimage_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_boolean_constv( in, out,
VIPS_OPERATION_BOOLEAN_EOR, &c, 1, ap );
&c, 1, VIPS_OPERATION_BOOLEAN_EOR, ap );
va_end( ap );
return( result );
@ -872,7 +872,7 @@ vips_lshift_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_boolean_constv( in, out,
VIPS_OPERATION_BOOLEAN_LSHIFT, &c, 1, ap );
&c, 1, VIPS_OPERATION_BOOLEAN_LSHIFT, ap );
va_end( ap );
return( result );
@ -900,7 +900,7 @@ vips_rshift_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_boolean_constv( in, out,
VIPS_OPERATION_BOOLEAN_RSHIFT, &c, 1, ap );
&c, 1, VIPS_OPERATION_BOOLEAN_RSHIFT, ap );
va_end( ap );
return( result );

View File

@ -373,11 +373,17 @@ vips_math2_const_buffer( VipsArithmetic *arithmetic,
int i, x, b;
switch( math2->math2 ) {
case VIPS_OPERATION_MATH2_POW: SWITCH( LOOPC, POW ); break;
case VIPS_OPERATION_MATH2_WOP: SWITCH( LOOPC, WOP ); break;
case VIPS_OPERATION_MATH2_POW:
SWITCH( LOOPC, POW );
break;
case VIPS_OPERATION_MATH2_WOP:
SWITCH( LOOPC, WOP );
break;
default:
g_assert_not_reached();
break;
}
}
@ -415,7 +421,7 @@ vips_math2_const_init( VipsMath2Const *math2_const )
static int
vips_math2_constv( VipsImage *in, VipsImage **out,
VipsOperationMath2 math2, double *c, int n, va_list ap )
double *c, int n, VipsOperationMath2 math2, va_list ap )
{
VipsArea *area_c;
double *array;
@ -427,7 +433,7 @@ vips_math2_constv( VipsImage *in, VipsImage **out,
for( i = 0; i < n; i++ )
array[i] = c[i];
result = vips_call_split( "math2_const", ap, in, out, math2, area_c );
result = vips_call_split( "math2_const", ap, in, out, area_c, math2 );
vips_area_unref( area_c );
@ -438,9 +444,9 @@ vips_math2_constv( VipsImage *in, VipsImage **out,
* vips_math2_const:
* @in: input image
* @out: output image
* @math2: math operation to perform
* @c: array of constants
* @n: number of constants in @c
* @math2: math operation to perform
* @...: %NULL-terminated list of optional named arguments
*
* This operation calculates various 2-ary maths operations on an image and
@ -465,13 +471,13 @@ vips_math2_constv( VipsImage *in, VipsImage **out,
*/
int
vips_math2_const( VipsImage *in, VipsImage **out,
VipsOperationMath2 math2, double *c, int n, ... )
double *c, int n, VipsOperationMath2 math2, ... )
{
va_list ap;
int result;
va_start( ap, n );
result = vips_math2_constv( in, out, math2, c, n, ap );
va_start( ap, math2 );
result = vips_math2_constv( in, out, c, n, math2, ap );
va_end( ap );
return( result );
@ -498,7 +504,7 @@ vips_pow_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_math2_constv( in, out,
VIPS_OPERATION_MATH2_POW, c, n, ap );
c, n, VIPS_OPERATION_MATH2_POW, ap );
va_end( ap );
return( result );
@ -525,7 +531,7 @@ vips_wop_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_math2_constv( in, out,
VIPS_OPERATION_MATH2_WOP, c, n, ap );
c, n, VIPS_OPERATION_MATH2_WOP, ap );
va_end( ap );
return( result );
@ -546,13 +552,13 @@ vips_wop_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
*/
int
vips_math2_const1( VipsImage *in, VipsImage **out,
VipsOperationMath2 math2, double c, ... )
double c, VipsOperationMath2 math2, ... )
{
va_list ap;
int result;
va_start( ap, c );
result = vips_math2_constv( in, out, math2, &c, 1, ap );
va_start( ap, math2 );
result = vips_math2_constv( in, out, &c, 1, math2, ap );
va_end( ap );
return( result );
@ -578,7 +584,7 @@ vips_pow_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_math2_constv( in, out,
VIPS_OPERATION_MATH2_POW, &c, 1, ap );
&c, 1, VIPS_OPERATION_MATH2_POW, ap );
va_end( ap );
return( result );
@ -604,7 +610,7 @@ vips_wop_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_math2_constv( in, out,
VIPS_OPERATION_MATH2_WOP, &c, 1, ap );
&c, 1, VIPS_OPERATION_MATH2_WOP, ap );
va_end( ap );
return( result );

View File

@ -574,7 +574,7 @@ vips_relational_const_init( VipsRelationalConst *relational_const )
static int
vips_relational_constv( VipsImage *in, VipsImage **out,
VipsOperationRelational relational, double *c, int n, va_list ap )
double *c, int n, VipsOperationRelational relational, va_list ap )
{
VipsArea *area_c;
double *array;
@ -587,7 +587,7 @@ vips_relational_constv( VipsImage *in, VipsImage **out,
array[i] = c[i];
result = vips_call_split( "relational_const", ap,
in, out, relational, area_c );
in, out, area_c, relational );
vips_area_unref( area_c );
@ -598,9 +598,9 @@ vips_relational_constv( VipsImage *in, VipsImage **out,
* vips_relational_const:
* @in: input image
* @out: output image
* @relational: relational operation to perform
* @c: array of constants
* @n: number of constants in @c
* @relational: relational operation to perform
* @...: %NULL-terminated list of optional named arguments
*
* Perform various relational operations on an image and an array of
@ -621,13 +621,13 @@ vips_relational_constv( VipsImage *in, VipsImage **out,
*/
int
vips_relational_const( VipsImage *in, VipsImage **out,
VipsOperationRelational relational, double *c, int n, ... )
double *c, int n, VipsOperationRelational relational, ... )
{
va_list ap;
int result;
va_start( ap, n );
result = vips_relational_constv( in, out, relational, c, n, ap );
va_start( ap, relational );
result = vips_relational_constv( in, out, c, n, relational, ap );
va_end( ap );
return( result );
@ -654,7 +654,7 @@ vips_equal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_EQUAL, c, n, ap );
c, n, VIPS_OPERATION_RELATIONAL_EQUAL, ap );
va_end( ap );
return( result );
@ -681,7 +681,7 @@ vips_notequal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_NOTEQ, c, n, ap );
c, n, VIPS_OPERATION_RELATIONAL_NOTEQ, ap );
va_end( ap );
return( result );
@ -708,7 +708,7 @@ vips_less_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_LESS, c, n, ap );
c, n, VIPS_OPERATION_RELATIONAL_LESS, ap );
va_end( ap );
return( result );
@ -735,7 +735,7 @@ vips_lesseq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_LESSEQ, c, n, ap );
c, n, VIPS_OPERATION_RELATIONAL_LESSEQ, ap );
va_end( ap );
return( result );
@ -762,7 +762,7 @@ vips_more_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_MORE, c, n, ap );
c, n, VIPS_OPERATION_RELATIONAL_MORE, ap );
va_end( ap );
return( result );
@ -789,7 +789,7 @@ vips_moreeq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
va_start( ap, n );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_MOREEQ, c, n, ap );
c, n, VIPS_OPERATION_RELATIONAL_MOREEQ, ap );
va_end( ap );
return( result );
@ -799,8 +799,8 @@ vips_moreeq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
* vips_relational_const1:
* @in: input image
* @out: output image
* @relational: relational operation to perform
* @c: constant
* @relational: relational operation to perform
* @...: %NULL-terminated list of optional named arguments
*
* Perform various relational operations on an image and a constant. See
@ -812,13 +812,13 @@ vips_moreeq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
*/
int
vips_relational_const1( VipsImage *in, VipsImage **out,
VipsOperationRelational relational, double c, ... )
double c, VipsOperationRelational relational, ... )
{
va_list ap;
int result;
va_start( ap, c );
result = vips_relational_constv( in, out, relational, &c, 1, ap );
va_start( ap, relational );
result = vips_relational_constv( in, out, &c, 1, relational, ap );
va_end( ap );
return( result );
@ -844,7 +844,7 @@ vips_equal_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_EQUAL, &c, 1, ap );
&c, 1, VIPS_OPERATION_RELATIONAL_EQUAL, ap );
va_end( ap );
return( result );
@ -870,7 +870,7 @@ vips_notequal_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_NOTEQ, &c, 1, ap );
&c, 1, VIPS_OPERATION_RELATIONAL_NOTEQ, ap );
va_end( ap );
return( result );
@ -896,7 +896,7 @@ vips_less_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_LESS, &c, 1, ap );
&c, 1, VIPS_OPERATION_RELATIONAL_LESS, ap );
va_end( ap );
return( result );
@ -922,7 +922,7 @@ vips_lesseq_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_LESSEQ, &c, 1, ap );
&c, 1, VIPS_OPERATION_RELATIONAL_LESSEQ, ap );
va_end( ap );
return( result );
@ -948,7 +948,7 @@ vips_more_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_MORE, &c, 1, ap );
&c, 1, VIPS_OPERATION_RELATIONAL_MORE, ap );
va_end( ap );
return( result );
@ -974,7 +974,7 @@ vips_moreeq_const1( VipsImage *in, VipsImage **out, double c, ... )
va_start( ap, c );
result = vips_relational_constv( in, out,
VIPS_OPERATION_RELATIONAL_MOREEQ, &c, 1, ap );
&c, 1, VIPS_OPERATION_RELATIONAL_MOREEQ, ap );
va_end( ap );
return( result );

View File

@ -203,7 +203,7 @@ vips_unary_const_class_init( VipsUnaryConstClass *class )
object_class->description = _( "unary operations with a constant" );
object_class->build = vips_unary_const_build;
VIPS_ARG_BOXED( class, "c", 200,
VIPS_ARG_BOXED( class, "c", 199,
_( "c" ),
_( "Array of constants" ),
VIPS_ARGUMENT_REQUIRED_INPUT,

View File

@ -196,7 +196,7 @@ vips_conversion_class_init( VipsConversionClass *class )
vobject_class->description = _( "conversion operations" );
vobject_class->build = vips_conversion_build;
VIPS_ARG_IMAGE( class, "out", 1,
VIPS_ARG_IMAGE( class, "out", 2,
_( "Output" ),
_( "Output image" ),
VIPS_ARGUMENT_REQUIRED_OUTPUT,

View File

@ -560,41 +560,41 @@ vips_embed_class_init( VipsEmbedClass *class )
operation_class->flags = VIPS_OPERATION_SEQUENTIAL;
VIPS_ARG_IMAGE( class, "in", -1,
VIPS_ARG_IMAGE( class, "in", 1,
_( "Input" ),
_( "Input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsEmbed, in ) );
VIPS_ARG_INT( class, "x", 2,
VIPS_ARG_INT( class, "x", 3,
_( "x" ),
_( "Left edge of input in output" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsEmbed, x ),
-1000000000, 1000000000, 0 );
VIPS_ARG_INT( class, "y", 3,
VIPS_ARG_INT( class, "y", 4,
_( "y" ),
_( "Top edge of input in output" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsEmbed, y ),
-1000000000, 1000000000, 0 );
VIPS_ARG_INT( class, "width", 4,
VIPS_ARG_INT( class, "width", 5,
_( "Width" ),
_( "Image width in pixels" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsEmbed, width ),
1, 1000000000, 1 );
VIPS_ARG_INT( class, "height", 5,
VIPS_ARG_INT( class, "height", 6,
_( "Height" ),
_( "Image height in pixels" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsEmbed, height ),
1, 1000000000, 1 );
VIPS_ARG_ENUM( class, "extend", 6,
VIPS_ARG_ENUM( class, "extend", 7,
_( "Extend" ),
_( "How to generate the extra pixels" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,

View File

@ -190,34 +190,34 @@ vips_extract_area_class_init( VipsExtractAreaClass *class )
operation_class->flags = VIPS_OPERATION_SEQUENTIAL;
VIPS_ARG_IMAGE( class, "input", 0,
VIPS_ARG_IMAGE( class, "input", 1,
_( "Input" ),
_( "Input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsExtractArea, in ) );
VIPS_ARG_INT( class, "left", 2,
VIPS_ARG_INT( class, "left", 3,
_( "Left" ),
_( "Left edge of extract area" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsExtractArea, left ),
-VIPS_MAX_COORD, VIPS_MAX_COORD, 0 );
VIPS_ARG_INT( class, "top", 3,
VIPS_ARG_INT( class, "top", 4,
_( "Top" ),
_( "Top edge of extract area" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsExtractArea, top ),
-VIPS_MAX_COORD, VIPS_MAX_COORD, 0 );
VIPS_ARG_INT( class, "width", 4,
VIPS_ARG_INT( class, "width", 5,
_( "Width" ),
_( "Width of extract area" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsExtractArea, width ),
1, VIPS_MAX_COORD, 1 );
VIPS_ARG_INT( class, "height", 5,
VIPS_ARG_INT( class, "height", 6,
_( "Height" ),
_( "Height of extract area" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
@ -413,7 +413,7 @@ vips_extract_band_class_init( VipsExtractBandClass *class )
bandary_class->process_line = vips_extract_band_buffer;
VIPS_ARG_IMAGE( class, "in", 0,
VIPS_ARG_IMAGE( class, "in", 1,
_( "Input" ),
_( "Input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,

View File

@ -139,13 +139,13 @@ vips_gamma_class_init( VipsGammaClass *class )
operation_class->flags = VIPS_OPERATION_SEQUENTIAL;
VIPS_ARG_IMAGE( class, "in", -1,
VIPS_ARG_IMAGE( class, "in", 1,
_( "in" ),
_( "Input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsGamma, in ) );
VIPS_ARG_DOUBLE( class, "exponent", 0,
VIPS_ARG_DOUBLE( class, "exponent", 2,
_( "exponent" ),
_( "Gamma factor" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,

View File

@ -508,40 +508,40 @@ vips_insert_class_init( VipsInsertClass *class )
*/
operation_class->flags = VIPS_OPERATION_SEQUENTIAL;
VIPS_ARG_IMAGE( class, "main", -1,
VIPS_ARG_IMAGE( class, "main", 0,
_( "Main" ),
_( "Main input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsInsert, main ) );
VIPS_ARG_IMAGE( class, "sub", 0,
VIPS_ARG_IMAGE( class, "sub", 1,
_( "Sub-image" ),
_( "Sub-image to insert into main image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsInsert, sub ) );
VIPS_ARG_INT( class, "x", 2,
VIPS_ARG_INT( class, "x", 3,
_( "X" ),
_( "Left edge of sub in main" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsInsert, x ),
-VIPS_MAX_COORD, VIPS_MAX_COORD, 0 );
VIPS_ARG_INT( class, "y", 3,
VIPS_ARG_INT( class, "y", 4,
_( "Y" ),
_( "Top edge of sub in main" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsInsert, y ),
-VIPS_MAX_COORD, VIPS_MAX_COORD, 0 );
VIPS_ARG_BOOL( class, "expand", 4,
VIPS_ARG_BOOL( class, "expand", 5,
_( "Expand" ),
_( "Expand output to hold all of both inputs" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsInsert, expand ),
FALSE );
VIPS_ARG_BOXED( class, "background", 5,
VIPS_ARG_BOXED( class, "background", 6,
_( "Background" ),
_( "Color for new pixels" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,

View File

@ -228,19 +228,19 @@ vips_join_class_init( VipsJoinClass *class )
vobject_class->description = _( "join a pair of images" );
vobject_class->build = vips_join_build;
VIPS_ARG_IMAGE( class, "in1", -1,
VIPS_ARG_IMAGE( class, "in1", 0,
_( "in1" ),
_( "First input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsJoin, in1 ) );
VIPS_ARG_IMAGE( class, "in2", 0,
VIPS_ARG_IMAGE( class, "in2", 1,
_( "in2" ),
_( "Second input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsJoin, in2 ) );
VIPS_ARG_ENUM( class, "direction", 2,
VIPS_ARG_ENUM( class, "direction", 3,
_( "direction" ),
_( "Join left-right or up-down" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
@ -268,7 +268,7 @@ vips_join_class_init( VipsJoinClass *class )
G_STRUCT_OFFSET( VipsJoin, background ),
VIPS_TYPE_ARRAY_DOUBLE );
VIPS_ARG_ENUM( class, "align", 2,
VIPS_ARG_ENUM( class, "align", 7,
_( "Align" ),
_( "Align on the low, centre or high coordinate edge" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,

View File

@ -26,6 +26,8 @@
* - gtkdoc
* 4/11/11
* - rewrite as a class
* 7/3/17
* - added 90/180/270 convenience functions
*/
/*
@ -374,6 +376,12 @@ vips_rot_init( VipsRot *rot )
{
}
static int
vips_rotv( VipsImage *in, VipsImage **out, VipsAngle angle, va_list ap )
{
return( vips_call_split( "rot", ap, in, out, angle ) );
}
/**
* vips_rot:
* @in: input image
@ -397,7 +405,82 @@ vips_rot( VipsImage *in, VipsImage **out, VipsAngle angle, ... )
int result;
va_start( ap, angle );
result = vips_call_split( "rot", ap, in, out, angle );
result = vips_rotv( in, out, angle, ap );
va_end( ap );
return( result );
}
/**
* vips_rot90:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Rotate @in by 90 degress clockwise. A convenience function over vips_rot().
*
* See also: vips_rot().
*
* Returns: 0 on success, -1 on error
*/
int
vips_rot90( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_rotv( in, out, VIPS_ANGLE_D90, ap );
va_end( ap );
return( result );
}
/**
* vips_rot180:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Rotate @in by 180 degress. A convenience function over vips_rot().
*
* See also: vips_rot().
*
* Returns: 0 on success, -1 on error
*/
int
vips_rot180( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_rotv( in, out, VIPS_ANGLE_D180, ap );
va_end( ap );
return( result );
}
/**
* vips_rot270:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Rotate @in by 270 degress clockwise. A convenience function over vips_rot().
*
* See also: vips_rot().
*
* Returns: 0 on success, -1 on error
*/
int
vips_rot270( VipsImage *in, VipsImage **out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_rotv( in, out, VIPS_ANGLE_D270, ap );
va_end( ap );
return( result );

View File

@ -265,27 +265,27 @@ vips_subsample_class_init( VipsSubsampleClass *class )
* scanlines, and that confuses vips_sequential().
*/
VIPS_ARG_IMAGE( class, "input", 0,
VIPS_ARG_IMAGE( class, "input", 1,
_( "Input" ),
_( "Input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsSubsample, in ) );
VIPS_ARG_INT( class, "xfac", 2,
VIPS_ARG_INT( class, "xfac", 3,
_( "Xfac" ),
_( "Horizontal subsample factor" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsSubsample, xfac ),
1, VIPS_MAX_COORD, 1 );
VIPS_ARG_INT( class, "yfac", 3,
VIPS_ARG_INT( class, "yfac", 4,
_( "Yfac" ),
_( "Vertical subsample factor" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsSubsample, yfac ),
1, VIPS_MAX_COORD, 1 );
VIPS_ARG_BOOL( class, "point", 2,
VIPS_ARG_BOOL( class, "point", 5,
_( "Point" ),
_( "Point sample" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,

View File

@ -33,6 +33,8 @@
* - free the hash table in _dispose()
* 11/7/16
* - terminate on tile calc error
* 7/3/17
* - remove "access" on linecache, use the base class instead
*/
/*
@ -875,8 +877,6 @@ vips_tilecache( VipsImage *in, VipsImage **out, ... )
typedef struct _VipsLineCache {
VipsBlockCache parent_instance;
VipsAccess access;
} VipsLineCache;
typedef VipsBlockCacheClass VipsLineCacheClass;
@ -923,28 +923,26 @@ vips_line_cache_build( VipsObject *object )
VIPS_DEBUG_MSG( "vips_line_cache_build\n" );
if( !vips_object_argument_isset( object, "access" ) )
block_cache->access = VIPS_ACCESS_SEQUENTIAL;
if( VIPS_OBJECT_CLASS( vips_line_cache_parent_class )->
build( object ) )
return( -1 );
/* tile_height is set by a param, or defaulted below.
*/
block_cache->tile_width = block_cache->in->Xsize;
block_cache->access = cache->access;
/* This can go up with request size, see vips_line_cache_gen().
*/
vips_get_tile_size( block_cache->in,
&tile_width, &tile_height, &n_lines );
block_cache->tile_width = block_cache->in->Xsize;
block_cache->max_tiles = 1 + 2 * n_lines / block_cache->tile_height;
VIPS_DEBUG_MSG( "vips_line_cache_build: n_lines = %d\n", n_lines );
VIPS_DEBUG_MSG( "vips_line_cache_build: "
"max_tiles = %d, tile_height = %d\n",
block_cache->max_tiles, block_cache->tile_height );
VIPS_DEBUG_MSG( "vips_line_cache_build: n_lines = %d\n",
n_lines );
VIPS_DEBUG_MSG( "vips_line_cache_build: max_tiles = %d\n",
block_cache->max_tiles );
VIPS_DEBUG_MSG( "vips_line_cache_build: tile_height = %d\n",
block_cache->tile_height );
VIPS_DEBUG_MSG( "vips_line_cache_build: max size = %g MB\n",
(block_cache->max_tiles *
block_cache->tile_width *
@ -969,31 +967,19 @@ vips_line_cache_build( VipsObject *object )
static void
vips_line_cache_class_init( VipsLineCacheClass *class )
{
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class );
VIPS_DEBUG_MSG( "vips_line_cache_class_init\n" );
gobject_class->set_property = vips_object_set_property;
gobject_class->get_property = vips_object_get_property;
vobject_class->nickname = "linecache";
vobject_class->description = _( "cache an image as a set of lines" );
vobject_class->build = vips_line_cache_build;
VIPS_ARG_ENUM( class, "access", 6,
_( "Access" ),
_( "Expected access pattern" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsLineCache, access ),
VIPS_TYPE_ACCESS, VIPS_ACCESS_SEQUENTIAL );
}
static void
vips_line_cache_init( VipsLineCache *cache )
{
cache->access = VIPS_ACCESS_SEQUENTIAL;
}
/**

View File

@ -374,20 +374,20 @@ vips_zoom_class_init( VipsZoomClass *class )
operation_class->flags = VIPS_OPERATION_SEQUENTIAL;
VIPS_ARG_IMAGE( class, "input", 0,
VIPS_ARG_IMAGE( class, "input", 1,
_( "Input" ),
_( "Input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsZoom, in ) );
VIPS_ARG_INT( class, "xfac", 2,
VIPS_ARG_INT( class, "xfac", 3,
_( "Xfac" ),
_( "Horizontal zoom factor" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsZoom, xfac ),
1, VIPS_MAX_COORD, 1 );
VIPS_ARG_INT( class, "yfac", 3,
VIPS_ARG_INT( class, "yfac", 4,
_( "Yfac" ),
_( "Vertical zoom factor" ),
VIPS_ARGUMENT_REQUIRED_INPUT,

View File

@ -2749,7 +2749,7 @@ vips__relational_vec( IMAGE *in, IMAGE *out,
{
VipsImage *t;
if( vips_relational_const( in, &t, relational, c, n,
if( vips_relational_const( in, &t, c, n, relational,
NULL ) )
return( -1 );
if( vips_image_write( t, out ) ) {
@ -2921,7 +2921,7 @@ vips__boolean_vec( IMAGE *in, IMAGE *out,
{
VipsImage *t;
if( vips_boolean_const( in, &t, boolean, c, n,
if( vips_boolean_const( in, &t, c, n, boolean,
NULL ) )
return( -1 );
if( vips_image_write( t, out ) ) {
@ -3008,7 +3008,7 @@ vips__math2_vec( IMAGE *in, IMAGE *out,
{
VipsImage *t;
if( vips_math2_const( in, &t, math2, c, n,
if( vips_math2_const( in, &t, c, n, math2,
NULL ) )
return( -1 );
if( vips_image_write( t, out ) ) {

View File

@ -279,7 +279,7 @@ int vips_more( VipsImage *left, VipsImage *right, VipsImage **out, ... )
int vips_moreeq( VipsImage *left, VipsImage *right, VipsImage **out, ... )
__attribute__((sentinel));
int vips_relational_const( VipsImage *in, VipsImage **out,
VipsOperationRelational relational, double *c, int n, ... )
double *c, int n, VipsOperationRelational relational, ... )
__attribute__((sentinel));
int vips_equal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
@ -294,7 +294,7 @@ int vips_more_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
int vips_moreeq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
int vips_relational_const1( VipsImage *in, VipsImage **out,
VipsOperationRelational relational, double c, ... )
double c, VipsOperationRelational relational, ... )
__attribute__((sentinel));
int vips_equal_const1( VipsImage *in, VipsImage **out, double c, ... )
__attribute__((sentinel));
@ -324,7 +324,7 @@ int vips_rshift( VipsImage *left, VipsImage *right, VipsImage **out, ... )
__attribute__((sentinel));
int vips_boolean_const( VipsImage *in, VipsImage **out,
VipsOperationBoolean boolean, double *c, int n, ... )
double *c, int n, VipsOperationBoolean boolean, ... )
__attribute__((sentinel));
int vips_andimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
@ -337,7 +337,7 @@ int vips_lshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
int vips_rshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
int vips_boolean_const1( VipsImage *in, VipsImage **out,
VipsOperationBoolean boolean, double c, ... )
double c, VipsOperationBoolean boolean, ... )
__attribute__((sentinel));
int vips_andimage_const1( VipsImage *in, VipsImage **out, double c, ... )
__attribute__((sentinel));
@ -358,14 +358,14 @@ int vips_pow( VipsImage *left, VipsImage *right, VipsImage **out, ... )
int vips_wop( VipsImage *left, VipsImage *right, VipsImage **out, ... )
__attribute__((sentinel));
int vips_math2_const( VipsImage *in, VipsImage **out,
VipsOperationMath2 math2, double *c, int n, ... )
double *c, int n, VipsOperationMath2 math2, ... )
__attribute__((sentinel));
int vips_pow_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
int vips_wop_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
__attribute__((sentinel));
int vips_math2_const1( VipsImage *in, VipsImage **out,
VipsOperationMath2 math2, double c, ... )
double c, VipsOperationMath2 math2, ... )
__attribute__((sentinel));
int vips_pow_const1( VipsImage *in, VipsImage **out, double c, ... )
__attribute__((sentinel));

View File

@ -124,6 +124,12 @@ int vips_wrap( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_rot( VipsImage *in, VipsImage **out, VipsAngle angle, ... )
__attribute__((sentinel));
int vips_rot90( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_rot180( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_rot270( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_rot45( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
VipsAngle vips_autorot_get_angle( VipsImage *image );

View File

@ -1661,6 +1661,20 @@ vips_object_init( VipsObject *object )
g_mutex_unlock( vips__object_all_lock );
}
static void *
traverse_find_required_priority( void *data, void *a, void *b )
{
VipsArgumentClass *argument_class = (VipsArgumentClass *) data;
int priority = GPOINTER_TO_INT( a );
if( (argument_class->flags & VIPS_ARGUMENT_REQUIRED) &&
!(argument_class->flags & VIPS_ARGUMENT_DEPRECATED) &&
argument_class->priority == priority )
return( argument_class );
return( NULL );
}
static gint
traverse_sort( gconstpointer a, gconstpointer b )
{
@ -1677,7 +1691,9 @@ vips_object_class_install_argument( VipsObjectClass *object_class,
GParamSpec *pspec, VipsArgumentFlags flags, int priority, guint offset )
{
VipsArgumentClass *argument_class = g_new( VipsArgumentClass, 1 );
GSList *argument_table_traverse;
VipsArgumentClass *ac;
#ifdef DEBUG
printf( "vips_object_class_install_argument: %p %s %s\n",
@ -1731,6 +1747,21 @@ vips_object_class_install_argument( VipsObjectClass *object_class,
argument_table_traverse =
g_slist_copy( object_class->argument_table_traverse );
/* We keep traverse sorted by priority, so we musn't have duplicate
* priority values in required args.
*/
if( (flags & VIPS_ARGUMENT_REQUIRED) &&
!(flags & VIPS_ARGUMENT_DEPRECATED) &&
(ac = vips_slist_map2( argument_table_traverse,
traverse_find_required_priority,
GINT_TO_POINTER( priority ), NULL )) )
g_warning( "vips_object_class_install_argument: "
"%s.%s, %s.%s duplicate priority",
g_type_name( G_TYPE_FROM_CLASS( object_class ) ),
g_param_spec_get_name( pspec ),
g_type_name( G_TYPE_FROM_CLASS( ac->object_class ) ),
g_param_spec_get_name( ((VipsArgument *) ac)->pspec ) );
argument_table_traverse = g_slist_prepend(
argument_table_traverse, argument_class );
argument_table_traverse = g_slist_sort(