summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2018-09-18 16:19:57 -0400
committerLeo Liu <[email protected]>2018-09-24 09:12:49 -0400
commit3e7b5e5db2f332e258d01c855137476e8fd4a44f (patch)
treeeb12c1def35c85b38355f677334baf358af02c16 /src/gallium/drivers/radeon
parent6ca1402c117856b55d044be1e82224db30ed1b02 (diff)
radeon/uvd: use bitstream coded number for symbols of Huffman tables
Signed-off-by: Leo Liu <[email protected]> Fixes: 130d1f456(radeon/uvd: reconstruct MJPEG bitstream) Cc: "18.2" <[email protected]> Reviewed-by: Boyuan Zhang <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r--src/gallium/drivers/radeon/radeon_uvd.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
index 923216d77f1..a7ef4252ee0 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1003,25 +1003,35 @@ static void get_mjpeg_slice_header(struct ruvd_decoder *dec, struct pipe_mjpeg_p
size++;
for (i = 0; i < 2; ++i) {
+ int num = 0, j;
+
if (pic->huffman_table.load_huffman_table[i] == 0)
continue;
buf[size++] = 0x00 | i;
memcpy((buf + size), &pic->huffman_table.table[i].num_dc_codes, 16);
size += 16;
- memcpy((buf + size), &pic->huffman_table.table[i].dc_values, 12);
- size += 12;
+ for (j = 0; j < 16; ++j)
+ num += pic->huffman_table.table[i].num_dc_codes[j];
+ assert(num <= 12);
+ memcpy((buf + size), &pic->huffman_table.table[i].dc_values, num);
+ size += num;
}
for (i = 0; i < 2; ++i) {
+ int num = 0, j;
+
if (pic->huffman_table.load_huffman_table[i] == 0)
continue;
buf[size++] = 0x10 | i;
memcpy((buf + size), &pic->huffman_table.table[i].num_ac_codes, 16);
size += 16;
- memcpy((buf + size), &pic->huffman_table.table[i].ac_values, 162);
- size += 162;
+ for (j = 0; j < 16; ++j)
+ num += pic->huffman_table.table[i].num_ac_codes[j];
+ assert(num <= 162);
+ memcpy((buf + size), &pic->huffman_table.table[i].ac_values, num);
+ size += num;
}
bs = (uint16_t*)&buf[len_pos];