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 5010648BF4 for ; Sun, 10 Mar 2024 14:02:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7933468CDD9; Sun, 10 Mar 2024 16:02:30 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B2F3568CAF7 for ; Sun, 10 Mar 2024 16:02:23 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1710079343; bh=qgT2EKjFPIFUvsJhUFc9II45bStsbbsb9P6LKwmDY/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ciq3d8wq3Xh89xFLLM3nbNZYRODrGKyEp0or5y4fxs/j8eyDlGk9PCvAOuw22IQef tFZRJ5y87BMuvInljh45hKYheXTd+aAVjrltx2ZATAxUB1gg4m4ILW8OSweKg4mgUA uDxM2wMNNpHKVyp0uIC+GHqy4k9xKTt/3aOAEI+w= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 3DED342558; Sun, 10 Mar 2024 15:02:23 +0100 (CET) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Mar 2024 15:01:12 +0100 Message-ID: <20240310140112.41366-3-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240310140112.41366-2-ffmpeg@haasn.xyz> References: <20240310140112.41366-2-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/3] avcodec/libdav1d: parse DV profile 10 T.35 OBU 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 This is thankfully passed through verbatim by libdav1d, so we can parse it in our own code. In theory, taking the DV profile from the packet-level configuration struct is redundant since there is currently only one possible DV level for AV1 (and all others would fail parsing), but this marginally future-proofs it against possible new AV1-specific profiles being added in the future. --- libavcodec/libdav1d.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 5c4c643696f..1aa2d1f3436 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -35,6 +35,7 @@ #include "bytestream.h" #include "codec_internal.h" #include "decode.h" +#include "dovi_rpu.h" #include "internal.h" #define FF_DAV1D_VERSION_AT_LEAST(x,y) \ @@ -44,6 +45,7 @@ typedef struct Libdav1dContext { AVClass *class; Dav1dContext *c; AVBufferPool *pool; + DOVIContext dovi; int pool_size; Dav1dData data; @@ -213,6 +215,7 @@ static av_cold int libdav1d_init(AVCodecContext *c) #else int threads = (c->thread_count ? c->thread_count : av_cpu_count()) * 3 / 2; #endif + const AVPacketSideData *sd; int res; av_log(c, AV_LOG_VERBOSE, "libdav1d %s\n", dav1d_version()); @@ -285,6 +288,11 @@ static av_cold int libdav1d_init(AVCodecContext *c) c->delay = res > 1 ? res : 0; #endif + dav1d->dovi.logctx = c; + dav1d->dovi.dv_profile = 10; // default for AV1 + sd = ff_get_coded_side_data(c, AV_PKT_DATA_DOVI_CONF); + if (sd && sd->size > 0) + ff_dovi_update_cfg(&dav1d->dovi, (AVDOVIDecoderConfigurationRecord *) sd->data); return 0; } @@ -579,6 +587,22 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) goto fail; break; } + case 0x3B: { // dolby_provider_code + int provider_oriented_code = bytestream2_get_be32(&gb); + if (itut_t35->country_code != 0xB5 || provider_oriented_code != 0x800) + break; + + res = ff_dovi_rpu_parse(&dav1d->dovi, gb.buffer, gb.buffer_end - gb.buffer); + if (res < 0) { + av_log(c, AV_LOG_WARNING, "Error parsing DOVI OBU.\n"); + break; // ignore + } + + res = ff_dovi_attach_side_data(&dav1d->dovi, frame); + if (res < 0) + goto fail; + break; + } default: // ignore unsupported provider codes break; } @@ -638,6 +662,7 @@ static av_cold int libdav1d_close(AVCodecContext *c) Libdav1dContext *dav1d = c->priv_data; av_buffer_pool_uninit(&dav1d->pool); + ff_dovi_ctx_unref(&dav1d->dovi); dav1d_data_unref(&dav1d->data); dav1d_close(&dav1d->c); -- 2.44.0 _______________________________________________ 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".