Merge remote-tracking branch 'origin/master' into draw

This commit is contained in:
John Cupitt 2014-02-04 09:22:18 +00:00
commit 7ef49c2f2d
25 changed files with 80 additions and 61 deletions

View File

@ -1,9 +1,13 @@
21/1/14 started 7.39.0 21/1/14 started 7.39.0
- auto-decode for (almost) all operations - auto-decode for (almost) all operations, see vips_image_decode()
- background render thread cleans up and quits neatly - background render thread cleans up and quits neatly
- colourspace has a source_space option - colourspace has a source_space option
- operations can be tagged as "deprecated" - operations can be tagged as "deprecated"
22/1/14 started 7.38.3
- undeprecate VIPS_MASK_IDEAL_HIGHPASS and friends, ruby-vips was using them,
thanks ahacking
22/1/14 started 7.38.2 22/1/14 started 7.38.2
- auto RAD decode for affine - auto RAD decode for affine
- falsecolour was not working for some image types - falsecolour was not working for some image types

17
TODO
View File

@ -1,21 +1,4 @@
- check_uncoded() left to do:
resample/quadratic.c
- move vips__image_decode() into the public API
- we vips_image_write() a lot, could we do this by
int
vips_image_write( in, out )
{
g_object_ref( in)
vips_object_local( out,in )
}
i.e. do everything at pipe build time
- inplace - inplace
can we set a region for the pixels we will modify? can we set a region for the pixels we will modify?

View File

@ -37,7 +37,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
# binary interface changes not backwards compatible?: reset age to 0 # binary interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=37 LIBRARY_CURRENT=37
LIBRARY_REVISION=1 LIBRARY_REVISION=2
LIBRARY_AGE=0 LIBRARY_AGE=0
# patched into include/vips/version.h # patched into include/vips/version.h

View File

