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 <jamr...@gmail.com>
---
 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;
-- 
2.46.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to