diff mbox series

[FFmpeg-devel] lavu/hwcontext_qsv: Derive bind flag from frame type if no valid surface

Message ID 20240723012702.1111362-1-fei.w.wang@intel.com
State New
Headers show
Series [FFmpeg-devel] lavu/hwcontext_qsv: Derive bind flag from frame type if no valid surface | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Wang, Fei W July 23, 2024, 1:27 a.m. UTC
From: Fei Wang <fei.w.wang@intel.com>

Fix cmd:
ffmpeg.exe -init_hw_device d3d11va=d3d -init_hw_device qsv=qsv@d3d \
-filter_hw_device d3d -hwaccel qsv -hwaccel_output_format qsv      \
-i in.h264 -vf "hwmap,format=d3d11,hwdownload,format=nv12" -y out.yuv

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
 libavutil/hwcontext_qsv.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Tong Wu July 29, 2024, 3:27 p.m. UTC | #1
>-----Original Message-----
>From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
>fei.w.wang-at-intel.com@ffmpeg.org
>Sent: 2024年7月23日 9:27
>To: ffmpeg-devel@ffmpeg.org
>Cc: fei.w.wang@intel.com
>Subject: [FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: Derive bind flag from
>frame type if no valid surface
>
>From: Fei Wang <fei.w.wang@intel.com>
>
>Fix cmd:
>ffmpeg.exe -init_hw_device d3d11va=d3d -init_hw_device qsv=qsv@d3d \
>-filter_hw_device d3d -hwaccel qsv -hwaccel_output_format qsv      \
>-i in.h264 -vf "hwmap,format=d3d11,hwdownload,format=nv12" -y out.yuv
>
>Signed-off-by: Fei Wang <fei.w.wang@intel.com>
>---
> libavutil/hwcontext_qsv.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
>diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index
>7cec347478..09156275ec 100644
>--- a/libavutil/hwcontext_qsv.c
>+++ b/libavutil/hwcontext_qsv.c
>@@ -1549,8 +1549,11 @@ static int
>qsv_frames_derive_from(AVHWFramesContext *dst_ctx,
>                 dst_hwctx->texture_infos[i].texture = (ID3D11Texture2D*)pair->first;
>                 dst_hwctx->texture_infos[i].index = pair->second ==
>(mfxMemId)MFX_INFINITE ? (intptr_t)0 : (intptr_t)pair->second;
>             }
>-            ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture,
>&texDesc);
>-            dst_hwctx->BindFlags = texDesc.BindFlags;
>+            if (src_hwctx->nb_surfaces) {
>+                ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture,
>&texDesc);
>+                dst_hwctx->BindFlags = texDesc.BindFlags;
>+            } else
>+                dst_hwctx->BindFlags =
>+ qsv_get_d3d11va_bind_flags(src_hwctx->frame_type);
>         }
>         break;
> #endif
>--
>2.34.1
>

Tested. LGTM. Thanks.
Xiang, Haihao July 30, 2024, 7:43 a.m. UTC | #2
On Ma, 2024-07-29 at 15:27 +0000, Tong Wu wrote:
-----Original Message-----
From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org<mailto:ffmpeg-devel-bounces@ffmpeg.org>> On Behalf Of
fei.w.wang-at-intel.com@ffmpeg.org<mailto:fei.w.wang-at-intel.com@ffmpeg.org>
Sent: 2024年7月23日 9:27
To: ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>
Cc: fei.w.wang@intel.com<mailto:fei.w.wang@intel.com>
Subject: [FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: Derive bind flag from
frame type if no valid surface

From: Fei Wang <fei.w.wang@intel.com<mailto:fei.w.wang@intel.com>>

Fix cmd:
ffmpeg.exe -init_hw_device d3d11va=d3d -init_hw_device qsv=qsv@d3d \
-filter_hw_device d3d -hwaccel qsv -hwaccel_output_format qsv      \
-i in.h264 -vf "hwmap,format=d3d11,hwdownload,format=nv12" -y out.yuv

Signed-off-by: Fei Wang <fei.w.wang@intel.com<mailto:fei.w.wang@intel.com>>
---
libavutil/hwcontext_qsv.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index
7cec347478..09156275ec 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -1549,8 +1549,11 @@ static int
qsv_frames_derive_from(AVHWFramesContext *dst_ctx,
                dst_hwctx->texture_infos[i].texture = (ID3D11Texture2D*)pair->first;
                dst_hwctx->texture_infos[i].index = pair->second ==
(mfxMemId)MFX_INFINITE ? (intptr_t)0 : (intptr_t)pair->second;
            }
-            ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture,
&texDesc);
-            dst_hwctx->BindFlags = texDesc.BindFlags;
+            if (src_hwctx->nb_surfaces) {
+                ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture,
&texDesc);
+                dst_hwctx->BindFlags = texDesc.BindFlags;
+            } else
+                dst_hwctx->BindFlags =
+ qsv_get_d3d11va_bind_flags(src_hwctx->frame_type);
        }
        break;
#endif
--
2.34.1


Tested. LGTM. Thanks.

Applied, thx

- Haihao

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org<mailto:ffmpeg-devel@ffmpeg.org>
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org<mailto:ffmpeg-devel-request@ffmpeg.org> with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 7cec347478..09156275ec 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -1549,8 +1549,11 @@  static int qsv_frames_derive_from(AVHWFramesContext *dst_ctx,
                 dst_hwctx->texture_infos[i].texture = (ID3D11Texture2D*)pair->first;
                 dst_hwctx->texture_infos[i].index = pair->second == (mfxMemId)MFX_INFINITE ? (intptr_t)0 : (intptr_t)pair->second;
             }
-            ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture, &texDesc);
-            dst_hwctx->BindFlags = texDesc.BindFlags;
+            if (src_hwctx->nb_surfaces) {
+                ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture, &texDesc);
+                dst_hwctx->BindFlags = texDesc.BindFlags;
+            } else
+                dst_hwctx->BindFlags = qsv_get_d3d11va_bind_flags(src_hwctx->frame_type);
         }
         break;
 #endif