[FFmpeg-cvslog] avcodec/hevc/ps: print the correct unsupported scalability value found

James Almer git at videolan.org
Sat Oct 5 20:38:01 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Oct  3 14:47:30 2024 -0300| [32e34692fb779844a11d7be2d9b6114e93af67a5] | committer: James Almer

avcodec/hevc/ps: print the correct unsupported scalability value found

With multilayer001.heic, which signals Spatial scalability:

Before:
[hevc @ ...] Scalability type 1 not supported
[hevc @ ...] Ignoring unsupported VPS extension

After:
[hevc @ ...] Scalability type 2 not supported
[hevc @ ...] Ignoring unsupported VPS extension

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

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

 libavcodec/hevc/ps.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c
index f18b88489b..3fc14c1e72 100644
--- a/libavcodec/hevc/ps.c
+++ b/libavcodec/hevc/ps.c
@@ -470,7 +470,7 @@ static int decode_vps_ext(GetBitContext *gb, AVCodecContext *avctx, HEVCVPS *vps
     PTL ptl_dummy;
     uint8_t max_sub_layers[HEVC_MAX_LAYERS];
 
-    int splitting_flag, dimension_id_len, view_id_len, num_add_olss,
+    int splitting_flag, dimension_id_len, view_id_len, num_add_olss, num_scalability_types,
         default_output_layer_idc, direct_dep_type_len, direct_dep_type,
         sub_layers_max_present, sub_layer_flag_info_present_flag, nb_ptl;
     unsigned non_vui_extension_length;
@@ -532,13 +532,17 @@ static int decode_vps_ext(GetBitContext *gb, AVCodecContext *avctx, HEVCVPS *vps
         return AVERROR_INVALIDDATA;
 
     splitting_flag = get_bits1(gb);
+    num_scalability_types = 0;
     for (int i = 0; i <= HEVC_SCALABILITY_MASK_MAX; i++) {
         int scalability_mask_flag = get_bits1(gb);
-        if (scalability_mask_flag != (i == HEVC_SCALABILITY_MULTIVIEW)) {
+        if (scalability_mask_flag && (i != HEVC_SCALABILITY_MULTIVIEW)) {
             av_log(avctx, AV_LOG_ERROR, "Scalability type %d not supported\n", i);
             return AVERROR_PATCHWELCOME;
         }
+        num_scalability_types += scalability_mask_flag;
     }
+    if (num_scalability_types != 1)
+        return AVERROR_INVALIDDATA;
 
     if (!splitting_flag)
         dimension_id_len = get_bits(gb, 3) + 1;



More information about the ffmpeg-cvslog mailing list