From cce71d5cd5b89318939e96a5ca422f588a192118 Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Tue, 24 Mar 2020 19:35:07 +0100 Subject: [PATCH] vpx: Support GST_VIDEO_FORMAT_I422_10LE Part-of: --- ext/vpx/gstvp9dec.c | 8 +++++--- ext/vpx/gstvp9enc.c | 9 ++++++++- ext/vpx/gstvpxenc.c | 3 +++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ext/vpx/gstvp9dec.c b/ext/vpx/gstvp9dec.c index 397f59b..8687d1d 100644 --- a/ext/vpx/gstvp9dec.c +++ b/ext/vpx/gstvp9dec.c @@ -74,7 +74,7 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE - ("{ I420, YV12, Y42B, Y444, GBR, I420_10LE }")) + ("{ I420, YV12, Y42B, Y444, GBR, I420_10LE, I422_10LE }")) ); #define parent_class gst_vp9_dec_parent_class @@ -168,14 +168,16 @@ gst_vp9_dec_get_valid_format (GstVPXDec * dec, vpx_image_t * img, GST_ELEMENT_WARNING (dec, STREAM, NOT_IMPLEMENTED, (NULL), ("Unsupported frame format - 16-bit 4:2:0 planar")); return FALSE; -#ifdef VPX_IMG_FMT_I42216 case VPX_IMG_FMT_I42216: /* VPX_IMG_FMT_I422 | VPX_IMG_FMT_HIGHBITDEPTH */ + if (img->bit_depth == 10) { + *fmt = GST_VIDEO_FORMAT_I422_10LE; + return TRUE; + } GST_FIXME_OBJECT (dec, "Please add 16-bit Y42B format"); GST_ELEMENT_WARNING (dec, STREAM, NOT_IMPLEMENTED, (NULL), ("Unsupported frame format - 16-bit 4:2:2 planar")); return FALSE; -#endif #ifdef VPX_IMG_FMT_I44416 case VPX_IMG_FMT_I44416: /* VPX_IMG_FMT_I444 | VPX_IMG_FMT_HIGHBITDEPTH */ diff --git a/ext/vpx/gstvp9enc.c b/ext/vpx/gstvp9enc.c index 44c1ab6..669cf97 100644 --- a/ext/vpx/gstvp9enc.c +++ b/ext/vpx/gstvp9enc.c @@ -75,7 +75,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, /*GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ I420, YV12, Y42B, Y444 }")) */ - GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ I420, YV12, Y444, I420_10LE }")) + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE + ("{ I420, YV12, Y444, I420_10LE, I422_10LE }")) ); static GstStaticPadTemplate gst_vp9_enc_src_template = @@ -199,6 +200,12 @@ gst_vp9_enc_set_image_format (GstVPXEnc * enc, vpx_image_t * image) image->bps = 15; image->x_chroma_shift = image->y_chroma_shift = 1; break; + case GST_VIDEO_FORMAT_I422_10LE: + image->fmt = VPX_IMG_FMT_I42216; + image->bps = 20; + image->x_chroma_shift = 1; + image->y_chroma_shift = 0; + break; default: g_assert_not_reached (); break; diff --git a/ext/vpx/gstvpxenc.c b/ext/vpx/gstvpxenc.c index 214ff8a..7d8d240 100644 --- a/ext/vpx/gstvpxenc.c +++ b/ext/vpx/gstvpxenc.c @@ -1525,6 +1525,9 @@ gst_vpx_enc_get_downstream_profile (GstVPXEnc * encoder, GstVideoInfo * info) case GST_VIDEO_FORMAT_I420_10LE: min_profile = 2; break; + case GST_VIDEO_FORMAT_I422_10LE: + min_profile = 3; + break; default: min_profile = 0; } -- 2.7.4