From 23efe419964d54061cacf0c68d420c299319c07a Mon Sep 17 00:00:00 2001 From: "ogg.k.ogg.k" Date: Fri, 12 Feb 2010 16:39:13 +0000 Subject: [PATCH] fix the un-premultiplying post processing step, which would yield values above 255 for full white - and thus shade some text. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Duraffort --- modules/codec/kate.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/codec/kate.c b/modules/codec/kate.c index 0e65a34f9f..e912e035af 100644 --- a/modules/codec/kate.c +++ b/modules/codec/kate.c @@ -824,7 +824,6 @@ static void SubpictureReleaseRegions( subpicture_t *p_subpic ) } } -#if 0 /* * We get premultiplied alpha, but VLC doesn't expect this, so we demultiply * alpha to avoid double multiply (and thus thinner text than we should)). @@ -854,14 +853,14 @@ static void PostprocessTigerImage( plane_t *p_plane, unsigned int i_width ) { #ifdef WORDS_BIGENDIAN uint8_t tmp = p_pixel[2]; - p_pixel[0] = p_pixel[3] * 255 / a; + p_pixel[0] = clip_uint8_vlc((p_pixel[3] * 255 + a / 2) / a); p_pixel[3] = a; - p_pixel[2] = p_pixel[1] * 255 / a; - p_pixel[1] = tmp * 255 / a; + p_pixel[2] = clip_uint8_vlc((p_pixel[1] * 255 + a / 2) / a); + p_pixel[1] = clip_uint8_vlc((tmp * 255 + a / 2) / a); #else - p_pixel[0] = p_pixel[0] * 255 / a; - p_pixel[1] = p_pixel[1] * 255 / a; - p_pixel[2] = p_pixel[2] * 255 / a; + p_pixel[0] = clip_uint8_vlc((p_pixel[0] * 255 + a / 2) / a); + p_pixel[1] = clip_uint8_vlc((p_pixel[1] * 255 + a / 2) / a); + p_pixel[2] = clip_uint8_vlc((p_pixel[2] * 255 + a / 2) / a); #endif } else @@ -875,7 +874,6 @@ static void PostprocessTigerImage( plane_t *p_plane, unsigned int i_width ) } PROFILE_STOP( tiger_renderer_postprocess ); } -#endif /* Tiger renders can end up looking a bit crap since they get overlaid on top of a subsampled YUV image, so there can be a fair amount of chroma bleeding. @@ -977,9 +975,7 @@ static void TigerUpdateRegions( spu_t *p_spu, subpicture_t *p_subpic, const vide } PROFILE_STOP( tiger_renderer_render ); -#if 0 PostprocessTigerImage( p_plane, fmt.i_width ); -#endif p_subpic->p_region = p_r; p_sys->b_dirty = false; -- 2.11.4.GIT