[FFmpeg-devel] [PATCH v2] libavutil/hwcontext_{d3d11va, dxva2}: Support Y212/XV36 pixel format
James Almer
jamrial at gmail.com
Mon Nov 4 15:15:25 EET 2024
On 11/4/2024 12:53 AM, fei.w.wang-at-intel.com at ffmpeg.org wrote:
> From: Fei Wang <fei.w.wang at intel.com>
>
> Use DXGI/D3DFMT 16bit pixel format to compatible with 12bit Y212/XV36
> since there is no 12bit pixel defined in D3D11/D3D9.
>
> Fix cmdline on Windows:
>
> $ ffmpeg.exe -hwaccel qsv -init_hw_device qsv:hw,child_device_type=
> {d3d11, dxva2} -i input_12bit.bin -f null -
>
> Signed-off-by: Fei Wang <fei.w.wang at intel.com>
> ---
> 1. Add the same change to dxva2.
>
> libavutil/hwcontext_d3d11va.c | 4 ++++
> libavutil/hwcontext_dxva2.c | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
> index 9d81effe5e..1a047ce57b 100644
> --- a/libavutil/hwcontext_d3d11va.c
> +++ b/libavutil/hwcontext_d3d11va.c
> @@ -104,6 +104,10 @@ static const struct {
> { DXGI_FORMAT_P016, AV_PIX_FMT_P012 },
> { DXGI_FORMAT_Y216, AV_PIX_FMT_Y216 },
> { DXGI_FORMAT_Y416, AV_PIX_FMT_XV48 },
> + // There is no 12bit pixel format defined in DXGI_FORMAT*, use 16bit to compatible
> + // with 12 bit AV_PIX_FMT* formats.
> + { DXGI_FORMAT_Y216, AV_PIX_FMT_Y212 },
> + { DXGI_FORMAT_Y416, AV_PIX_FMT_XV36 },
> // Special opaque formats. The pix_fmt is merely a place holder, as the
> // opaque format cannot be accessed directly.
> { DXGI_FORMAT_420_OPAQUE, AV_PIX_FMT_YUV420P },
> diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c
> index b6eb13439d..f697690e19 100644
> --- a/libavutil/hwcontext_dxva2.c
> +++ b/libavutil/hwcontext_dxva2.c
> @@ -95,6 +95,10 @@ static const struct {
> { MKTAG('P', '0', '1', '6'), AV_PIX_FMT_P012 },
> { MKTAG('Y', '2', '1', '6'), AV_PIX_FMT_Y216 },
> { MKTAG('Y', '4', '1', '6'), AV_PIX_FMT_XV48 },
> + // There is no 12bit pixel format defined in D3DFMT*, use 16bit to compatible
> + // with 12 bit AV_PIX_FMT* formats.
> + { MKTAG('Y', '2', '1', '6'), AV_PIX_FMT_Y212 },
> + { MKTAG('Y', '4', '1', '6'), AV_PIX_FMT_XV36 },
> { D3DFMT_P8, AV_PIX_FMT_PAL8 },
> { D3DFMT_A8R8G8B8, AV_PIX_FMT_BGRA },
> };
Ok.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241104/1bcf5836/attachment.sig>
More information about the ffmpeg-devel
mailing list