diff mbox series

[FFmpeg-devel,v2,1/2] hevc_ps: fix cpb_cnt_minus1 initialization

Message ID 20230910152522.27429-2-llyyr.public@gmail.com
State Accepted
Commit 06241c31546a089eecbd5504fe6c9e27fdc68ea0
Headers show
Series [FFmpeg-devel,v2,1/2] hevc_ps: fix cpb_cnt_minus1 initialization | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

llyyr Sept. 10, 2023, 3:25 p.m. UTC
Fixes: fc429d785e9e24c5520ce716d4bc3b5547e581eb

cpb_cnt used to be initialized to 1 before
fc429d785e9e24c5520ce716d4bc3b5547e581eb so cpb_cnt_minus1 should be
initialized to 0.

Also add +1 to the decode_sublayer_hrd call to account for the change to
the offset
---
 libavcodec/hevc_ps.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index bdd623507d..ac3fe55b07 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -406,8 +406,6 @@  static int decode_hrd(GetBitContext *gb, int common_inf_present,
     for (int i = 0; i < max_sublayers; i++) {
         hdr->flags.fixed_pic_rate_general_flag = get_bits1(gb);
 
-        hdr->cpb_cnt_minus1[i] = 1;
-
         if (!hdr->flags.fixed_pic_rate_general_flag)
             hdr->flags.fixed_pic_rate_within_cvs_flag = get_bits1(gb);
 
@@ -426,11 +424,11 @@  static int decode_hrd(GetBitContext *gb, int common_inf_present,
         }
 
         if (hdr->flags.nal_hrd_parameters_present_flag)
-            decode_sublayer_hrd(gb, hdr->cpb_cnt_minus1[i], &hdr->nal_params[i],
+            decode_sublayer_hrd(gb, hdr->cpb_cnt_minus1[i]+1, &hdr->nal_params[i],
                                 hdr->flags.sub_pic_hrd_params_present_flag);
 
         if (hdr->flags.vcl_hrd_parameters_present_flag)
-            decode_sublayer_hrd(gb, hdr->cpb_cnt_minus1[i], &hdr->vcl_params[i],
+            decode_sublayer_hrd(gb, hdr->cpb_cnt_minus1[i]+1, &hdr->vcl_params[i],
                                 hdr->flags.sub_pic_hrd_params_present_flag);
     }