diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-07-12 15:15:07 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-07-12 15:15:07 +0200 |
commit | d79d561819277cc24818a3106080258d32755c89 (patch) | |
tree | 059b5118c8441e57c58ab3648279699dacf9a842 | |
parent | ac757551050ea328b42ea701c4328ecbd7d279c6 (diff) |
vaapiupload: use implicit color conversion to NV12.
Always perform conversion of sources buffers to NV12 since this is
the way we tested for this capability in ensure_allowed_caps(). This
also saves memory bandwidth for further rendering. However, this may
not preserve quality since the YUV buffers are down-sampled to 4:2:0.
-rwxr-xr-x | gst/vaapi/gstvaapiuploader.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gst/vaapi/gstvaapiuploader.c b/gst/vaapi/gstvaapiuploader.c index ca7f675c..234674b9 100755 --- a/gst/vaapi/gstvaapiuploader.c +++ b/gst/vaapi/gstvaapiuploader.c @@ -219,6 +219,21 @@ ensure_surface_pool(GstVaapiUploader *uploader, GstCaps *caps, if (!*caps_changed_ptr) return TRUE; + /* Always try to downsample source buffers to YUV 4:2:0 format as + this saves memory bandwidth for further rendering */ + /* XXX: this also means that visual quality is not preserved */ + if (format != GST_VIDEO_FORMAT_ENCODED) { + const GstVaapiChromaType chroma_type = + gst_video_format_get_chroma_type(format); + if (chroma_type != GST_VAAPI_CHROMA_TYPE_YUV420) { + const GstVideoFormat image_format = + GST_VIDEO_INFO_FORMAT(&priv->image_info); + GST_INFO("use implicit conversion of %s buffers to NV12 surfaces", + gst_video_format_to_string(image_format)); + gst_video_info_set_format(&vi, GST_VIDEO_FORMAT_NV12, width, height); + } + } + pool = gst_vaapi_surface_pool_new(priv->display, &vi); if (!pool) return FALSE; |