misc big fixes

This commit is contained in:
John Cupitt 2011-11-08 18:36:33 +00:00
parent ff2e7b26de
commit cb5f199f1c
7 changed files with 48 additions and 38 deletions

16
TODO
View File

@ -1,20 +1,6 @@
- add an INTERPRETATION for "array"
can move the whole of mask, plus headers, plus conversion/im_vips2mask and
- can move the whole of mask, plus headers, plus conversion/im_vips2mask and
mask2vips to deprecated
- try:
$ vips stats babe.jpg
reports leaks, we need to unref more stuff
- try:
$ vips add babe.jpg
GLib-GObject-CRITICAL **: g_o ....

View File

@ -64,8 +64,11 @@ vips_binary_build( VipsObject *object )
arithmetic->in = (VipsImage **) vips_object_local_array( object, 2 );
arithmetic->in[0] = binary->left;
arithmetic->in[1] = binary->right;
g_object_ref( arithmetic->in[0] );
g_object_ref( arithmetic->in[1] );
if( arithmetic->in[0] )
g_object_ref( arithmetic->in[0] );
if( arithmetic->in[1] )
g_object_ref( arithmetic->in[1] );
if( VIPS_OBJECT_CLASS( vips_binary_parent_class )->build( object ) )
return( -1 );

View File

@ -59,6 +59,22 @@
#include <vips/vips.h>
#include <vips/internal.h>
/* Get the value of pixel (0, 0). Use this to init the min/max value for
* im_max()/im_stats()/etc.
*/
int
im__value( IMAGE *im, double *value )
{
IMAGE *t;
if( !(t = im_open_local( im, "im__value", "p" )) ||
im_extract_areabands( im, t, 0, 0, 1, 1, 0, 1 ) ||
im_avg( t, value ) )
return( -1 );
return( 0 );
}
/* A position and maximum.
*/
typedef struct _Maxposavg {

View File

@ -107,25 +107,26 @@ typedef enum {
/**
* VipsInterpretation:
* @VIPS_TYPE_MULTIBAND: generic many-band image
* @VIPS_TYPE_B_W: some kind of single-band image
* @VIPS_TYPE_HISTOGRAM: a 1D image such as a histogram or lookup table
* @VIPS_TYPE_FOURIER: image is in fourier space
* @VIPS_TYPE_XYZ: the first three bands are colours in CIE XYZ colourspace
* @VIPS_TYPE_LAB: pixels are in CIE Lab space
* @VIPS_TYPE_CMYK: the first four bands are in CMYK space
* @VIPS_TYPE_LABQ: implies #VIPS_CODING_LABQ
* @VIPS_TYPE_RGB: generic RGB space
* @VIPS_TYPE_UCS: a uniform colourspace based on CMC
* @VIPS_TYPE_LCH: pixels are in CIE LCh space
* @VIPS_TYPE_LABS: pixels are CIE LAB coded as three signed 16-bit values
* @VIPS_TYPE_sRGB: pixels are sRGB
* @VIPS_TYPE_YXY: pixels are CIE Yxy
* @VIPS_TYPE_RGB16: generic 16-bit RGB
* @VIPS_TYPE_GREY16: generic 16-bit mono
* @VIPS_INTERPREATION_MULTIBAND: generic many-band image
* @VIPS_INTERPREATION_B_W: some kind of single-band image
* @VIPS_INTERPREATION_HISTOGRAM: a 1D image such as a histogram or lookup table
* @VIPS_INTERPREATION_FOURIER: image is in fourier space
* @VIPS_INTERPREATION_XYZ: the first three bands are CIE XYZ
* @VIPS_INTERPREATION_LAB: pixels are in CIE Lab space
* @VIPS_INTERPREATION_CMYK: the first four bands are in CMYK space
* @VIPS_INTERPREATION_LABQ: implies #VIPS_CODING_LABQ
* @VIPS_INTERPREATION_RGB: generic RGB space
* @VIPS_INTERPREATION_UCS: a uniform colourspace based on CMC
* @VIPS_INTERPREATION_LCH: pixels are in CIE LCh space
* @VIPS_INTERPREATION_LABS: CIE LAB coded as three signed 16-bit values
* @VIPS_INTERPREATION_sRGB: pixels are sRGB
* @VIPS_INTERPREATION_YXY: pixels are CIE Yxy
* @VIPS_INTERPREATION_RGB16: generic 16-bit RGB
* @VIPS_INTERPREATION_GREY16: generic 16-bit mono
* @VIPS_INTERPREATION_ARRAY: an array
*
* How the values in an image should be interpreted. For example, a
* three-band float image of type #VIPS_TYPE_LAB should have its pixels
* three-band float image of type #VIPS_INTERPREATION_LAB should have its pixels
* interpreted as coordinates in CIE Lab space.
*
* These values are set by operations as hints to user-interfaces built on top
@ -151,7 +152,8 @@ typedef enum {
VIPS_INTERPRETATION_sRGB = 22,
VIPS_INTERPRETATION_YXY = 23,
VIPS_INTERPRETATION_RGB16 = 25,
VIPS_INTERPRETATION_GREY16 = 26
VIPS_INTERPRETATION_GREY16 = 26,
VIPS_INTERPRETATION_ARRAY = 27
} VipsInterpretation;
/**

View File

@ -197,6 +197,7 @@ vips_interpretation_get_type( void )
{VIPS_INTERPRETATION_YXY, "VIPS_INTERPRETATION_YXY", "yxy"},
{VIPS_INTERPRETATION_RGB16, "VIPS_INTERPRETATION_RGB16", "rgb16"},
{VIPS_INTERPRETATION_GREY16, "VIPS_INTERPRETATION_GREY16", "grey16"},
{VIPS_INTERPRETATION_ARRAY, "VIPS_INTERPRETATION_ARRAY", "array"},
{0, NULL, NULL}
};

View File

@ -412,7 +412,7 @@ vips_image_sanity( VipsObject *object, VipsBuf *buf )
image->Coding != VIPS_CODING_NONE &&
image->Coding != VIPS_CODING_LABQ &&
image->Coding != VIPS_CODING_RAD) ||
image->Type > VIPS_INTERPRETATION_GREY16 ||
image->Type > VIPS_INTERPRETATION_ARRAY ||
image->dtype > VIPS_IMAGE_PARTIAL ||
image->dhint > VIPS_DEMAND_STYLE_ANY )
vips_buf_appends( buf, "bad enum\n" );
@ -1642,6 +1642,7 @@ vips_image_new_array( int xsize, int ysize )
"height", ysize,
"bands", 1,
"format", VIPS_FORMAT_DOUBLE,
"interpretation", VIPS_INTERPRETATION_ARRAY,
NULL );
if( vips_object_build( VIPS_OBJECT( image ) ) ) {
VIPS_UNREF( image );

View File

@ -1073,8 +1073,9 @@ main( int argc, char **argv )
if( vips_call_argv( operation, argc - 1, argv + 1 ) ) {
if( argc == 1 )
vips_object_print( VIPS_OBJECT( operation ) );
else
error_exit( NULL );
g_object_unref( operation );
error_exit( NULL );
}
g_object_unref( operation );