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 0B86B42909 for ; Sat, 7 May 2022 06:25:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 15BCB68B142; Sat, 7 May 2022 09:25:14 +0300 (EEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EB33E68B104 for ; Sat, 7 May 2022 09:25:06 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651904712; x=1683440712; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Fvpof9+HfrCqRgzsbIqhU0SdoG0zrYEEwBILZu8iV3E=; b=Pt9funt6O9RtUQfkvbdMOitci8ePuGoLb4mOW5eXlGdzQZyNFst7rEuy tzDyskgm9Ax93CkgAnnEe11IyMcSUcHwF0N25AWEF0hX4uLz3FqQa61ZK YDuTEibT9DBMLKFKLB5hv8wb0mZQpz7eeSgxG22f11Ah/ebfzo/JQro8K dHcIfup7+Rl+tcv8pFTM5VU5pVF2d1TYU2wkGJc+VEQBUKQD0b/4TCRLo mcAd7ARIze0nIRiZplGemsE6xks+JWNpiLS1yMio43eMeorzVdZWByNhD A6bqURpXnIiQgMkFhx4rJVLHnuGTiCCknUXgt2rj5njcF1xohhyWUsrD1 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="268557751" X-IronPort-AV: E=Sophos;i="5.91,206,1647327600"; d="scan'208";a="268557751" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 23:24:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,206,1647327600"; d="scan'208";a="586385472" Received: from gtapc.iind.intel.com (HELO localhost.localdomain) ([10.190.234.85]) by orsmga008.jf.intel.com with ESMTP; 06 May 2022 23:24:57 -0700 From: Tong Wu To: ffmpeg-devel@ffmpeg.org Date: Sat, 7 May 2022 06:24:40 +0000 Message-Id: <20220507062441.779-2-tong1.wu@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220507062441.779-1-tong1.wu@intel.com> References: <20220507062441.779-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 2/3] avutil/hwcontext_d3d11va: pass the format value from outside for staging texture 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: Tong Wu 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: In d3d11va_create_staging_texture(), during the hwmap process, the ctx->internal->priv is not initialized, resulting in the texDesc.Format not initialized. Now pass the format value from d3d11va_transfer_data() to fix it. $ ffmpeg.exe -y -hwaccel qsv -init_hw_device d3d11va=d3d11 \ -init_hw_device qsv=qsv@d3d11 -c:v h264_qsv \ -i input.h264 -vf "hwmap=derive_device=d3d11va,format=d3d11,hwdownload,format=nv12" \ -f null - Signed-off-by: Tong Wu --- libavutil/hwcontext_d3d11va.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 2b4e24bb56..bb4e9d6965 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -346,7 +346,7 @@ static int d3d11va_transfer_get_formats(AVHWFramesContext *ctx, return 0; } -static int d3d11va_create_staging_texture(AVHWFramesContext *ctx) +static int d3d11va_create_staging_texture(AVHWFramesContext *ctx, DXGI_FORMAT format) { AVD3D11VADeviceContext *device_hwctx = ctx->device_ctx->hwctx; D3D11VAFramesContext *s = ctx->internal->priv; @@ -355,7 +355,7 @@ static int d3d11va_create_staging_texture(AVHWFramesContext *ctx) .Width = ctx->width, .Height = ctx->height, .MipLevels = 1, - .Format = s->format, + .Format = format, .SampleDesc = { .Count = 1 }, .ArraySize = 1, .Usage = D3D11_USAGE_STAGING, @@ -411,7 +411,8 @@ static int d3d11va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, device_hwctx->lock(device_hwctx->lock_ctx); if (!s->staging_texture) { - int res = d3d11va_create_staging_texture(ctx); + ID3D11Texture2D_GetDesc((ID3D11Texture2D *)texture, &desc); + int res = d3d11va_create_staging_texture(ctx, desc.Format); if (res < 0) return res; } -- 2.35.1 _______________________________________________ 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".