summaryrefslogtreecommitdiff
path: root/src/gen7_mfd.c
diff options
context:
space:
mode:
authorcarpalis <jerome.borsboom@carpalis.nl>2017-10-21 12:22:19 +0200
committerXiang, Haihao <haihao.xiang@intel.com>2018-01-05 14:57:31 +0800
commitf5aec8df5d853961cdba65961893102094909f08 (patch)
tree36d066a25a1b7cb17ef303c64ff4126be051544b /src/gen7_mfd.c
parent3d5c53dcdc25ea09c6a469c91c2555ad63e2b7a0 (diff)
downloadlibva-intel-driver-f5aec8df5d853961cdba65961893102094909f08.tar.gz
genX_mfd: remove emulation byte on MB layer boundary
As stated in the PRM, VC-1 decoder hardware cannot handle the case where the second 0x00 byte in the emulation prevention pattern 0x00 0x00 0x03 (0x00-0x03) coincides with the start of the MB layer. Fixed by overwriting the 0x03 byte with the previous 0x00 byte and adjusting the MB layer byte offset accordingly. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Diffstat (limited to 'src/gen7_mfd.c')
-rw-r--r--src/gen7_mfd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gen7_mfd.c b/src/gen7_mfd.c
index 1e6911e2..1bf6500c 100644
--- a/src/gen7_mfd.c
+++ b/src/gen7_mfd.c
@@ -1761,7 +1761,12 @@ gen7_mfd_vc1_get_macroblock_bit_offset(uint8_t *buf, int in_slice_data_bit_offse
else {
for (i = 0, j = 0; i < slice_header_size; i++, j++) {
if (!buf[j] && !buf[j + 1] && buf[j + 2] == 3 && buf[j + 3] < 4) {
- i++, j += 2;
+ if (i < slice_header_size - 1)
+ i++, j += 2;
+ else {
+ buf[j + 2] = buf[j + 1];
+ j++;
+ }
}
}
@@ -1784,7 +1789,7 @@ gen7_mfd_vc1_bsd_object(VADriverContextP ctx,
int macroblock_offset;
uint8_t *slice_data = NULL;
- dri_bo_map(slice_data_bo, 0);
+ dri_bo_map(slice_data_bo, True);
slice_data = (uint8_t *)(slice_data_bo->virtual + slice_param->slice_data_offset);
macroblock_offset = gen7_mfd_vc1_get_macroblock_bit_offset(slice_data,
slice_param->macroblock_offset,