[FFmpeg-devel] [PATCH 27/39] lavc/hevcdec: move per-slice local_ctx setup out of hls_slice_header()

Anton Khirnov anton at khirnov.net
Fri Jun 7 16:01:23 EEST 2024


Into decode_slice_data(). This is a step towards constifying
HEVCContext in hls_slice_header().
---
 libavcodec/hevc/hevcdec.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index bbcaa350c7..cda52e05ef 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -1014,14 +1014,7 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb)
         return AVERROR_INVALIDDATA;
     }
 
-    s->local_ctx[0].first_qp_group = !s->sh.dependent_slice_segment_flag;
-
-    if (!pps->cu_qp_delta_enabled_flag)
-        s->local_ctx[0].qp_y = s->sh.slice_qp;
-
     s->slice_initialized = 1;
-    s->local_ctx[0].tu.cu_qp_offset_cb = 0;
-    s->local_ctx[0].tu.cu_qp_offset_cr = 0;
 
     return 0;
 }
@@ -2818,6 +2811,14 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext
         }
     }
 
+    s->local_ctx[0].first_qp_group = !s->sh.dependent_slice_segment_flag;
+
+    if (!pps->cu_qp_delta_enabled_flag)
+        s->local_ctx[0].qp_y = s->sh.slice_qp;
+
+    s->local_ctx[0].tu.cu_qp_offset_cb = 0;
+    s->local_ctx[0].tu.cu_qp_offset_cr = 0;
+
     if (s->avctx->active_thread_type == FF_THREAD_SLICE  &&
         s->sh.num_entry_point_offsets > 0                &&
         pps->num_tile_rows == 1 && pps->num_tile_columns == 1)
-- 
2.43.0



More information about the ffmpeg-devel mailing list