From: David Schleef Date: Sun, 22 Jan 2012 23:48:28 +0000 (-0800) Subject: schro: Handle 10 and 16-bit formats X-Git-Tag: 1.19.3~507^2~15778^2~69 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e2abd5c83390032531f4470cc9356119cecb44e6;p=platform%2Fupstream%2Fgstreamer.git schro: Handle 10 and 16-bit formats --- diff --git a/configure.ac b/configure.ac index 9d5d9522c6..a0f0c39358 100644 --- a/configure.ac +++ b/configure.ac @@ -1702,7 +1702,7 @@ AG_GST_CHECK_FEATURE(VDPAU, [VDPAU], vdpau, [ dnl *** schroedinger *** translit(dnm, m, l) AM_CONDITIONAL(USE_SCHRO, true) AG_GST_CHECK_FEATURE(SCHRO, [Schroedinger video codec], schro, [ - AG_GST_PKG_CHECK_MODULES(SCHRO, schroedinger-1.0 >= 1.0.7) + AG_GST_PKG_CHECK_MODULES(SCHRO, schroedinger-1.0 >= 1.0.10) ]) dnl *** zbar *** diff --git a/ext/schroedinger/gstschrodec.c b/ext/schroedinger/gstschrodec.c index bbff0ebe2c..030298e40c 100644 --- a/ext/schroedinger/gstschrodec.c +++ b/ext/schroedinger/gstschrodec.c @@ -102,7 +102,7 @@ static GstStaticPadTemplate gst_schro_dec_src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, AYUV }")) + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV (GST_SCHRO_YUV_LIST)) ); GST_BOILERPLATE (GstSchroDec, gst_schro_dec, GstBaseVideoDecoder, @@ -313,12 +313,25 @@ parse_sequence_header (GstSchroDec * schro_dec, guint8 * data, int size) ret = schro_parse_decode_sequence_header (data + 13, size - 13, &video_format); if (ret) { - if (video_format.chroma_format == SCHRO_CHROMA_444) { - state->format = GST_VIDEO_FORMAT_AYUV; - } else if (video_format.chroma_format == SCHRO_CHROMA_422) { - state->format = GST_VIDEO_FORMAT_YUY2; - } else if (video_format.chroma_format == SCHRO_CHROMA_420) { - state->format = GST_VIDEO_FORMAT_I420; + int bit_depth; + + bit_depth = schro_video_format_get_bit_depth (&video_format); + + if (bit_depth == 8) { + if (video_format.chroma_format == SCHRO_CHROMA_444) { + state->format = GST_VIDEO_FORMAT_AYUV; + } else if (video_format.chroma_format == SCHRO_CHROMA_422) { + state->format = GST_VIDEO_FORMAT_UYVY; + } else if (video_format.chroma_format == SCHRO_CHROMA_420) { + state->format = GST_VIDEO_FORMAT_I420; + } + } else if (bit_depth <= 10) { + state->format = GST_VIDEO_FORMAT_v210; + } else if (bit_depth <= 16) { + state->format = GST_VIDEO_FORMAT_AYUV64; + } else { + GST_ERROR ("bit depth too large (%d > 16)", bit_depth); + state->format = GST_VIDEO_FORMAT_AYUV64; } state->fps_n = video_format.frame_rate_numerator; state->fps_d = video_format.frame_rate_denominator; diff --git a/ext/schroedinger/gstschroenc.c b/ext/schroedinger/gstschroenc.c index d1eb498fb5..7ed96b3b74 100644 --- a/ext/schroedinger/gstschroenc.c +++ b/ext/schroedinger/gstschroenc.c @@ -107,7 +107,7 @@ static GstStaticPadTemplate gst_schro_enc_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, UYVY, AYUV }")) + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV (GST_SCHRO_YUV_LIST)) ); static GstStaticPadTemplate gst_schro_enc_src_template = @@ -271,13 +271,18 @@ gst_schro_enc_set_format (GstBaseVideoEncoder * base_video_encoder, switch (state->format) { case GST_VIDEO_FORMAT_I420: case GST_VIDEO_FORMAT_YV12: + case GST_VIDEO_FORMAT_Y42B: schro_enc->video_format->chroma_format = SCHRO_CHROMA_420; break; case GST_VIDEO_FORMAT_YUY2: case GST_VIDEO_FORMAT_UYVY: + case GST_VIDEO_FORMAT_v216: + case GST_VIDEO_FORMAT_v210: schro_enc->video_format->chroma_format = SCHRO_CHROMA_422; break; case GST_VIDEO_FORMAT_AYUV: + case GST_VIDEO_FORMAT_Y444: + case GST_VIDEO_FORMAT_AYUV64: schro_enc->video_format->chroma_format = SCHRO_CHROMA_444; break; case GST_VIDEO_FORMAT_ARGB: @@ -300,8 +305,24 @@ gst_schro_enc_set_format (GstBaseVideoEncoder * base_video_encoder, schro_enc->video_format->aspect_ratio_numerator = state->par_n; schro_enc->video_format->aspect_ratio_denominator = state->par_d; - schro_video_format_set_std_signal_range (schro_enc->video_format, - SCHRO_SIGNAL_RANGE_8BIT_VIDEO); + switch (state->format) { + default: + schro_video_format_set_std_signal_range (schro_enc->video_format, + SCHRO_SIGNAL_RANGE_8BIT_VIDEO); + break; + case GST_VIDEO_FORMAT_v210: + schro_video_format_set_std_signal_range (schro_enc->video_format, + SCHRO_SIGNAL_RANGE_10BIT_VIDEO); + break; + case GST_VIDEO_FORMAT_v216: + case GST_VIDEO_FORMAT_AYUV64: + schro_enc->video_format->luma_offset = 64 << 8; + schro_enc->video_format->luma_excursion = 219 << 8; + schro_enc->video_format->chroma_offset = 128 << 8; + schro_enc->video_format->chroma_excursion = 224 << 8; + break; + } + schro_video_format_set_std_colour_spec (schro_enc->video_format, SCHRO_COLOUR_SPEC_HDTV); diff --git a/ext/schroedinger/gstschroutils.c b/ext/schroedinger/gstschroutils.c index 66514a3d53..99a22c8a4b 100644 --- a/ext/schroedinger/gstschroutils.c +++ b/ext/schroedinger/gstschroutils.c @@ -72,6 +72,29 @@ gst_schro_buffer_wrap (GstBuffer * buf, GstVideoFormat format, int width, frame = schro_frame_new_from_data_AYUV (GST_BUFFER_DATA (buf), width, height); break; + case GST_VIDEO_FORMAT_Y42B: + frame = + schro_frame_new_from_data_Y42B (GST_BUFFER_DATA (buf), width, height); + break; + case GST_VIDEO_FORMAT_Y444: + frame = + schro_frame_new_from_data_Y444 (GST_BUFFER_DATA (buf), width, height); + break; + case GST_VIDEO_FORMAT_v210: + frame = + schro_frame_new_from_data_v210 (GST_BUFFER_DATA (buf), width, height); + break; + case GST_VIDEO_FORMAT_v216: + frame = + schro_frame_new_from_data_v216 (GST_BUFFER_DATA (buf), width, height); + break; +#ifdef SCHRO_FRAME_FORMAT_AY64 + /* Added in 1.0.11 */ + case GST_VIDEO_FORMAT_AYUV64: + frame = + schro_frame_new_from_data_AY64 (GST_BUFFER_DATA (buf), width, height); + break; +#endif #if 0 case GST_VIDEO_FORMAT_ARGB: { diff --git a/ext/schroedinger/gstschroutils.h b/ext/schroedinger/gstschroutils.h index 4e8ca2de3c..a9924a6331 100644 --- a/ext/schroedinger/gstschroutils.h +++ b/ext/schroedinger/gstschroutils.h @@ -24,6 +24,12 @@ #include #include +#ifdef SCHRO_FRAME_FORMAT_AY64 +#define GST_SCHRO_YUV_LIST "{ I420, YV12, YUY2, UYVY, AYUV, Y42B, Y444, v216, v210, AY64 }" +#else +#define GST_SCHRO_YUV_LIST "{ I420, YV12, YUY2, UYVY, AYUV, Y42B, Y444 }" +#endif + SchroFrame * gst_schro_buffer_wrap (GstBuffer *buf, GstVideoFormat format, int width, int height);