• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/intel-driver


Commit MetaInfo

修订版896316a21f72c9599f2bc4cd504b9256cb6649fb (tree)
时间2015-03-24 13:05:25
作者Olivier Crete <olivier.crete@coll...>
CommiterXiang, Haihao

Log Message

gen7_mfd: Optimise start code search

Code inspired from GStreamer

See https://bugs.freedesktop.org/show_bug.cgi?id=89507

Signed-off-by: Olivier Crete <olivier.crete@collabora.com>

更改概述

差异

--- a/src/gen7_mfd.c
+++ b/src/gen7_mfd.c
@@ -1043,21 +1043,29 @@ uint32_t mpeg2_get_slice_data_length(dri_bo *slice_data_bo, VASliceParameterBuff
10431043 uint8_t *buf;
10441044 uint32_t buf_offset = slice_param->slice_data_offset + (slice_param->macroblock_offset >> 3);
10451045 uint32_t buf_size = slice_param->slice_data_size - (slice_param->macroblock_offset >> 3);
1046- uint32_t i;
1046+ uint32_t i = 0;
10471047
10481048 dri_bo_map(slice_data_bo, 0);
10491049 buf = (uint8_t *)slice_data_bo->virtual + buf_offset;
10501050
1051- for (i = 3; i < buf_size; i++) {
1052- if (buf[i - 3] &&
1053- !buf[i - 2] &&
1054- !buf[i - 1] &&
1055- !buf[i]) {
1056- dri_bo_unmap(slice_data_bo);
1057- return i - 3 + 1;
1058- }
1051+ if (buf_size < 4)
1052+ return buf_size;
1053+
1054+ while (i <= (buf_size - 4)) {
1055+ if (buf[i + 2] > 1) {
1056+ i += 3;
1057+ } else if (buf[i + 1]) {
1058+ i += 2;
1059+ } else if (buf[i] || buf[i + 2] != 1) {
1060+ i++;
1061+ } else {
1062+ break;
1063+ }
10591064 }
10601065
1066+ if (i <= (buf_size - 4))
1067+ buf_size = i;
1068+
10611069 dri_bo_unmap(slice_data_bo);
10621070 return buf_size;
10631071 }