This commit is contained in:
John Cupitt 2009-11-07 21:33:07 +00:00
parent 174fdd782a
commit c2a4908d43
67 changed files with 60 additions and 131 deletions

1
TODO
View File

@ -1,4 +1,3 @@
WONTFIX for 7.20
================

View File

@ -250,12 +250,10 @@ im_abs( IMAGE *in, IMAGE *out )
break;
case IM_BANDFMT_COMPLEX:
out->Bbits = IM_BBITS_FLOAT;
out->BandFmt = IM_BANDFMT_FLOAT;
break;
case IM_BANDFMT_DPCOMPLEX:
out->Bbits = IM_BBITS_DOUBLE;
out->BandFmt = IM_BANDFMT_DOUBLE;
break;

View File

@ -279,7 +279,6 @@ im__arith_binary( const char *domain,
/* What output type will we write?
*/
out->BandFmt = format_table[t[2]->BandFmt];
out->Bbits = im_bits_of_fmt( out->BandFmt );
/* And process! The buffer function gets one of the input images as a
* sample.

View File

@ -207,7 +207,6 @@ int im_linreg( IMAGE **ins, IMAGE *out, double *xs ){
out-> Bands= 7;
out-> BandFmt= IM_BANDFMT_DOUBLE;
out-> Bbits= IM_BBITS_DOUBLE;
out-> Type= 0;
if( im_demand_hint_array( out, IM_THINSTRIP, ins ) )

View File

@ -344,10 +344,8 @@ im_lintra_vec( int n, double *a, IMAGE *in, double *b, IMAGE *out )
*/
if( im_cp_desc( out, in ) )
return( -1 );
if( im_isint( in ) ) {
out->Bbits = IM_BBITS_FLOAT;
if( im_isint( in ) )
out->BandFmt = IM_BANDFMT_FLOAT;
}
if( in->Bands == 1 )
out->Bands = n;

View File

@ -133,10 +133,8 @@ im_recomb( IMAGE *in, IMAGE *out, DOUBLEMASK *recomb )
if( im_cp_desc( out, in ) )
return( -1 );
out->Bands = recomb->ysize;
if( im_isint( in ) ) {
out->Bbits = IM_BBITS_FLOAT;
if( im_isint( in ) )
out->BandFmt = IM_BANDFMT_FLOAT;
}
/* Take a copy of the matrix.
*/

View File

@ -237,7 +237,6 @@ im__arith_binary_const( const char *name,
if( im_cp_desc( out, in ) )
return( -1 );
out->BandFmt = format_table[in->BandFmt];
out->Bbits = im_bits_of_fmt( out->BandFmt );
/* Some operations need the vector in the input type (eg.
* im_equal_vec() where the output type is always uchar and is useless

View File

@ -136,10 +136,8 @@ im_sign( IMAGE *in, IMAGE *out )
im_cp_desc( out, in ) )
return( -1 );
if( !im_iscomplex( in ) ) {
out->Bbits = IM_BBITS_BYTE;
if( !im_iscomplex( in ) )
out->BandFmt = IM_BANDFMT_CHAR;
}
if( im_wrapone( in, out, (im_wrapone_fn) sign_gen, in, NULL ) )
return( -1 );

View File

@ -115,10 +115,8 @@ im__math( const char *name, IMAGE *in, IMAGE *out, im_wrapone_fn gen )
if( im_cp_desc( out, in ) )
return( -1 );
if( im_isint( in ) ) {
out->Bbits = IM_BBITS_FLOAT;
if( im_isint( in ) )
out->BandFmt = IM_BANDFMT_FLOAT;
}
if( im_wrapone( in, out, gen, in, NULL ) )
return( -1 );

View File

@ -88,7 +88,6 @@ im_Lab2LabS( IMAGE *in, IMAGE *out )
return( -1 );
out->Type = IM_TYPE_LABS;
out->BandFmt = IM_BANDFMT_SHORT;
out->Bbits = IM_BBITS_SHORT;
if( im_wrapone( t[0], out,
(im_wrapone_fn) imb_Lab2LabS, NULL, NULL ) )

View File

@ -180,7 +180,6 @@ im_LabQ2disp_table( IMAGE *in, IMAGE *out, void *table )
if( im_cp_desc( out, in ) )
return( -1 );
out->Bands = 3;
out->Bbits = IM_BBITS_BYTE;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_NONE;
out->Type = IM_TYPE_RGB;

View File

@ -145,7 +145,6 @@ im_XYZ2disp( IMAGE *in, IMAGE *out, struct im_col_display *d )
if( im_cp_desc( out, in ) )
return( -1 );
out->Bbits = IM_BBITS_BYTE;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Type = IM_TYPE_RGB;

View File

@ -95,7 +95,6 @@ im_disp2XYZ( IMAGE *in, IMAGE *out, struct im_col_display *d )
*/
if( im_cp_desc( out, in ) )
return( -1 );
out->Bbits = IM_BBITS_FLOAT;
out->BandFmt = IM_BANDFMT_FLOAT;
out->Type = IM_TYPE_XYZ;

View File

@ -99,14 +99,10 @@ im_c2imag( IMAGE *in, IMAGE *out )
/* Output will be float or double.
*/
if( in->BandFmt == IM_BANDFMT_DPCOMPLEX ) {
if( in->BandFmt == IM_BANDFMT_DPCOMPLEX )
out->BandFmt = IM_BANDFMT_DOUBLE;
out->Bbits = IM_BBITS_DOUBLE;
}
else {
else
out->BandFmt = IM_BANDFMT_FLOAT;
out->Bbits = IM_BBITS_FLOAT;
}
/* Do the processing.
*/

View File

@ -104,14 +104,10 @@ im_c2real( IMAGE *in, IMAGE *out )
/* Output will be float or double.
*/
if( in->BandFmt == IM_BANDFMT_DPCOMPLEX ) {
if( in->BandFmt == IM_BANDFMT_DPCOMPLEX )
out->BandFmt = IM_BANDFMT_DOUBLE;
out->Bbits = IM_BBITS_DOUBLE;
}
else {
else
out->BandFmt = IM_BANDFMT_FLOAT;
out->Bbits = IM_BBITS_FLOAT;
}
/* Do the processing.
*/

View File

@ -459,7 +459,6 @@ im_clip2fmt( IMAGE *in, IMAGE *out, int ofmt )
if( im_cp_desc( out, in ) )
return( -1 );
out->BandFmt = ofmt;
out->Bbits = im_bits_of_fmt( ofmt );
if( im_demand_hint( out, IM_THINSTRIP, in, NULL ) ||
im_generate( out, clip_start, clip_gen, clip_stop, in, clip ) )

View File

@ -164,7 +164,6 @@ im_copy_set_all( IMAGE *in, IMAGE *out,
out->Bands = Bands;
out->BandFmt = BandFmt;
out->Coding = Coding;
out->Bbits = im_bits_of_fmt( BandFmt );
/* Sanity check: we (may) have changed bytes-per-pixel since we've
* changed Bands and BandFmt ... bad!

View File

@ -183,7 +183,6 @@ im_msb (IMAGE * in, IMAGE * out)
if (im_cp_desc (out, in))
return -1;
out->Bbits = sizeof (unsigned char) << 3;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_NONE;
@ -283,7 +282,6 @@ im_msb_band (IMAGE * in, IMAGE * out, int band)
return -1;
out->Bands = 1;
out->Bbits = sizeof (unsigned char) << 3;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_NONE;

View File

@ -129,14 +129,10 @@ im_ri2c( IMAGE *in1, IMAGE *in2, IMAGE *out )
if( im_cp_descv( out, in1, in2, NULL ) )
return( -1 );
if( in1->BandFmt == IM_BANDFMT_DOUBLE ||
in2->BandFmt == IM_BANDFMT_DOUBLE ) {
out->Bbits = IM_BBITS_DPCOMPLEX;
in2->BandFmt == IM_BANDFMT_DOUBLE )
out->BandFmt = IM_BANDFMT_DPCOMPLEX;
}
else {
out->Bbits = IM_BBITS_COMPLEX;
else
out->BandFmt = IM_BANDFMT_COMPLEX;
}
/* Float inputs up to correct type. Note that if they are already the
* right type, this operation becomes a NOOP.

View File

@ -173,7 +173,6 @@ im_contrast_surface_raw (IMAGE * in, IMAGE * out, int half_win_size,
return -1;
out->BandFmt = IM_BANDFMT_UINT;
out->Bbits = sizeof (unsigned int) << 3;
out->Xsize = 1 + ((in->Xsize - DOUBLE_ADD_ONE (half_win_size)) / spacing);
out->Ysize = 1 + ((in->Ysize - DOUBLE_ADD_ONE (half_win_size)) / spacing);

View File

@ -305,10 +305,8 @@ im_convf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask )
*/
if( im_cp_desc( out, in ) )
return( -1 );
if( im_isint( in ) ) {
out->Bbits = IM_BBITS_FLOAT;
if( im_isint( in ) )
out->BandFmt = IM_BANDFMT_FLOAT;
}
out->Xsize -= mask->xsize - 1;
out->Ysize -= mask->ysize - 1;
if( out->Xsize <= 0 || out->Ysize <= 0 ) {

View File

@ -311,10 +311,8 @@ im_convsepf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask )
*/
if( im_cp_desc( out, in ) )
return( -1 );
if( im_isint( in ) ) {
out->Bbits = IM_BBITS_FLOAT;
if( im_isint( in ) )
out->BandFmt = IM_BANDFMT_FLOAT;
}
out->Xsize -= conv->size - 1;
out->Ysize -= conv->size - 1;
if( out->Xsize <= 0 || out->Ysize <= 0 ) {

View File

@ -167,7 +167,6 @@ im_fastcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out )
*/
if( im_cp_descv( out, in, ref, NULL ) )
return( -1 );
out->Bbits = IM_BBITS_INT;
out->BandFmt = IM_BANDFMT_UINT;
out->Xsize = in->Xsize - ref->Xsize + 1;
out->Ysize = in->Ysize - ref->Ysize + 1;

View File

@ -134,7 +134,6 @@ int im_gradcor_raw( IMAGE *large, IMAGE *small, IMAGE *out ){
out-> Xsize= 1 + large-> Xsize - small-> Xsize;
out-> Ysize= 1 + large-> Ysize - small-> Ysize;
out-> BandFmt= IM_BANDFMT_FLOAT;
out-> Bbits= IM_BBITS_FLOAT;
if( im_demand_hint( out, IM_FATSTRIP, large, NULL ) )
return -1;
@ -196,7 +195,6 @@ int im_grad_x( IMAGE *in, IMAGE *out ){
-- out-> Xsize;
out-> BandFmt= IM_BANDFMT_INT; /* do not change without updating im_gradcor() */
out-> Bbits= IM_BBITS_INT;
if( im_demand_hint( out, IM_THINSTRIP, in, NULL ) )
return -1;
@ -260,7 +258,6 @@ int im_grad_y( IMAGE *in, IMAGE *out ){
-- out-> Ysize;
out-> BandFmt= IM_BANDFMT_INT; /* do not change without updating im_gradcor() */
out-> Bbits= IM_BBITS_INT;
if( im_demand_hint( out, IM_FATSTRIP, in, NULL ) )
return -1;

View File

@ -282,7 +282,6 @@ im_spcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out )
*/
if( im_cp_descv( out, in, ref, NULL ) )
return( -1 );
out->Bbits = IM_BBITS_FLOAT;
out->BandFmt = IM_BANDFMT_FLOAT;
out->Xsize = in->Xsize - ref->Xsize + 1;
out->Ysize = in->Ysize - ref->Ysize + 1;

View File

@ -196,8 +196,8 @@ int xskip, yskip;
if (im_iocheck(in, out) == -1)
return( -1 );
if ( (in->Coding != IM_CODING_NONE)||(in->Bbits != IM_BBITS_BYTE)
||(in->BandFmt != IM_BANDFMT_UCHAR) )
if ( (in->Coding != IM_CODING_NONE)||
(in->BandFmt != IM_BANDFMT_UCHAR) )
{
im_error( "im_convsub", "%s", _( "nput should be unsigned char uncoded") );
return(-1);

View File

@ -126,8 +126,6 @@ int im_gaddim(a, in1, b, in2, c, out)
IMAGE *in1, *in2, *out;
double a, b, c;
{
static int bb[] = { IM_BBITS_BYTE, IM_BBITS_BYTE, IM_BBITS_SHORT,
IM_BBITS_SHORT, IM_BBITS_INT, IM_BBITS_INT };
static int fmt[] = { IM_BANDFMT_UCHAR, IM_BANDFMT_CHAR,
IM_BANDFMT_USHORT, IM_BANDFMT_SHORT,
IM_BANDFMT_UINT, IM_BANDFMT_INT };
@ -176,7 +174,6 @@ double a, b, c;
/* Prepare the output header */
if ( im_cp_desc(out, in1) == -1)
{ im_error("im_gaddim"," im_cp_desc failed"); return(-1); }
out->Bbits = bb[result];
out->BandFmt = fmt[result];
if( im_setupout(out) == -1)

View File

@ -136,7 +136,6 @@ int im_gfadd(a, in1, b, in2, c, out)
double a, b, c;
IMAGE *in1, *in2, *out;
{
static int bb[] = { IM_BBITS_FLOAT, IM_BBITS_DOUBLE };
static int fmt[] = { IM_BANDFMT_FLOAT, IM_BANDFMT_DOUBLE };
int y, x;
int first, second, result;
@ -184,7 +183,6 @@ IMAGE *in1, *in2, *out;
/* Prepare output */
if ( im_cp_desc(out, in1) == -1)
{ im_error("im_gfadd"," im_cp_desc failed"); return( -1 ); }
out->Bbits = bb[result];
out->BandFmt = fmt[result];
if( im_setupout(out) == -1)
{ im_error("im_gfadd"," im_setupout failed"); return( -1 ); }

View File

@ -297,12 +297,12 @@ double factor;
*/
if( im_iocheck( in, out ) )
return( -1 );
if( in->Bands != 1 || in->Bbits != 8 ||
if( in->Bands != 1 ||
in->Coding != IM_CODING_NONE || in->BandFmt != IM_BANDFMT_UCHAR ) {
im_error( "im_litecor", "bad input format" );
return( -1 );
}
if( white->Bands != 1 || white->Bbits != 8 ||
if( white->Bands != 1 ||
white->Coding != IM_CODING_NONE || white->BandFmt != IM_BANDFMT_UCHAR ) {
im_error( "im_litecor", "bad white format" );
return( -1 );

View File

@ -104,7 +104,6 @@ double t1, t2;
return( -1 );
}
out->BandFmt = IM_BANDFMT_UCHAR;
out->Bbits = IM_BBITS_BYTE;
if( im_setupout( out ) )
{
im_error( "im_slice", "%s", _( "im_setupout failed") );

View File

@ -90,7 +90,6 @@ double threshold;
if( im_cp_desc( out, in ) )
return( -1 );
out->BandFmt = IM_BANDFMT_UCHAR;
out->Bbits = IM_BBITS_BYTE;
if( im_setupout( out ) )
return( -1 );

View File

@ -267,8 +267,6 @@ parse_header( Read *read )
return( -1 );
}
im->Bbits = im_bits_of_fmt( im->BandFmt );
switch( image->colorspace ) {
case GRAYColorspace:
if( im->BandFmt == IM_BANDFMT_USHORT )
@ -361,7 +359,6 @@ parse_header( Read *read )
for( p = image; p; (p = GetNextImageInList( p )) ) {
if( p->columns != (unsigned int) im->Xsize ||
p->rows != (unsigned int) im->Ysize ||
p->depth != (unsigned int) im->Bbits ||
get_bands( p ) != im->Bands )
break;

View File

@ -344,7 +344,6 @@ parse_labpack( ReadTiff *rtiff, IMAGE *out )
return( -1 );
out->Bands = 4;
out->Bbits = 8;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_LABQ;
out->Type = IM_TYPE_LAB;
@ -384,7 +383,6 @@ parse_labs( ReadTiff *rtiff, IMAGE *out )
return( -1 );
out->Bands = 3;
out->Bbits = 16;
out->BandFmt = IM_BANDFMT_SHORT;
out->Coding = IM_CODING_NONE;
out->Type = IM_TYPE_LABS;
@ -423,7 +421,6 @@ parse_ycbcr( ReadTiff *rtiff, IMAGE *out )
return( -1 );
out->Bands = 4;
out->Bbits = 8;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_LABQ;
out->Type = IM_TYPE_LAB;
@ -482,7 +479,6 @@ parse_onebit( ReadTiff *rtiff, int pm, IMAGE *out )
return( -1 );
out->Bands = 1;
out->Bbits = 8;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_NONE;
out->Type = IM_TYPE_B_W;
@ -533,7 +529,6 @@ parse_greyscale8( ReadTiff *rtiff, int pm, IMAGE *out )
*mask = (pm == PHOTOMETRIC_MINISBLACK) ? 0 : 255;
out->Bands = 1;
out->Bbits = 8;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_NONE;
out->Type = IM_TYPE_B_W;
@ -580,7 +575,6 @@ parse_greyscale16( ReadTiff *rtiff, int pm, IMAGE *out )
mask[0] = (pm == PHOTOMETRIC_MINISBLACK) ? 0 : 65535;
out->Bands = 1;
out->Bbits = 16;
out->BandFmt = IM_BANDFMT_USHORT;
out->Coding = IM_CODING_NONE;
out->Type = IM_TYPE_GREY16;
@ -615,7 +609,6 @@ parse_greyscale32f( ReadTiff *rtiff, int pm, IMAGE *out )
return( -1 );
out->Bands = 1;
out->Bbits = 32;
out->BandFmt = IM_BANDFMT_FLOAT;
out->Coding = IM_CODING_NONE;
out->Type = IM_TYPE_B_W;
@ -690,7 +683,6 @@ parse_palette( ReadTiff *rtiff, IMAGE *out )
maps[2] = blue;
out->Bands = 3;
out->Bbits = 8;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_NONE;
out->Type = IM_TYPE_sRGB;
@ -737,7 +729,6 @@ parse_rgb8( ReadTiff *rtiff, IMAGE *out )
}
out->Bands = bands;
out->Bbits = 8;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_NONE;
out->Type = IM_TYPE_sRGB;
@ -786,7 +777,6 @@ parse_rgb16( ReadTiff *rtiff, IMAGE *out )
}
out->Bands = bands;
out->Bbits = 16;
out->BandFmt = IM_BANDFMT_USHORT;
out->Coding = IM_CODING_NONE;
out->Type = IM_TYPE_RGB16;
@ -832,7 +822,6 @@ parse_32f( ReadTiff *rtiff, int pm, IMAGE *out )
assert( bands == 3 || bands == 4 );
out->Bands = bands;
out->Bbits = 32;
out->BandFmt = IM_BANDFMT_FLOAT;
out->Coding = IM_CODING_NONE;
@ -876,7 +865,6 @@ parse_cmyk( ReadTiff *rtiff, IMAGE *out )
}
out->Bands = bands;
out->Bbits = 8;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Coding = IM_CODING_NONE;
out->Type = IM_TYPE_CMYK;

View File

@ -254,7 +254,7 @@ im_vips2ppm( IMAGE *in, const char *filename )
}
}
if( in->Bbits > 8 && !ascii ) {
if( im_bits_of_fmt( in->BandFmt ) > 8 && !ascii ) {
im_error( "im_vips2ppm",
"%s", _( "can't write binary >8 bit images" ) );
return( -1 );

View File

@ -480,7 +480,8 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
int photometric;
TIFFSetField( tif, TIFFTAG_SAMPLESPERPIXEL, tw->im->Bands );
TIFFSetField( tif, TIFFTAG_BITSPERSAMPLE, tw->im->Bbits );
TIFFSetField( tif, TIFFTAG_BITSPERSAMPLE,
im_bits_of_fmt( tw->im->BandFmt ) );
switch( tw->im->Bands ) {
case 1:

View File

@ -890,7 +890,6 @@ rad2vips_get_header( Read *read, FILE *fin, IMAGE *out )
out->Bands = 4;
out->BandFmt = IM_BANDFMT_UCHAR;
out->Bbits = im_bits_of_fmt( out->BandFmt );
out->Coding = IM_CODING_RAD;
out->Xres = 1.0;

View File

@ -134,7 +134,6 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
*/
if( im_cp_desc( out, in ) )
return( -1 );
out->Bbits = IM_BBITS_DPCOMPLEX;
out->BandFmt = IM_BANDFMT_DPCOMPLEX;
if( im_setupout( out ) )
return( -1 );
@ -238,7 +237,6 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
*/
if( im_cp_desc( out, in ) )
return( -1 );
out->Bbits = IM_BBITS_DPCOMPLEX;
out->BandFmt = IM_BANDFMT_DPCOMPLEX;
if( im_setupout( out ) )
return( -1 );
@ -333,7 +331,6 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
*/
if( im_cp_desc( out, in ) )
return( -1 );
out->Bbits = IM_BBITS_DPCOMPLEX;
out->BandFmt = IM_BANDFMT_DPCOMPLEX;
if( im_setupout( out ) )
return( -1 );
@ -447,7 +444,6 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
*/
if( im_cp_desc( out, in ) )
return( -1 );
out->Bbits = IM_BBITS_DPCOMPLEX;
out->BandFmt = IM_BANDFMT_DPCOMPLEX;
if( im_setupout( out ) )
return( -1 );
@ -546,7 +542,6 @@ fwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
*/
if( im_cp_desc( out, in ) )
return( -1 );
out->Bbits = IM_BBITS_COMPLEX;
out->BandFmt = IM_BANDFMT_COMPLEX;
if( im_setupout( out ) )
return( -1 );

View File

@ -235,7 +235,6 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
*/
if( im_cp_desc( out, in ) )
return( -1 );
out->Bbits = IM_BBITS_COMPLEX;
out->BandFmt = IM_BANDFMT_COMPLEX;
if( im_setupout( out ) )
return( -1 );

View File

@ -100,7 +100,6 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
*/
if( im_cp_desc( real, in ) )
return( -1 );
real->Bbits = IM_BBITS_DOUBLE;
real->BandFmt = IM_BANDFMT_DOUBLE;
if( im_setupout( real ) )
return( -1 );
@ -183,7 +182,6 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
*/
if( im_cp_desc( real, in ) )
return( -1 );
real->Bbits = IM_BBITS_DOUBLE;
real->BandFmt = IM_BANDFMT_DOUBLE;
if( im_setupout( real ) )
return( -1 );
@ -287,7 +285,6 @@ invfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
*/
if( im_cp_desc( out, in ) )
return( -1 );
out->Bbits = IM_BBITS_FLOAT;
out->BandFmt = IM_BANDFMT_FLOAT;
if( im_setupout( out ) )
return( -1 );

View File

@ -114,7 +114,6 @@ im_histcum( IMAGE *in, IMAGE *out )
out->BandFmt = IM_BANDFMT_UINT;
else if( im_isint( in ) )
out->BandFmt = IM_BANDFMT_INT;
out->Bbits = im_bits_of_fmt( out->BandFmt );
if( !(outbuf = im_malloc( out, IM_IMAGE_SIZEOF_LINE( out ))) )
return( -1 );

View File

@ -313,10 +313,9 @@ im_histgr( IMAGE *in, IMAGE *out, int bandno )
/* Find the range of pixel values we must handle.
*/
if( in->Bbits == IM_BBITS_BYTE && in->BandFmt == IM_BANDFMT_UCHAR )
if( in->BandFmt == IM_BANDFMT_UCHAR )
size = 256;
else if( in->Bbits == IM_BBITS_SHORT &&
in->BandFmt == IM_BANDFMT_USHORT )
else if( in->BandFmt == IM_BANDFMT_USHORT )
size = 65536;
else {
im_error( "im_histgr", "%s", _( "input not uchar or ushort" ) );

View File

@ -1,5 +1,5 @@
/* @(#) Creates a image file with Xsize=256, Ysize=1, Bands=bands,
* @(#) Bbits=IM_BBITS_BYTE, BandFmt=IM_BANDFMT_UCHAR, Type=IM_TYPE_HISTOGRAM;
* @(#) BandFmt=IM_BANDFMT_UCHAR, Type=IM_TYPE_HISTOGRAM;
* @(#)
* @(#) The created image consist a n bands linear lut and is the basis
* @(#) for building up look-up tables.

View File

@ -155,7 +155,7 @@ im_lhisteq_raw( IMAGE *in, IMAGE *out, int xwin, int ywin )
if( im_piocheck( in, out ) )
return( -1 );
if( in->Bbits != IM_BBITS_BYTE || in->BandFmt != IM_BANDFMT_UCHAR ||
if( in->BandFmt != IM_BANDFMT_UCHAR ||
in->Bands != 1 || in->Coding != IM_CODING_NONE ) {
im_error( "im_lhisteq",
"%s", _( "one band uchar uncoded only" ) );

View File

@ -609,7 +609,6 @@ im_maplut( IMAGE *in, IMAGE *out, IMAGE *lut )
/* Force output to be the same type as lut.
*/
out->Bbits = lut->Bbits;
out->BandFmt = lut->BandFmt;
/* Output has same number of bands as LUT, unless LUT has 1 band, in

View File

@ -270,12 +270,10 @@ im_project( IMAGE *in, IMAGE *hout, IMAGE *vout )
hout->Xsize = 1;
hout->BandFmt = project_type[in->BandFmt];
hout->Bbits = im_bits_of_fmt( hout->BandFmt );
hout->Type = IM_TYPE_HISTOGRAM;
vout->Ysize = 1;
vout->BandFmt = project_type[in->BandFmt];
vout->Bbits = im_bits_of_fmt( hout->BandFmt );
vout->Type = IM_TYPE_HISTOGRAM;
/* Build the main project we accumulate data in.

View File

@ -202,7 +202,7 @@ im_stdif_raw( IMAGE *in, IMAGE *out,
}
if( im_piocheck( in, out ) )
return( -1 );
if( in->Bbits != IM_BBITS_BYTE || in->BandFmt != IM_BANDFMT_UCHAR ||
if( in->BandFmt != IM_BANDFMT_UCHAR ||
in->Bands != 1 || in->Coding != IM_CODING_NONE ) {
im_error( "im_stdif", "%s",
_( "one band uchar uncoded only" ) );

View File

@ -72,8 +72,8 @@ im_circle( IMAGE *im, int cx, int cy, int radius, int intensity )
return( -1 );
/* Check args */
if ( (im->data == NULL)||(im->BandFmt != IM_BANDFMT_UCHAR)||(im->Bands != 1)
||(im->Bbits != IM_BBITS_BYTE) )
if ( (im->data == NULL)||(im->BandFmt != IM_BANDFMT_UCHAR)||
(im->Bands != 1))
{
im_error("im_circle: ", "%s", _( "able to write input image") );
return(-1);

View File

@ -61,7 +61,7 @@
int
im_paintrect( IMAGE *im, Rect *r, PEL *ink )
{
int es = im->Bbits >> 3;
int es = IM_IMAGE_SIZEOF_ELEMENT( im );
int ps = es * im->Bands;
int ls = ps * im->Xsize;
Rect image, clipped;

View File

@ -89,7 +89,7 @@
int
im_fastline( IMAGE *im, int x1, int y1, int x2, int y2, PEL *pel )
{
int es = im->Bbits >> 3;
int es = IM_IMAGE_SIZEOF_ELEMENT( im );
int ps = es * im->Bands;
int ls = ps * im->Xsize;
PEL *p;

View File

@ -63,7 +63,7 @@
int
im_readpoint( IMAGE *im, int x, int y, PEL *pel )
{
int es = im->Bbits >> 3;
int es = IM_IMAGE_SIZEOF_ELEMENT( im );
int ps = es * im->Bands;
int ls = ps * im->Xsize;
int b;
@ -93,7 +93,7 @@ im_readpoint( IMAGE *im, int x, int y, PEL *pel )
int
im_plotpoint( IMAGE *im, int x, int y, PEL *pel )
{
int es = im->Bbits >> 3;
int es = IM_IMAGE_SIZEOF_ELEMENT( im );
int ps = es * im->Bands;
int ls = ps * im->Xsize;
int b;

View File

@ -167,8 +167,8 @@ im_binfile( const char *name, int xsize, int ysize, int bands, int offset )
/* Set others to standard values.
*/
im->Bbits = IM_BBITS_BYTE;
im->BandFmt = IM_BANDFMT_UCHAR;
im->Bbits = im_bits_of_fmt( im->BandFmt );
im->Coding = IM_CODING_NONE;
if( bands == 1 )

View File

@ -541,6 +541,11 @@ im_generate( IMAGE *im,
"%s", _( "bad dimensions" ) );
return( -1 );
}
/* We don't use this, but make sure it's set in case any old binaries
* are expectiing it.
*/
im->Bbits = im_bits_of_fmt( im->BandFmt );
/* Look at output type to decide our action.
*/

View File

@ -380,6 +380,11 @@ im_iterate( IMAGE *im,
g_assert( !im_image_sanity( im ) );
/* We don't use this, but make sure it's set in case any old binaries
* are expectiing it.
*/
im->Bbits = im_bits_of_fmt( im->BandFmt );
if( iterate_init( &iter, im, start, generate, stop, b, c ) )
return( -1 );

View File

@ -1265,8 +1265,7 @@ im_open_vips( const char *filename )
im_close( im );
return( NULL );
}
if( im->Bbits != IM_BBITS_BYTE &&
im_isMSBfirst( im ) != im_amiMSBfirst() ) {
if( im_isMSBfirst( im ) != im_amiMSBfirst() ) {
im_close( im );
im_error( "im_open_vips", "%s",
_( "open for read-write for "

View File

@ -1092,7 +1092,6 @@ im_render_priority( IMAGE *in, IMAGE *out, IMAGE *mask,
mask->Bands = 1;
mask->BandFmt = IM_BANDFMT_UCHAR;
mask->Bbits = IM_BBITS_BYTE;
mask->Type = IM_TYPE_B_W;
mask->Coding = IM_CODING_NONE;
}

View File

@ -96,6 +96,11 @@ im_setupout( IMAGE *im )
return( -1 );
}
/* We don't use this, but make sure it's set in case any old binaries
* are expectiing it.
*/
im->Bbits = im_bits_of_fmt( im->BandFmt );
if( im->dtype == IM_PARTIAL ) {
/* Make it into a im_setbuf() image.
*/

View File

@ -261,7 +261,7 @@ im_dilate_raw( IMAGE *in, IMAGE *out, INTMASK *m )
*/
if( im_piocheck( in, out ) )
return( -1 );
if( in->Coding != IM_CODING_NONE || in->Bbits != 8 ||
if( in->Coding != IM_CODING_NONE ||
in->BandFmt != IM_BANDFMT_UCHAR ) {
im_error( "im_dilate", "%s", _( "uchar uncoded only" ) );
return( -1 );

View File

@ -257,7 +257,7 @@ im_erode_raw( IMAGE *in, IMAGE *out, INTMASK *m )
*/
if( im_piocheck( in, out ) )
return( -1 );
if( in->Coding != IM_CODING_NONE || in->Bbits != 8 ||
if( in->Coding != IM_CODING_NONE ||
in->BandFmt != IM_BANDFMT_UCHAR ) {
im_error( "im_erode", "%s", _( "1-band uchar uncoded only" ) );
return( -1 );

View File

@ -88,7 +88,6 @@ im_profile( IMAGE *in, IMAGE *out, int dir )
out->Ysize = in->Ysize;
}
out->BandFmt = IM_BANDFMT_USHORT;
out->Bbits = IM_BBITS_SHORT;
if( im_setupout( out ) )
return( -1 );
if( !(buf = IM_ARRAY( out, out->Xsize, unsigned short )) )

View File

@ -157,7 +157,6 @@ im_zerox( IMAGE *in, IMAGE *out, int flag )
*/
if( im_cp_desc( t1, in ) )
return( -1 );
t1->Bbits = IM_BBITS_BYTE;
t1->BandFmt = IM_BANDFMT_UCHAR;
t1->Xsize -= 1;

View File

@ -1067,7 +1067,7 @@ im__lrmerge( IMAGE *ref, IMAGE *sec, IMAGE *out, int dx, int dy, int mwidth )
/* Check IMAGEs parameters
*/
if( ref->Bands != sec->Bands || ref->Bbits != sec->Bbits ||
if( ref->Bands != sec->Bands ||
ref->BandFmt != sec->BandFmt ||
ref->Coding != sec->Coding ) {
im_error( "im_lrmerge",

View File

@ -667,7 +667,7 @@ im__tbmerge( IMAGE *ref, IMAGE *sec, IMAGE *out, int dx, int dy, int mwidth )
/* Check IMAGEs parameters
*/
if( ref->Bands != sec->Bands || ref->Bbits != sec->Bbits ||
if( ref->Bands != sec->Bands ||
ref->BandFmt != sec->BandFmt ||
ref->Coding != sec->Coding ) {
im_error( "im_tbmerge",

View File

@ -96,7 +96,7 @@ int dx, dy; /* displacements */
if (im_iocheck(im, m) == -1)
return( -1 );
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR)) {
if ((im->Bands != 1)||(im->BandFmt != IM_BANDFMT_UCHAR)) {
im_error( "im_cooc_sym", "%s", _( "Unable to accept input") );
return(-1);
}
@ -107,7 +107,6 @@ int dx, dy; /* displacements */
return( -1 );
m->Xsize = 256;
m->Ysize = 256;
m->Bbits = IM_BBITS_DOUBLE;
m->BandFmt = IM_BANDFMT_DOUBLE;
m->Type = IM_TYPE_B_W;
if (im_setupout(m) == -1)
@ -174,7 +173,7 @@ int dx, dy; /* displacements */
if (im_iocheck(im, m) == -1)
return( -1 );
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR))
if ((im->Bands != 1)||(im->BandFmt != IM_BANDFMT_UCHAR))
{
im_error( "im_cooc_ord", "%s", _( "Unable to accept input") );
return(-1);
@ -186,7 +185,6 @@ int dx, dy; /* displacements */
return( -1 );
m->Xsize = 256;
m->Ysize = 256;
m->Bbits = IM_BBITS_DOUBLE;
m->BandFmt = IM_BANDFMT_DOUBLE;
if (im_setupout(m) == -1)
return( -1 );

View File

@ -93,7 +93,7 @@ im_glds_matrix( IMAGE *im, IMAGE *m,
if (im_iocheck(im, m) == -1)
return( -1 );
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR)) {
if ((im->Bands != 1)||(im->BandFmt != IM_BANDFMT_UCHAR)) {
im_error( "im_glds_matrix", "%s", _( "Wrong input") );
return(-1); }
@ -103,8 +103,9 @@ im_glds_matrix( IMAGE *im, IMAGE *m,
if (im_cp_desc(m, im) == -1)
return( -1 );
m->Xsize = 256; m->Ysize = 1;
m->Bbits = IM_BBITS_DOUBLE; m->BandFmt = IM_BANDFMT_DOUBLE;
m->Xsize = 256;
m->Ysize = 1;
m->BandFmt = IM_BANDFMT_DOUBLE;
m->Type = IM_TYPE_B_W;
if (im_setupout(m) == -1)

View File

@ -66,7 +66,7 @@ double *pmean, *pstd;
if( im_incheck( im ) )
return( -1 );
if ((im->Bands != 1)||(im->Bbits != IM_BBITS_BYTE)||(im->BandFmt != IM_BANDFMT_UCHAR)) {
if ((im->Bands != 1)||(im->BandFmt != IM_BANDFMT_UCHAR)) {
im_error( "im_dif_std", "%s", _( "Unable to accept input") );
return(-1);}
if ( (xpos + xsize + dx > im->Xsize)|| (ypos + ysize + dy > im->Ysize) ) {

View File

@ -78,7 +78,7 @@ im_spatres( IMAGE *in, IMAGE *out, int step )
if (im_iocheck(in, out) == -1)
return( -1 );
if((in->Coding != IM_CODING_NONE)||(in->Bbits != 8)||(in->BandFmt !=IM_BANDFMT_UCHAR)) {
if((in->Coding != IM_CODING_NONE)||(in->BandFmt !=IM_BANDFMT_UCHAR)) {
im_error( "im_spatres", "%s", _( "wrong input") );
return(-1); }

View File

@ -165,7 +165,6 @@ im_rightshift_size( IMAGE *in, IMAGE *out, int xshift, int yshift, int band_fmt
out-> Xres/= ( 1 << xshift ); /* x scale */
out-> Yres/= ( 1 << yshift ); /* y scale */
out-> BandFmt= band_fmt;
out-> Bbits= outbits;
if( im_demand_hint( out, IM_THINSTRIP, in, NULL ) )
return -1;
@ -194,7 +193,7 @@ im_rightshift_size( IMAGE *in, IMAGE *out, int xshift, int yshift, int band_fmt
RETURN_MACRO( MACRO, guint32, guint ## OUT_SIZE, guint ## SUM_SIZE ) \
}
#define RETURN_MACRO_SUMSS( MACRO, SUM_SIZE ) switch( out-> Bbits ){ \
#define RETURN_MACRO_SUMSS( MACRO, SUM_SIZE ) switch( im_bits_of_fmt( out->BandFmt ) ){ \
case 32: \
RETURN_MACRO_OUTS( MACRO, SUM_SIZE, 32 ) \
case 16: \