[FFmpeg-cvslog] avformat/vvc: fix parsing some early VPS bitstream values

James Almer git at videolan.org
Sat May 18 19:31:15 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri May 17 16:23:41 2024 -0300| [a48203d51aa4836150f9379448f6b2a1d5ca9d36] | committer: James Almer

avformat/vvc: fix parsing some early VPS bitstream values

vps_default_ptl_dpb_hrd_max_tid_flag needs to always be set, and
vps_direct_ref_layer_flag needs to be read even when
vps_max_tid_ref_present_flag is false.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a48203d51aa4836150f9379448f6b2a1d5ca9d36
---

 libavformat/vvc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/vvc.c b/libavformat/vvc.c
index 09a4aa52e8..b147f44683 100644
--- a/libavformat/vvc.c
+++ b/libavformat/vvc.c
@@ -252,6 +252,8 @@ static int vvcc_parse_vps(GetBitContext *gb,
 
     if (vps_max_layers_minus1 > 0 && vps_max_sublayers_minus1 > 0)
         vps_default_ptl_dpb_hrd_max_tid_flag = get_bits1(gb);
+    else
+        vps_default_ptl_dpb_hrd_max_tid_flag = 0;
     if (vps_max_layers_minus1 > 0)
         vps_all_independent_layers_flag = get_bits1(gb);
     else
@@ -260,10 +262,11 @@ static int vvcc_parse_vps(GetBitContext *gb,
     for (int i = 0; i <= vps_max_layers_minus1; i++) {
         skip_bits(gb, 6);    //vps_layer_id[i]
         if (i > 0 && !vps_all_independent_layers_flag) {
-            if (get_bits1(gb)) {    // vps_independent_layer_flag[i]
+            if (!get_bits1(gb)) {   // vps_independent_layer_flag[i]
                 unsigned int vps_max_tid_ref_present_flag = get_bits1(gb);
                 for (int j = 0; j < i; j++) {
-                    if (vps_max_tid_ref_present_flag && get_bits1(gb))  // vps_direct_ref_layer_flag[i][j]
+                    unsigned int vps_direct_ref_layer_flag = get_bits1(gb);
+                    if (vps_max_tid_ref_present_flag && vps_direct_ref_layer_flag)
                         skip_bits(gb, 3);                               // vps_max_tid_il_ref_pics_plus1
                 }
             }



More information about the ffmpeg-cvslog mailing list