mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 03:46:11 +00:00
schro: Handle 10 and 16-bit formats
This commit is contained in:
parent
f4afa8e53c
commit
e2abd5c833
5 changed files with 74 additions and 11 deletions
|
@ -1702,7 +1702,7 @@ AG_GST_CHECK_FEATURE(VDPAU, [VDPAU], vdpau, [
|
||||||
dnl *** schroedinger ***
|
dnl *** schroedinger ***
|
||||||
translit(dnm, m, l) AM_CONDITIONAL(USE_SCHRO, true)
|
translit(dnm, m, l) AM_CONDITIONAL(USE_SCHRO, true)
|
||||||
AG_GST_CHECK_FEATURE(SCHRO, [Schroedinger video codec], schro, [
|
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 ***
|
dnl *** zbar ***
|
||||||
|
|
|
@ -102,7 +102,7 @@ static GstStaticPadTemplate gst_schro_dec_src_template =
|
||||||
GST_STATIC_PAD_TEMPLATE ("src",
|
GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
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,
|
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,
|
ret = schro_parse_decode_sequence_header (data + 13, size - 13,
|
||||||
&video_format);
|
&video_format);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (video_format.chroma_format == SCHRO_CHROMA_444) {
|
int bit_depth;
|
||||||
state->format = GST_VIDEO_FORMAT_AYUV;
|
|
||||||
} else if (video_format.chroma_format == SCHRO_CHROMA_422) {
|
bit_depth = schro_video_format_get_bit_depth (&video_format);
|
||||||
state->format = GST_VIDEO_FORMAT_YUY2;
|
|
||||||
} else if (video_format.chroma_format == SCHRO_CHROMA_420) {
|
if (bit_depth == 8) {
|
||||||
state->format = GST_VIDEO_FORMAT_I420;
|
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_n = video_format.frame_rate_numerator;
|
||||||
state->fps_d = video_format.frame_rate_denominator;
|
state->fps_d = video_format.frame_rate_denominator;
|
||||||
|
|
|
@ -107,7 +107,7 @@ static GstStaticPadTemplate gst_schro_enc_sink_template =
|
||||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
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 =
|
static GstStaticPadTemplate gst_schro_enc_src_template =
|
||||||
|
@ -271,13 +271,18 @@ gst_schro_enc_set_format (GstBaseVideoEncoder * base_video_encoder,
|
||||||
switch (state->format) {
|
switch (state->format) {
|
||||||
case GST_VIDEO_FORMAT_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
case GST_VIDEO_FORMAT_YV12:
|
case GST_VIDEO_FORMAT_YV12:
|
||||||
|
case GST_VIDEO_FORMAT_Y42B:
|
||||||
schro_enc->video_format->chroma_format = SCHRO_CHROMA_420;
|
schro_enc->video_format->chroma_format = SCHRO_CHROMA_420;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_YUY2:
|
case GST_VIDEO_FORMAT_YUY2:
|
||||||
case GST_VIDEO_FORMAT_UYVY:
|
case GST_VIDEO_FORMAT_UYVY:
|
||||||
|
case GST_VIDEO_FORMAT_v216:
|
||||||
|
case GST_VIDEO_FORMAT_v210:
|
||||||
schro_enc->video_format->chroma_format = SCHRO_CHROMA_422;
|
schro_enc->video_format->chroma_format = SCHRO_CHROMA_422;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_AYUV:
|
case GST_VIDEO_FORMAT_AYUV:
|
||||||
|
case GST_VIDEO_FORMAT_Y444:
|
||||||
|
case GST_VIDEO_FORMAT_AYUV64:
|
||||||
schro_enc->video_format->chroma_format = SCHRO_CHROMA_444;
|
schro_enc->video_format->chroma_format = SCHRO_CHROMA_444;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_ARGB:
|
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_numerator = state->par_n;
|
||||||
schro_enc->video_format->aspect_ratio_denominator = state->par_d;
|
schro_enc->video_format->aspect_ratio_denominator = state->par_d;
|
||||||
|
|
||||||
schro_video_format_set_std_signal_range (schro_enc->video_format,
|
switch (state->format) {
|
||||||
SCHRO_SIGNAL_RANGE_8BIT_VIDEO);
|
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_video_format_set_std_colour_spec (schro_enc->video_format,
|
||||||
SCHRO_COLOUR_SPEC_HDTV);
|
SCHRO_COLOUR_SPEC_HDTV);
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,29 @@ gst_schro_buffer_wrap (GstBuffer * buf, GstVideoFormat format, int width,
|
||||||
frame =
|
frame =
|
||||||
schro_frame_new_from_data_AYUV (GST_BUFFER_DATA (buf), width, height);
|
schro_frame_new_from_data_AYUV (GST_BUFFER_DATA (buf), width, height);
|
||||||
break;
|
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
|
#if 0
|
||||||
case GST_VIDEO_FORMAT_ARGB:
|
case GST_VIDEO_FORMAT_ARGB:
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,12 @@
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
#include <schroedinger/schro.h>
|
#include <schroedinger/schro.h>
|
||||||
|
|
||||||
|
#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 *
|
SchroFrame *
|
||||||
gst_schro_buffer_wrap (GstBuffer *buf, GstVideoFormat format, int width,
|
gst_schro_buffer_wrap (GstBuffer *buf, GstVideoFormat format, int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
Loading…
Reference in a new issue