[Libva] [PATCH] support H264 monochroma stream decoding
Li Xiaowei
xiaowei.a.li at intel.com
Tue Jan 29 23:43:47 PST 2013
one workaround to help YUV400 pass the chroma
type check, actually the render surface is still set to
YUV420 mandatorily and the UV components are ignored.
Signed-off-by: Li Xiaowei <xiaowei.a.li at intel.com>
---
gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 6 +++++-
gst-libs/gst/vaapi/gstvaapisurface.c | 3 +++
gst-libs/gst/vaapi/gstvaapisurface.h | 4 +++-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
index 3f8bb84..a563d00 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
@@ -938,6 +938,9 @@ h264_get_chroma_type(GstH264SPS *sps)
guint chroma_type = 0;
switch (sps->chroma_format_idc) {
+ case 0:
+ chroma_type = GST_VAAPI_CHROMA_TYPE_YUV400;
+ break;
case 1:
chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
break;
@@ -1009,7 +1012,8 @@ ensure_context(GstVaapiDecoderH264 *decoder, GstH264SPS *sps)
}
chroma_type = h264_get_chroma_type(sps);
- if (!chroma_type || chroma_type != GST_VAAPI_CHROMA_TYPE_YUV420) {
+ if (chroma_type != GST_VAAPI_CHROMA_TYPE_YUV400 &&
+ chroma_type != GST_VAAPI_CHROMA_TYPE_YUV420) {
GST_ERROR("unsupported chroma_format_idc %u", sps->chroma_format_idc);
return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT;
}
diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c
index 965912c..ecd1e72 100755
--- a/gst-libs/gst/vaapi/gstvaapisurface.c
+++ b/gst-libs/gst/vaapi/gstvaapisurface.c
@@ -146,6 +146,9 @@ gst_vaapi_surface_create(GstVaapiSurface *surface)
break;
case 0:
switch (priv->chroma_type) {
+ case GST_VAAPI_CHROMA_TYPE_YUV400:
+ format = VA_RT_FORMAT_YUV400;
+ break;
case GST_VAAPI_CHROMA_TYPE_YUV420:
format = VA_RT_FORMAT_YUV420;
break;
diff --git a/gst-libs/gst/vaapi/gstvaapisurface.h b/gst-libs/gst/vaapi/gstvaapisurface.h
index 0e4f114..b286029 100755
--- a/gst-libs/gst/vaapi/gstvaapisurface.h
+++ b/gst-libs/gst/vaapi/gstvaapisurface.h
@@ -53,6 +53,7 @@ G_BEGIN_DECLS
/**
* GstVaapiChromaType:
+ * @GST_VAAPI_CHROMA_TYPE_YUV400: 4:0:0 chroma format
* @GST_VAAPI_CHROMA_TYPE_YUV420: 4:2:0 chroma format
* @GST_VAAPI_CHROMA_TYPE_YUV422: 4:2:2 chroma format
* @GST_VAAPI_CHROMA_TYPE_YUV444: 4:4:4 chroma format
@@ -60,7 +61,8 @@ G_BEGIN_DECLS
* The set of all chroma types for #GstVaapiSurface.
*/
typedef enum {
- GST_VAAPI_CHROMA_TYPE_YUV420 = 1,
+ GST_VAAPI_CHROMA_TYPE_YUV400,
+ GST_VAAPI_CHROMA_TYPE_YUV420,
GST_VAAPI_CHROMA_TYPE_YUV422,
GST_VAAPI_CHROMA_TYPE_YUV444
} GstVaapiChromaType;
--
1.7.9.5
More information about the Libva
mailing list