diff mbox series

[FFmpeg-devel,16/39] lavc/hevcdec: do not pass HEVCContext to decode_lt_rps()

Message ID 20240607130135.9088-16-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
Pass the two numbers needed from it explicitly.

Makes it clear that HEVCContext is not modified by this function.
---
 libavcodec/hevc/hevcdec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 6a9de79dcd..960a06c773 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -260,8 +260,8 @@  static int pred_weight_table(SliceHeader *sh, void *logctx,
     return 0;
 }
 
-static int decode_lt_rps(HEVCContext *s, const HEVCSPS *sps, LongTermRPS *rps,
-                         GetBitContext *gb)
+static int decode_lt_rps(const HEVCSPS *sps, LongTermRPS *rps,
+                         GetBitContext *gb, int cur_poc, int poc_lsb)
 {
     int max_poc_lsb    = 1 << sps->log2_max_poc_lsb;
     int prev_delta_msb = 0;
@@ -306,7 +306,7 @@  static int decode_lt_rps(HEVCContext *s, const HEVCSPS *sps, LongTermRPS *rps,
             if (i && i != nb_sps)
                 delta += prev_delta_msb;
 
-            poc = rps->poc[i] + s->poc - delta * max_poc_lsb - s->sh.pic_order_cnt_lsb;
+            poc = rps->poc[i] + cur_poc - delta * max_poc_lsb - poc_lsb;
             if (poc != (int32_t)poc)
                 return AVERROR_INVALIDDATA;
             rps->poc[i] = poc;
@@ -744,7 +744,7 @@  static int hls_slice_header(HEVCContext *s, GetBitContext *gb)
             sh->short_term_ref_pic_set_size = pos - get_bits_left(gb);
 
             pos = get_bits_left(gb);
-            ret = decode_lt_rps(s, sps, &sh->long_term_rps, gb);
+            ret = decode_lt_rps(sps, &sh->long_term_rps, gb, s->poc, sh->pic_order_cnt_lsb);
             if (ret < 0) {
                 av_log(s->avctx, AV_LOG_WARNING, "Invalid long term RPS.\n");
                 if (s->avctx->err_recognition & AV_EF_EXPLODE)