dvbsuboverlay: Handle non_modifying_colour_flag correctly in the RLE handlers
authorMart Raudsepp <mart.raudsepp@collabora.com>
Wed, 21 Dec 2011 11:00:27 +0000 (13:00 +0200)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Wed, 11 Jul 2012 11:42:02 +0000 (13:42 +0200)
The check for when to not memset was checking on an undeterministic 'bits' variable value,
which is only meant to be used inside the loop earlier when it is supposed to check if
clut_index is 1 together with non_mod set, as per spec:

"non_modifying_colour_flag:  If set to '1' this indicates that the CLUT entry value '1'
is a non modifying colour. When the non modifying colour is assigned to an object pixel,
then the pixel of the underlying region background or object shall not be modified. This
can be used to create "transparent holes" in objects."

https://bugzilla.gnome.org/show_bug.cgi?id=666352

gst/dvbsuboverlay/dvb-sub.c

index 6ba3c74..21061a3 100644 (file)
@@ -715,7 +715,7 @@ _dvb_sub_read_2bit_string (guint8 * destbuf, gint dbuf_len,
     GST_TRACE ("RUNLEN: setting %u pixels to color 0x%x in destination buffer, "
         "dbuf_len left is %d pixels", run_length, clut_index, dbuf_len);
 
-    if (!(non_mod == 1 && bits == 1))
+    if (!(non_mod == 1 && clut_index == 1))
       memset (destbuf, clut_index, run_length);
 
     destbuf += run_length;
@@ -813,7 +813,7 @@ _dvb_sub_read_4bit_string (guint8 * destbuf, gint dbuf_len,
     GST_TRACE ("RUNLEN: setting %u pixels to color 0x%x in destination buffer; "
         "dbuf_len left is %d pixels", run_length, clut_index, dbuf_len);
 
-    if (!(non_mod == 1 && bits == 1))
+    if (!(non_mod == 1 && clut_index == 1))
       memset (destbuf, clut_index, run_length);
 
     destbuf += run_length;
@@ -905,7 +905,7 @@ _dvb_sub_read_8bit_string (guint8 * destbuf, gint dbuf_len,
     GST_TRACE ("RUNLEN: setting %u pixels to color 0x%x in destination buffer; "
         "dbuf_len left is %d pixels", run_length, clut_index, dbuf_len);
 
-    if (!(non_mod == 1 && bits == 1))
+    if (!(non_mod == 1 && clut_index == 1))
       memset (destbuf, clut_index, run_length);
 
     destbuf += run_length;