diff mbox series

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

Message ID 20240607130135.9088-27-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/39] lavc/hevcdec: do not free SliceHeader arrays in pic_arrays_free() | expand

Commit Message

Anton Khirnov June 7, 2024, 1:01 p.m. UTC
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 mbox series

Patch

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)