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 B62B9494AC for ; Fri, 12 Apr 2024 11:37:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C7F0468D2C8; Fri, 12 Apr 2024 14:36:37 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1B74668D222 for ; Fri, 12 Apr 2024 14:36:24 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1712921783; bh=/6JPQaqNDsRUydZteFg6OxE8yULFQyhiY3BUFmX/lB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aU4EiUvJYH/xN+E54EVrCVhcYf7K3c67Afpc4Bf7VIGC0UJ1TyCl7XiWMqe+iXbjm HvdgtjUQjn6j7/1I3qwujGM3oyACiQQ1lHWmyMxfWApYWGX/BA2yBe4swHLH4giYuI MRe7PoXjXGN4v7zcLDr00mPAmuxgwhNcnUllHnSM= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id CC6C643065; Fri, 12 Apr 2024 13:36:23 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Apr 2024 13:35:18 +0200 Message-ID: <20240412113620.84013-5-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412113620.84013-1-ffmpeg@haasn.xyz> References: <20240412113620.84013-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 04/13] avcodec/dovi_rpu: expose guess_profile(), clarify semantics 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 To allow internally re-using it for both the encoder and decoder. This is based on HEVC only, H.264/AV1 use their own (hopefully correctly signalled) profiles (and in particular, the AV1 decoders implicitly default the correct profile in the absence of a configuration record). --- libavcodec/dovi_rpu.c | 4 ++-- libavcodec/dovi_rpu.h | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c index 267e52ceb6..77fef8c496 100644 --- a/libavcodec/dovi_rpu.c +++ b/libavcodec/dovi_rpu.c @@ -121,7 +121,7 @@ int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame) return 0; } -static int guess_profile(const AVDOVIRpuDataHeader *hdr) +int ff_dovi_guess_profile_hevc(const AVDOVIRpuDataHeader *hdr) { switch (hdr->vdr_rpu_profile) { case 0: @@ -510,7 +510,7 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, use_prev_vdr_rpu = get_bits1(gb); use_nlq = (hdr->rpu_format & 0x700) == 0 && !hdr->disable_residual_flag; - profile = s->cfg.dv_profile ? s->cfg.dv_profile : guess_profile(hdr); + profile = s->cfg.dv_profile ? s->cfg.dv_profile : ff_dovi_guess_profile_hevc(hdr); if (profile == 5 && use_nlq) { av_log(s->logctx, AV_LOG_ERROR, "Profile 5 RPUs should not use NLQ\n"); goto fail; diff --git a/libavcodec/dovi_rpu.h b/libavcodec/dovi_rpu.h index 9a68e45bf1..a866bbfebe 100644 --- a/libavcodec/dovi_rpu.h +++ b/libavcodec/dovi_rpu.h @@ -87,6 +87,10 @@ void ff_dovi_ctx_flush(DOVIContext *s); * DOVIContext struct. * * Returns 0 or an error code. + * + * Note: `DOVIContext.cfg` should be initialized before calling into this + * function. If not done, the profile will be guessed according to HEVC + * semantics. */ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, int err_recognition); @@ -96,4 +100,11 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, */ int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame); +/** + * Internal helper function to guess the correct DV profile for HEVC. + * + * Returns the profile number or 0 if unknown. + */ +int ff_dovi_guess_profile_hevc(const AVDOVIRpuDataHeader *hdr); + #endif /* AVCODEC_DOVI_RPU_H */ -- 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".