msdkmjpegenc: convert UYVY to YUY2 instead of NV12

Before this fix, the chroma subsampling of the output is 4:2:0. It is
4:2:2 with this fix, which is better for UYVY input
This commit is contained in:
Haihao Xiang 2019-10-11 14:48:11 +08:00 committed by Víctor Manuel Jáquez Leal
parent e1b8b81e84
commit 1dd3ef24b1
2 changed files with 19 additions and 6 deletions

View file

@ -322,12 +322,21 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz)
thiz->vpp_param.vpp.Out = thiz->vpp_param.vpp.In;
if (encoder_input_fmt == GST_VIDEO_FORMAT_P010_10LE) {
thiz->vpp_param.vpp.Out.FourCC = MFX_FOURCC_P010;
thiz->vpp_param.vpp.Out.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
} else {
thiz->vpp_param.vpp.Out.FourCC = MFX_FOURCC_NV12;
thiz->vpp_param.vpp.Out.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
switch (encoder_input_fmt) {
case GST_VIDEO_FORMAT_P010_10LE:
thiz->vpp_param.vpp.Out.FourCC = MFX_FOURCC_P010;
thiz->vpp_param.vpp.Out.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
break;
case GST_VIDEO_FORMAT_YUY2:
thiz->vpp_param.vpp.Out.FourCC = MFX_FOURCC_YUY2;
thiz->vpp_param.vpp.Out.ChromaFormat = MFX_CHROMAFORMAT_YUV422;
break;
default:
thiz->vpp_param.vpp.Out.FourCC = MFX_FOURCC_NV12;
thiz->vpp_param.vpp.Out.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
break;
}
/* validate parameters and allow the Media SDK to make adjustments */

View file

@ -141,6 +141,10 @@ gst_msdkmjpegenc_need_conversion (GstMsdkEnc * encoder, GstVideoInfo * info,
case GST_VIDEO_FORMAT_BGRA:
return FALSE;
case GST_VIDEO_FORMAT_UYVY:
*out_format = GST_VIDEO_FORMAT_YUY2;
return TRUE;
default:
*out_format = GST_VIDEO_FORMAT_NV12;
return TRUE;