[FFmpeg-devel] [PATCH] avcodec/cbs_h264: infer all pic_order_cnt slice fields when not coded

James Almer jamrial at gmail.com
Wed Aug 11 17:03:40 EEST 2021


Also change the syntax for some checks, to more closely follow the spec.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/cbs_h264_syntax_template.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
index 0f8bba4a0d..5de7b5b76b 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -1106,19 +1106,21 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw,
         if (pps->bottom_field_pic_order_in_frame_present_flag &&
             !current->field_pic_flag)
             se(delta_pic_order_cnt_bottom, INT32_MIN + 1, INT32_MAX);
+        else
+            infer(delta_pic_order_cnt_bottom, 0);
+    } else
+        infer(delta_pic_order_cnt_bottom, 0);
 
-    } else if (sps->pic_order_cnt_type == 1) {
-        if (!sps->delta_pic_order_always_zero_flag) {
-            se(delta_pic_order_cnt[0], INT32_MIN + 1, INT32_MAX);
-            if (pps->bottom_field_pic_order_in_frame_present_flag &&
-                !current->field_pic_flag)
-                se(delta_pic_order_cnt[1], INT32_MIN + 1, INT32_MAX);
-            else
-                infer(delta_pic_order_cnt[1], 0);
-        } else {
-            infer(delta_pic_order_cnt[0], 0);
+    if (sps->pic_order_cnt_type == 1 && !sps->delta_pic_order_always_zero_flag) {
+        se(delta_pic_order_cnt[0], INT32_MIN + 1, INT32_MAX);
+        if (pps->bottom_field_pic_order_in_frame_present_flag &&
+            !current->field_pic_flag)
+            se(delta_pic_order_cnt[1], INT32_MIN + 1, INT32_MAX);
+        else
             infer(delta_pic_order_cnt[1], 0);
-        }
+    } else {
+        infer(delta_pic_order_cnt[0], 0);
+        infer(delta_pic_order_cnt[1], 0);
     }
 
     if (pps->redundant_pic_cnt_present_flag)
-- 
2.32.0



More information about the ffmpeg-devel mailing list