From patchwork Fri Aug 5 03:59:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37142 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp789368pzb; Thu, 4 Aug 2022 20:59:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR5s7huBnSEaBk1UlUN6Q8A96RlG72hJLlskbgrj9h9vBsEsjSbxAeGbaIVm/IFdF2go9LCS X-Received: by 2002:a17:907:1dd2:b0:730:b687:adf1 with SMTP id og18-20020a1709071dd200b00730b687adf1mr4044090ejc.183.1659671990338; Thu, 04 Aug 2022 20:59:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659671990; cv=none; d=google.com; s=arc-20160816; b=Ipuy5iV7pJL3nGOgjuLToBHNm/CEWvdvawDAx+N43sPOmFzpgf9TMta4K13Ph8sBtB rcNBocNmmVB3VhGOVIlCNudvUisF5yGPUQIN3a8pagtYhzqOR+9rY7ml2GLrhXT19bBh Ml9P1Kf2sA4gbx+0n7tAsdWdgVJRXwe/JHK6Pwg3gqjWB2BDu6wrc5SLHbPI5NHIdS07 XIHlB8wM4VeyuEPksxndXol4A2C8x6Cxk0t3tijZnFQnPVMz+WYHDtNcsJBSkH1bmWH0 1Zb7m5eNBA7hP355Az3t753ObosoD5iwmpclTrqG3xL11IHIQZm62/wW9/wFnom6hNHQ B1TQ== 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=g2g/giMD8kKNLPWOjW0P8bZ+dLgdk1GGTDEm6femsPI=; b=jJeosFU4WpPy2NecoR6LWuiCaYv3c5TAmjwfP7fOOCm/yEvrE0gitW2Fx2mDh7mHRq efuOOlBc8DKxEthfas4OBQN0PYAwzmzCFiWIO4mWJzrPLJzmJ75MrdF+9o5SjmgFQSvV dTPzbICO+Ensri/9+0Psn/eRzkguBvOOGNrxEGt40DDGJCLK6/lseU1xPozg/ErxT+J2 /ChnM2qzTGWWr+fvgdYuShbXFkZzxib70EO5dHPfhKIGKgIp4QCWPB8CZkrI9PlzhzHa TvY8P45TlyAo6DlVI0rgtDtiVoLWlL9VOTd7XYA8BPkoIibhDCngvMlQHBuBUMo14tbR MSfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=ejjiQbeK; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w8-20020a50c448000000b0043c375f06fdsi2817157edf.252.2022.08.04.20.59.49; Thu, 04 Aug 2022 20:59:50 -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=@overt.org header.s=mail header.b=ejjiQbeK; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 91CEC68BAA6; Fri, 5 Aug 2022 06:59:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AE4BD68B9EE for ; Fri, 5 Aug 2022 06:59:24 +0300 (EEST) Received: from authenticated-user (mail.overt.org [157.230.92.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id 58C073F71C; Thu, 4 Aug 2022 22:59:23 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1659671963; bh=+0hnpK4DYevtuIOJ5RRuzhiEONaiWJRv/pR8u51urDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejjiQbeK2pz1lMli3+bhhVo2W+pLQkEM/sWfqCBpWn3LSeXZ5XEuoUA+mOqKOgt+G lbKMO/4zToSY46tLCcu3A7JbgyigTMvEDGJVNIxZIlUysEE65ezEvyUwOTgR0tBC/U Zgc1QcmjwN/r52tdcMoNgE4GmQ6R4PHzG0IiI7bHIBGR5OaP2MS8H1I4qnXi1e/amB gUplI5gob0eraBgiO/WyeY5AeEZxKkWXmWlvQfEHHyVC/aP7oFdBqfbOfyLTL5hubh itTlSHpQ7c6te36zvXhh0fl2IeAemrCIBT3nz67EFHgKnRrT+dqnaHZPmTNhWWO/SV UNd79PdR9Ry2A== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Aug 2022 20:59:04 -0700 Message-Id: <20220805035904.59799-3-philipl@overt.org> In-Reply-To: <20220805035904.59799-1-philipl@overt.org> References: <20220805035904.59799-1-philipl@overt.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] lavc/vaapi_encode: enable 8bit 4:4:4 encoding for HEVC and VP9 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: Philip Langdale Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: CW+xTcz/tspK Sufficiently recent Intel hardware is able to do encoding of 8bit 4:4:4 content in HEVC and VP9. The main requirement here is that the frames must be provided in the AYUV format. Enabling support is done by adding the appropriate encoding profiles and noting that AYUV is officially a four channel format with alpha so we must state that we expect all four channels. Also, there are currently very limited ways to get data into the right format. While our VUYA format exists, someone still has to write the swscale code to be able to convert to it. Without that, you're stuck only able to encode frames that came out of the vaapi decoder in the right format. Signed-off-by: Philip Langdale --- libavcodec/vaapi_encode.c | 1 + libavcodec/vaapi_encode_h265.c | 2 ++ libavcodec/vaapi_encode_vp9.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 284ce29888..f13daa5cff 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -1308,6 +1308,7 @@ static const VAAPIEncodeRTFormat vaapi_encode_rt_formats[] = { { "YUV422_10", VA_RT_FORMAT_YUV422_10, 10, 3, 1, 0 }, #endif { "YUV444", VA_RT_FORMAT_YUV444, 8, 3, 0, 0 }, + { "AYUV", VA_RT_FORMAT_YUV444, 8, 4, 0, 0 }, { "YUV411", VA_RT_FORMAT_YUV411, 8, 3, 2, 0 }, #if VA_CHECK_VERSION(0, 38, 1) { "YUV420_10", VA_RT_FORMAT_YUV420_10BPP, 10, 3, 1, 1 }, diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index d5375add22..1de323af78 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -1278,6 +1278,8 @@ static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = { #if VA_CHECK_VERSION(1, 2, 0) { FF_PROFILE_HEVC_REXT, 8, 3, 1, 0, VAProfileHEVCMain422_10 }, { FF_PROFILE_HEVC_REXT, 10, 3, 1, 0, VAProfileHEVCMain422_10 }, + // Four channels because this uses the AYUV format which has Alpha + { FF_PROFILE_HEVC_REXT, 8, 4, 0, 0, VAProfileHEVCMain444 }, #endif { FF_PROFILE_UNKNOWN } }; diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c index 892ad770c6..9b455e10c9 100644 --- a/libavcodec/vaapi_encode_vp9.c +++ b/libavcodec/vaapi_encode_vp9.c @@ -228,6 +228,8 @@ static av_cold int vaapi_encode_vp9_configure(AVCodecContext *avctx) static const VAAPIEncodeProfile vaapi_encode_vp9_profiles[] = { { FF_PROFILE_VP9_0, 8, 3, 1, 1, VAProfileVP9Profile0 }, + // Four channels because this uses the AYUV format which has Alpha + { FF_PROFILE_VP9_1, 8, 4, 0, 0, VAProfileVP9Profile1 }, { FF_PROFILE_VP9_2, 10, 3, 1, 1, VAProfileVP9Profile2 }, { FF_PROFILE_UNKNOWN } };