applemedia: improve vtenc/vtdec performance

Profiling of H.264 encode and decode revealed that conversions
between packed and planar were happening behind the scenes.

Hence we now choose I420 instead of YUY2.
This commit is contained in:
Ole André Vadla Ravnås 2010-11-08 13:49:04 +01:00
parent fe22a3ab5a
commit c2672f71cd
5 changed files with 9 additions and 10 deletions

View file

@ -47,6 +47,7 @@ enum _CVReturn
enum _CVPixelFormatType
{
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange = '420v',
kCVPixelFormatType_422YpCbCr8Deprecated = 'yuvs',
kCVPixelFormatType_422YpCbCr8 = '2vuy'
};

View file

@ -94,7 +94,7 @@ gst_vtdec_base_init (GstVTDecClass * klass)
GST_PAD_SRC,
GST_PAD_ALWAYS,
gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
"width", GST_TYPE_INT_RANGE, min_width, max_width,
"height", GST_TYPE_INT_RANGE, min_height, max_height,
"framerate", GST_TYPE_FRACTION_RANGE,
@ -345,7 +345,7 @@ gst_vtdec_create_session (GstVTDec * self, CMFormatDescriptionRef fmt_desc)
pb_attrs = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
gst_vtutil_dict_set_i32 (pb_attrs, *(cv->kCVPixelBufferPixelFormatTypeKey),
kCVPixelFormatType_422YpCbCr8Deprecated);
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange);
gst_vtutil_dict_set_i32 (pb_attrs, *(cv->kCVPixelBufferWidthKey),
self->negotiated_width);
gst_vtutil_dict_set_i32 (pb_attrs, *(cv->kCVPixelBufferHeightKey),

View file

@ -112,7 +112,7 @@ gst_vtenc_base_init (GstVTEncClass * klass)
GST_PAD_SINK,
GST_PAD_ALWAYS,
gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
"width", GST_TYPE_INT_RANGE, min_width, max_width,
"height", GST_TYPE_INT_RANGE, min_height, max_height,
"framerate", GST_TYPE_FRACTION_RANGE,
@ -491,13 +491,11 @@ gst_vtenc_create_session (GstVTEnc * self)
pb_attrs = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
gst_vtutil_dict_set_i32 (pb_attrs, *(cv->kCVPixelBufferPixelFormatTypeKey),
kCVPixelFormatType_422YpCbCr8Deprecated);
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange);
gst_vtutil_dict_set_i32 (pb_attrs, *(cv->kCVPixelBufferWidthKey),
self->negotiated_width);
gst_vtutil_dict_set_i32 (pb_attrs, *(cv->kCVPixelBufferHeightKey),
self->negotiated_height);
gst_vtutil_dict_set_i32 (pb_attrs,
*(cv->kCVPixelBufferBytesPerRowAlignmentKey), 2 * self->negotiated_width);
callback.func = gst_vtenc_output_buffer;
callback.data = self;

View file

@ -57,7 +57,7 @@ static GstStaticPadTemplate vth264decbin_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YUY2"))
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
);
#define TAA_VT_H264_DEC_BIN_GET_PRIVATE(obj) \

View file

@ -48,7 +48,7 @@ static GstStaticPadTemplate vth264encbin_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YUY2"))
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
);
static GstStaticPadTemplate vth264encbin_src_template =