im_conv() bug fixed

there was a typo in overflow estimation which could cause vips to use
the vector path when it should not, resulting in errors
This commit is contained in:
John Cupitt 2011-05-09 16:56:41 +01:00
parent e92f5ff353
commit 03d54dd099
3 changed files with 15 additions and 6 deletions

View File

@ -55,6 +55,7 @@
- im_bufjpeg2vips() has a "header_only" parameter
- added vips_image_get_data()
- updated German translation (thanks Chris)
- fixed typo in im_conv() overflow estimation which could cause errors
30/11/10 started 7.24.0
- bump for new stable

View File

@ -63,6 +63,8 @@
* keeping two versions
* 8/11/10
* - add array tiling
* 9/5/11
* - argh typo in overflow estimation could cause errors
*/
/*
@ -110,6 +112,9 @@
- make up a signed 8-bit code path?
- don't use divluw, it's insanely slow, instead scale coefficients so
that we can just do >>8 at the end
*/
#ifdef HAVE_CONFIG_H
@ -355,10 +360,8 @@ conv_compile_convolution_u8s16( Conv *conv )
for( i = 0; i < n_mask; i++ ) {
int v = 255 * mask->coeff[i];
if( min + v < min )
min += v;
else if( min + v > max )
max += v;
min = IM_MIN( min, min + v );
max = IM_MAX( max, max + v );
if( max > SHRT_MAX )
return( -1 );
@ -1008,6 +1011,11 @@ im_conv_raw( IMAGE *in, IMAGE *out, INTMASK *mask )
Conv *conv;
im_generate_fn generate;
#ifdef DEBUG
printf( "im_conv_raw: starting with matrix:\n" );
im_print_imask( mask );
#endif /*DEBUG*/
/* Check parameters.
*/
if( im_piocheck( in, out ) ||

View File

@ -43,8 +43,8 @@
*/
/*
#define DEBUG
*/
#define DEBUG
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -312,7 +312,7 @@ vips_vector_print( VipsVector *vector )
if( vector->compiled )
printf( "successfully compiled\n" );
else
printf( "not compiled successfully\n" );
printf( "not compiled\n" );
printf( " n_scanline = %d\n", vector->n_scanline );
for( i = 0; i < vector->n_scanline; i++ )
printf( " var %d = line %d\n",