From patchwork Sun Feb 25 22:30:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Plowman X-Patchwork-Id: 46525 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c51b:b0:19e:cdac:8cce with SMTP id gm27csp1060135pzb; Sun, 25 Feb 2024 14:31:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUttuLIMqW8aJBmUEk3a3QjO4trvl/cYKUaLXJgx/b/QKb5CWbpaYrTvPhNeEy/9hssJYHZiyKNLO+TjToUs/yO1BnBzE+XypLbnQ== X-Google-Smtp-Source: AGHT+IFtgHSBd2g/fUugE+Iyy+1yga5I9l+cgds+KUOQJQMhBXOmD0j4/3vPnoJ3+07PbieuaWJ0 X-Received: by 2002:a17:906:3397:b0:a3f:d797:e6e2 with SMTP id v23-20020a170906339700b00a3fd797e6e2mr3309510eja.28.1708900302327; Sun, 25 Feb 2024 14:31:42 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id pw5-20020a17090720a500b00a3f50f4e640si1560074ejb.232.2024.02.25.14.31.42; Sun, 25 Feb 2024 14:31:42 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@frankplowman.com header.s=zmail header.b=Nabforlk; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0F23468C79B; Mon, 26 Feb 2024 00:31:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from sender11-op-o12.zoho.eu (sender11-op-o12.zoho.eu [31.186.226.226]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D7DE068C0A0 for ; Mon, 26 Feb 2024 00:31:33 +0200 (EET) Delivered-To: post@frankplowman.com ARC-Seal: i=1; a=rsa-sha256; t=1708900291; cv=none; d=zohomail.eu; s=zohoarc; b=MumvM3RhPOCDVm4pnJ9KVJneosYlenv7Lxp+015ZrHkJxyQ5SG5F4XJI+1eA5XNe0EReRxi44MtCKZWwu/yC7w2dOgxm+5pDFM2ZKefPaqA1ZQrnsunBqvtXB6jKN5pWyngkb8XI6r5yayOfNqBkDph61yhS0fptUZK42Du0fH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1708900291; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=xsym3r4OnFQUw9/vP6VEdyD2Z85qTCS5uXPLLE+NNAQ=; b=atn3EPMWxuPea7ZCCgm3FMwUjNnhOP3K/6P59k/FFFYV91lw1jQxyiTqD4mKRELtB9sH76BazLz8bWpPBJRzZmJnGQOMjWxuVky/NCq8kAy2L0V5Sy+20xYI/CEzq/ZgsftTBisd5AomAwp1HcPsT4vgJwmyIhqjFqF94lonSnk= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=frankplowman.com; spf=pass smtp.mailfrom=post@frankplowman.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1708900291; s=zmail; d=frankplowman.com; i=post@frankplowman.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=xsym3r4OnFQUw9/vP6VEdyD2Z85qTCS5uXPLLE+NNAQ=; b=NabforlkWNyggwiMKa3lwrL5y2jeUTAe7w6vG8KxMIX79nSOFZvPJs5ecOR0avku 7f992hAEpBWbYEQYnidyQsH6HZ4aK47kwncnDe/ElHf+ZdgCemvqmkSePuqhASLezUt NNOrEg9GkvEZ66/F/4d1OOvK/pdnAOq+1mmdAGf4= Received: from localhost.localdomain (frankplowman.com [51.89.148.29]) by mx.zoho.eu with SMTPS id 1708900290479982.3251692561154; Sun, 25 Feb 2024 23:31:30 +0100 (CET) From: Frank Plowman To: ffmpeg-devel@ffmpeg.org Date: Sun, 25 Feb 2024 22:30:42 +0000 Message-ID: <20240225223127.38395-1-post@frankplowman.com> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 X-ZohoMailClient: External Subject: [FFmpeg-devel] [PATCH] lavc/vvc: Read subpic ID when only one subpicture is present X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Frank Plowman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 48lkvC7Zf3zl Previously, the following syntax elements were not read in the case sps_num_subpics_minus is 0: * sps_subpic_id_len_minus1 * sps_subpic_id_mapping_explicitly_signalled_flag * sps_subpic_id_mapping_present_flag * sps_subpic_id[i] This was causing failures to decode bitstreams, for example the DVB's "VVC HDR UHDTV1 OpenGOP 3840x2160 50fps HLG10 PiP" V&V bitstream. Patch fixes this by moving the reads for these syntax elements out a scope. Signed-off-by: Frank Plowman --- Sorry, should probably have put this in with 53ab7ff67e7ee9e7cae5cb0449203a7951cbe029. libavcodec/cbs_h266_syntax_template.c | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 1d4d0c796f..623417fce4 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -1213,30 +1213,30 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, infer(sps_loop_filter_across_subpic_enabled_flag[i], 0); } } - ue(sps_subpic_id_len_minus1, 0, 15); - if ((1 << (current->sps_subpic_id_len_minus1 + 1)) < - current->sps_num_subpics_minus1 + 1) { - av_log(ctx->log_ctx, AV_LOG_ERROR, - "sps_subpic_id_len_minus1(%d) is too small\n", - current->sps_subpic_id_len_minus1); - return AVERROR_INVALIDDATA; - } - flag(sps_subpic_id_mapping_explicitly_signalled_flag); - if (current->sps_subpic_id_mapping_explicitly_signalled_flag) { - flag(sps_subpic_id_mapping_present_flag); - if (current->sps_subpic_id_mapping_present_flag) { - for (i = 0; i <= current->sps_num_subpics_minus1; i++) { - ubs(current->sps_subpic_id_len_minus1 + 1, - sps_subpic_id[i], 1, i); - } - } - } } else { infer(sps_subpic_ctu_top_left_x[0], 0); infer(sps_subpic_ctu_top_left_y[0], 0); infer(sps_subpic_width_minus1[0], tmp_width_val - 1); infer(sps_subpic_height_minus1[0], tmp_height_val - 1); } + ue(sps_subpic_id_len_minus1, 0, 15); + if ((1 << (current->sps_subpic_id_len_minus1 + 1)) < + current->sps_num_subpics_minus1 + 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, + "sps_subpic_id_len_minus1(%d) is too small\n", + current->sps_subpic_id_len_minus1); + return AVERROR_INVALIDDATA; + } + flag(sps_subpic_id_mapping_explicitly_signalled_flag); + if (current->sps_subpic_id_mapping_explicitly_signalled_flag) { + flag(sps_subpic_id_mapping_present_flag); + if (current->sps_subpic_id_mapping_present_flag) { + for (i = 0; i <= current->sps_num_subpics_minus1; i++) { + ubs(current->sps_subpic_id_len_minus1 + 1, + sps_subpic_id[i], 1, i); + } + } + } } else { infer(sps_num_subpics_minus1, 0); infer(sps_independent_subpics_flag, 1);