From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3A8494B5F1 for ; Sun, 9 Jun 2024 15:06:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6AB2268D4EF; Sun, 9 Jun 2024 18:06:08 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 86B0D68D3A3 for ; Sun, 9 Jun 2024 18:05:58 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1717945557; bh=mbtglI9ixYhUQF4c1LF2dtkbMbX9uFnCrRGwxLjfp5E=; h=From:To:Cc:Subject:Date:From; b=A+PcJm0EdJcPIvMBRdljOkXyk7BKpuVncTFT7JPStSP/AEyjHSYBE9eq5NhDc1o7Y oZSD8/2rBF3SBe9hWnS9nCYz2/6E3DRhSa5VaMUd85fVB/29P+9MVotzpnoeWp42jg bMz/4dWlkD/GeMP/n+DEAt789SbTzhsRW2Wa1oi0= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 0FC1E40455; Sun, 9 Jun 2024 17:05:57 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Jun 2024 17:05:46 +0200 Message-ID: <20240609150553.72865-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/8] avdovi/dovi_rpudec: handle prev_vdr_rpu_id failures 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: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas According to the spec, missing previous VDR RPU IDs do not constitute an error, but we should instead fallback first to VDR RPU with ID 0, and failing that, synthesize "neutral" metadata. That's nontrivial though as the resulting metadata will be dependent on other properties of the RPU, and this case is not hit in practice so I'll defer it to a rainy day. --- libavcodec/dovi_rpudec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/dovi_rpudec.c b/libavcodec/dovi_rpudec.c index 7c7eda9d09..d1dcc3a262 100644 --- a/libavcodec/dovi_rpudec.c +++ b/libavcodec/dovi_rpudec.c @@ -444,7 +444,12 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, if (use_prev_vdr_rpu) { int prev_vdr_rpu_id = get_ue_golomb_31(gb); VALIDATE(prev_vdr_rpu_id, 0, DOVI_MAX_DM_ID); + if (!s->vdr[prev_vdr_rpu_id]) + prev_vdr_rpu_id = 0; if (!s->vdr[prev_vdr_rpu_id]) { + /* FIXME: Technically, the spec says that in this case we should + * synthesize "neutral" vdr metadata, but easier to just error + * out as this corner case is not hit in practice */ av_log(s->logctx, AV_LOG_ERROR, "Unknown previous RPU ID: %u\n", prev_vdr_rpu_id); goto fail; -- 2.45.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".