diff options
author | Thibault Saunier <thibault.saunier@collabora.com> | 2011-10-04 17:39:42 -0300 |
---|---|---|
committer | Thibault Saunier <thibault.saunier@collabora.com> | 2011-10-17 13:17:39 +0200 |
commit | ce71fdae1b2259bed05a79d50a1e2e888e085d77 (patch) | |
tree | 501eeb7735c5d6a33b8755ecf61cf296fa2cac51 | |
parent | 80906275816a27abd2943b7e4fce9f78d5062654 (diff) | |
download | gstreamer-plugins-bad-ce71fdae1b2259bed05a79d50a1e2e888e085d77.tar.gz |
codecparsers: VC1: Implement bitplanes diff operator
-rw-r--r-- | gst-libs/gst/codecparsers/gstvc1parser.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/gst-libs/gst/codecparsers/gstvc1parser.c b/gst-libs/gst/codecparsers/gstvc1parser.c index b724a9e62..172534796 100644 --- a/gst-libs/gst/codecparsers/gstvc1parser.c +++ b/gst-libs/gst/codecparsers/gstvc1parser.c @@ -485,7 +485,7 @@ bitplane_decoding (GstBitReader * br, guint8 * data, GST_DEBUG ("Parsing IMODE_DIFF6 or IMODE_NORM6 biplane"); - if (!(height % 3) && (width % 3)) { /* decode 2x3 "vertical" tiles */ + if (!(height % 3) && (width % 3)) { /* decode 2x3 "vertical" tiles */ for (y = 0; y < height; y += 3) { for (x = width & 1; x < width; x += 2) { if (!decode_vlc (br, &v, vc1_norm6_vlc_table, @@ -508,7 +508,7 @@ bitplane_decoding (GstBitReader * br, guint8 * data, x = width & 1; y = 0; - } else { /* decode 3x2 "horizontal" tiles */ + } else { /* decode 3x2 "horizontal" tiles */ if (pdata) pdata += (height & 1) * width; @@ -564,6 +564,30 @@ bitplane_decoding (GstBitReader * br, guint8 * data, break; } + if (!data) + return TRUE; + + /* Applying diff operator */ + if (imode == IMODE_DIFF2 || imode == IMODE_DIFF6) { + pdata = data; + pdata[0] ^= invert; + + for (x = 1; x < width; x++) + pdata[x] ^= pdata[x - 1]; + + for (y = 1; y < height; y++) { + pdata[stride] ^= pdata[0]; + + for (x = 1; x < width; x++) { + if (pdata[stride + x - 1] != pdata[x]) + pdata[stride + x] ^= invert; + else + pdata[stride + x] ^= pdata[stride + x - 1]; + } + pdata += stride; + } + } + return TRUE; failed: |