diff --git a/TODO b/TODO index 1f9dcb00..90bfa04d 100644 --- a/TODO +++ b/TODO @@ -1,17 +1,15 @@ -- various failures in make check - - setting x in vipsmin to nonsense - - also vipsmax? - - - - 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? diff --git a/libvips/arithmetic/max.c b/libvips/arithmetic/max.c index bf9b7e8f..8ce4aa10 100644 --- a/libvips/arithmetic/max.c +++ b/libvips/arithmetic/max.c @@ -150,17 +150,17 @@ static int vips_max_stop( VipsStatistic *statistic, void *seq ) { VipsMax *global = (VipsMax *) statistic; - VipsMax *max = (VipsMax *) seq; + VipsMax *local = (VipsMax *) seq; - if( max->set && - (!global->set || max->max > global->max) ) { - global->max = max->max; - global->x = max->x; - global->y = max->y; + if( local->set && + (!global->set || local->max > global->max) ) { + global->max = local->max; + global->x = local->x; + global->y = local->y; global->set = TRUE; } - g_free( max ); + g_free( local ); return( 0 ); } @@ -173,8 +173,11 @@ vips_max_stop( VipsStatistic *statistic, void *seq ) \ if( max->set ) \ m = max->max; \ - else \ + else { \ m = p[0]; \ + max->x = x; \ + max->y = y; \ + } \ \ for( i = 0; i < sz; i++ ) { \ if( p[i] > m ) { \ @@ -196,8 +199,11 @@ vips_max_stop( VipsStatistic *statistic, void *seq ) \ if( max->set ) \ m = max->max; \ - else \ + else { \ m = p[0]; \ + max->x = x; \ + max->y = y; \ + } \ \ for( i = 0; i < sz; i++ ) { \ if( p[i] > m ) { \ @@ -221,8 +227,11 @@ vips_max_stop( VipsStatistic *statistic, void *seq ) \ if( max->set ) \ m = max->max; \ - else \ + else { \ m = p[0] * p[0] + p[1] * p[1]; \ + max->x = x; \ + max->y = y; \ + } \ \ for( i = 0; i < sz; i++ ) { \ double mod; \ diff --git a/libvips/arithmetic/min.c b/libvips/arithmetic/min.c index be91d76b..3e20168d 100644 --- a/libvips/arithmetic/min.c +++ b/libvips/arithmetic/min.c @@ -173,8 +173,11 @@ vips_min_stop( VipsStatistic *statistic, void *seq ) \ if( min->set ) \ m = min->min; \ - else \ + else { \ m = p[0]; \ + min->x = x; \ + min->y = y; \ + } \ \ for( i = 0; i < sz; i++ ) { \ if( p[i] < m ) { \ @@ -196,8 +199,11 @@ vips_min_stop( VipsStatistic *statistic, void *seq ) \ if( min->set ) \ m = min->min; \ - else \ + else { \ m = p[0]; \ + min->x = x; \ + min->y = y; \ + } \ \ for( i = 0; i < sz; i++ ) { \ if( p[i] < m ) { \ @@ -221,8 +227,11 @@ vips_min_stop( VipsStatistic *statistic, void *seq ) \ if( min->set ) \ m = min->min; \ - else \ + else { \ m = p[0] * p[0] + p[1] * p[1]; \ + min->x = x; \ + min->y = y; \ + } \ \ for( i = 0; i < sz; i++ ) { \ double mod; \