clip bicubic output range from int
The output range of the bicubic interpolator is outside the input range, we must clip from a larger type. See https://github.com/jcupitt/libvips/pull/372
This commit is contained in:
parent
0dd7f14ada
commit
31e4168718
@ -153,17 +153,16 @@ bicubic_unsigned_int_tab( void *pout, const VipsPel *pin,
|
|||||||
const T qua_thr = in[l3_plus_b2];
|
const T qua_thr = in[l3_plus_b2];
|
||||||
const T qua_fou = in[l3_plus_b3];
|
const T qua_fou = in[l3_plus_b3];
|
||||||
|
|
||||||
out[z] = bicubic_unsigned_int<T>(
|
int bicubic = bicubic_unsigned_int<T>(
|
||||||
uno_one, uno_two, uno_thr, uno_fou,
|
uno_one, uno_two, uno_thr, uno_fou,
|
||||||
dos_one, dos_two, dos_thr, dos_fou,
|
dos_one, dos_two, dos_thr, dos_fou,
|
||||||
tre_one, tre_two, tre_thr, tre_fou,
|
tre_one, tre_two, tre_thr, tre_fou,
|
||||||
qua_one, qua_two, qua_thr, qua_fou,
|
qua_one, qua_two, qua_thr, qua_fou,
|
||||||
cx, cy );
|
cx, cy );
|
||||||
|
|
||||||
if( out[z] < 0 )
|
bicubic = VIPS_CLIP( 0, bicubic, max_value );
|
||||||
out[z] = 0;
|
|
||||||
else if( out[z] > max_value )
|
out[z] = bicubic;
|
||||||
out[z] = max_value;
|
|
||||||
|
|
||||||
in += 1;
|
in += 1;
|
||||||
}
|
}
|
||||||
@ -217,17 +216,16 @@ bicubic_signed_int_tab( void *pout, const VipsPel *pin,
|
|||||||
const T qua_thr = in[l3_plus_b2];
|
const T qua_thr = in[l3_plus_b2];
|
||||||
const T qua_fou = in[l3_plus_b3];
|
const T qua_fou = in[l3_plus_b3];
|
||||||
|
|
||||||
out[z] = bicubic_signed_int<T>(
|
int bicubic = bicubic_signed_int<T>(
|
||||||
uno_one, uno_two, uno_thr, uno_fou,
|
uno_one, uno_two, uno_thr, uno_fou,
|
||||||
dos_one, dos_two, dos_thr, dos_fou,
|
dos_one, dos_two, dos_thr, dos_fou,
|
||||||
tre_one, tre_two, tre_thr, tre_fou,
|
tre_one, tre_two, tre_thr, tre_fou,
|
||||||
qua_one, qua_two, qua_thr, qua_fou,
|
qua_one, qua_two, qua_thr, qua_fou,
|
||||||
cx, cy );
|
cx, cy );
|
||||||
|
|
||||||
if( out[z] < min_value )
|
bicubic = VIPS_CLIP( min_value, bicubic, max_value );
|
||||||
out[z] = min_value;
|
|
||||||
else if( out[z] > max_value )
|
out[z] = bicubic;
|
||||||
out[z] = max_value;
|
|
||||||
|
|
||||||
in += 1;
|
in += 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user