[FFmpeg-devel] [PATCH] avcodec/hevc_ps: Constify VPS, SPS pointers when parsing PPS

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri Jun 30 02:36:17 EEST 2023


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/hevc_ps.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index d7930d3ac3..4c4c1e2c17 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -725,7 +725,8 @@ static void set_default_scaling_list_data(ScalingList *sl)
     memcpy(sl->sl[3][5], default_scaling_list_inter, 64);
 }
 
-static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx, ScalingList *sl, HEVCSPS *sps)
+static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx,
+                             ScalingList *sl, const HEVCSPS *sps)
 {
     uint8_t scaling_list_pred_mode_flag;
     uint8_t scaling_list_dc_coef[2][6];
@@ -1412,7 +1413,7 @@ static int colour_mapping_table(GetBitContext *gb, AVCodecContext *avctx, HEVCPP
 }
 
 static int pps_multilayer_extension(GetBitContext *gb, AVCodecContext *avctx,
-                                    HEVCPPS *pps, HEVCSPS *sps, HEVCVPS *vps)
+                                    HEVCPPS *pps, const HEVCSPS *sps, const HEVCVPS *vps)
 {
     pps->poc_reset_info_present_flag = get_bits1(gb);
     pps->pps_infer_scaling_list_flag = get_bits1(gb);
@@ -1483,7 +1484,7 @@ static void delta_dlt(GetBitContext *gb, HEVCPPS *pps)
 }
 
 static int pps_3d_extension(GetBitContext *gb, AVCodecContext *avctx,
-                            HEVCPPS *pps, HEVCSPS *sps)
+                            HEVCPPS *pps, const HEVCSPS *sps)
 {
     unsigned int pps_depth_layers_minus1;
 
@@ -1507,7 +1508,7 @@ static int pps_3d_extension(GetBitContext *gb, AVCodecContext *avctx,
 }
 
 static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
-                                HEVCPPS *pps, HEVCSPS *sps)
+                                HEVCPPS *pps, const HEVCSPS *sps)
 {
     if (pps->transform_skip_enabled_flag) {
         pps->log2_max_transform_skip_block_size = get_ue_golomb_31(gb) + 2;
@@ -1547,7 +1548,7 @@ static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
 }
 
 static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx,
-                             HEVCPPS *pps, HEVCSPS *sps)
+                             HEVCPPS *pps, const HEVCSPS *sps)
 {
     int num_comps, ret;
 
@@ -1599,7 +1600,7 @@ static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx,
 }
 
 static inline int setup_pps(AVCodecContext *avctx, GetBitContext *gb,
-                            HEVCPPS *pps, HEVCSPS *sps)
+                            HEVCPPS *pps, const HEVCSPS *sps)
 {
     int log2_diff;
     int pic_area_in_ctbs;
@@ -1733,8 +1734,8 @@ static inline int setup_pps(AVCodecContext *avctx, GetBitContext *gb,
 int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
                            HEVCParamSets *ps)
 {
-    HEVCSPS      *sps = NULL;
-    HEVCVPS      *vps = NULL;
+    const HEVCSPS *sps = NULL;
+    const HEVCVPS *vps = NULL;
     int i, ret = 0;
     unsigned int pps_id = 0;
     ptrdiff_t nal_size;
-- 
2.34.1



More information about the ffmpeg-devel mailing list