Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Nicolas Robidoux 2011-11-22 19:58:35 -05:00
commit eae5a191ad
11 changed files with 97 additions and 108 deletions

78
TODO
View File

@ -1,44 +1,3 @@
- move recomb to bandary?
- transform_g_string_array_image() can't handle quoted strings, so filenames
with spaces will break
is there an easy fix? can we reuse code from the csv parser?
- test docs
gtk-doc can't introspect to generate class docs since it has no way to init
the classes ... investigate
- try an area operation, like conv, VipsArea? oops no haha what name should we
use?
- test _O_TEMPORARY thing on Windows
- avg/dev etc. should uncode images? eg. labq2lab etc.
how about ifthenelse?
- see: vips_abs_build(), should that set an arithmetic member? ugly
same code in round.c
- vipsimage should be cached too, eg.
VipsImage *a = vips_image_new_from_file( "poop.jpg" );
@ -89,6 +48,43 @@
- transform_g_string_array_image() can't handle quoted strings, so filenames
with spaces will break
is there an easy fix? can we reuse code from the csv parser?
the csv parser just parses FILE* streams, we'd need to break it out
- test docs
gtk-doc can't introspect to generate class docs since it has no way to init
the classes ... investigate
- try an area operation, like conv, VipsArea? oops no haha what name should we
use?
- test _O_TEMPORARY thing on Windows
- avg/dev etc. should uncode images? eg. labq2lab etc.
how about ifthenelse?
- bandalike: consider RGB + RGBA ... we should bandup by adding a black band

View File

@ -77,20 +77,11 @@ G_DEFINE_TYPE( VipsAbs, vips_abs, VIPS_TYPE_UNARY );
static int
vips_abs_build( VipsObject *object )
{
VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object );
VipsUnary *unary = (VipsUnary *) object;
if( unary->in &&
vips_band_format_isuint( unary->in->BandFmt ) ) {
/* This isn't set by arith until build(), so we have to set
* again here.
*
* Should arith set out in _init()?
*/
g_object_set( arithmetic, "out", vips_image_new(), NULL );
return( vips_image_write( unary->in, arithmetic->out ) );
}
vips_band_format_isuint( unary->in->BandFmt ) )
return( vips_unary_copy( unary ) );
if( VIPS_OBJECT_CLASS( vips_abs_parent_class )->build( object ) )
return( -1 );

View File

@ -347,21 +347,13 @@ G_DEFINE_TYPE( VipsComplexget, vips_complexget, VIPS_TYPE_UNARY );
static int
vips_complexget_build( VipsObject *object )
{
VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object );
VipsUnary *unary = (VipsUnary *) object;
VipsComplexget *complexget = (VipsComplexget *) object;
if( unary->in ) {
if( !vips_band_format_iscomplex( unary->in->BandFmt ) &&
complexget->get == VIPS_OPERATION_COMPLEXGET_REAL ) {
g_object_set( arithmetic,
"out", vips_image_new(),
NULL );
return( vips_image_write( unary->in,
arithmetic->out ) );
}
}
if( unary->in &&
!vips_band_format_iscomplex( unary->in->BandFmt ) &&
complexget->get == VIPS_OPERATION_COMPLEXGET_REAL )
return( vips_unary_copy( unary ) );
if( VIPS_OBJECT_CLASS( vips_complexget_parent_class )->build( object ) )
return( -1 );

View File

@ -68,23 +68,14 @@ G_DEFINE_TYPE( VipsRound, vips_round, VIPS_TYPE_UNARY );
static int
vips_round_build( VipsObject *object )
{
VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object );
VipsUnary *unary = (VipsUnary *) object;
/* Is this one of the int types? Degenerate to im_copy() if it
/* Is this one of the int types? Degenerate to vips_copy() if it
* is.
*/
if( unary->in &&
vips_bandfmt_isint( unary->in->BandFmt ) ) {
/* This isn't set by arith until build(), so we have to set
* again here.
*
* Should arith set out in _init()?
*/
g_object_set( arithmetic, "out", vips_image_new(), NULL );
return( vips_image_write( unary->in, arithmetic->out ) );
}
vips_bandfmt_isint( unary->in->BandFmt ) )
return( vips_unary_copy( unary ) );
if( VIPS_OBJECT_CLASS( vips_round_parent_class )->build( object ) )
return( -1 );

View File