@ -539,7 +539,7 @@ vips_arithmetic_build( VipsObject *object )
/* Decode RAD/LABQ etc. /* Decode RAD/LABQ etc.
*/ */
for( i = 0; i < arithmetic->n; i++ ) for( i = 0; i < arithmetic->n; i++ )
if( vips__image_decode( arithmetic->in[i], &decode[i] ) ) if( vips_image_decode( arithmetic->in[i], &decode[i] ) )
return( -1 ); return( -1 );
/* Cast our input images up to a common format, bands and size. /* Cast our input images up to a common format, bands and size.

View File

@ -123,7 +123,7 @@ vips_statistic_build( VipsObject *object )
statistic->ready = statistic->in; statistic->ready = statistic->in;
if( vips__image_decode( statistic->ready, &t[0] ) ) if( vips_image_decode( statistic->ready, &t[0] ) )
return( -1 ); return( -1 );
statistic->ready = t[0]; statistic->ready = t[0];

View File

@ -628,13 +628,13 @@ vips_colour_difference_build( VipsObject *object )
extra = NULL; extra = NULL;
if( left ) { if( left ) {
if( vips__image_decode( left, &t[0] ) ) if( vips_image_decode( left, &t[0] ) )
return( -1 ); return( -1 );
left = t[0]; left = t[0];
} }
if( right ) { if( right ) {
if( vips__image_decode( right, &t[1] ) ) if( vips_image_decode( right, &t[1] ) )
return( -1 ); return( -1 );
right = t[1]; right = t[1];
} }

View File

@ -146,7 +146,7 @@ vips_bandary_build( VipsObject *object )
size = (VipsImage **) vips_object_local_array( object, bandary->n ); size = (VipsImage **) vips_object_local_array( object, bandary->n );
for( i = 0; i < bandary->n; i++ ) for( i = 0; i < bandary->n; i++ )
if( vips__image_decode( bandary->in[i], &decode[i] ) ) if( vips_image_decode( bandary->in[i], &decode[i] ) )
return( -1 ); return( -1 );
if( vips__formatalike_vec( decode, format, bandary->n ) || if( vips__formatalike_vec( decode, format, bandary->n ) ||
vips__sizealike_vec( format, size, bandary->n ) ) vips__sizealike_vec( format, size, bandary->n ) )

View File

@ -446,7 +446,7 @@ vips_cast_build( VipsObject *object )
if( in->BandFmt == cast->format ) if( in->BandFmt == cast->format )
return( vips_image_write( in, conversion->out ) ); return( vips_image_write( in, conversion->out ) );
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -349,7 +349,7 @@ vips_falsecolour_build( VipsObject *object )
* want to work for images which aren't in a recognised space, like * want to work for images which aren't in a recognised space, like
* MULTIBAND. * MULTIBAND.
*/ */
if( vips__image_decode( falsecolour->in, &t[1] ) || if( vips_image_decode( falsecolour->in, &t[1] ) ||
vips_extract_band( t[1], &t[2], 0, NULL ) || vips_extract_band( t[1], &t[2], 0, NULL ) ||
vips_cast( t[2], &t[3], VIPS_FORMAT_UCHAR, NULL ) || vips_cast( t[2], &t[3], VIPS_FORMAT_UCHAR, NULL ) ||
vips_maplut( t[3], &t[4], t[0], NULL ) || vips_maplut( t[3], &t[4], t[0], NULL ) ||

View File

@ -311,7 +311,7 @@ vips_flatten_build( VipsObject *object )
in = flatten->in; in = flatten->in;
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -150,7 +150,7 @@ vips_recomb_build( VipsObject *object )
in = recomb->in; in = recomb->in;
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -94,7 +94,7 @@ vips_conv_build( VipsObject *object )
/* Unpack for processing. /* Unpack for processing.
*/ */
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -303,7 +303,7 @@ vips_fwfft_build( VipsObject *object )
in = freqfilt->in; in = freqfilt->in;
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -216,7 +216,7 @@ vips_invfft_build( VipsObject *object )
in = freqfilt->in; in = freqfilt->in;
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -236,7 +236,7 @@ vips_hist_local_build( VipsObject *object )
in = local->in; in = local->in;
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -143,7 +143,7 @@ vips_histogram_build( VipsObject *object )
g_object_set( histogram, "out", vips_image_new(), NULL ); g_object_set( histogram, "out", vips_image_new(), NULL );
for( i = 0; i < histogram->n; i++ ) for( i = 0; i < histogram->n; i++ )
if( vips__image_decode( histogram->in[i], &decode[i] ) || if( vips_image_decode( histogram->in[i], &decode[i] ) ||
vips_check_hist( class->nickname, decode[i] ) ) vips_check_hist( class->nickname, decode[i] ) )
return( -1 ); return( -1 );

View File

@ -224,7 +224,7 @@ vips_stdif_build( VipsObject *object )
in = stdif->in; in = stdif->in;
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -430,6 +430,8 @@ VipsImage *vips_image_new_temp_file( const char *format );
int vips_image_write( VipsImage *image, VipsImage *out ); int vips_image_write( VipsImage *image, VipsImage *out );
int vips_image_write_to_file( VipsImage *image, const char *filename ); int vips_image_write_to_file( VipsImage *image, const char *filename );
int vips_image_decode( VipsImage *in, VipsImage **out );
gboolean vips_image_isMSBfirst( VipsImage *image ); gboolean vips_image_isMSBfirst( VipsImage *image );
gboolean vips_image_isfile( VipsImage *image ); gboolean vips_image_isfile( VipsImage *image );
gboolean vips_image_ispartial( VipsImage *image ); gboolean vips_image_ispartial( VipsImage *image );

View File

@ -298,8 +298,6 @@ IMAGE *vips__deprecated_open_write( const char *filename );
int vips__input_interpolate_init( im_object *obj, char *str ); int vips__input_interpolate_init( im_object *obj, char *str );
int vips__image_decode( VipsImage *in, VipsImage **out );
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /*__cplusplus*/ #endif /*__cplusplus*/

View File

@ -962,6 +962,28 @@ typedef enum {
IM_MASK_FRACTAL_FLT = 18 IM_MASK_FRACTAL_FLT = 18
} ImMaskType; } ImMaskType;
/* We had them in the VIPS namespace for a while before deprecating them.
*/
#define VIPS_MASK_IDEAL_HIGHPASS IM_MASK_IDEAL_HIGHPASS
#define VIPS_MASK_IDEAL_LOWPASS IM_MASK_IDEAL_LOWPASS
#define VIPS_MASK_BUTTERWORTH_HIGHPASS IM_MASK_BUTTERWORTH_HIGHPASS
#define VIPS_MASK_BUTTERWORTH_LOWPASS IM_MASK_BUTTERWORTH_LOWPASS
#define VIPS_MASK_GAUSS_HIGHPASS IM_MASK_GAUSS_HIGHPASS
#define VIPS_MASK_GAUSS_LOWPASS IM_MASK_GAUSS_LOWPASS
#define VIPS_MASK_IDEAL_RINGPASS IM_MASK_IDEAL_RINGPASS
#define VIPS_MASK_IDEAL_RINGREJECT IM_MASK_IDEAL_RINGREJECT
#define VIPS_MASK_BUTTERWORTH_RINGPASS IM_MASK_BUTTERWORTH_RINGPASS
#define VIPS_MASK_BUTTERWORTH_RINGREJECT IM_MASK_BUTTERWORTH_RINGREJECT
#define VIPS_MASK_GAUSS_RINGPASS IM_MASK_GAUSS_RINGPASS
#define VIPS_MASK_GAUSS_RINGREJECT IM_MASK_GAUSS_RINGREJECT
#define VIPS_MASK_IDEAL_BANDPASS IM_MASK_IDEAL_BANDPASS
#define VIPS_MASK_IDEAL_BANDREJECT IM_MASK_IDEAL_BANDREJECT
#define VIPS_MASK_BUTTERWORTH_BANDPASS IM_MASK_BUTTERWORTH_BANDPASS
#define VIPS_MASK_BUTTERWORTH_BANDREJECT IM_MASK_BUTTERWORTH_BANDREJECT
#define VIPS_MASK_GAUSS_BANDPASS IM_MASK_GAUSS_BANDPASS
#define VIPS_MASK_GAUSS_BANDREJECT IM_MASK_GAUSS_BANDREJECT
#define VIPS_MASK_FRACTAL_FLT IM_MASK_FRACTAL_FLT
int im_flt_image_freq( VipsImage *in, VipsImage *out, ImMaskType flag, ... ); int im_flt_image_freq( VipsImage *in, VipsImage *out, ImMaskType flag, ... );
int im_create_fmask( VipsImage *out, int im_create_fmask( VipsImage *out,
int xsize, int ysize, ImMaskType flag, ... ); int xsize, int ysize, ImMaskType flag, ... );

View File

@ -1997,6 +1997,37 @@ vips_image_write_to_file( VipsImage *image, const char *filename )
return( 0 ); return( 0 );
} }
/**
* vips_image_decode:
* @in: image to decode
* @out: write to this image
*
* A convenience function to unpack to a format that we can compute with.
* @out->Coding is always VIPS_CODING_NONE.
*
* See also: vips_LabQ2LabS(), vips_rad2float().
*
* Returns: 0 on success, or -1 on error.
*/
int
vips_image_decode( VipsImage *in, VipsImage **out )
{
if( in->Coding == VIPS_CODING_LABQ ) {
if( vips_LabQ2LabS( in, out, NULL ) )
return( -1 );
}
else if( in->Coding == VIPS_CODING_RAD ) {
if( vips_rad2float( in, out, NULL ) )
return( -1 );
}
else {
if( vips_copy( in, out, NULL ) )
return( -1 );
}
return( 0 );
}
/** /**
* vips_image_isMSBfirst: * vips_image_isMSBfirst:
* @image: image to test * @image: image to test

View File

@ -93,7 +93,7 @@ vips_morph_build( VipsObject *object )
in = morphology->in; in = morphology->in;
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -341,7 +341,7 @@ vips_rank_build( VipsObject *object )
in = morphology->in; in = morphology->in;
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -375,27 +375,6 @@ vips_affine_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
return( 0 ); return( 0 );
} }
/* Unpack to a format that we can compute with.
*/
int
vips__image_decode( VipsImage *in, VipsImage **out )
{
if( in->Coding == VIPS_CODING_LABQ ) {
if( vips_LabQ2LabS( in, out, NULL ) )
return( -1 );
}
else if( in->Coding == VIPS_CODING_RAD ) {
if( vips_rad2float( in, out, NULL ) )
return( -1 );
}
else {
if( vips_copy( in, out, NULL ) )
return( -1 );
}
return( 0 );
}
static int static int
vips_affine_build( VipsObject *object ) vips_affine_build( VipsObject *object )
{ {
@ -485,7 +464,7 @@ vips_affine_build( VipsObject *object )
return( -1 ); return( -1 );
} }
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];

View File

@ -347,7 +347,7 @@ vips_shrink_build( VipsObject *object )
/* Unpack for processing. /* Unpack for processing.
*/ */
if( vips__image_decode( in, &t[0] ) ) if( vips_image_decode( in, &t[0] ) )
return( -1 ); return( -1 );
in = t[0]; in = t[0];