From e792463b4b1d289048a9c735c513f0f535e8a558 Mon Sep 17 00:00:00 2001 From: rcaridade145 Date: Fri, 12 Dec 2025 15:07:53 +0000 Subject: [PATCH] Refactor slice header processing logic https://android.googlesource.com/platform/external/libavc/+/23247c81421129686df32536ed9a15b0508acd39 --- .../ih264d/decoder/ih264d_parse_slice.c | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/dependencies/ih264d/decoder/ih264d_parse_slice.c b/dependencies/ih264d/decoder/ih264d_parse_slice.c index 266c69bf..dd144cb7 100644 --- a/dependencies/ih264d/decoder/ih264d_parse_slice.c +++ b/dependencies/ih264d/decoder/ih264d_parse_slice.c @@ -1435,28 +1435,13 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice, i1_is_end_of_poc = 0; } - /* Increment only if the current slice has atleast 1 more MB */ - if (ps_dec->u4_first_slice_in_pic == 0 && - (ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice < - (UWORD32)(ps_dec->u2_total_mbs_coded >> ps_dec->ps_cur_slice->u1_mbaff_frame_flag))) - { - ps_dec->ps_parse_cur_slice++; - ps_dec->u2_cur_slice_num++; - // in the case of single core increment ps_decode_cur_slice - if(ps_dec->u1_separate_parse == 0) - { - ps_dec->ps_decode_cur_slice++; - } - } - - ps_dec->u1_slice_header_done = 0; - - + if(u1_field_pic_flag) { ps_dec->u2_prv_frame_num = u2_frame_num; } + if(ps_cur_slice->u1_mmco_equalto5) { WORD32 i4_temp_poc; @@ -1519,6 +1504,23 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice, } } + /* Increment only if the current slice has atleast 1 more MB */ + if (ps_dec->u4_first_slice_in_pic == 0 && + (ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice < + (UWORD32)(ps_dec->u2_total_mbs_coded >> ps_dec->ps_cur_slice->u1_mbaff_frame_flag))) + { + ps_dec->ps_parse_cur_slice++; + ps_dec->u2_cur_slice_num++; + // in the case of single core increment ps_decode_cur_slice + if(ps_dec->u1_separate_parse == 0) + { + ps_dec->ps_decode_cur_slice++; + } + } + + ps_dec->u1_slice_header_done = 0; + + /*--------------------------------------------------------------------*/ /* Copy the values read from the bitstream to the slice header and then*/ /* If the slice is first slice in picture, then do Start of Picture */