@ -97,3 +97,21 @@ vips_unary_init( VipsUnary *unary )
/* Init our instance fields.
*/
}
/* Call this before chaining up in _build() to make the operation fall back to
* copy.
*/
int
vips_unary_copy( VipsUnary *unary )
{
VipsArithmetic *arithmetic = VIPS_ARITHMETIC( unary );
/* This isn't set by arith until build(), so we have to set
* again here.
*
* Should arith set out in _init()?
*/
g_object_set( unary, "out", vips_image_new(), NULL );
return( vips_image_write( unary->in, arithmetic->out ) );
}

View File

@ -59,6 +59,8 @@ typedef VipsArithmeticClass VipsUnaryClass;
GType vips_unary_get_type( void );
int vips_unary_copy( VipsUnary *unary );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -183,3 +183,21 @@ vips_bandary_init( VipsBandary *bandjoin )
/* Init our instance fields.
*/
}
/* Call this before chaining up in _build() to make the operation fall back to
* copy.
*/
int
vips_bandary_copy( VipsBandary *bandary )
{
VipsConversion *conversion = VIPS_CONVERSION( bandary );
/* This isn't set by arith until build(), so we have to set
* again here.
*
* Should arith set out in _init()?
*/
g_object_set( bandary, "out", vips_image_new(), NULL );
return( vips_image_write( bandary->in[0], conversion->out ) );
}

View File

@ -85,6 +85,8 @@ typedef struct _VipsBandaryClass {
GType vips_bandary_get_type( void );
int vips_bandary_copy( VipsBandary *bandary );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -123,7 +123,6 @@ vips_bandjoin_buffer( VipsBandary *bandary, PEL *q, PEL **p, int width )
static int
vips_bandjoin_build( VipsObject *object )
{
VipsConversion *conversion = VIPS_CONVERSION( object );
VipsBandary *bandary = (VipsBandary *) object;
VipsBandjoin *bandjoin = (VipsBandjoin *) object;
@ -131,14 +130,8 @@ vips_bandjoin_build( VipsObject *object )
bandary->in = bandjoin->in->data;
bandary->n = bandjoin->in->n;
if( bandary->n == 1 ) {
g_object_set( conversion,
"out", vips_image_new(),
NULL );
return( vips_image_write( bandary->in[0],
conversion->out ) );
}
if( bandary->n == 1 )
return( vips_bandary_copy( bandary ) );
else {
int i;

View File

@ -157,24 +157,17 @@ vips_bandmean_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width )
static int
vips_bandmean_build( VipsObject *object )
{
VipsConversion *conversion = VIPS_CONVERSION( object );
VipsBandary *bandary = (VipsBandary *) object;
VipsBandmean *bandmean = (VipsBandmean *) object;
bandary->out_bands = 1;
if( bandmean->in ) {
if( bandmean->in->Bands == 1 ) {
g_object_set( conversion,
"out", vips_image_new(),
NULL );
return( vips_image_write( bandmean->in,
conversion->out ) );
}
bandary->n = 1;
bandary->in = &bandmean->in;
if( bandmean->in->Bands == 1 )
return( vips_bandary_copy( bandary ) );
}
if( VIPS_OBJECT_CLASS( vips_bandmean_parent_class )->build( object ) )

View File

@ -305,11 +305,14 @@ vips_extract_band_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width )
static int
vips_extract_band_build( VipsObject *object )
{
VipsConversion *conversion = VIPS_CONVERSION( object );
VipsBandary *bandary = (VipsBandary *) object;
VipsExtractBand *extract = (VipsExtractBand *) object;
if( extract->in ) {
bandary->n = 1;
bandary->in = &extract->in;
bandary->out_bands = extract->n;
if( extract->band + extract->n > extract->in->Bands ) {
vips_error( "VipsExtractBand",
"%s", _( "bad extract band" ) );
@ -317,18 +320,8 @@ vips_extract_band_build( VipsObject *object )
}
if( extract->band == 0 &&
extract->n == extract->in->Bands ) {
g_object_set( conversion,
"out", vips_image_new(),
NULL );
return( vips_image_write( extract->in,
conversion->out ) );
}
bandary->n = 1;
bandary->in = &extract->in;
bandary->out_bands = extract->n;
extract->n == extract->in->Bands )
return( vips_bandary_copy( bandary ) );
}
if( VIPS_OBJECT_CLASS( vips_extract_band_parent_class )->