This commit is contained in:
John Cupitt 2008-05-12 18:16:38 +00:00
parent 5d278b725f
commit 7f40537fea
7 changed files with 58 additions and 22 deletions

View File

@ -13,6 +13,10 @@
- performance improvements for morphology ops, esp. when zooming out
- oop, im_render() was broken for mask == NULL
- better support for multiple Python installs (thanks Jay)
- better IM_SETSTR() stops some warnings
- im_histcum() works for signed histograms
- better rounding for im_conv(), im_convsep()
- tiny speedup for im_conv()
25/1/08 started 7.14.0
- bump all version numbers for new stable

7
TODO
View File

@ -1,3 +1,10 @@
- try
libsrc/convolution$ grep -l offsets *.c
could we do the don't calc offsets thing unless bpl; changes thing in more
places?
- should check for gettext in configure? see
https://sourceforge.net/tracker/index.php?func=detail&aid=1836080&group_id=100050&atid=626186

View File

@ -27,7 +27,7 @@ echo " by" `header -f Ysize temp.v` "pixels"
echo "starting benchmark ..."
echo "chain=$chain"
for cpus in 1 2 3 ; do
for cpus in 1 2 ; do
export IM_CONCURRENCY=$cpus
echo IM_CONCURRENCY=$IM_CONCURRENCY

View File

@ -161,10 +161,10 @@ extern "C" {
} while( 0 )
#define IM_FREE( A ) IM_FREEF( im_free, A )
#define IM_SETSTR( S, V ) do { \
if( (S) != (V) ) { \
if( !(S) || !(V) || strcmp( (S), (V) ) != 0 ) { \
const char *sst = (V); \
\
const char *sst = (V); \
\
if( (S) != sst ) { \
if( !(S) || !sst || strcmp( (S), sst ) != 0 ) { \
IM_FREE( S ); \
if( sst ) \
(S) = im_strdup( NULL, sst ); \

View File

@ -61,6 +61,9 @@
* - simpler inner loop avoids gcc4 bug
* 7/11/07
* - new evalstart/end callbacks
* 12/5/08
* - int rounding was +1 too much, argh
* - only rebuild the buffer offsets if bpl changes
*/
/*
@ -200,6 +203,8 @@ typedef struct {
int underflow; /* Underflow/overflow counts */
int overflow;
int last_bpl; /* Avoid recalcing offsets, if we can */
} ConvSequence;
/* Free a sequence value.
@ -239,6 +244,7 @@ conv_start( IMAGE *out, void *a, void *b )
seq->pts = NULL;
seq->underflow = 0;
seq->overflow = 0;
seq->last_bpl = -1;
/* Attach region and arrays.
*/
@ -303,7 +309,11 @@ conv_gen( REGION *or, void *vseq, void *a, void *b )
Conv *conv = (Conv *) b;
REGION *ir = seq->ir;
INTMASK *mask = conv->mask;
int rounding = (mask->scale + 1)/2;
/* You might think this should be (scale+1)/2, but then we'd be adding
* one for scale == 1.
*/
int rounding = mask->scale / 2;
Rect *r = &or->valid;
Rect s;
@ -323,15 +333,21 @@ conv_gen( REGION *or, void *vseq, void *a, void *b )
if( im_prepare( ir, &s ) )
return( -1 );
/* Fill offset array.
*/
z = 0;
for( i = 0, y = 0; y < mask->ysize; y++ )
for( x = 0; x < mask->xsize; x++, i++ )
if( mask->coeff[i] )
seq->offsets[z++] =
IM_REGION_ADDR( ir, x + le, y + to ) -
IM_REGION_ADDR( ir, le, to );
/* Fill offset array. Only do this if the bpl has changed since the
* previous im_prepare().
*/
if( seq->last_bpl != IM_REGION_LSKIP( ir ) ) {
seq->last_bpl = IM_REGION_LSKIP( ir );
z = 0;
for( i = 0, y = 0; y < mask->ysize; y++ )
for( x = 0; x < mask->xsize; x++, i++ )
if( mask->coeff[i] )
seq->offsets[z++] =
IM_REGION_ADDR( ir,
x + le, y + to ) -
IM_REGION_ADDR( ir, le, to );
}
for( y = to; y < bo; y++ ) {
/* Init pts for this line of PELs.

View File

@ -27,6 +27,8 @@
* 21/4/04
* - scale down int convolves at 1/2 way mark, much less likely to integer
* overflow on intermediates
* 12/5/08
* - int rounding was +1 too much, argh
*/
/*
@ -304,7 +306,12 @@ conv_gen( REGION *or, void *vseq, void *a, void *b )
Conv *conv = (Conv *) b;
REGION *ir = seq->ir;
INTMASK *mask = conv->mask;
int rounding = (mask->scale + 1)/2;
/* You might think this should be (scale+1)/2, but then we'd be adding
* one for scale == 1.
*/
int rounding = mask->scale / 2;
int bands = in->Bands;
int *coeff = conv->mask->coeff;

View File

@ -25,6 +25,8 @@
* - neater im_histnorm()
* 23/7/07
* - eek, off by 1 for more than 1 band hists
* 12/5/08
* - histcum works for signed hists now as well
*/
/*
@ -104,14 +106,14 @@ im_histcum( IMAGE *in, IMAGE *out )
if( im_incheck( in ) )
return( -1 );
/* int types -> uint, float/double stay as they are.
*/
if( im_cp_desc( out, in ) )
return( -1 );
out->Xsize = px;
out->Ysize = 1;
if( im_isint( in ) )
if( im_isuint( in ) )
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 ))) )
@ -119,15 +121,15 @@ im_histcum( IMAGE *in, IMAGE *out )
switch( in->BandFmt ) {
case IM_BANDFMT_CHAR:
ACCUMULATE( signed char, unsigned int ); break;
ACCUMULATE( signed char, signed int ); break;
case IM_BANDFMT_UCHAR:
ACCUMULATE( unsigned char, unsigned int ); break;
case IM_BANDFMT_SHORT:
ACCUMULATE( signed short, unsigned int ); break;
ACCUMULATE( signed short, signed int ); break;
case IM_BANDFMT_USHORT:
ACCUMULATE( unsigned short, unsigned int ); break;
case IM_BANDFMT_INT:
ACCUMULATE( signed int, unsigned int ); break;
ACCUMULATE( signed int, signed int ); break;
case IM_BANDFMT_UINT:
ACCUMULATE( unsigned int, unsigned int ); break;