added vips_bandfmt_*()
This commit is contained in:
parent
53ed981820
commit
79c050c814
@ -24,6 +24,7 @@
|
||||
- flood_blob could loop if start point == ink
|
||||
- added im_meta_remove()
|
||||
- added remove profile option to vipsthumbnail
|
||||
- added vips_bandfmt_iscomplex() and friends, im_iscomplex() deprecated
|
||||
|
||||
26/11/09 started 7.20.3
|
||||
- updated en_GB.po translation
|
||||
|
7
TODO
7
TODO
@ -1,3 +1,10 @@
|
||||
- we have this in many places:
|
||||
|
||||
const int nb = vips_bandfmt_iscomplex( in->BandFmt ) ?
|
||||
in->Bands * 2 : in->Bands;
|
||||
|
||||
macroise it?
|
||||
|
||||
- how about im_invalidate_area()? we currently repaint the whole window on
|
||||
every paint action in nip2 :-(
|
||||
|
||||
|
@ -231,7 +231,7 @@ im_abs( IMAGE *in, IMAGE *out )
|
||||
/* Is this one of the unsigned types? Degenerate to im_copy() if it
|
||||
* is.
|
||||
*/
|
||||
if( im_isuint( in ) )
|
||||
if( vips_bandfmt_isuint( in->BandFmt ) )
|
||||
return( im_copy( in, out ) );
|
||||
|
||||
/* Prepare output header. Output type == input type, except for
|
||||
|
@ -91,7 +91,8 @@ add_buffer( PEL **in, PEL *out, int width, IMAGE *im )
|
||||
{
|
||||
/* Complex just doubles the size.
|
||||
*/
|
||||
const int sz = width * im->Bands * (im_iscomplex( im ) ? 2 : 1);
|
||||
const int sz = width * im->Bands *
|
||||
(vips_bandfmt_iscomplex( im->BandFmt ) ? 2 : 1);
|
||||
|
||||
int x;
|
||||
|
||||
@ -155,13 +156,13 @@ static int bandfmt_largest[6][6] = {
|
||||
/* For two formats, find one which can represent the full range of both.
|
||||
*/
|
||||
static VipsBandFmt
|
||||
im__format_common( IMAGE *in1, IMAGE *in2 )
|
||||
im__format_common( VipsBandFmt in1, VipsBandFmt in2 )
|
||||
{
|
||||
if( im_iscomplex( in1 ) || im_iscomplex( in2 ) ) {
|
||||
if( vips_bandfmt_iscomplex( in1 ) ||
|
||||
vips_bandfmt_iscomplex( in2 ) ) {
|
||||
/* What kind of complex?
|
||||
*/
|
||||
if( in1->BandFmt == IM_BANDFMT_DPCOMPLEX ||
|
||||
in2->BandFmt == IM_BANDFMT_DPCOMPLEX )
|
||||
if( in1 == IM_BANDFMT_DPCOMPLEX || in2 == IM_BANDFMT_DPCOMPLEX )
|
||||
/* Output will be DPCOMPLEX.
|
||||
*/
|
||||
return( IM_BANDFMT_DPCOMPLEX );
|
||||
@ -169,11 +170,11 @@ im__format_common( IMAGE *in1, IMAGE *in2 )
|
||||
return( IM_BANDFMT_COMPLEX );
|
||||
|
||||
}
|
||||
else if( im_isfloat( in1 ) || im_isfloat( in2 ) ) {
|
||||
else if( vips_bandfmt_isfloat( in1 ) ||
|
||||
vips_bandfmt_isfloat( in2 ) ) {
|
||||
/* What kind of float?
|
||||
*/
|
||||
if( in1->BandFmt == IM_BANDFMT_DOUBLE ||
|
||||
in2->BandFmt == IM_BANDFMT_DOUBLE )
|
||||
if( in1 == IM_BANDFMT_DOUBLE || in2 == IM_BANDFMT_DOUBLE )
|
||||
return( IM_BANDFMT_DOUBLE );
|
||||
else
|
||||
return( IM_BANDFMT_FLOAT );
|
||||
@ -181,20 +182,40 @@ im__format_common( IMAGE *in1, IMAGE *in2 )
|
||||
else
|
||||
/* Must be int+int -> int.
|
||||
*/
|
||||
return( bandfmt_largest[in1->BandFmt][in2->BandFmt] );
|
||||
return( bandfmt_largest[in1][in2] );
|
||||
}
|
||||
|
||||
int
|
||||
im__formatalike_vec( IMAGE **in, IMAGE **out, int n )
|
||||
{
|
||||
int i;
|
||||
VipsBandFmt fmt;
|
||||
|
||||
g_assert( n >= 1 );
|
||||
|
||||
fmt = in[0]->BandFmt;
|
||||
for( i = 1; i < n; i++ )
|
||||
fmt = im__format_common( fmt, in[i]->BandFmt );
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
if( im_clip2fmt( in[i], out[i], fmt ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
im__formatalike( IMAGE *in1, IMAGE *in2, IMAGE *out1, IMAGE *out2 )
|
||||
{
|
||||
VipsBandFmt fmt;
|
||||
IMAGE *in[2];
|
||||
IMAGE *out[2];
|
||||
|
||||
fmt = im__format_common( in1, in2 );
|
||||
if( im_clip2fmt( in1, out1, fmt ) ||
|
||||
im_clip2fmt( in2, out2, fmt ) )
|
||||
return( -1 );
|
||||
in[0] = in1;
|
||||
in[1] = in2;
|
||||
out[0] = out1;
|
||||
out[1] = out2;
|
||||
|
||||
return( 0 );
|
||||
return( im__formatalike_vec( in, out, 2 ) );
|
||||
}
|
||||
|
||||
/* Make an n-band image. Input 1 or n bands.
|
||||
|
@ -290,7 +290,7 @@ im_avg( IMAGE *in, double *out )
|
||||
pels = (gint64) in->Xsize * in->Ysize;
|
||||
vals = pels * in->Bands;
|
||||
*out = global_sum / vals;
|
||||
if( im_iscomplex( in ) )
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) )
|
||||
*out = sqrt( *out );
|
||||
|
||||
return( 0 );
|
||||
|
@ -88,7 +88,7 @@ bandmean_buffer( PEL *p, PEL *q, int n, IMAGE *in )
|
||||
{
|
||||
/* Complex just doubles the size.
|
||||
*/
|
||||
const int sz = n * (im_iscomplex( in ) ? 2 : 1);
|
||||
const int sz = n * (vips_bandfmt_iscomplex( in->BandFmt ) ? 2 : 1);
|
||||
const int b = in->Bands;
|
||||
|
||||
int i, j;
|
||||
|
@ -186,7 +186,7 @@ int im_linreg( IMAGE **ins, IMAGE *out, double *xs ){
|
||||
}
|
||||
}
|
||||
else {
|
||||
if( ! im_isscalar( ins[ 0 ] ) ){
|
||||
if( vips_bandfmt_iscomplex( ins[ 0 ]->BandFmt ) ){
|
||||
im_error( FUNCTION_NAME, "image has non-scalar band format" );
|
||||
return( -1 );
|
||||
}
|
||||
|
@ -1,14 +1,4 @@
|
||||
/* @(#) Pass an image through a linear transform - ie. out = in*a + b. Output
|
||||
* @(#) is always float for integer input, double for double input, complex for
|
||||
* @(#) complex input and double complex for double complex input.
|
||||
* @(#)
|
||||
* @(#) int
|
||||
* @(#) im_lintra( a, in, b, out )
|
||||
* @(#) IMAGE *in, *out;
|
||||
* @(#) double a, b;
|
||||
* @(#)
|
||||
* @(#) Returns 0 on success and -1 on error
|
||||
* @(#)
|
||||
/* im_lintra.c -- linear transform
|
||||
*
|
||||
* Copyright: 1990, N. Dessipris, based on im_powtra()
|
||||
* Author: Nicos Dessipris
|
||||
@ -344,7 +334,7 @@ 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 ) )
|
||||
if( vips_bandfmt_isint( in->BandFmt ) )
|
||||
out->BandFmt = IM_BANDFMT_FLOAT;
|
||||
if( in->Bands == 1 )
|
||||
out->Bands = n;
|
||||
|
@ -219,7 +219,7 @@ im_maxpos( IMAGE *in, int *xpos, int *ypos, double *out )
|
||||
|
||||
/* We use square mod for scanning, for speed.
|
||||
*/
|
||||
if( im_iscomplex( in ) )
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) )
|
||||
global_maxpos->max *= global_maxpos->max;
|
||||
|
||||
if( im_iterate( in, maxpos_start, maxpos_scan, maxpos_stop,
|
||||
@ -228,7 +228,7 @@ im_maxpos( IMAGE *in, int *xpos, int *ypos, double *out )
|
||||
|
||||
/* Back to modulus.
|
||||
*/
|
||||
if( im_iscomplex( in ) )
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) )
|
||||
global_maxpos->max = sqrt( global_maxpos->max );
|
||||
|
||||
if( xpos )
|
||||
|
@ -235,7 +235,7 @@ im_maxpos_avg( IMAGE *in, double *xpos, double *ypos, double *out )
|
||||
|
||||
/* We use square mod for scanning, for speed.
|
||||
*/
|
||||
if( im_iscomplex( in ) )
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) )
|
||||
global_maxposavg->max *= global_maxposavg->max;
|
||||
|
||||
if( im_iterate( in, maxposavg_start, maxposavg_scan, maxposavg_stop,
|
||||
@ -244,7 +244,7 @@ im_maxpos_avg( IMAGE *in, double *xpos, double *ypos, double *out )
|
||||
|
||||
/* Back to modulus.
|
||||
*/
|
||||
if( im_iscomplex( in ) )
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) )
|
||||
global_maxposavg->max = sqrt( global_maxposavg->max );
|
||||
|
||||
if( xpos )
|
||||
|
@ -120,7 +120,8 @@ int im_maxpos_vec( IMAGE *im, int *xpos, int *ypos, double *maxima, int n ){
|
||||
if( !pointers )
|
||||
return -1;
|
||||
|
||||
if( ! ( im_isint( im ) || im_isfloat( im ) ) ){
|
||||
if( ! ( vips_bandfmt_isint( im->BandFmt ) ||
|
||||
vips_bandfmt_isfloat( im->BandFmt ) ) ){
|
||||
im_error( FUNCTION_NAME, "%s", _( "scalar images only" ) );
|
||||
return -1;
|
||||
}
|
||||
@ -184,7 +185,8 @@ int im_minpos_vec( IMAGE *im, int *xpos, int *ypos, double *minima, int n ){
|
||||
if( !pointers )
|
||||
return -1;
|
||||
|
||||
if( ! ( im_isint( im ) || im_isfloat( im ) ) ){
|
||||
if( ! ( vips_bandfmt_isint( im->BandFmt ) ||
|
||||
vips_bandfmt_isfloat( im->BandFmt ) ) ){
|
||||
im_error( FUNCTION_NAME, "%s", _( "scalar images only" ) );
|
||||
return -1;
|
||||
}
|
||||
@ -302,6 +304,8 @@ static int maxpos_vec_scan( REGION *reg, void *seq, void *a, void *b ){
|
||||
case IM_BANDFMT_INT: MAXPOS_VEC_SCAN( gint32 ) break;
|
||||
case IM_BANDFMT_FLOAT: MAXPOS_VEC_SCAN( float ) break;
|
||||
case IM_BANDFMT_DOUBLE: MAXPOS_VEC_SCAN( double ) break;
|
||||
default:
|
||||
g_assert( 0 );
|
||||
}
|
||||
|
||||
#undef MAXPOS_VEC_SCAN
|
||||
@ -424,6 +428,8 @@ static int minpos_vec_scan( REGION *reg, void *seq, void *a, void *b ){
|
||||
case IM_BANDFMT_INT: MINPOS_VEC_SCAN( gint32 ) break;
|
||||
case IM_BANDFMT_FLOAT: MINPOS_VEC_SCAN( float ) break;
|
||||
case IM_BANDFMT_DOUBLE: MINPOS_VEC_SCAN( double ) break;
|
||||
default:
|
||||
g_assert( 0 );
|
||||
}
|
||||
|
||||
#undef MINPOS_VEC_SCAN
|
||||
|
@ -219,7 +219,7 @@ im_minpos( IMAGE *in, int *xpos, int *ypos, double *out )
|
||||
|
||||
/* We use square mod for scanning, for speed.
|
||||
*/
|
||||
if( im_iscomplex( in ) )
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) )
|
||||
global_minpos->min *= global_minpos->min;
|
||||
|
||||
if( im_iterate( in, minpos_start, minpos_scan, minpos_stop,
|
||||
@ -228,7 +228,7 @@ im_minpos( IMAGE *in, int *xpos, int *ypos, double *out )
|
||||
|
||||
/* Back to modulus.
|
||||
*/
|
||||
if( im_iscomplex( in ) )
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) )
|
||||
global_minpos->min = sqrt( global_minpos->min );
|
||||
|
||||
if( xpos )
|
||||
|
@ -133,7 +133,7 @@ im_recomb( IMAGE *in, IMAGE *out, DOUBLEMASK *recomb )
|
||||
if( im_cp_desc( out, in ) )
|
||||
return( -1 );
|
||||
out->Bands = recomb->ysize;
|
||||
if( im_isint( in ) )
|
||||
if( vips_bandfmt_isint( in->BandFmt ) )
|
||||
out->BandFmt = IM_BANDFMT_FLOAT;
|
||||
|
||||
/* Take a copy of the matrix.
|
||||
|
@ -136,7 +136,7 @@ im_sign( IMAGE *in, IMAGE *out )
|
||||
im_cp_desc( out, in ) )
|
||||
return( -1 );
|
||||
|
||||
if( !im_iscomplex( in ) )
|
||||
if( !vips_bandfmt_iscomplex( in->BandFmt ) )
|
||||
out->BandFmt = IM_BANDFMT_CHAR;
|
||||
|
||||
if( im_wrapone( in, out, (im_wrapone_fn) sign_gen, in, NULL ) )
|
||||
|
@ -99,7 +99,8 @@ subtract_buffer( PEL **in, PEL *out, int width, IMAGE *im )
|
||||
{
|
||||
/* Complex just doubles the size.
|
||||
*/
|
||||
const int sz = width * im->Bands * (im_iscomplex( im ) ? 2 : 1);
|
||||
const int sz = width * im->Bands *
|
||||
(vips_bandfmt_iscomplex( im->BandFmt ) ? 2 : 1);
|
||||
|
||||
int x;
|
||||
|
||||
|
@ -115,7 +115,7 @@ 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 ) )
|
||||
if( vips_bandfmt_isint( in->BandFmt ) )
|
||||
out->BandFmt = IM_BANDFMT_FLOAT;
|
||||
|
||||
if( im_wrapone( in, out, gen, in, NULL ) )
|
||||
|
@ -81,7 +81,8 @@ FUN ## 1_buffer( PEL *p, PEL *q, int n, double *tc, IMAGE *im ) \
|
||||
{ \
|
||||
/* Complex just doubles the size. \
|
||||
*/ \
|
||||
const int ne = n * im->Bands * (im_iscomplex( im ) ? 2 : 1); \
|
||||
const int ne = n * im->Bands * \
|
||||
(vips_bandfmt_iscomplex( im->BandFmt ) ? 2 : 1); \
|
||||
const double c = tc[0]; \
|
||||
\
|
||||
int i; \
|
||||
|
@ -64,7 +64,8 @@ FUN ## _buffer( PEL *in, PEL *out, int width, IMAGE *im ) \
|
||||
{ \
|
||||
/* Complex just doubles the size. \
|
||||
*/ \
|
||||
const int ne = width * im->Bands * (im_iscomplex( im ) ? 2 : 1); \
|
||||
const int ne = width * im->Bands * \
|
||||
(vips_bandfmt_iscomplex( im->BandFmt ) ? 2 : 1); \
|
||||
\
|
||||
int x; \
|
||||
\
|
||||
@ -94,7 +95,7 @@ im__round( const char *name, IMAGE *in, IMAGE *out, im_wrapone_fn gen )
|
||||
/* Is this one of the int types? Degenerate to im_copy() if it
|
||||
* is.
|
||||
*/
|
||||
if( im_isint( in ) )
|
||||
if( vips_bandfmt_isint( in->BandFmt ) )
|
||||
return( im_copy( in, out ) );
|
||||
|
||||
/* Output type == input type.
|
||||
|
@ -100,7 +100,8 @@ NAME ## _buffer( PEL **p, PEL *q, int n, IMAGE *im ) \
|
||||
{ \
|
||||
/* Complex just doubles the size. \
|
||||
*/ \
|
||||
const int ne = n * im->Bands * (im_iscomplex( im ) ? 2 : 1); \
|
||||
const int ne = n * im->Bands * \
|
||||
(vips_bandfmt_iscomplex( im->BandFmt ) ? 2 : 1); \
|
||||
\
|
||||
int i; \
|
||||
\
|
||||
@ -221,7 +222,8 @@ NAME ## 1_buffer( PEL *p, PEL *q, int n, PEL *vector, IMAGE *im ) \
|
||||
{ \
|
||||
/* Complex just doubles the size. \
|
||||
*/ \
|
||||
const int ne = n * im->Bands * (im_iscomplex( im ) ? 2 : 1); \
|
||||
const int ne = n * im->Bands * \
|
||||
(vips_bandfmt_iscomplex( im->BandFmt ) ? 2 : 1); \
|
||||
\
|
||||
int i; \
|
||||
\
|
||||
|
@ -2,7 +2,6 @@ noinst_LTLIBRARIES = libconversion.la
|
||||
|
||||
libconversion_la_SOURCES = \
|
||||
conver_dispatch.c \
|
||||
im_bandjoin.c \
|
||||
im_black.c \
|
||||
im_c2amph.c \
|
||||
im_c2rect.c \
|
||||
|
@ -1,162 +0,0 @@
|
||||
/* @(#) Function to perform a band-wise join of two images. If the two images
|
||||
* @(#) have n and m bands respectively, then the output image will have n+m
|
||||
* @(#) bands, with the first n coming from the first image and the last m
|
||||
* @(#) from the second. Works for any image type.
|
||||
* @(#)
|
||||
* @(#) Function im_bandjoin() assumes that the imin image
|
||||
* @(#) is either memory mapped or in the buffer pimin->data.
|
||||
* @(#)
|
||||
* @(#) int im_bandjoin(imin1, imin2, imout)
|
||||
* @(#) IMAGE *imin1, *imin2, *imout;
|
||||
* @(#)
|
||||
* @(#) All functions return 0 on success and -1 on error
|
||||
* @(#)
|
||||
*
|
||||
* Copyright: 1990, J. Cupitt
|
||||
*
|
||||
* Author: J. Cupitt
|
||||
* Written on: 12/02/1990
|
||||
* Modified on : 07/03/1991, by N. Dessipris, history removed
|
||||
* 27/10/93 JC
|
||||
* - adapted for partials
|
||||
* - Nicos formatting removed
|
||||
* - ANSIfied
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
This file is part of VIPS.
|
||||
|
||||
VIPS is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
#include <vips/intl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
|
||||
#ifdef WITH_DMALLOC
|
||||
#include <dmalloc.h>
|
||||
#endif /*WITH_DMALLOC*/
|
||||
|
||||
/* Bandjoin generate function.
|
||||
*/
|
||||
static int
|
||||
bandjoin_gen( REGION *or, void *seq, void *a, void *b )
|
||||
{
|
||||
REGION **ir = (REGION **) seq;
|
||||
Rect *r = &or->valid;
|
||||
int le = r->left;
|
||||
int ri = IM_RECT_RIGHT(r);
|
||||
int to = r->top;
|
||||
int bo = IM_RECT_BOTTOM(r);
|
||||
int x, y, z;
|
||||
int i1s = IM_IMAGE_SIZEOF_PEL( ir[0]->im );
|
||||
int i2s = IM_IMAGE_SIZEOF_PEL( ir[1]->im );
|
||||
|
||||
/* Ask for input we need.
|
||||
*/
|
||||
if( im_prepare( ir[0], r ) )
|
||||
return( -1 );
|
||||
if( im_prepare( ir[1], r ) )
|
||||
return( -1 );
|
||||
|
||||
/* Perform join.
|
||||
*/
|
||||
for( y = to; y < bo; y++ ) {
|
||||
PEL *i1 = (PEL *) IM_REGION_ADDR( ir[0], le, y );
|
||||
PEL *i2 = (PEL *) IM_REGION_ADDR( ir[1], le, y );
|
||||
PEL *q = (PEL *) IM_REGION_ADDR( or, le, y );
|
||||
|
||||
for( x = le; x < ri; x++ ) {
|
||||
/* Copy bytes from first file.
|
||||
*/
|
||||
for( z = 0; z < i1s; z++ )
|
||||
*q++ = *i1++;
|
||||
|
||||
/* Copy bytes from in2.
|
||||
*/
|
||||
for( z = 0; z < i2s; z++ )
|
||||
*q++ = *i2++;
|
||||
}
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Join two images. out->Bands = in1->Bands + in2->Bands. in1 goes first in
|
||||
* the list.
|
||||
*/
|
||||
int
|
||||
im_bandjoin( IMAGE *in1, IMAGE *in2, IMAGE *out )
|
||||
{
|
||||
IMAGE **in;
|
||||
|
||||
/* Check our args.
|
||||
*/
|
||||
if( im_piocheck( in1, out ) )
|
||||
return( -1 );
|
||||
if( im_piocheck( in2, out ) )
|
||||
return( -1 );
|
||||
if( in1->Xsize != in2->Xsize ||
|
||||
in1->Ysize != in2->Ysize ) {
|
||||
im_error( "im_bandjoin", "%s", _( "images not same size" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( in1->BandFmt != in2->BandFmt ) {
|
||||
im_error( "im_bandjoin", "%s", _( "images not same type" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( in1->Coding != IM_CODING_NONE || in2->Coding != IM_CODING_NONE ) {
|
||||
im_error( "im_bandjoin", "%s", _( "input coded" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/* Set up the output header.
|
||||
*/
|
||||
if( im_cp_descv( out, in1, in2, NULL ) )
|
||||
return( -1 );
|
||||
out->Bands = in1->Bands + in2->Bands;
|
||||
|
||||
/* Set demand hints.
|
||||
*/
|
||||
if( im_demand_hint( out, IM_THINSTRIP, in1, in2, NULL ) )
|
||||
return( -1 );
|
||||
|
||||
/* Make input array.
|
||||
*/
|
||||
if( !(in = im_allocate_input_array( out, in1, in2, NULL )) )
|
||||
return( -1 );
|
||||
|
||||
/* Make output image.
|
||||
*/
|
||||
if( im_generate( out,
|
||||
im_start_many, bandjoin_gen, im_stop_many, in, NULL ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -125,7 +125,8 @@ buffer_c2amph( void *in, void *out, int w, IMAGE *im )
|
||||
int
|
||||
im_c2amph( IMAGE *in, IMAGE *out )
|
||||
{
|
||||
if( in->Coding != IM_CODING_NONE || !im_iscomplex( in ) ) {
|
||||
if( in->Coding != IM_CODING_NONE ||
|
||||
!vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_c2amph", "%s",
|
||||
_( "input should be uncoded complex" ) );
|
||||
return( -1 );
|
||||
|
@ -89,7 +89,8 @@ buffer_c2imag( void *in, void *out, int w, IMAGE *im )
|
||||
int
|
||||
im_c2imag( IMAGE *in, IMAGE *out )
|
||||
{
|
||||
if( in->Coding != IM_CODING_NONE || !im_iscomplex( in ) ) {
|
||||
if( in->Coding != IM_CODING_NONE ||
|
||||
!vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_c2imag", "%s",
|
||||
_( "input should be uncoded complex" ) );
|
||||
return( -1 );
|
||||
|
@ -94,7 +94,8 @@ buffer_c2real( void *in, void *out, int w, IMAGE *im )
|
||||
int
|
||||
im_c2real( IMAGE *in, IMAGE *out )
|
||||
{
|
||||
if( in->Coding != IM_CODING_NONE || !im_iscomplex( in ) ) {
|
||||
if( in->Coding != IM_CODING_NONE ||
|
||||
!vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_c2real", "%s",
|
||||
_( "input should be uncoded complex" ) );
|
||||
return( -1 );
|
||||
|
@ -91,7 +91,8 @@ buffer_c2rect( void *in, void *out, int w, IMAGE *im )
|
||||
int
|
||||
im_c2rect( IMAGE *in, IMAGE *out )
|
||||
{
|
||||
if( in->Coding != IM_CODING_NONE || !im_iscomplex( in ) ) {
|
||||
if( in->Coding != IM_CODING_NONE ||
|
||||
!vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_c2rect", "%s",
|
||||
_( "input should be uncoded complex" ) );
|
||||
return( -1 );
|
||||
|
@ -173,12 +173,7 @@ clip_stop( void *vseq, void *a, void *b )
|
||||
clip->underflow += seq->underflow;
|
||||
clip->overflow += seq->overflow;
|
||||
|
||||
/* Junk our region too.
|
||||
*/
|
||||
if( seq->ir ) {
|
||||
im_region_free( seq->ir );
|
||||
seq->ir = NULL;
|
||||
}
|
||||
IM_FREEF( im_region_free, seq->ir );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -1,17 +1,4 @@
|
||||
/* @(#) Function to perform a band-wise join of no images.
|
||||
* @(#) Input images can have any number of bands; for instance if im[0] has j
|
||||
* @(#) bands, im[1] k, ...., im[no-1] l bands, output has j+k+...+l bands
|
||||
* @(#) respectively
|
||||
* @(#)
|
||||
* @(#) Function im_gbandjoin() assumes that the imin image
|
||||
* @(#) is either memory mapped or in buffer
|
||||
* @(#)
|
||||
* @(#) int im_gbandjoin( imarray, imout, no )
|
||||
* @(#) IMAGE *imarray[], *imout;
|
||||
* @(#) int no;
|
||||
* @(#)
|
||||
* @(#) All functions return 0 on success and -1 on error
|
||||
* @(#)
|
||||
/* im_gbandjoin -- bandwise join of a set of images
|
||||
*
|
||||
* Copyright: 1991, N. Dessipris, modification of im_bandjoin()
|
||||
*
|
||||
@ -26,6 +13,11 @@
|
||||
* - new IM_NEW()
|
||||
* 16/4/07
|
||||
* - fall back to im_copy() for 1 input image
|
||||
* 17/1/09
|
||||
* - cleanups
|
||||
* - gtk-doc
|
||||
* - im_bandjoin() just calls this
|
||||
* - works for RAD coding too
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -79,27 +71,27 @@ typedef struct joins {
|
||||
/* Make a Join struct.
|
||||
*/
|
||||
static Join *
|
||||
make_join( IMAGE *out, IMAGE **in, int nim )
|
||||
join_new( IMAGE *out, IMAGE **in, int nim )
|
||||
{
|
||||
Join *jn;
|
||||
Join *join;
|
||||
int i;
|
||||
|
||||
if( !(jn = IM_NEW( out, Join )) )
|
||||
if( !(join = IM_NEW( out, Join )) )
|
||||
return( NULL );
|
||||
jn->nim = nim;
|
||||
if( !(jn->in = IM_ARRAY( out, nim + 1, IMAGE * )) ||
|
||||
!(jn->is = IM_ARRAY( out, nim, int )) )
|
||||
join->nim = nim;
|
||||
if( !(join->in = IM_ARRAY( out, nim + 1, IMAGE * )) ||
|
||||
!(join->is = IM_ARRAY( out, nim, int )) )
|
||||
return( NULL );
|
||||
|
||||
/* Remember to NULL-terminate.
|
||||
*/
|
||||
for( i = 0; i < nim; i++ ) {
|
||||
jn->in[i] = in[i];
|
||||
jn->is[i] = IM_IMAGE_SIZEOF_PEL( in[i] );
|
||||
join->in[i] = in[i];
|
||||
join->is[i] = IM_IMAGE_SIZEOF_PEL( in[i] );
|
||||
}
|
||||
jn->in[nim] = NULL;
|
||||
join->in[nim] = NULL;
|
||||
|
||||
return( jn );
|
||||
return( join );
|
||||
}
|
||||
|
||||
/* Perform join.
|
||||
@ -108,52 +100,44 @@ static int
|
||||
join_bands( REGION *or, void *seq, void *a, void *b )
|
||||
{
|
||||
REGION **ir = (REGION **) seq;
|
||||
Join *jn = (Join *) b;
|
||||
int x, y, z, i;
|
||||
Join *join = (Join *) b;
|
||||
Rect *r = &or->valid;
|
||||
int le = r->left;
|
||||
int ri = IM_RECT_RIGHT(r);
|
||||
int to = r->top;
|
||||
int bo = IM_RECT_BOTTOM(r);
|
||||
int ps = IM_IMAGE_SIZEOF_PEL( or->im );
|
||||
const int ps = IM_IMAGE_SIZEOF_PEL( or->im );
|
||||
|
||||
/* Prepare each input area.
|
||||
*/
|
||||
for( i = 0; i < jn->nim; i++ )
|
||||
int x, y, z, i;
|
||||
|
||||
for( i = 0; i < join->nim; i++ )
|
||||
if( im_prepare( ir[i], r ) )
|
||||
return( -1 );
|
||||
|
||||
/* Loop over output!
|
||||
*/
|
||||
for( y = to; y < bo; y++ ) {
|
||||
PEL *qb = (PEL *) IM_REGION_ADDR( or, le, y );
|
||||
for( y = 0; y < r->height; y++ ) {
|
||||
PEL *qb;
|
||||
|
||||
/* Loop for each input image.
|
||||
qb = (PEL *) IM_REGION_ADDR( or, r->left, r->top + y );
|
||||
|
||||
/* Loop for each input image. Scattered write is faster than
|
||||
* scattered read.
|
||||
*/
|
||||
for( i = 0; i < jn->nim; i++ ) {
|
||||
PEL *p = (PEL *) IM_REGION_ADDR( ir[i], le, y );
|
||||
PEL *q = qb;
|
||||
int k = jn->is[i];
|
||||
for( i = 0; i < join->nim; i++ ) {
|
||||
int k = join->is[i];
|
||||
|
||||
/* Copy all PELs from this line of this input image
|
||||
* into the correct place in the output line.
|
||||
*/
|
||||
for( x = le; x < ri; x++ ) {
|
||||
PEL *qn = q;
|
||||
PEL *p;
|
||||
PEL *q;
|
||||
|
||||
/* Copy one PEL.
|
||||
*/
|
||||
p = (PEL *) IM_REGION_ADDR( ir[i],
|
||||
r->left, r->top + y );
|
||||
q = qb;
|
||||
|
||||
for( x = 0; x < r->width; x++ ) {
|
||||
for( z = 0; z < k; z++ )
|
||||
*q++ = *p++;
|
||||
|
||||
/* Skip to the point at which the next PEL
|
||||
* from this input should go.
|
||||
*/
|
||||
q = qn + ps;
|
||||
q[z] = p[z];
|
||||
|
||||
p += z;
|
||||
q += ps;
|
||||
}
|
||||
|
||||
/* Move on to the line start for the next PEL.
|
||||
*/
|
||||
qb += k;
|
||||
}
|
||||
}
|
||||
@ -161,13 +145,32 @@ join_bands( REGION *or, void *seq, void *a, void *b )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Band-wise join of a vector of image descriptors.
|
||||
/**
|
||||
* im_gbandjoin:
|
||||
* @in: vector of input images
|
||||
* @out: output image
|
||||
* @nim: number of input images
|
||||
*
|
||||
* Join a set of images together, bandwise.
|
||||
* If the images
|
||||
* have n and m bands, then the output image will have n + m
|
||||
* bands, with the first n coming from the first image and the last m
|
||||
* from the second.
|
||||
*
|
||||
* The images must be the same size.
|
||||
* The input images are cast up to the smallest common type (see table
|
||||
* Smallest common format in
|
||||
* <link linkend="VIPS-arithmetic">arithmetic</link>).
|
||||
*
|
||||
* See also: im_bandjoin(), im_insert().
|
||||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int
|
||||
im_gbandjoin( IMAGE **in, IMAGE *out, int nim )
|
||||
{
|
||||
int i;
|
||||
Join *jn;
|
||||
Join *join;
|
||||
|
||||
/* Check it out!
|
||||
*/
|
||||
@ -175,57 +178,70 @@ im_gbandjoin( IMAGE **in, IMAGE *out, int nim )
|
||||
im_error( "im_gbandjoin", "%s", _( "zero input images!" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( nim == 1 )
|
||||
else if( nim == 1 )
|
||||
return( im_copy( in[0], out ) );
|
||||
|
||||
/* Check our args.
|
||||
*/
|
||||
if( im_poutcheck( out ) )
|
||||
if( im_poutcheck( out ) ||
|
||||
im_check_known_coded( "im_gbandjoin", in[0] ) )
|
||||
return( -1 );
|
||||
for( i = 0; i < nim; i++ ) {
|
||||
if( im_pincheck( in[i] ) )
|
||||
for( i = 0; i < nim; i++ )
|
||||
if( im_pincheck( in[i] ) ||
|
||||
im_check_same_size( "im_gbandjoin", in[i], in[0] ) ||
|
||||
im_check_same_coding( "im_gbandjoin", in[i], in[0] ) )
|
||||
return( -1 );
|
||||
|
||||
if( in[i]->Coding != IM_CODING_NONE ) {
|
||||
im_error( "im_gbandjoin",
|
||||
"%s", _( "uncoded input only" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( in[0]->BandFmt != in[i]->BandFmt ) {
|
||||
im_error( "im_gbandjoin",
|
||||
"%s", _( "input images differ in format" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( in[0]->Xsize != in[i]->Xsize ||
|
||||
in[0]->Ysize != in[i]->Ysize ) {
|
||||
im_error( "im_gbandjoin",
|
||||
"%s", _( "input images differ in size" ) );
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
/* Build a data area.
|
||||
*/
|
||||
if( !(jn = make_join( out, in, nim )) )
|
||||
if( !(join = join_new( out, in, nim )) )
|
||||
return( -1 );
|
||||
|
||||
/* Prepare the output header.
|
||||
*/
|
||||
if( im_cp_desc_array( out, jn->in ) )
|
||||
if( im_cp_desc_array( out, join->in ) )
|
||||
return( -1 );
|
||||
out->Bands = 0;
|
||||
for( i = 0; i < nim; i++ )
|
||||
out->Bands += in[i]->Bands;
|
||||
|
||||
/* Set demand hints.
|
||||
*/
|
||||
if( im_demand_hint_array( out, IM_THINSTRIP, jn->in ) )
|
||||
if( im_demand_hint_array( out, IM_THINSTRIP, join->in ) )
|
||||
return( -1 );
|
||||
|
||||
if( im_generate( out,
|
||||
im_start_many, join_bands, im_stop_many, jn->in, jn ) )
|
||||
im_start_many, join_bands, im_stop_many, join->in, join ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* im_bandjoin:
|
||||
* @in1: first input image
|
||||
* @in2: second input image
|
||||
* @out: output image
|
||||
*
|
||||
* Join two images bandwise.
|
||||
* If the two images
|
||||
* have n and m bands respectively, then the output image will have n+m
|
||||
* bands, with the first n coming from the first image and the last m
|
||||
* from the second.
|
||||
*
|
||||
* The images must be the same size.
|
||||
* The two input images are cast up to the smallest common type (see table
|
||||
* Smallest common format in
|
||||
* <link linkend="VIPS-arithmetic">arithmetic</link>).
|
||||
*
|
||||
* See also: im_gbandjoin(), im_insert().
|
||||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int
|
||||
im_bandjoin( IMAGE *in1, IMAGE *in2, IMAGE *out )
|
||||
{
|
||||
IMAGE *t[2];
|
||||
|
||||
t[0] = in1;
|
||||
t[1] = in2;
|
||||
|
||||
return( im_gbandjoin( t, out, 2 ) );
|
||||
}
|
||||
|
@ -114,11 +114,13 @@ im_ri2c( IMAGE *in1, IMAGE *in2, IMAGE *out )
|
||||
/* Check input image. We don't need to check that sizes match --
|
||||
* im_wrapmany does this for us.
|
||||
*/
|
||||
if( in1->Coding != IM_CODING_NONE || in2->Coding != IM_CODING_NONE ) {
|
||||
if( in1->Coding != IM_CODING_NONE ||
|
||||
in2->Coding != IM_CODING_NONE ) {
|
||||
im_error( "im_ri2c", "%s", _( "inputs should be uncoded" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( im_iscomplex( in1 ) || im_iscomplex( in2 ) ) {
|
||||
if( vips_bandfmt_iscomplex( in1->BandFmt ) ||
|
||||
vips_bandfmt_iscomplex( in2->BandFmt ) ) {
|
||||
im_error( "im_ri2c", "%s", _( "inputs already complex" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ im_conv_f_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask )
|
||||
*/
|
||||
if( im_cp_desc( out, in ) )
|
||||
return( -1 );
|
||||
if( im_isint( in ) )
|
||||
if( vips_bandfmt_isint( in->BandFmt ) )
|
||||
out->BandFmt = IM_BANDFMT_FLOAT;
|
||||
out->Xsize -= mask->xsize - 1;
|
||||
out->Ysize -= mask->ysize - 1;
|
||||
|
@ -183,7 +183,7 @@ conv_start( IMAGE *out, void *a, void *b )
|
||||
/* Attach region and arrays.
|
||||
*/
|
||||
seq->ir = im_region_create( in );
|
||||
if( im_isint( conv->out ) )
|
||||
if( vips_bandfmt_isint( conv->out->BandFmt ) )
|
||||
seq->sum = (PEL *)
|
||||
IM_ARRAY( out, IM_IMAGE_N_ELEMENTS( in ), int );
|
||||
else
|
||||
@ -379,7 +379,8 @@ im_convsep_raw( IMAGE *in, IMAGE *out, INTMASK *mask )
|
||||
|
||||
/* Check parameters.
|
||||
*/
|
||||
if( !in || in->Coding != IM_CODING_NONE || im_iscomplex( in ) ) {
|
||||
if( !in || in->Coding != IM_CODING_NONE ||
|
||||
vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_convsep", "%s", _( "non-complex uncoded only" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ conv_start( IMAGE *out, void *a, void *b )
|
||||
/* Attach region and arrays.
|
||||
*/
|
||||
seq->ir = im_region_create( in );
|
||||
if( im_isint( conv->out ) )
|
||||
if( vips_bandfmt_isint( conv->out->BandFmt ) )
|
||||
seq->sum = (PEL *)
|
||||
IM_ARRAY( out, IM_IMAGE_N_ELEMENTS( in ), int );
|
||||
else
|
||||
@ -285,7 +285,9 @@ im_convsep_f_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask )
|
||||
|
||||
/* Check parameters.
|
||||
*/
|
||||
if( !in || in->Coding != IM_CODING_NONE || im_iscomplex( in ) ) {
|
||||
if( !in ||
|
||||
in->Coding != IM_CODING_NONE ||
|
||||
vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_convsep_f",
|
||||
"%s", _( "non-complex uncoded only" ) );
|
||||
return( -1 );
|
||||
@ -311,7 +313,7 @@ im_convsep_f_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask )
|
||||
*/
|
||||
if( im_cp_desc( out, in ) )
|
||||
return( -1 );
|
||||
if( im_isint( in ) )
|
||||
if( vips_bandfmt_isint( in->BandFmt ) )
|
||||
out->BandFmt = IM_BANDFMT_FLOAT;
|
||||
out->Xsize -= conv->size - 1;
|
||||
out->Ysize -= conv->size - 1;
|
||||
|
@ -112,7 +112,8 @@ int im_gradcor_raw( IMAGE *large, IMAGE *small, IMAGE *out ){
|
||||
if( im_piocheck( large, out ) || im_pincheck( small ) )
|
||||
return -1;
|
||||
|
||||
if( ! im_isint( large ) || ! im_isint( small ) ){
|
||||
if( ! vips_bandfmt_isint( large->BandFmt ) ||
|
||||
! vips_bandfmt_isint( small->BandFmt ) ){
|
||||
im_error( FUNCTION_NAME, "image does not have integer band format" );
|
||||
return -1;
|
||||
}
|
||||
@ -178,7 +179,7 @@ int im_grad_x( IMAGE *in, IMAGE *out ){
|
||||
if( im_piocheck( in, out ) )
|
||||
return -1;
|
||||
|
||||
if( ! im_isint( in ) ){
|
||||
if( ! vips_bandfmt_isint( in->BandFmt ) ){
|
||||
im_error( FUNCTION_NAME, "image does not have integer band format" );
|
||||
return -1;
|
||||
}
|
||||
@ -227,6 +228,8 @@ int im_grad_x( IMAGE *in, IMAGE *out ){
|
||||
RETURN_GENERATE( double );
|
||||
#endif
|
||||
#undef RETURN_GENERATE
|
||||
default:
|
||||
g_assert( 0 );
|
||||
}
|
||||
|
||||
/* Keep gcc happy.
|
||||
@ -241,7 +244,7 @@ int im_grad_y( IMAGE *in, IMAGE *out ){
|
||||
if( im_piocheck( in, out ) )
|
||||
return -1;
|
||||
|
||||
if( ! im_isint( in ) ){
|
||||
if( ! vips_bandfmt_isint( in->BandFmt ) ){
|
||||
im_error( FUNCTION_NAME, "image does not have integer band format" );
|
||||
return -1;
|
||||
}
|
||||
@ -290,6 +293,8 @@ int im_grad_y( IMAGE *in, IMAGE *out ){
|
||||
RETURN_GENERATE( double );
|
||||
#endif
|
||||
#undef RETURN_GENERATE
|
||||
default:
|
||||
g_assert( 0 );
|
||||
}
|
||||
|
||||
/* Keep gcc happy.
|
||||
@ -419,6 +424,8 @@ static int gradcor_gen( REGION *to_make, void *vptr_seq, void *unrequired, void
|
||||
case IM_BANDFMT_INT:
|
||||
FILL_BUFFERS( signed int )
|
||||
break;
|
||||
default:
|
||||
g_assert( 0 );
|
||||
}
|
||||
{ /* write to output */
|
||||
size_t write_skip= IM_REGION_LSKIP( to_make ) / sizeof( float );
|
||||
|
@ -102,7 +102,8 @@ static int array[6][6] = {
|
||||
case IM_BANDFMT_UCHAR: select_tmp1_for_out_short(unsigned char, OUT); break; \
|
||||
case IM_BANDFMT_CHAR: select_tmp1_for_out_short(signed char, OUT); break; \
|
||||
case IM_BANDFMT_USHORT: select_tmp1_for_out_short(unsigned short, OUT); break; \
|
||||
case IM_BANDFMT_SHORT: select_tmp1_for_out_short(signed short, OUT); break;
|
||||
case IM_BANDFMT_SHORT: select_tmp1_for_out_short(signed short, OUT); break; \
|
||||
default: g_assert( 0 );
|
||||
#define select_tmp1_for_out_short(IN2, OUT) \
|
||||
switch(tmp1->BandFmt) { \
|
||||
case IM_BANDFMT_UCHAR: loop(unsigned char, IN2, OUT); break; \
|
||||
|
@ -121,7 +121,7 @@ im_resize_linear( IMAGE *in, IMAGE *out, int X, int Y )
|
||||
|
||||
if( im_iocheck( in, out ) )
|
||||
return( -1 );
|
||||
if( im_iscomplex( in ) ) {
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_lowpass", "%s", _( "non-complex input only" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
@ -257,3 +257,33 @@ im_convsepf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask )
|
||||
{
|
||||
return( im_convsep_f_raw( in, out, mask ) );
|
||||
}
|
||||
|
||||
gboolean
|
||||
im_isint( IMAGE *im )
|
||||
{
|
||||
return( vips_bandfmt_isint( im->BandFmt ) );
|
||||
}
|
||||
|
||||
gboolean
|
||||
im_isuint( IMAGE *im )
|
||||
{
|
||||
return( vips_bandfmt_isuint( im->BandFmt ) );
|
||||
}
|
||||
|
||||
gboolean
|
||||
im_isfloat( IMAGE *im )
|
||||
{
|
||||
return( vips_bandfmt_isfloat( im->BandFmt ) );
|
||||
}
|
||||
|
||||
gboolean
|
||||
im_iscomplex( IMAGE *im )
|
||||
{
|
||||
return( vips_bandfmt_iscomplex( im->BandFmt ) );
|
||||
}
|
||||
|
||||
gboolean
|
||||
im_isscalar( IMAGE *im )
|
||||
{
|
||||
return( !im_iscomplex( im ) );
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ im_vips2ppm( IMAGE *in, const char *filename )
|
||||
"%s", _( "can't write binary >8 bit images" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( !im_isuint( in ) ) {
|
||||
if( !vips_bandfmt_isuint( in->BandFmt ) ) {
|
||||
im_error( "im_vips2ppm",
|
||||
"%s", _( "unsigned int formats only" ) );
|
||||
return( -1 );
|
||||
|
@ -1396,7 +1396,8 @@ make_tiff_write( IMAGE *im, const char *filename )
|
||||
/* We can only pyramid LABQ and non-complex images.
|
||||
*/
|
||||
if( tw->pyramid ) {
|
||||
if( im->Coding == IM_CODING_NONE && im_iscomplex( im ) ) {
|
||||
if( im->Coding == IM_CODING_NONE &&
|
||||
vips_bandfmt_iscomplex( im->BandFmt ) ) {
|
||||
im_error( "im_vips2tiff",
|
||||
"%s", _( "can only pyramid LABQ and "
|
||||
"non-complex images" ) );
|
||||
|
@ -81,7 +81,7 @@ im_freqflt( IMAGE *in, IMAGE *mask, IMAGE *out )
|
||||
if( !(dummy = im_open( "memory-1", "p" )) )
|
||||
return( -1 );
|
||||
|
||||
if( im_iscomplex( in ) ) {
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
/* Easy case! Assume it has already been transformed.
|
||||
*/
|
||||
IMAGE *t1 = im_open_local( dummy, "im_freqflt-1", "p" );
|
||||
|
@ -475,7 +475,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
static int
|
||||
fwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
|
||||
{
|
||||
if( im_iscomplex( in ) )
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) )
|
||||
return( cfwfft1( dummy, in, out ) );
|
||||
else
|
||||
return( rfwfft1( dummy, in, out ) );
|
||||
|
@ -89,7 +89,8 @@ int
|
||||
im_histcum( IMAGE *in, IMAGE *out )
|
||||
{
|
||||
const int px = in->Xsize * in->Ysize;
|
||||
const int nb = im_iscomplex( in ) ? in->Bands * 2 : in->Bands;
|
||||
const int nb = vips_bandfmt_iscomplex( in->BandFmt ) ?
|
||||
in->Bands * 2 : in->Bands;
|
||||
const int mx = px * nb;
|
||||
|
||||
PEL *outbuf;
|
||||
@ -110,9 +111,9 @@ im_histcum( IMAGE *in, IMAGE *out )
|
||||
return( -1 );
|
||||
out->Xsize = px;
|
||||
out->Ysize = 1;
|
||||
if( im_isuint( in ) )
|
||||
if( vips_bandfmt_isuint( in->BandFmt ) )
|
||||
out->BandFmt = IM_BANDFMT_UINT;
|
||||
else if( im_isint( in ) )
|
||||
else if( vips_bandfmt_isint( in->BandFmt ) )
|
||||
out->BandFmt = IM_BANDFMT_INT;
|
||||
|
||||
if( !(outbuf = im_malloc( out, IM_IMAGE_SIZEOF_LINE( out ))) )
|
||||
|
@ -95,18 +95,18 @@ normalise( IMAGE *in, IMAGE *out )
|
||||
im_error( "im_histplot", "%s", _( "uncoded only" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( im_iscomplex( in ) ) {
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_histplot", "%s", _( "non-complex only" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( im_isuint( in ) ) {
|
||||
if( vips_bandfmt_isuint( in->BandFmt ) ) {
|
||||
/* Trivial case.
|
||||
*/
|
||||
if( im_copy( in, out ) )
|
||||
return( -1 );
|
||||
}
|
||||
else if( im_isint( in ) ) {
|
||||
else if( vips_bandfmt_isint( in->BandFmt ) ) {
|
||||
/* Move min up to 0. incheck(), because we have to min() so we
|
||||
* might as well save the calcs.
|
||||
*/
|
||||
|
@ -181,7 +181,8 @@ im_histspec( IMAGE *in, IMAGE *ref, IMAGE *out )
|
||||
|
||||
if( im_open_local_array( out, t, 5, "im_histspec", "p" ) )
|
||||
return( -1 );
|
||||
if( !im_isuint( in ) || !im_isuint( ref ) ) {
|
||||
if( !vips_bandfmt_isuint( in->BandFmt ) ||
|
||||
!vips_bandfmt_isuint( ref->BandFmt ) ) {
|
||||
im_error( "im_histspec", "%s",
|
||||
_( "input luts are not some unsigned integer type" ) );
|
||||
return( -1 );
|
||||
|
@ -584,7 +584,7 @@ im_maplut( IMAGE *in, IMAGE *out, IMAGE *lut )
|
||||
im_error( "im_maplut", "%s", _( "input is not uncoded" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( !im_isuint( in ) ) {
|
||||
if( !vips_bandfmt_isuint( in->BandFmt ) ) {
|
||||
im_error( "im_maplut", "%s",
|
||||
_( "input is not some unsigned integer type" ) );
|
||||
return( -1 );
|
||||
|
@ -258,7 +258,7 @@ im_project( IMAGE *in, IMAGE *hout, IMAGE *vout )
|
||||
im_error( "im_project", "%s", _( "uncoded images only" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( im_iscomplex( in ) ) {
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_project", "%s", _( "non-complex images only" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
@ -60,11 +60,10 @@ int im_check_same_format( const char *domain, IMAGE *im1, IMAGE *im2 );
|
||||
int im_check_same_coding( const char *domain, IMAGE *im1, IMAGE *im2 );
|
||||
int im_check_vector( const char *domain, int n, IMAGE *im );
|
||||
|
||||
gboolean im_isuint( IMAGE *im );
|
||||
gboolean im_isint( IMAGE *im );
|
||||
gboolean im_isfloat( IMAGE *im );
|
||||
gboolean im_isscalar( IMAGE *im );
|
||||
gboolean im_iscomplex( IMAGE *im );
|
||||
gboolean vips_bandfmt_isint( VipsBandFmt fmt );
|
||||
gboolean vips_bandfmt_isuint( VipsBandFmt fmt );
|
||||
gboolean vips_bandfmt_isfloat( VipsBandFmt fmt );
|
||||
gboolean vips_bandfmt_iscomplex( VipsBandFmt fmt );
|
||||
|
||||
gboolean im_isfile( IMAGE *im );
|
||||
gboolean im_ispartial( IMAGE *im );
|
||||
|
@ -258,6 +258,12 @@ int im_erode_raw( IMAGE *in, IMAGE *out, INTMASK *m );
|
||||
int im_dilate_raw( IMAGE *in, IMAGE *out, INTMASK *m );
|
||||
int im_rank_raw( IMAGE *in, IMAGE *out, int xsize, int ysize, int order );
|
||||
|
||||
gboolean im_isuint( IMAGE *im );
|
||||
gboolean im_isint( IMAGE *im );
|
||||
gboolean im_isfloat( IMAGE *im );
|
||||
gboolean im_isscalar( IMAGE *im );
|
||||
gboolean im_iscomplex( IMAGE *im );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /*__cplusplus*/
|
||||
|
@ -129,9 +129,9 @@ typedef struct _VipsImage {
|
||||
*/
|
||||
int Bbits; /* was number of bits in this format */
|
||||
/*< public >*/
|
||||
int BandFmt; /* #VipsBandFmt describing the pixel format */
|
||||
int Coding; /* #VipsCoding describing the pixel coding */
|
||||
int Type; /* #VipsType hinting at pixel interpretation */
|
||||
VipsBandFmt BandFmt; /* #VipsBandFmt describing the pixel format */
|
||||
VipsCoding Coding; /* #VipsCoding describing the pixel coding */
|
||||
VipsType Type; /* #VipsType hinting at pixel interpretation */
|
||||
float Xres; /* horizontal pixels per millimetre */
|
||||
float Yres; /* vertical pixels per millimetre */
|
||||
/*< private >*/
|
||||
|
@ -683,7 +683,7 @@ im_check_bands_1orn( const char *domain, IMAGE *im1, IMAGE *im2 )
|
||||
int
|
||||
im_check_noncomplex( const char *domain, IMAGE *im )
|
||||
{
|
||||
if( im_iscomplex( im ) ) {
|
||||
if( vips_bandfmt_iscomplex( im->BandFmt ) ) {
|
||||
im_error( domain, "%s", _( "image must be non-complex" ) );
|
||||
return( -1 );
|
||||
}
|
||||
@ -707,7 +707,7 @@ im_check_noncomplex( const char *domain, IMAGE *im )
|
||||
int
|
||||
im_check_complex( const char *domain, IMAGE *im )
|
||||
{
|
||||
if( !im_iscomplex( im ) ) {
|
||||
if( !vips_bandfmt_iscomplex( im->BandFmt ) ) {
|
||||
im_error( domain, "%s", _( "image must be complex" ) );
|
||||
return( -1 );
|
||||
}
|
||||
@ -757,7 +757,7 @@ im_check_format( const char *domain, IMAGE *im, VipsBandFmt fmt )
|
||||
int
|
||||
im_check_int( const char *domain, IMAGE *im )
|
||||
{
|
||||
if( !im_isint( im ) ) {
|
||||
if( !vips_bandfmt_isint( im->BandFmt ) ) {
|
||||
im_error( domain, "%s", _( "image must be integer" ) );
|
||||
return( -1 );
|
||||
}
|
||||
@ -921,46 +921,45 @@ im_check_vector( const char *domain, int n, IMAGE *im )
|
||||
}
|
||||
|
||||
/**
|
||||
* im_isint:
|
||||
* @im: image to test
|
||||
* vips_bandfmt_isint:
|
||||
* @fmt: format to test
|
||||
*
|
||||
* Return %TRUE if @im's #VipsBandFmt is one of the integer types.
|
||||
* Return %TRUE if @fmt is one of the integer types.
|
||||
*/
|
||||
gboolean
|
||||
im_isint( IMAGE *im )
|
||||
{
|
||||
switch( im->BandFmt ) {
|
||||
vips_bandfmt_isint( VipsBandFmt fmt )
|
||||
{
|
||||
switch( fmt ) {
|
||||
case IM_BANDFMT_UCHAR:
|
||||
case IM_BANDFMT_CHAR:
|
||||
case IM_BANDFMT_USHORT:
|
||||
case IM_BANDFMT_SHORT:
|
||||
case IM_BANDFMT_UINT:
|
||||
case IM_BANDFMT_INT:
|
||||
return( 1 );
|
||||
return( TRUE );
|
||||
|
||||
case IM_BANDFMT_FLOAT:
|
||||
case IM_BANDFMT_DOUBLE:
|
||||
case IM_BANDFMT_COMPLEX:
|
||||
case IM_BANDFMT_DPCOMPLEX:
|
||||
return( 0 );
|
||||
return( FALSE );
|
||||
|
||||
default:
|
||||
error_exit( "im_isint: unknown image BandFmt" );
|
||||
/*NOTREACHED*/
|
||||
g_assert( 0 );
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* im_isuint:
|
||||
* @im: image to test
|
||||
* vips_bandfmt_isuint:
|
||||
* @fmt: format to test
|
||||
*
|
||||
* Return %TRUE if @im's #VipsBandFmt is one of the unsigned integer types.
|
||||
* Return %TRUE if @fmt is one of the unsigned integer types.
|
||||
*/
|
||||
gboolean
|
||||
im_isuint( IMAGE *im )
|
||||
{
|
||||
switch( im->BandFmt ) {
|
||||
vips_bandfmt_isuint( VipsBandFmt fmt )
|
||||
{
|
||||
switch( fmt ) {
|
||||
case IM_BANDFMT_UCHAR:
|
||||
case IM_BANDFMT_USHORT:
|
||||
case IM_BANDFMT_UINT:
|
||||
@ -976,85 +975,51 @@ im_isuint( IMAGE *im )
|
||||
return( 0 );
|
||||
|
||||
default:
|
||||
error_exit( "im_isuint: unknown image BandFmt" );
|
||||
/*NOTREACHED*/
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* im_isint:
|
||||
* @im: image to test
|
||||
*
|
||||
* Return %TRUE if @im's #VipsBandFmt is one of the integer types.
|
||||
*/
|
||||
gboolean
|
||||
im_isfloat( IMAGE *im )
|
||||
{
|
||||
switch( im->BandFmt ) {
|
||||
case IM_BANDFMT_FLOAT:
|
||||
case IM_BANDFMT_DOUBLE:
|
||||
return( 1 );
|
||||
|
||||
case IM_BANDFMT_UCHAR:
|
||||
case IM_BANDFMT_CHAR:
|
||||
case IM_BANDFMT_USHORT:
|
||||
case IM_BANDFMT_SHORT:
|
||||
case IM_BANDFMT_UINT:
|
||||
case IM_BANDFMT_INT:
|
||||
case IM_BANDFMT_COMPLEX:
|
||||
case IM_BANDFMT_DPCOMPLEX:
|
||||
return( 0 );
|
||||
|
||||
default:
|
||||
error_exit( "im_isfloat: unknown image BandFmt" );
|
||||
/*NOTREACHED*/
|
||||
g_assert( 0 );
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* im_isscalar:
|
||||
* @im: image to test
|
||||
* vips_bandfmt_isfloat:
|
||||
* @fmt: format to test
|
||||
*
|
||||
* Return %TRUE if @im's #VipsBandFmt is one of the non-complex types.
|
||||
* Return %TRUE if @fmt is one of the float types.
|
||||
*/
|
||||
gboolean
|
||||
im_isscalar( IMAGE *im )
|
||||
{
|
||||
switch( im->BandFmt ) {
|
||||
vips_bandfmt_isfloat( VipsBandFmt fmt )
|
||||
{
|
||||
switch( fmt ) {
|
||||
case IM_BANDFMT_FLOAT:
|
||||
case IM_BANDFMT_DOUBLE:
|
||||
return( 1 );
|
||||
|
||||
case IM_BANDFMT_UCHAR:
|
||||
case IM_BANDFMT_CHAR:
|
||||
case IM_BANDFMT_USHORT:
|
||||
case IM_BANDFMT_SHORT:
|
||||
case IM_BANDFMT_UINT:
|
||||
case IM_BANDFMT_INT:
|
||||
case IM_BANDFMT_FLOAT:
|
||||
case IM_BANDFMT_DOUBLE:
|
||||
return( 1 );
|
||||
|
||||
case IM_BANDFMT_COMPLEX:
|
||||
case IM_BANDFMT_DPCOMPLEX:
|
||||
return( 0 );
|
||||
|
||||
default:
|
||||
error_exit( "im_isscalar: unknown image BandFmt" );
|
||||
/*NOTREACHED*/
|
||||
g_assert( 0 );
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* im_iscomplex:
|
||||
* vips_bandfmt_iscomplex:
|
||||
* @im: image to test
|
||||
*
|
||||
* Return %TRUE if @im's #VipsBandFmt is one of the complex types.
|
||||
* Return %TRUE if @fmt is one of the complex types.
|
||||
*/
|
||||
gboolean
|
||||
im_iscomplex( IMAGE *im )
|
||||
{
|
||||
switch( im->BandFmt ) {
|
||||
vips_bandfmt_iscomplex( VipsBandFmt fmt )
|
||||
{
|
||||
switch( fmt ) {
|
||||
case IM_BANDFMT_COMPLEX:
|
||||
case IM_BANDFMT_DPCOMPLEX:
|
||||
return( 1 );
|
||||
@ -1070,8 +1035,7 @@ im_iscomplex( IMAGE *im )
|
||||
return( 0 );
|
||||
|
||||
default:
|
||||
error_exit( "im_iscomplex: unknown image BandFmt" );
|
||||
/*NOTREACHED*/
|
||||
g_assert( 0 );
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
@ -353,7 +353,9 @@ im_rank_raw( IMAGE *in, IMAGE *out, int xsize, int ysize, int order )
|
||||
|
||||
/* Check parameters.
|
||||
*/
|
||||
if( !in || in->Coding != IM_CODING_NONE || im_iscomplex( in ) ) {
|
||||
if( !in ||
|
||||
in->Coding != IM_CODING_NONE ||
|
||||
vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_rank", "%s",
|
||||
_( "input non-complex uncoded only" ) );
|
||||
return( -1 );
|
||||
|
@ -289,7 +289,8 @@ im_rank_image( IMAGE **in, IMAGE *out, int n, int index )
|
||||
if( im_pincheck( in[i] ) )
|
||||
return( -1 );
|
||||
|
||||
if( in[i]->Coding != IM_CODING_NONE || im_iscomplex( in[i] ) ) {
|
||||
if( in[i]->Coding != IM_CODING_NONE ||
|
||||
vips_bandfmt_iscomplex( in[i]->BandFmt ) ) {
|
||||
im_error( "im_rank_image", "%s",
|
||||
_( "uncoded non-complex only" ) );
|
||||
return( -1 );
|
||||
|
@ -140,7 +140,8 @@ im_zerox( IMAGE *in, IMAGE *out, int flag )
|
||||
}
|
||||
if( im_piocheck( in, t1 ) )
|
||||
return( -1 );
|
||||
if( im_iscomplex( in ) || in->Coding != IM_CODING_NONE ) {
|
||||
if( vips_bandfmt_iscomplex( in->BandFmt ) ||
|
||||
in->Coding != IM_CODING_NONE ) {
|
||||
im_error( "im_zerox", "%s", _( "non-complex uncoded only" ) );
|
||||
return( -1 );
|
||||
}
|
||||
@ -148,7 +149,7 @@ im_zerox( IMAGE *in, IMAGE *out, int flag )
|
||||
im_error( "im_zerox", "%s", _( "image too narrow" ) );
|
||||
return( -1 );
|
||||
}
|
||||
if( im_isuint( in ) )
|
||||
if( vips_bandfmt_isuint( in->BandFmt ) )
|
||||
/* Unsigned type, therefore there will be no zero-crossings.
|
||||
*/
|
||||
return( im_black( out, in->Xsize, in->Ysize, in->Bands ) );
|
||||
|
@ -195,7 +195,7 @@ find_first( REGION *ir, int *pos, int x, int y, int w )
|
||||
|
||||
/* Double the number of bands in a complex.
|
||||
*/
|
||||
if( im_iscomplex( im ) )
|
||||
if( vips_bandfmt_iscomplex( im->BandFmt ) )
|
||||
ne *= 2;
|
||||
|
||||
/* Search for the first non-zero band element from the left edge of the image.
|
||||
@ -244,7 +244,7 @@ find_last( REGION *ir, int *pos, int x, int y, int w )
|
||||
|
||||
/* Double the number of bands in a complex.
|
||||
*/
|
||||
if( im_iscomplex( im ) )
|
||||
if( vips_bandfmt_iscomplex( im->BandFmt ) )
|
||||
ne *= 2;
|
||||
|
||||
/* Search for the first non-zero band element from the right.
|
||||
|
@ -129,7 +129,7 @@ find_top( REGION *ir, int *pos, int x, int y, int h )
|
||||
|
||||
/* Double the number of bands in a complex.
|
||||
*/
|
||||
if( im_iscomplex( im ) )
|
||||
if( vips_bandfmt_iscomplex( im->BandFmt ) )
|
||||
b *= 2;
|
||||
|
||||
/* Search for the first non-zero band element from the top edge of the image.
|
||||
@ -183,7 +183,7 @@ find_bot( REGION *ir, int *pos, int x, int y, int h )
|
||||
|
||||
/* Double the number of bands in a complex.
|
||||
*/
|
||||
if( im_iscomplex( im ) )
|
||||
if( vips_bandfmt_iscomplex( im->BandFmt ) )
|
||||
b *= 2;
|
||||
|
||||
/* Search for the first non-zero band element from the top edge of the image.
|
||||
|
@ -122,7 +122,7 @@ im_rightshift_size( IMAGE *in, IMAGE *out, int xshift, int yshift, int band_fmt
|
||||
im_error( FUNCTION_NAME, "%s", _( "would result in zero size output image" ) );
|
||||
return -1;
|
||||
}
|
||||
if( ! im_isint( in ) ){
|
||||
if( ! vips_bandfmt_isint( in->BandFmt ) ){
|
||||
im_error( FUNCTION_NAME, "%s", _( "integer type images only" ) );
|
||||
return -1;
|
||||
}
|
||||
@ -130,7 +130,7 @@ im_rightshift_size( IMAGE *in, IMAGE *out, int xshift, int yshift, int band_fmt
|
||||
im_error( FUNCTION_NAME, "%s", _( "uncoded images only" ) );
|
||||
return -1;
|
||||
}
|
||||
if( im_isuint( in ) ){
|
||||
if( vips_bandfmt_isuint( in->BandFmt ) ){
|
||||
if( IM_BANDFMT_UCHAR != band_fmt && IM_BANDFMT_USHORT != band_fmt && IM_BANDFMT_UINT != band_fmt ){
|
||||
im_error( FUNCTION_NAME, "%s", _( "unsigned input means that output must be unsigned int, short or char" ) );
|
||||
return -1;
|
||||
@ -191,6 +191,8 @@ im_rightshift_size( IMAGE *in, IMAGE *out, int xshift, int yshift, int band_fmt
|
||||
\
|
||||
case IM_BANDFMT_UINT: \
|
||||
RETURN_MACRO( MACRO, guint32, guint ## OUT_SIZE, guint ## SUM_SIZE ) \
|
||||
default: \
|
||||
g_assert( 0 ); \
|
||||
}
|
||||
|
||||
#define RETURN_MACRO_SUMSS( MACRO, SUM_SIZE ) switch( im_bits_of_fmt( out->BandFmt ) ){ \
|
||||
|
@ -242,7 +242,7 @@ shrink( IMAGE *in, IMAGE *out, double xshrink, double yshrink )
|
||||
|
||||
/* Check parameters.
|
||||
*/
|
||||
if( !in || im_iscomplex( in ) ) {
|
||||
if( !in || vips_bandfmt_iscomplex( in->BandFmt ) ) {
|
||||
im_error( "im_shrink", "%s", _( "non-complex input only" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
@ -591,8 +591,8 @@ vips_interpolate_nohalo1_interpolate( VipsInterpolate* restrict interpolate,
|
||||
/*
|
||||
* Double bands for complex images:
|
||||
*/
|
||||
const int bands =
|
||||
( im_iscomplex( in->im ) ? 2 * actual_bands : actual_bands );
|
||||
const int bands = vips_bandfmt_iscomplex( in->im->BandFmt ) ?
|
||||
2 * actual_bands : actual_bands;
|
||||
|
||||
#define CALL( T, inter ) \
|
||||
nohalo1_ ## inter<T>( out, \
|
||||
|
@ -1038,8 +1038,8 @@ vips_interpolate_nohalo2_interpolate( VipsInterpolate* restrict interpolate,
|
||||
/*
|
||||
* Double bands for complex images:
|
||||
*/
|
||||
const int bands =
|
||||
( im_iscomplex( in->im ) ? 2 * actual_bands : actual_bands );
|
||||
const int bands = vips_bandfmt_iscomplex( in->im->BandFmt ) ?
|
||||
2 * actual_bands : actual_bands;
|
||||
|
||||
#define CALL( T, inter ) \
|
||||
nohalo2_ ## inter<T>( out, \
|
||||
|
@ -509,8 +509,8 @@ vips_interpolate_snohalo1_interpolate( VipsInterpolate* restrict interpolate,
|
||||
/*
|
||||
* Double bands for complex images:
|
||||
*/
|
||||
const int bands =
|
||||
( im_iscomplex( in->im ) ? 2 * actual_bands : actual_bands );
|
||||
const int bands = vips_bandfmt_iscomplex( in->im->BandFmt ) ?
|
||||
2 * actual_bands : actual_bands;
|
||||
|
||||
#define CALL( T, inter ) \
|
||||
snohalo1_ ## inter<T>( out, \
|
||||
|
Loading…
Reference in New Issue
Block a user