nvenc: Add support VUYA format

The addition is very simple. Map NV_ENC_BUFFER_FORMAT_AYUV format
to GST_VIDEO_FORMAT_VUYA and add a condition for the VUYA format.
This commit is contained in:
Seungha Yang 2019-08-20 22:07:30 +09:00 committed by Matthew Waters
parent 14b9a1cffd
commit 68a51abdcd
4 changed files with 10 additions and 2 deletions

View file

@ -685,6 +685,7 @@ gst_nv_base_enc_set_filtered_input_formats (GstNvBaseEnc * nvenc,
num_format++; num_format++;
break; break;
case GST_VIDEO_FORMAT_Y444: case GST_VIDEO_FORMAT_Y444:
case GST_VIDEO_FORMAT_VUYA:
if (max_chroma >= 2) { if (max_chroma >= 2) {
gst_value_list_append_value (&supported_format, val); gst_value_list_append_value (&supported_format, val);
last_format = val; last_format = val;
@ -1840,6 +1841,7 @@ _get_cuda_device_stride (GstVideoInfo * info, guint plane, gsize cuda_stride)
case GST_VIDEO_FORMAT_RGB10A2_LE: case GST_VIDEO_FORMAT_RGB10A2_LE:
case GST_VIDEO_FORMAT_Y444_16LE: case GST_VIDEO_FORMAT_Y444_16LE:
case GST_VIDEO_FORMAT_Y444_16BE: case GST_VIDEO_FORMAT_Y444_16BE:
case GST_VIDEO_FORMAT_VUYA:
return cuda_stride; return cuda_stride;
case GST_VIDEO_FORMAT_I420: case GST_VIDEO_FORMAT_I420:
case GST_VIDEO_FORMAT_YV12: case GST_VIDEO_FORMAT_YV12:

View file

@ -282,6 +282,8 @@ gst_nvenc_get_nv_buffer_format (GstVideoFormat fmt)
case GST_VIDEO_FORMAT_Y444_16LE: case GST_VIDEO_FORMAT_Y444_16LE:
case GST_VIDEO_FORMAT_Y444_16BE: case GST_VIDEO_FORMAT_Y444_16BE:
return NV_ENC_BUFFER_FORMAT_YUV444_10BIT; return NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
case GST_VIDEO_FORMAT_VUYA:
return NV_ENC_BUFFER_FORMAT_AYUV;
default: default:
break; break;
} }
@ -337,6 +339,7 @@ gst_nvenc_get_supported_input_formats (gpointer encoder, GUID codec_id,
{GST_VIDEO_FORMAT_BGRA, NV_ENC_BUFFER_FORMAT_ARGB, FALSE, FALSE}, {GST_VIDEO_FORMAT_BGRA, NV_ENC_BUFFER_FORMAT_ARGB, FALSE, FALSE},
{GST_VIDEO_FORMAT_RGBA, NV_ENC_BUFFER_FORMAT_ABGR, FALSE, FALSE}, {GST_VIDEO_FORMAT_RGBA, NV_ENC_BUFFER_FORMAT_ABGR, FALSE, FALSE},
{GST_VIDEO_FORMAT_Y444, NV_ENC_BUFFER_FORMAT_YUV444, FALSE, FALSE}, {GST_VIDEO_FORMAT_Y444, NV_ENC_BUFFER_FORMAT_YUV444, FALSE, FALSE},
{GST_VIDEO_FORMAT_VUYA, NV_ENC_BUFFER_FORMAT_AYUV, FALSE, FALSE},
#if G_BYTE_ORDER == G_LITTLE_ENDIAN #if G_BYTE_ORDER == G_LITTLE_ENDIAN
{GST_VIDEO_FORMAT_P010_10LE, NV_ENC_BUFFER_FORMAT_YUV420_10BIT, TRUE, {GST_VIDEO_FORMAT_P010_10LE, NV_ENC_BUFFER_FORMAT_YUV420_10BIT, TRUE,
FALSE}, FALSE},
@ -388,6 +391,7 @@ gst_nvenc_get_supported_input_formats (gpointer encoder, GUID codec_id,
} }
break; break;
case NV_ENC_BUFFER_FORMAT_YUV444: case NV_ENC_BUFFER_FORMAT_YUV444:
case NV_ENC_BUFFER_FORMAT_AYUV:
if (support_yuv444 && !format_map[i].supported) { if (support_yuv444 && !format_map[i].supported) {
format_map[i].supported = TRUE; format_map[i].supported = TRUE;
num_format++; num_format++;

View file

@ -431,7 +431,8 @@ gst_nv_h264_enc_set_encoder_config (GstNvBaseEnc * nvenc,
config->profileGUID = selected_profile; config->profileGUID = selected_profile;
h264_config->level = level_idc; h264_config->level = level_idc;
h264_config->chromaFormatIDC = 1; h264_config->chromaFormatIDC = 1;
if (GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_Y444) { if (GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_Y444 ||
GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_VUYA) {
GST_DEBUG_OBJECT (h264enc, "have Y444 input, setting config accordingly"); GST_DEBUG_OBJECT (h264enc, "have Y444 input, setting config accordingly");
config->profileGUID = NV_ENC_H264_PROFILE_HIGH_444_GUID; config->profileGUID = NV_ENC_H264_PROFILE_HIGH_444_GUID;
h264_config->chromaFormatIDC = 3; h264_config->chromaFormatIDC = 3;

View file

@ -528,7 +528,8 @@ gst_nv_h265_enc_set_encoder_config (GstNvBaseEnc * nvenc,
config->encodeCodecConfig.hevcConfig.chromaFormatIDC = 1; config->encodeCodecConfig.hevcConfig.chromaFormatIDC = 1;
if (GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_Y444 || if (GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_Y444 ||
GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_Y444_16LE || GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_Y444_16LE ||
GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_Y444_16BE) { GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_Y444_16BE ||
GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_VUYA) {
GST_DEBUG_OBJECT (h265enc, "have Y444 input, setting config accordingly"); GST_DEBUG_OBJECT (h265enc, "have Y444 input, setting config accordingly");
config->profileGUID = NV_ENC_HEVC_PROFILE_FREXT_GUID; config->profileGUID = NV_ENC_HEVC_PROFILE_FREXT_GUID;
config->encodeCodecConfig.hevcConfig.chromaFormatIDC = 3; config->encodeCodecConfig.hevcConfig.chromaFormatIDC = 3;