qsvjpegenc: Add support for YUY2 format

Now GstD3D11 defines YUY2 format

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3316>
This commit is contained in:
Seungha Yang 2022-11-03 05:18:03 +09:00
parent 1853dd56a4
commit f7cc753274
2 changed files with 14 additions and 3 deletions

View file

@ -226105,7 +226105,7 @@
"klass": "Codec/Encoder/Video/Hardware",
"pad-templates": {
"sink": {
"caps": "video/x-raw(memory:D3D11Memory):\n format: { NV12, BGRA }\n width: [ 16, 16384 ]\n height: [ 16, 16384 ]\n\nvideo/x-raw(memory:VAMemory):\n format: { NV12, BGRA }\n width: [ 16, 16384 ]\n height: [ 16, 16384 ]\nvideo/x-raw:\n format: { NV12, BGRA }\n width: [ 16, 16384 ]\n height: [ 16, 16384 ]\n",
"caps": "video/x-raw(memory:D3D11Memory):\n format: { NV12, YUY2, BGRA }\n width: [ 16, 16384 ]\n height: [ 16, 16384 ]\n\nvideo/x-raw(memory:VAMemory):\n format: { NV12, YUY2, BGRA }\n width: [ 16, 16384 ]\n height: [ 16, 16384 ]\nvideo/x-raw:\n format: { NV12, YUY2, BGRA }\n width: [ 16, 16384 ]\n height: [ 16, 16384 ]\n",
"direction": "sink",
"presence": "always"
},

View file

@ -59,7 +59,7 @@ enum
#define DEFAULT_JPEG_QUALITY 85
#define DOC_SINK_CAPS_COMM \
"format = (string) { NV12, BGRA }, " \
"format = (string) { NV12, YUY2, BGRA }, " \
"width = (int) [ 16, 16384 ], height = (int) [ 16, 16384 ]"
#define DOC_SINK_CAPS \
@ -290,6 +290,12 @@ gst_qsv_jpeg_enc_set_format (GstQsvEncoder * encoder,
frame_info->BitDepthLuma = 8;
frame_info->BitDepthChroma = 8;
break;
case GST_VIDEO_FORMAT_YUY2:
frame_info->ChromaFormat = MFX_CHROMAFORMAT_YUV422;
frame_info->FourCC = MFX_FOURCC_YUY2;
frame_info->BitDepthLuma = 8;
frame_info->BitDepthChroma = 8;
break;
case GST_VIDEO_FORMAT_BGRA:
frame_info->ChromaFormat = MFX_CHROMAFORMAT_YUV444;
frame_info->FourCC = MFX_FOURCC_RGB4;
@ -411,11 +417,16 @@ gst_qsv_jpeg_enc_register (GstPlugin * plugin, guint rank, guint impl_index,
supported_formats.push_back ("NV12");
mfx->FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV422;
mfx->FrameInfo.FourCC = MFX_FOURCC_YUY2;
status = MFXVideoENCODE_Query (session, &param, &param);
if (status == MFX_ERR_NONE)
supported_formats.push_back ("YUY2");
mfx->FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV444;
mfx->FrameInfo.FourCC = MFX_FOURCC_RGB4;
status = MFXVideoENCODE_Query (session, &param, &param);
/* TODO: Add YUY2 support, d3d11 doesn't support the format yet */
if (status == MFX_ERR_NONE)
supported_formats.push_back ("BGRA");