make webp frame blend do doround to nearest

see https://github.com/libvips/libvips/pull/1918
This commit is contained in:
John Cupitt 2020-12-04 13:53:24 +00:00
parent aa9906184a
commit 6eaf1eda30
2 changed files with 4 additions and 3 deletions

View File

@ -15,6 +15,7 @@
- force binary mode on win for connection read / write [Alreiber] - force binary mode on win for connection read / write [Alreiber]
- better testing for output to target [barryspearce] - better testing for output to target [barryspearce]
- ppmload_source was missing is_a [ewelot] - ppmload_source was missing is_a [ewelot]
- improve webpload rounding and blending behaviour [lovell]
6/9/20 started 8.10.2 6/9/20 started 8.10.2
- update magicksave/load profile handling [kelilevi] - update magicksave/load profile handling [kelilevi]

View File

@ -232,7 +232,7 @@ vips_image_paint_area( VipsImage *image, const VipsRect *r, const VipsPel *ink )
/* Blend two guint8. /* Blend two guint8.
*/ */
#define BLEND( X, aX, Y, aY, scale ) \ #define BLEND( X, aX, Y, aY, scale ) \
((X * aX + Y * aY) * scale >> 24) (((X * aX + Y * aY) * scale + (1 << 12)) >> 24)
/* Extract R, G, B, A, assuming little-endian. /* Extract R, G, B, A, assuming little-endian.
*/ */
@ -260,7 +260,7 @@ blend_pixel( guint32 A, guint32 B )
guint8 aB = getA( B ); guint8 aB = getA( B );
guint8 fac = (aB * (256 - aA)) >> 8; guint8 fac = (aB * (256 - aA) + 128) >> 8;
guint8 aR = aA + fac; guint8 aR = aA + fac;
int scale = (1 << 24) / aR; int scale = (1 << 24) / aR;
@ -693,7 +693,7 @@ read_next_frame( Read *read )
vips_image_paint_image( read->frame, frame, vips_image_paint_image( read->frame, frame,
area.left, area.top, area.left, area.top,
read->iter.frame_num > 1 && read->iter.frame_num > 1 &&
read->iter.blend_method == WEBP_MUX_BLEND ); read->iter.blend_method == WEBP_MUX_BLEND );
g_object_unref( frame ); g_object_unref( frame );