min/max error initing x/y

This commit is contained in:
John Cupitt 2011-11-14 12:10:54 +00:00
parent b400918541
commit 15f7568423
3 changed files with 38 additions and 22 deletions

16
TODO
View File

@ -1,17 +1,15 @@
- various failures in make check
setting x in vipsmin to nonsense
also vipsmax?
- move ifthenelse / blend to conversion? or arithmetic? - move ifthenelse / blend to conversion? or arithmetic?
not ternary arithmetic ops since the condition image is always ucharo
maybe a subclass of binary, since the then & else images do need to be
upcast to match
- try an area operation, like conv, VipsArea? oops no
- try an area operation, like conv, VipsArea? oops no haha what name should we
use?

View File

@ -150,17 +150,17 @@ static int
vips_max_stop( VipsStatistic *statistic, void *seq ) vips_max_stop( VipsStatistic *statistic, void *seq )
{ {
VipsMax *global = (VipsMax *) statistic; VipsMax *global = (VipsMax *) statistic;
VipsMax *max = (VipsMax *) seq; VipsMax *local = (VipsMax *) seq;
if( max->set && if( local->set &&
(!global->set || max->max > global->max) ) { (!global->set || local->max > global->max) ) {
global->max = max->max; global->max = local->max;
global->x = max->x; global->x = local->x;
global->y = max->y; global->y = local->y;
global->set = TRUE; global->set = TRUE;
} }
g_free( max ); g_free( local );
return( 0 ); return( 0 );
} }
@ -173,8 +173,11 @@ vips_max_stop( VipsStatistic *statistic, void *seq )
\ \
if( max->set ) \ if( max->set ) \
m = max->max; \ m = max->max; \
else \ else { \
m = p[0]; \ m = p[0]; \
max->x = x; \
max->y = y; \
} \
\ \
for( i = 0; i < sz; i++ ) { \ for( i = 0; i < sz; i++ ) { \
if( p[i] > m ) { \ if( p[i] > m ) { \
@ -196,8 +199,11 @@ vips_max_stop( VipsStatistic *statistic, void *seq )
\ \
if( max->set ) \ if( max->set ) \
m = max->max; \ m = max->max; \
else \ else { \
m = p[0]; \ m = p[0]; \
max->x = x; \
max->y = y; \
} \
\ \
for( i = 0; i < sz; i++ ) { \ for( i = 0; i < sz; i++ ) { \
if( p[i] > m ) { \ if( p[i] > m ) { \
@ -221,8 +227,11 @@ vips_max_stop( VipsStatistic *statistic, void *seq )
\ \
if( max->set ) \ if( max->set ) \
m = max->max; \ m = max->max; \
else \ else { \
m = p[0] * p[0] + p[1] * p[1]; \ m = p[0] * p[0] + p[1] * p[1]; \
max->x = x; \
max->y = y; \
} \
\ \
for( i = 0; i < sz; i++ ) { \ for( i = 0; i < sz; i++ ) { \
double mod; \ double mod; \

View File

@ -173,8 +173,11 @@ vips_min_stop( VipsStatistic *statistic, void *seq )
\ \
if( min->set ) \ if( min->set ) \
m = min->min; \ m = min->min; \
else \ else { \
m = p[0]; \ m = p[0]; \
min->x = x; \
min->y = y; \
} \
\ \
for( i = 0; i < sz; i++ ) { \ for( i = 0; i < sz; i++ ) { \
if( p[i] < m ) { \ if( p[i] < m ) { \
@ -196,8 +199,11 @@ vips_min_stop( VipsStatistic *statistic, void *seq )
\ \
if( min->set ) \ if( min->set ) \
m = min->min; \ m = min->min; \
else \ else { \
m = p[0]; \ m = p[0]; \
min->x = x; \
min->y = y; \
} \
\ \
for( i = 0; i < sz; i++ ) { \ for( i = 0; i < sz; i++ ) { \
if( p[i] < m ) { \ if( p[i] < m ) { \
@ -221,8 +227,11 @@ vips_min_stop( VipsStatistic *statistic, void *seq )
\ \
if( min->set ) \ if( min->set ) \
m = min->min; \ m = min->min; \
else \ else { \
m = p[0] * p[0] + p[1] * p[1]; \ m = p[0] * p[0] + p[1] * p[1]; \
min->x = x; \
min->y = y; \
} \
\ \
for( i = 0; i < sz; i++ ) { \ for( i = 0; i < sz; i++ ) { \
double mod; \ double mod; \