[vlc-devel] commit: fix the un-premultiplying post processing step, which would yield values above 255 for full white - and thus shade some text . (ogg.k.ogg.k )

git version control git at videolan.org
Mon Feb 15 14:00:02 CET 2010


vlc | branch: master | ogg.k.ogg.k <ogg.k.ogg.k at googlemail.com> | Fri Feb 12 16:39:13 2010 +0000| [23efe419964d54061cacf0c68d420c299319c07a] | committer: Rémi Duraffort 

fix the un-premultiplying post processing step, which would yield values above 255 for full white - and thus shade some text.

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=23efe419964d54061cacf0c68d420c299319c07a
---

 modules/codec/kate.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/modules/codec/kate.c b/modules/codec/kate.c
index 0e65a34..e912e03 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;
 




More information about the vlc-devel mailing list