From e69e2f88c7dc773c075388c8a750a142e32681d0 Mon Sep 17 00:00:00 2001 From: Chandler Chen Date: Wed, 16 Apr 2025 17:28:18 +0800 Subject: [PATCH] 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 Change-Id: I7e544e127f324df42418765adc5a7a51e082736e --- mpp/codec/dec/h265/h265d_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpp/codec/dec/h265/h265d_parser.c b/mpp/codec/dec/h265/h265d_parser.c index 44bae87b..5c1c40d6 100644 --- a/mpp/codec/dec/h265/h265d_parser.c +++ b/mpp/codec/dec/h265/h265d_parser.c @@ -1531,7 +1531,7 @@ RK_S32 mpp_hevc_extract_rbsp(HEVCContext *s, const RK_U8 *src, int length, s->skipped_bytes = 0; #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 */ \ length = i; \ break; \