Fix line lengths

This commit is contained in:
Simon Harris 2018-03-27 21:27:24 +11:00
parent eada4a7731
commit 442f4e55c9
3 changed files with 24 additions and 10 deletions

View File

@ -1404,7 +1404,8 @@ strip_shrink( Layer *layer )
if( vips_rect_isempty( &target ) ) if( vips_rect_isempty( &target ) )
break; break;
(void) vips_region_shrink( from, to, &target, VIPS_REGION_SHRINK_MEAN ); (void) vips_region_shrink( from, to, &target,
VIPS_REGION_SHRINK_MEAN );
below->write_y += target.height; below->write_y += target.height;

View File

@ -1392,7 +1392,8 @@ layer_strip_shrink( Layer *layer )
if( vips_rect_isempty( &target ) ) if( vips_rect_isempty( &target ) )
break; break;
(void) vips_region_shrink( from, to, &target, VIPS_REGION_SHRINK_MEAN ); (void) vips_region_shrink( from, to, &target,
VIPS_REGION_SHRINK_MEAN );
below->write_y += target.height; below->write_y += target.height;

View File

@ -1204,10 +1204,16 @@ vips_region_shrink_labpack( VipsRegion *from,
q += ps; \ q += ps; \
} }
// This *DOES* gurantee the result is taken from one of the input values /* This method is implemented so as to perform well and to always select an
// It therefore does *NOT* interpolate between the two middle values * output pixel from one of the input pixels. As such we make only the
// It is *NOT* stable with respect to the set of values * following guarantees:
// It *IS* however stable with respect to the initial arrangement of values *
* ONLY works for non-complex uncoded images pixel types
* ALWAYS draws from the input values
* NEVER interpolates
* NOT stable with respect to the ordered set of input values
* IS stable with respect to the initial arrangement of input values
*/
#define SHRINK_TYPE_MEDIAN( TYPE ) \ #define SHRINK_TYPE_MEDIAN( TYPE ) \
for( x = 0; x < target->width; x++ ) { \ for( x = 0; x < target->width; x++ ) { \
TYPE *tp = (TYPE *) p; \ TYPE *tp = (TYPE *) p; \
@ -1215,7 +1221,10 @@ vips_region_shrink_labpack( VipsRegion *from,
TYPE *tq = (TYPE *) q; \ TYPE *tq = (TYPE *) q; \
\ \
for( z = 0; z < nb; z++ ) { \ for( z = 0; z < nb; z++ ) { \
tq[z] = VIPS_MIN( VIPS_MAX( tp[z], tp[z + nb] ), VIPS_MAX( tp1[z], tp1[z + nb] ) ); \ tq[z] = VIPS_MIN( \
VIPS_MAX( tp[z], tp[z + nb] ), \
VIPS_MAX( tp1[z], tp1[z + nb] ) \
); \
} \ } \
\ \
/* Move on two pels in input. \ /* Move on two pels in input. \
@ -1320,9 +1329,11 @@ vips_region_shrink_uncoded( VipsRegion *from,
{ {
switch( method ) { switch( method ) {
case VIPS_REGION_SHRINK_MEAN: case VIPS_REGION_SHRINK_MEAN:
vips_region_shrink_uncoded_mean( from, to, target ); break; vips_region_shrink_uncoded_mean( from, to, target );
break;
case VIPS_REGION_SHRINK_MEDIAN: case VIPS_REGION_SHRINK_MEDIAN:
vips_region_shrink_uncoded_median( from, to, target ); break; vips_region_shrink_uncoded_median( from, to, target );
break;
default: default:
g_assert_not_reached(); g_assert_not_reached();
@ -1426,7 +1437,8 @@ vips_region_shrink_alpha( VipsRegion *from,
* See also: vips_region_copy(). * See also: vips_region_copy().
*/ */
int int
vips_region_shrink( VipsRegion *from, VipsRegion *to, const VipsRect *target, VipsRegionShrink method ) vips_region_shrink( VipsRegion *from, VipsRegion *to, const VipsRect *target,
VipsRegionShrink method )
{ {
VipsImage *image = from->im; VipsImage *image = from->im;