fix[h265d_parser]: fix startcode finder for 00 00 00 xx case

Platform: All
Spec: h265

Error case:
nalu payloads with byte sequence 00 00 00 xx data used to be incorrectly detected as start code.

Solution:
Modify the start code detection logic by replacing
condition src[i+2] < 2 with src[i+2] == 1

Reported by: redmine #545594

Source: kiloview-p3.hevc

Signed-off-by: Chandler Chen <chandler.chen@rock-chips.com>
Change-Id: I7e544e127f324df42418765adc5a7a51e082736e
This commit is contained in:
Chandler Chen
2025-04-16 17:28:18 +08:00
parent 4999c7762f
commit e69e2f88c7

View File

@@ -1531,7 +1531,7 @@ RK_S32 mpp_hevc_extract_rbsp(HEVCContext *s, const RK_U8 *src, int length,
s->skipped_bytes = 0; s->skipped_bytes = 0;
#define STARTCODE_TEST \ #define STARTCODE_TEST \
if (i + 2 < length && src[i + 1] == 0 && src[i + 2] < 2) { \ if (i + 2 < length && src[i + 1] == 0 && src[i + 2] == 1) { \
/* startcode, so we must be past the end */ \ /* startcode, so we must be past the end */ \
length = i; \ length = i; \
break; \ break; \