[Mesa-stable] [PATCH] st/omx/h264: fix corruption when scaling matrix present flag is set

Leo Liu leo.liu at amd.com
Mon Feb 1 17:09:09 CET 2016


The scaling lsit should be filling out with zig zag scan

Cc: "11.0 11.1" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Leo Liu <leo.liu at amd.com>
---
 src/gallium/state_trackers/omx/vid_dec_h264.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/omx/vid_dec_h264.c b/src/gallium/state_trackers/omx/vid_dec_h264.c
index f66ed89..8104e93 100644
--- a/src/gallium/state_trackers/omx/vid_dec_h264.c
+++ b/src/gallium/state_trackers/omx/vid_dec_h264.c
@@ -79,6 +79,22 @@ static const uint8_t Default_8x8_Inter[64] = {
    30, 30, 32, 32, 32, 33, 33, 35
 };
 
+static const uint8_t Zigzag_Scan[16] = {
+    0,  1,  4,  8,  5,  2,  3,  6,
+    9, 12, 13, 10,  7, 11, 14, 15
+};
+
+static const uint8_t Zigzag_Scan8[64] = {
+    0,  1,  8, 16,  9,  2,  3, 10,
+   17, 24, 32, 25, 18, 11,  4,  5,
+   12, 19, 26, 33, 40, 48, 41, 34,
+   27, 20, 13,  6,  7, 14, 21, 28,
+   35, 42, 49, 56, 57, 50, 43, 36,
+   29, 22, 15, 23, 30, 37, 44, 51,
+   58, 59, 52, 45, 38, 31, 39, 46,
+   53, 60, 61, 54, 47, 55, 62, 63
+};
+
 static void vid_dec_h264_Decode(vid_dec_PrivateType *priv, struct vl_vlc *vlc, unsigned min_bits_left);
 static void vid_dec_h264_EndFrame(vid_dec_PrivateType *priv);
 static struct pipe_video_buffer *vid_dec_h264_Flush(vid_dec_PrivateType *priv);
@@ -215,6 +231,7 @@ static void scaling_list(struct vl_rbsp *rbsp, uint8_t *scalingList, unsigned si
    }
 
    for (i = 0; i < sizeOfScalingList; ++i ) {
+      unsigned scan = (sizeOfScalingList == 16) ? Zigzag_Scan[i] : Zigzag_Scan8[i];
 
       if (nextScale != 0) {
          signed delta_scale = vl_rbsp_se(rbsp);
@@ -224,8 +241,8 @@ static void scaling_list(struct vl_rbsp *rbsp, uint8_t *scalingList, unsigned si
             return;
          }
       }
-      scalingList[i] = nextScale == 0 ? lastScale : nextScale;
-      lastScale = scalingList[i];
+      scalingList[scan] = nextScale == 0 ? lastScale : nextScale;
+      lastScale = scalingList[scan];
    }
 }
 
-- 
1.9.1



More information about the mesa-stable mailing list