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 5EE7A48CE7 for ; Sun, 24 Mar 2024 16:38:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E200068D391; Sun, 24 Mar 2024 18:37:59 +0200 (EET) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2A1AE68D2BB for ; Sun, 24 Mar 2024 18:37:53 +0200 (EET) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-414859830f2so4253745e9.0 for ; Sun, 24 Mar 2024 09:37:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20230601.gappssmtp.com; s=20230601; t=1711298272; x=1711903072; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=MAv0OMOWVzB1tMvgCtPnpVSKHK90CephnxnzXTj3Slo=; b=TNqGoRqcu9gvWkxZOrSPrn2grrk+X5wrZoGaaavzBmFX8JR85qd02j1lsRQ3wsUw/7 pwxPy02avkhFP+dYuJSXYVnC03uMYNuS5gWGtwrTjjvg1UYoz3nEaTURgWhUPqtEEORo AluwkDYh65syuicnRqAb8u/foQFMsXPFXOHnPROc3WHK/GgVmKF8GMUbxiApTNE80L7O fd6pUcO8ejn0kiCtKS2M/rC70qaQ/FRE4+e7VtSV3YqQZvHdSZ/IK23RklNLB68lO3cH KFijdbHG+GcGL6OLUnNmzxhDgatfEb8Siq9DIfHtKJsMKUJ5KImFbzKwpc5pynf1bb1z gknQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711298272; x=1711903072; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MAv0OMOWVzB1tMvgCtPnpVSKHK90CephnxnzXTj3Slo=; b=moiAU99wQRwGTTZm00xjnyFh3pBiFeW933CUuMNMbP0X+BQ0kHOKNkoQZE1b3ZW/Tn aJqlFgsPyXxQbdVxRakmutL3gn5TE3C7tbA6fU7r9/kKQQuDt2PAQZcVN0aP2V6eGg1w kO5bapo9DM8uR3bb3qJ3tYFggZD/X5dNM6OmzsXQe+TIMM86HIzaOOPx2mOSz4kKK9sK WX2sakJRCUr/8eTthAVqWmt4z4Yz5XOAH1K1MMX9HKbOVoGmdr2Ez57oxZcyXJw0U9tl e7ugM2HzvPznnDnbPwY4Jbh+mXaDi6YmB5mIbzXiPi1VU7mzjgADJlE7g0nMzW8uYdyY jYCQ== X-Gm-Message-State: AOJu0YxJNpLIoV5P0qqDmWM4rlL8qAKz2Kb478NmOgLHfMQdFARLPYis h5cdcG961FgZeKeFA2fv4LYLeR4PiPZGHMZ+BB5x7y/uu7unTlgzb52AF/NOTiCM97UXBKkCaZB M X-Google-Smtp-Source: AGHT+IEiAgFWaYfiAcqgUvOlEjh900RQySAamJLYLCd6XgHvmTmm4NasSbQrg8WNxe37KV8bzYugqg== X-Received: by 2002:a05:600c:24c:b0:413:eba4:f221 with SMTP id 12-20020a05600c024c00b00413eba4f221mr3184242wmj.37.1711298272110; Sun, 24 Mar 2024 09:37:52 -0700 (PDT) Received: from [192.168.0.15] (cpc92302-cmbg19-2-0-cust1183.5-4.cable.virginm.net. [82.1.212.160]) by smtp.gmail.com with ESMTPSA id bq29-20020a5d5a1d000000b00341b66d3992sm6587917wrb.19.2024.03.24.09.37.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Mar 2024 09:37:51 -0700 (PDT) Message-ID: Date: Sun, 24 Mar 2024 16:38:15 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20240321170219.1487-1-Primeadvice@gmail.com> Content-Language: en-US From: Mark Thompson In-Reply-To: <20240321170219.1487-1-Primeadvice@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] [v4] avcodec/vaapi_encode: add customized surface alignment 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 21/03/2024 17:02, Araz Iusubov wrote: > This commit fixes issues with AMD HEVC encoding. > By default AMD hevc encoder asks for the alignment 64x16, while FFMPEG VAAPI has 16x16. > Adding support for customized surface size from VASurfaceAttribAlignmentSize in VAAPI version 1.21.0 > > Signed-off-by: Araz Iusubov > --- > libavcodec/vaapi_encode.c | 11 +++++++++++ > libavutil/hwcontext.h | 7 +++++++ > libavutil/hwcontext_vaapi.c | 5 +++++ > 3 files changed, 23 insertions(+) > > diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c > index 940f0678a5..2a74db23b1 100644 > --- a/libavcodec/vaapi_encode.c > +++ b/libavcodec/vaapi_encode.c > @@ -2711,6 +2711,17 @@ static av_cold int vaapi_encode_create_recon_frames(AVCodecContext *avctx) > av_log(avctx, AV_LOG_DEBUG, "Using %s as format of " > "reconstructed frames.\n", av_get_pix_fmt_name(recon_format)); > > + if (constraints->log2_alignment) { > + ctx->surface_width = FFALIGN(avctx->width, > + 1 << (constraints->log2_alignment & 0xf)); > + ctx->surface_height = FFALIGN(avctx->height, > + 1 << ((constraints->log2_alignment & 0xf0) >> 4)); > + av_log(avctx, AV_LOG_VERBOSE, "Using customized alignment size " > + "[%dx%d].\n", > + (1 << (constraints->log2_alignment & 0xf)), > + (1 << ((constraints->log2_alignment & 0xf0) >> 4))); > + } > + > if (ctx->surface_width < constraints->min_width || > ctx->surface_height < constraints->min_height || > ctx->surface_width > constraints->max_width || > diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h > index bac30debae..1eb56aff78 100644 > --- a/libavutil/hwcontext.h > +++ b/libavutil/hwcontext.h > @@ -465,6 +465,13 @@ typedef struct AVHWFramesConstraints { > */ > int max_width; > int max_height; > + > + /** > + * The frame width/height log2 alignment when available > + * the lower 4 bits, width; another 4 bits, height > + * (Zero is not applied, use the default value) > + */ > + int log2_alignment; What other users do you have in mind for this? (Are you expecting hwupload to use it as well, say?) If this is only used in VAAPI encode then I would suggest putting the query there rather than adding new library API for it. Also agree with Anton that this form is unnecessarily confusing - just make it a normal field, don't pack it like this. (And possibly drop the log2 as well? That doesn't seem like it adds anything useful.) > } AVHWFramesConstraints; > > /** > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c > index 56d03aa4cd..6cda0fd811 100644 > --- a/libavutil/hwcontext_vaapi.c > +++ b/libavutil/hwcontext_vaapi.c > @@ -294,6 +294,11 @@ static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev, > case VASurfaceAttribMaxHeight: > constraints->max_height = attr_list[i].value.value.i; > break; > +#if VA_CHECK_VERSION(1, 21, 0) > + case VASurfaceAttribAlignmentSize: > + constraints->log2_alignment = attr_list[i].value.value.i; > + break; > +#endif > } > } > if (pix_fmt_count == 0) { Thanks, - Mark _______________________________________________ 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".