diff mbox series

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

Message ID 20210811140340.4624-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/cbs_h264: infer all pic_order_cnt slice fields when not coded | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer Aug. 11, 2021, 2:03 p.m. UTC
Also change the syntax for some checks, to more closely follow the spec.

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

Patch

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)