[FFmpeg-cvslog] cbs_h266: fix inference for sh_alf_enabled_flag

Nuo Mi git at videolan.org
Thu Aug 17 16:06:08 EEST 2023


ffmpeg | branch: master | Nuo Mi <nuomi2021 at gmail.com> | Tue Aug  8 18:58:57 2023 +0800| [d7f851b8c442b7a2acd79ccfb666ef3ba7e57943] | committer: James Almer

cbs_h266: fix inference for sh_alf_enabled_flag

if pps_alf_info_in_ph_flag is true
sh_alf_enabled_flag infered from ph

Failed clip:
LTRP_A_ERICSSON_3.bit

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

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

 libavcodec/cbs_h266_syntax_template.c | 81 ++++++++++++++++++++---------------
 1 file changed, 47 insertions(+), 34 deletions(-)

diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index 857882655b..801feedb4a 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -3111,44 +3111,57 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
     if (nal_unit_type == VVC_IDR_W_RADL || nal_unit_type == VVC_IDR_N_LP ||
         nal_unit_type == VVC_CRA_NUT || nal_unit_type == VVC_GDR_NUT)
         flag(sh_no_output_of_prior_pics_flag);
-    if (sps->sps_alf_enabled_flag && !pps->pps_alf_info_in_ph_flag) {
-        flag(sh_alf_enabled_flag);
-        if (current->sh_alf_enabled_flag) {
-            ub(3, sh_num_alf_aps_ids_luma);
-            for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++)
-                ubs(3, sh_alf_aps_id_luma[i], 1, i);
-            if (sps->sps_chroma_format_idc != 0) {
-                flag(sh_alf_cb_enabled_flag);
-                flag(sh_alf_cr_enabled_flag);
-            } else {
+
+    if (sps->sps_alf_enabled_flag) {
+        if (!pps->pps_alf_info_in_ph_flag) {
+            flag(sh_alf_enabled_flag);
+            if (current->sh_alf_enabled_flag) {
+                ub(3, sh_num_alf_aps_ids_luma);
+                for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++)
+                    ubs(3, sh_alf_aps_id_luma[i], 1, i);
+
+                if (sps->sps_chroma_format_idc != 0) {
+                    flag(sh_alf_cb_enabled_flag);
+                    flag(sh_alf_cr_enabled_flag);
+                }
+                if (current->sh_alf_cb_enabled_flag ||
+                    current->sh_alf_cr_enabled_flag) {
+                    ub(3, sh_alf_aps_id_chroma);
+                }
+
+                if (sps->sps_ccalf_enabled_flag) {
+                    flag(sh_alf_cc_cb_enabled_flag);
+                    if (current->sh_alf_cc_cb_enabled_flag)
+                        ub(3, sh_alf_cc_cb_aps_id);
+
+                    flag(sh_alf_cc_cr_enabled_flag);
+                    if (current->sh_alf_cc_cr_enabled_flag)
+                        ub(3, sh_alf_cc_cr_aps_id);
+                }
+            }
+        } else {
+            infer(sh_alf_enabled_flag, ph->ph_alf_enabled_flag);
+            if (current->sh_alf_enabled_flag) {
+                infer(sh_num_alf_aps_ids_luma, ph->ph_num_alf_aps_ids_luma);
+                for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++)
+                    infer(sh_alf_aps_id_luma[i], ph->ph_alf_aps_id_luma[i]);
+
                 infer(sh_alf_cb_enabled_flag, ph->ph_alf_cb_enabled_flag);
                 infer(sh_alf_cr_enabled_flag, ph->ph_alf_cr_enabled_flag);
-            }
-            if (current->sh_alf_cb_enabled_flag ||
-                current->sh_alf_cr_enabled_flag)
-                ub(3, sh_alf_aps_id_chroma);
-            else
-                infer(sh_alf_aps_id_chroma, ph->ph_alf_aps_id_chroma);
-            if (sps->sps_ccalf_enabled_flag) {
-                flag(sh_alf_cc_cb_enabled_flag);
-                if (current->sh_alf_cc_cb_enabled_flag)
-                    ub(3, sh_alf_cc_cb_aps_id);
-                else
-                    infer(sh_alf_cc_cb_aps_id, ph->ph_alf_cc_cb_aps_id);
-                flag(sh_alf_cc_cr_enabled_flag);
-                if (current->sh_alf_cc_cr_enabled_flag)
-                    ub(3, sh_alf_cc_cr_aps_id);
-                else
-                    infer(sh_alf_cc_cr_aps_id, ph->ph_alf_cc_cr_aps_id);
-            } else {
-                infer(sh_alf_cc_cb_enabled_flag, ph->ph_alf_cc_cb_enabled_flag);
-                infer(sh_alf_cc_cr_enabled_flag, ph->ph_alf_cc_cr_enabled_flag);
-                infer(sh_alf_cc_cb_aps_id, ph->ph_alf_cc_cb_aps_id);
-                infer(sh_alf_cc_cr_aps_id, ph->ph_alf_cc_cr_aps_id);
+                if (current->sh_alf_cb_enabled_flag ||current->sh_alf_cr_enabled_flag)
+                    infer(sh_alf_aps_id_chroma, ph->ph_alf_aps_id_chroma);
+
+                if (sps->sps_ccalf_enabled_flag) {
+                    infer(sh_alf_cc_cb_enabled_flag, ph->ph_alf_cc_cb_enabled_flag);
+                    if (current->sh_alf_cc_cb_enabled_flag)
+                        infer(sh_alf_cc_cb_aps_id, ph->ph_alf_cc_cb_aps_id);
+
+                    infer(sh_alf_cc_cr_enabled_flag, ph->ph_alf_cc_cr_enabled_flag);
+                    if (current->sh_alf_cc_cr_enabled_flag)
+                        infer(sh_alf_cc_cr_aps_id, ph->ph_alf_cc_cr_aps_id);
+                }
             }
         }
-    } else {
-        infer(sh_alf_enabled_flag, 0);
     }
 
     if (current->sh_picture_header_in_slice_header_flag) {



More information about the ffmpeg-cvslog mailing list