From patchwork Sun Jul 28 10:25:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 50801 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:16f:b0:489:2eb3:e4c4 with SMTP id h47csp647867vqi; Sun, 28 Jul 2024 06:31:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUr89jSk4jVQlx+BVLxVy9fHZvMDNEK3f4qpHGN8XDG2+SXPkCbmOXByCrVQrs+QzhuP/cQuu/iwTRolalR9z3A/jnlSEQ5Qp8CFw== X-Google-Smtp-Source: AGHT+IElAy1KMpMi5QZBywz0OZuTKrxLKZdpiYPBp4PHktbJD28mxGcNWkdBtfMuxBr55D5gEVnF X-Received: by 2002:a2e:9dd4:0:b0:2ef:2bac:bb50 with SMTP id 38308e7fff4ca-2f12ee14eedmr32729991fa.11.1722173514564; Sun, 28 Jul 2024 06:31:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722173514; cv=none; d=google.com; s=arc-20160816; b=A7QLYP08DHrdkDFIHjSgaMilsmil+foxZOAuqzrfyVS61SLts8GM7PFbTsSWRMpR8S 10cNTUegtATCNoOWbV40o9Ss6Q2q2mtZSqfuZufH8WxrSMA04yut9iUaCOh1GivT5jzh 0ycS+uFb7Xb5LTCwAevqVAy8tuWQqltX2Nni+VJodRnlcY+PRoXdBwZ8lyz2GuAbCUOL YhJCzhNv2qualq/iPnGlcIOtA1xiCIgCTf8ZhbqEQkjYkAJhtLE6E6lHjyPSW00bISUq VVghkzhlN2/oMpwPJXVkIdi2XjA2ORWPTXRLzcC/S5WLRXqbW2Sq2r38mp+nmrHRGQUN fIig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=nwGyXdkyYTxsNWkssa02Auc21oyjFV3yIubGC1umOes=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=u09XPFhmIlSsjwrSLoeZXxeFImKdhs3J5WqAqDPmIqK+qL5EJ+5Te42jW6Y0JK7VfV 7Ij/yDOIKu+fcJMtChxvv78jF2eD5ZmWlxof9D1idcc+eALG9ZJvNlfA9bF7mlBc9sEh 6Fkkcy2R966WlRVf64i34F2qpgUylAliPj2ZKN14CdavF9P37C/RtykYz6QTfhyVTxdy rcAWebd4t7SimUw0cTQa0NBmcKQ3mpl5uRh43Jfd732MWZbIGeytAEqNy/IWawgu6klB pSUBYxbEKWfI+V6QlEY2XuPPzukqWyQbB+98QRs9f+t1MFXnjsElDwWwPQGU+8kQ6pHb ngSA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=E8XRQIOj; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2f03d186d06si19336671fa.575.2024.07.28.06.31.54; Sun, 28 Jul 2024 06:31:54 -0700 (PDT) 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=@haasn.xyz header.s=mail header.b=E8XRQIOj; 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 BAB9168D8D8; Sun, 28 Jul 2024 13:25:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D529268D86B for ; Sun, 28 Jul 2024 13:25:41 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1722162339; bh=yppZfnugsvt7iEOfjCswHpcBKZjAhIqCKb7ycZbG5hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E8XRQIOjOAKZIJeGeYu4/VgJv6NUNBmMclsaBv/49nc4PP4+9yBrZ4nCgGVg89cWV EAu/K2bvgtBK/5u247NVnzY0rk4fqyO3Uo6n30rLi/lOytvn+DZgoM8ecrRPbkI3L2 dHkmw1VvUV3ndJvOV9BXO0ds7gvnEM/rz1XuscnQ= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 5942E44607; Sun, 28 Jul 2024 12:25:39 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 28 Jul 2024 12:25:24 +0200 Message-ID: <20240728102527.17991-19-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240728102527.17991-1-ffmpeg@haasn.xyz> References: <20240728102527.17991-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 19/22] avcodec/dovi_rpuenc: slightly improve profile autodetection 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ra6qGy5F4KSX From: Niklas Haas In the absence of an RPU header, we can consult the colorspace tags to make a more informed guess about whether we're looking at profile 5 or profile 8. --- libavcodec/dovi_rpuenc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libavcodec/dovi_rpuenc.c b/libavcodec/dovi_rpuenc.c index c73805037c..8113ec44bf 100644 --- a/libavcodec/dovi_rpuenc.c +++ b/libavcodec/dovi_rpuenc.c @@ -79,7 +79,20 @@ int ff_dovi_configure_ext(DOVIContext *s, AVCodecParameters *codecpar, switch (codecpar->codec_id) { case AV_CODEC_ID_AV1: dv_profile = 10; break; case AV_CODEC_ID_H264: dv_profile = 9; break; - case AV_CODEC_ID_HEVC: dv_profile = hdr ? ff_dovi_guess_profile_hevc(hdr) : 8; break; + case AV_CODEC_ID_HEVC: + if (hdr) { + dv_profile = ff_dovi_guess_profile_hevc(hdr); + break; + } + + /* This is likely to be proprietary IPTPQc2 */ + if (codecpar->color_space == AVCOL_SPC_IPT_C2 || + (codecpar->color_space == AVCOL_SPC_UNSPECIFIED && + codecpar->color_trc == AVCOL_TRC_UNSPECIFIED)) + dv_profile = 5; + else + dv_profile = 8; + break; default: /* No other encoder should be calling this! */ av_assert0(0);