diff mbox series

[FFmpeg-devel] avcodec/cbs_h265: fix valid range for {left, right}_view_id

Message ID 20240827125237.56-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/cbs_h265: fix valid range for {left, right}_view_id | 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

James Almer Aug. 27, 2024, 12:52 p.m. UTC
view_id_len in VPS is 4 bits, so view_id values can be up to 15 bits long.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/cbs_h265.h                 | 4 ++--
 libavcodec/cbs_h265_syntax_template.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
index 892a35bd22..eec4bf0825 100644
--- a/libavcodec/cbs_h265.h
+++ b/libavcodec/cbs_h265.h
@@ -725,8 +725,8 @@  typedef struct H265RawSEI3DReferenceDisplaysInfo {
     uint8_t ref_viewing_distance_flag;
     uint8_t prec_ref_viewing_dist;
     uint8_t num_ref_displays_minus1;
-    uint8_t left_view_id[31];
-    uint8_t right_view_id[31];
+    uint16_t left_view_id[31];
+    uint16_t right_view_id[31];
     uint8_t exponent_ref_display_width[31];
     uint8_t mantissa_ref_display_width[31];
     uint8_t exponent_ref_viewing_distance[31];
diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
index 9f0281b8e8..e2805c7ff1 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -2299,8 +2299,8 @@  SEI_FUNC(sei_3d_reference_displays_info, (CodedBitstreamContext *ctx, RWContext
         ue(prec_ref_viewing_dist, 0, 31);
     ue(num_ref_displays_minus1, 0, 31);
     for (i = 0; i <= current->num_ref_displays_minus1; i++) {
-        ues(left_view_id[i], 0, UINT8_MAX, 1, i);
-        ues(right_view_id[i], 0, UINT8_MAX, 1, i);
+        ues(left_view_id[i], 0, MAX_UINT_BITS(15), 1, i);
+        ues(right_view_id[i], 0, MAX_UINT_BITS(15), 1, i);
         us(6, exponent_ref_display_width[i], 0, 62, 1, i);
         if (!current->exponent_ref_display_width[i])
             length = FFMAX(0, (int)current->prec_ref_display_width - 30);