fix bandbool for float/double
bandary couldn't set output type correctly
This commit is contained in:
parent
eed4bfc731
commit
02ea78232e
libvips/conversion
@ -118,9 +118,10 @@ vips_bandary_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
|
||||
static int
|
||||
vips_bandary_build( VipsObject *object )
|
||||
{
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||
VipsObjectClass *object_class = VIPS_OBJECT_GET_CLASS( object );
|
||||
VipsBandaryClass *class = VIPS_BANDARY_GET_CLASS( object );
|
||||
VipsConversion *conversion = VIPS_CONVERSION( object );
|
||||
VipsBandary *bandary = (VipsBandary *) object;
|
||||
VipsBandary *bandary = VIPS_BANDARY( object );
|
||||
|
||||
int i;
|
||||
VipsImage **decode;
|
||||
@ -131,12 +132,12 @@ vips_bandary_build( VipsObject *object )
|
||||
return( -1 );
|
||||
|
||||
if( bandary->n <= 0 ) {
|
||||
vips_error( class->nickname,
|
||||
vips_error( object_class->nickname,
|
||||
"%s", _( "no input images" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( bandary->n > MAX_INPUT_IMAGES ) {
|
||||
vips_error( class->nickname,
|
||||
vips_error( object_class->nickname,
|
||||
"%s", _( "too many input images" ) );
|
||||
return( -1 );
|
||||
}
|
||||
@ -158,6 +159,9 @@ vips_bandary_build( VipsObject *object )
|
||||
return( -1 );
|
||||
|
||||
conversion->out->Bands = bandary->out_bands;
|
||||
if( class->format_table )
|
||||
conversion->out->BandFmt =
|
||||
class->format_table[bandary->ready[0]->BandFmt];
|
||||
|
||||
if( vips_image_generate( conversion->out,
|
||||
vips_start_many, vips_bandary_gen, vips_stop_many,
|
||||
|
@ -82,6 +82,11 @@ typedef struct _VipsBandaryClass {
|
||||
*/
|
||||
VipsBandaryProcessFn process_line;
|
||||
|
||||
/* For each input format, what output format. Leave NULL for output
|
||||
* format == input format.
|
||||
*/
|
||||
const VipsBandFormat *format_table;
|
||||
|
||||
} VipsBandaryClass;
|
||||
|
||||
GType vips_bandary_get_type( void );
|
||||
|
@ -187,7 +187,7 @@ vips_bandbool_buffer( VipsBandary *bandary,
|
||||
|
||||
/* Type conversions for boolean.
|
||||
*/
|
||||
static const VipsBandFormat vips_bandfmt_boolean[10] = {
|
||||
static const VipsBandFormat vips_bandbool_format_table[10] = {
|
||||
/* UC C US S UI I F X D DX */
|
||||
UC, C, US, S, UI, I, I, I, I, I,
|
||||
};
|
||||
@ -207,6 +207,7 @@ vips_bandbool_class_init( VipsBandboolClass *class )
|
||||
object_class->build = vips_bandbool_build;
|
||||
|
||||
bandary_class->process_line = vips_bandbool_buffer;
|
||||
bandary_class->format_table = vips_bandbool_format_table;
|
||||
|
||||
VIPS_ARG_IMAGE( class, "in", 0,
|
||||
_( "Input" ),
|
||||
|
Loading…
x
Reference in New Issue
Block a user