diff mbox series

[FFmpeg-devel,v2,05/13] lavc/hevcdec: Fix the parsing for use_integer_mv_flag

Message ID 20221205060929.2511871-5-fei.w.wang@intel.com
State New
Headers show
Series [FFmpeg-devel,v2,01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Wang, Fei W Dec. 5, 2022, 6:09 a.m. UTC
From: Linjie Fu <linjie.fu@intel.com>

According to 7.3.6.1, use_integer_mv_flag should be parsed if
motion_vector_resolution_control_idc equals to 2. If not present, it
equals to motion_vector_resolution_control_idc.

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
 libavcodec/hevcdec.c | 8 ++++++++
 libavcodec/hevcdec.h | 1 +
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index f9a97ac7f5..52fa627133 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -839,6 +839,14 @@  static int hls_slice_header(HEVCContext *s)
                        sh->max_num_merge_cand);
                 return AVERROR_INVALIDDATA;
             }
+
+            // Syntax in 7.3.6.1
+            if (s->ps.sps->motion_vector_resolution_control_idc == 2)
+                sh->use_integer_mv_flag = get_bits1(gb);
+            else
+                // Inferred to be equal to motion_vector_resolution_control_idc if not present
+                sh->use_integer_mv_flag = s->ps.sps->motion_vector_resolution_control_idc;
+
         }
 
         sh->slice_qp_delta = get_se_golomb(gb);
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index 7841ba8565..a7fc669bcb 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -305,6 +305,7 @@  typedef struct SliceHeader {
     int tc_offset;      ///< tc_offset_div2 * 2
 
     unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand
+    uint8_t use_integer_mv_flag;
 
     unsigned *entry_point_offset;
     int * offset;