bugfixes ready for 7.16
This commit is contained in:
parent
0180e99d0e
commit
5c6ddec956
@ -1,5 +1,7 @@
|
||||
24/8/08 fork for stable 7.16 branch
|
||||
- load plgs from libdir as well as libdir/vips-x.x for compat
|
||||
- complex -> complex conversion was broken
|
||||
- refstring <-> gstring transforms
|
||||
|
||||
25/5/08 fork for loadable image format branch
|
||||
- image load/save in non-vips format code moved to own dir
|
||||
|
@ -45,6 +45,8 @@
|
||||
* before calling this if you want round-to-nearest
|
||||
* 7/11/07
|
||||
* - use new evalstart/evalend system
|
||||
* 26/8/08
|
||||
* - oops, complex->complex conversion was broken
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -272,9 +274,9 @@ clip_start( IMAGE *out, void *a, void *b )
|
||||
}\
|
||||
}
|
||||
|
||||
/* Clip any to a complex type ... set imaginary to zero.
|
||||
/* Clip any non-complex to a complex type ... set imaginary to zero.
|
||||
*/
|
||||
#define IM_CLIP_ANY_COMPLEX( ITYPE, OTYPE ) { \
|
||||
#define IM_CLIP_REAL_COMPLEX( ITYPE, OTYPE ) { \
|
||||
ITYPE *p = (ITYPE *) IM_REGION_ADDR( ir, le, y );\
|
||||
OTYPE *q = (OTYPE *) IM_REGION_ADDR( or, le, y );\
|
||||
\
|
||||
@ -285,6 +287,20 @@ clip_start( IMAGE *out, void *a, void *b )
|
||||
}\
|
||||
}
|
||||
|
||||
/* Clip any complex to a complex type.
|
||||
*/
|
||||
#define IM_CLIP_COMPLEX_COMPLEX( ITYPE, OTYPE ) { \
|
||||
ITYPE *p = (ITYPE *) IM_REGION_ADDR( ir, le, y );\
|
||||
OTYPE *q = (OTYPE *) IM_REGION_ADDR( or, le, y );\
|
||||
\
|
||||
for( x = 0; x < sz; x++ ) {\
|
||||
q[0] = p[0];\
|
||||
q[1] = p[1];\
|
||||
p += 2;\
|
||||
q += 2;\
|
||||
}\
|
||||
}
|
||||
|
||||
#define BAND_SWITCH_INNER( ITYPE, INT, FLOAT, COMPLEX ) { \
|
||||
switch( clip->out->BandFmt ) { \
|
||||
case IM_BANDFMT_UCHAR: \
|
||||
@ -344,53 +360,63 @@ clip_gen( REGION *or, void *vseq, void *a, void *b )
|
||||
switch( clip->in->BandFmt ) {
|
||||
case IM_BANDFMT_UCHAR:
|
||||
BAND_SWITCH_INNER( unsigned char,
|
||||
IM_CLIP_INT_INT, IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_ANY_COMPLEX );
|
||||
IM_CLIP_INT_INT,
|
||||
IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_REAL_COMPLEX );
|
||||
break;
|
||||
case IM_BANDFMT_CHAR:
|
||||
BAND_SWITCH_INNER( signed char,
|
||||
IM_CLIP_INT_INT, IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_ANY_COMPLEX );
|
||||
IM_CLIP_INT_INT,
|
||||
IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_REAL_COMPLEX );
|
||||
break;
|
||||
case IM_BANDFMT_USHORT:
|
||||
BAND_SWITCH_INNER( unsigned short,
|
||||
IM_CLIP_INT_INT, IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_ANY_COMPLEX );
|
||||
IM_CLIP_INT_INT,
|
||||
IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_REAL_COMPLEX );
|
||||
break;
|
||||
case IM_BANDFMT_SHORT:
|
||||
BAND_SWITCH_INNER( signed short,
|
||||
IM_CLIP_INT_INT, IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_ANY_COMPLEX );
|
||||
IM_CLIP_INT_INT,
|
||||
IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_REAL_COMPLEX );
|
||||
break;
|
||||
case IM_BANDFMT_UINT:
|
||||
BAND_SWITCH_INNER( unsigned int,
|
||||
IM_CLIP_INT_INT, IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_ANY_COMPLEX );
|
||||
IM_CLIP_INT_INT,
|
||||
IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_REAL_COMPLEX );
|
||||
break;
|
||||
case IM_BANDFMT_INT:
|
||||
BAND_SWITCH_INNER( signed int,
|
||||
IM_CLIP_INT_INT, IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_ANY_COMPLEX );
|
||||
IM_CLIP_INT_INT,
|
||||
IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_REAL_COMPLEX );
|
||||
break;
|
||||
case IM_BANDFMT_FLOAT:
|
||||
BAND_SWITCH_INNER( float,
|
||||
IM_CLIP_FLOAT_INT, IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_ANY_COMPLEX );
|
||||
IM_CLIP_FLOAT_INT,
|
||||
IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_REAL_COMPLEX );
|
||||
break;
|
||||
case IM_BANDFMT_DOUBLE:
|
||||
BAND_SWITCH_INNER( double,
|
||||
IM_CLIP_FLOAT_INT, IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_ANY_COMPLEX );
|
||||
IM_CLIP_FLOAT_INT,
|
||||
IM_CLIP_REAL_FLOAT,
|
||||
IM_CLIP_REAL_COMPLEX );
|
||||
break;
|
||||
case IM_BANDFMT_COMPLEX:
|
||||
BAND_SWITCH_INNER( float,
|
||||
IM_CLIP_COMPLEX_INT, IM_CLIP_COMPLEX_FLOAT,
|
||||
IM_CLIP_ANY_COMPLEX );
|
||||
IM_CLIP_COMPLEX_INT,
|
||||
IM_CLIP_COMPLEX_FLOAT,
|
||||
IM_CLIP_COMPLEX_COMPLEX );
|
||||
break;
|
||||
case IM_BANDFMT_DPCOMPLEX:
|
||||
BAND_SWITCH_INNER( double,
|
||||
IM_CLIP_COMPLEX_INT, IM_CLIP_COMPLEX_FLOAT,
|
||||
IM_CLIP_ANY_COMPLEX );
|
||||
IM_CLIP_COMPLEX_INT,
|
||||
IM_CLIP_COMPLEX_FLOAT,
|
||||
IM_CLIP_COMPLEX_COMPLEX );
|
||||
break;
|
||||
default:
|
||||
assert( 0 );
|
||||
|
@ -15,6 +15,8 @@
|
||||
* - oop, hash table insert/replace confusion fixed
|
||||
* 24/1/07
|
||||
* - oop, im_save_string_setf() was leaking
|
||||
* 26/8/08
|
||||
* - added string <-> refstring transforms
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -705,7 +707,7 @@ im_ref_string_set( GValue *value, const char *str )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Transform a refstring to a G_TYPE_STRING.
|
||||
/* Transform a refstring to a G_TYPE_STRING and back.
|
||||
*/
|
||||
static void
|
||||
transform_ref_string_g_string( const GValue *src_value, GValue *dest_value )
|
||||
@ -713,6 +715,12 @@ transform_ref_string_g_string( const GValue *src_value, GValue *dest_value )
|
||||
g_value_set_string( dest_value, im_ref_string_get( src_value ) );
|
||||
}
|
||||
|
||||
static void
|
||||
transform_g_string_ref_string( const GValue *src_value, GValue *dest_value )
|
||||
{
|
||||
im_ref_string_set( dest_value, g_value_get_string( src_value ) );
|
||||
}
|
||||
|
||||
/* To a save string.
|
||||
*/
|
||||
static void
|
||||
@ -738,6 +746,8 @@ im_ref_string_get_type( void )
|
||||
(GBoxedFreeFunc) area_unref );
|
||||
g_value_register_transform_func( type, G_TYPE_STRING,
|
||||
transform_ref_string_g_string );
|
||||
g_value_register_transform_func( G_TYPE_STRING, type,
|
||||
transform_g_string_ref_string );
|
||||
g_value_register_transform_func( type, IM_TYPE_SAVE_STRING,
|
||||
transform_ref_string_save_string );
|
||||
g_value_register_transform_func( IM_TYPE_SAVE_STRING, type,
|
||||
|
Loading…
Reference in New Issue
Block a user