diff options
author | Tong Wu <tong1.wu-at-intel.com@ffmpeg.org> | 2022-05-07 06:24:41 +0000 |
---|---|---|
committer | Haihao Xiang <haihao.xiang@intel.com> | 2022-05-23 15:10:05 +0800 |
commit | 1f9b5fa5815c0ea22d830da6cc4cbfcb6098def4 (patch) | |
tree | 028075005033227a85651661af383c72286f0fa1 | |
parent | 20807a9d6128ac7a872949a8cc6c6b1672cb6942 (diff) | |
download | ffmpeg-1f9b5fa5815c0ea22d830da6cc4cbfcb6098def4.tar.gz |
avutil/hwcontext_qsv: fix mapping issue between QSV frames and D3D11VA frames
Fixes:
$ ffmpeg.exe -init_hw_device d3d11va=d3d11 -init_hw_device \
qsv=qsv@d3d11 -s:v WxH -pix_fmt nv12 -i input.yuv -vf \
"hwupload=extra_hw_frames=16,hwmap=derive_device=d3d11va,format=d3d11,\
hwmap=derive_device=qsv,format=qsv" -f null -
Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
-rw-r--r-- | libavutil/hwcontext_qsv.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 6e4ba9d5d3..f0616f20b9 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -914,7 +914,7 @@ static int qsv_map_from(AVHWFramesContext *ctx, if (child_frames_ctx->device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) { mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId; dst->data[0] = pair->first; - dst->data[1] = pair->second; + dst->data[1] = pair->second == (mfxMemId)MFX_INFINITE ? (uint8_t *)0 : pair->second; } else { dst->data[3] = child_data; } @@ -944,7 +944,7 @@ static int qsv_map_from(AVHWFramesContext *ctx, if (child_frames_ctx->device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) { mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId; dummy->data[0] = pair->first; - dummy->data[1] = pair->second; + dummy->data[1] = pair->second == (mfxMemId)MFX_INFINITE ? (uint8_t *)0 : pair->second; } else { dummy->data[3] = child_data; } @@ -1362,7 +1362,8 @@ static int qsv_map_to(AVHWFramesContext *dst_ctx, { mfxHDLPair *pair = (mfxHDLPair*)hwctx->surfaces[i].Data.MemId; if (pair->first == src->data[0] - && pair->second == src->data[1]) { + && (pair->second == src->data[1] + || (pair->second == (mfxMemId)MFX_INFINITE && src->data[1] == (uint8_t *)0))) { index = i; break; } |