[FFmpeg-cvslog] cbs_h266: fix inference for xh_deblocking_filter_disabled_flag

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


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

cbs_h266: fix inference for xh_deblocking_filter_disabled_flag

if !ph_deblocking_params_present_flag is true, ph_deblocking_filter_disabled_flag infered from pps
if !sh_deblocking_params_present_flag is true, sh_deblocking_filter_disabled_flag infered from ph

Failed clips:
ENT444MAINTIER_C_Sony_3.bit
ENT444HIGHTIER_D_Sony_3.bit

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

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

 libavcodec/cbs_h266_syntax_template.c | 76 +++++++++++++----------------------
 1 file changed, 28 insertions(+), 48 deletions(-)

diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index 801feedb4a..7277154c40 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -2938,20 +2938,14 @@ static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw,
         infer(ph_sao_chroma_enabled_flag, 0);
     }
 
-    if (pps->pps_dbf_info_in_ph_flag) {
+    if (pps->pps_dbf_info_in_ph_flag)
         flag(ph_deblocking_params_present_flag);
-        if (current->ph_deblocking_params_present_flag) {
-            if (!pps->pps_deblocking_filter_disabled_flag) {
-                flag(ph_deblocking_filter_disabled_flag);
-            } else {
-                if (pps->pps_deblocking_filter_disabled_flag &&
-                    current->ph_deblocking_params_present_flag) {
-                    infer(ph_deblocking_filter_disabled_flag, 0);
-                } else {
-                    infer(ph_deblocking_filter_disabled_flag,
-                          pps->pps_deblocking_filter_disabled_flag);
-                }
-            }
+    else
+        infer(ph_deblocking_params_present_flag, 0);
+
+    if (current->ph_deblocking_params_present_flag) {
+        if (!pps->pps_deblocking_filter_disabled_flag) {
+            flag(ph_deblocking_filter_disabled_flag);
             if (!current->ph_deblocking_filter_disabled_flag) {
                 se(ph_luma_beta_offset_div2, -12, 12);
                 se(ph_luma_tc_offset_div2, -12, 12);
@@ -2970,25 +2964,19 @@ static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw,
                     infer(ph_cr_tc_offset_div2,
                           current->ph_luma_tc_offset_div2);
                 }
-            } else {
-                infer(ph_luma_beta_offset_div2, pps->pps_luma_beta_offset_div2);
-                infer(ph_luma_tc_offset_div2, pps->pps_luma_tc_offset_div2);
-                if (pps->pps_chroma_tool_offsets_present_flag) {
-                    infer(ph_cb_beta_offset_div2, pps->pps_cb_beta_offset_div2);
-                    infer(ph_cb_tc_offset_div2, pps->pps_cb_tc_offset_div2);
-                    infer(ph_cr_beta_offset_div2, pps->pps_cr_beta_offset_div2);
-                    infer(ph_cr_tc_offset_div2, pps->pps_cr_tc_offset_div2);
-                } else {
-                    infer(ph_cb_beta_offset_div2,
-                          current->ph_luma_beta_offset_div2);
-                    infer(ph_cb_tc_offset_div2,
-                          current->ph_luma_tc_offset_div2);
-                    infer(ph_cr_beta_offset_div2,
-                          current->ph_luma_beta_offset_div2);
-                    infer(ph_cr_tc_offset_div2,
-                          current->ph_luma_tc_offset_div2);
-                }
             }
+        } else {
+            infer(ph_deblocking_filter_disabled_flag, 0);
+        }
+    } else {
+        infer(ph_deblocking_filter_disabled_flag, pps->pps_deblocking_filter_disabled_flag);
+        if (!current->ph_deblocking_filter_disabled_flag) {
+            infer(ph_luma_beta_offset_div2, pps->pps_luma_beta_offset_div2);
+            infer(ph_luma_tc_offset_div2, pps->pps_luma_tc_offset_div2);
+            infer(ph_cb_beta_offset_div2, pps->pps_cb_beta_offset_div2);
+            infer(ph_cb_tc_offset_div2, pps->pps_cb_tc_offset_div2);
+            infer(ph_cr_beta_offset_div2, pps->pps_cr_beta_offset_div2);
+            infer(ph_cr_tc_offset_div2, pps->pps_cr_tc_offset_div2);
         }
     }
 
@@ -3321,9 +3309,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
         if (!pps->pps_deblocking_filter_disabled_flag)
             flag(sh_deblocking_filter_disabled_flag);
         else
-            infer(sh_deblocking_filter_disabled_flag,
-                  !(pps->pps_deblocking_filter_disabled_flag &&
-                    current->sh_deblocking_params_present_flag));
+            infer(sh_deblocking_filter_disabled_flag, 0);
         if (!current->sh_deblocking_filter_disabled_flag) {
             se(sh_luma_beta_offset_div2, -12, 12);
             se(sh_luma_tc_offset_div2, -12, 12);
@@ -3340,22 +3326,16 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
                       current->sh_luma_beta_offset_div2);
                 infer(sh_cr_tc_offset_div2, current->sh_luma_tc_offset_div2);
             }
-        } else {
+        }
+    } else {
+        infer(sh_deblocking_filter_disabled_flag, ph->ph_deblocking_filter_disabled_flag);
+        if (!current->sh_deblocking_filter_disabled_flag) {
             infer(sh_luma_beta_offset_div2, ph->ph_luma_beta_offset_div2);
             infer(sh_luma_tc_offset_div2, ph->ph_luma_tc_offset_div2);
-            if (pps->pps_chroma_tool_offsets_present_flag) {
-                infer(sh_cb_beta_offset_div2, ph->ph_cb_beta_offset_div2);
-                infer(sh_cb_tc_offset_div2, ph->ph_cb_tc_offset_div2);
-                infer(sh_cr_beta_offset_div2, ph->ph_cr_beta_offset_div2);
-                infer(sh_cr_tc_offset_div2, ph->ph_cr_beta_offset_div2);
-            } else {
-                infer(sh_cb_beta_offset_div2,
-                      current->sh_luma_beta_offset_div2);
-                infer(sh_cb_tc_offset_div2, current->sh_luma_tc_offset_div2);
-                infer(sh_cr_beta_offset_div2,
-                      current->sh_luma_beta_offset_div2);
-                infer(sh_cr_tc_offset_div2, current->sh_luma_tc_offset_div2);
-            }
+            infer(sh_cb_beta_offset_div2, ph->ph_cb_beta_offset_div2);
+            infer(sh_cb_tc_offset_div2, ph->ph_cb_tc_offset_div2);
+            infer(sh_cr_beta_offset_div2, ph->ph_cr_beta_offset_div2);
+            infer(sh_cr_tc_offset_div2, ph->ph_cr_tc_offset_div2);
         }
     }
 



More information about the ffmpeg-cvslog mailing list