From 17224d3c8e6aef33dbead6714645b2098a867813 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 12 May 2000 17:33:35 +0000 Subject: [PATCH] More changes to the mpeg parser and encoder. Original commit message from CVS: More changes to the mpeg parser and encoder. It seems like the mpeg2 decoder does not like some MPEG1 videos. Use mpeg_play for now (eg. AlienSong) --- configure.in | 2 ++ gst/gstclock.c | 5 ++-- libs/Makefile.am | 4 +-- libs/colorspace/yuv2rgb.c | 63 +++++++++++++++++++++++++---------------------- test/.gitignore | 1 + test/Makefile.am | 4 ++- test/mp1parse.c | 12 ++++----- test/mpeg2parse.c | 2 ++ 8 files changed, 52 insertions(+), 41 deletions(-) diff --git a/configure.in b/configure.in index 42fcb00..0550616 100644 --- a/configure.in +++ b/configure.in @@ -324,6 +324,7 @@ gst/xml/Makefile libs/Makefile libs/riff/Makefile libs/colorspace/Makefile +libs/videoscale/Makefile libs/getbits/Makefile plugins/Makefile plugins/au/Makefile @@ -355,6 +356,7 @@ plugins/visualization/vumeter/Makefile plugins/visualization/synaesthesia/Makefile plugins/visualization/smoothwave/Makefile plugins/videosink/Makefile +plugins/videoscale/Makefile plugins/dvdsrc/Makefile plugins/vcdsrc/Makefile plugins/cobin/Makefile diff --git a/gst/gstclock.c b/gst/gstclock.c index 67b2354..41300d3 100644 --- a/gst/gstclock.c +++ b/gst/gstclock.c @@ -18,7 +18,7 @@ */ #include -#define DEBUG_ENABLED +//#define DEBUG_ENABLED #include static GstClock *the_system_clock = NULL; @@ -54,7 +54,7 @@ GstClock *gst_clock_get_system() { void gst_clock_register(GstClock *clock, GstObject *obj) { if (GST_IS_SINK(obj)) { - DEBUG("gst_clock: registered sink object 0x%p\n", obj); + DEBUG("gst_clock: setting registered sink object 0x%p\n", obj); clock->sinkobjects = g_list_append(clock->sinkobjects, obj); num++; } @@ -89,6 +89,7 @@ void gst_clock_wait(GstClock *clock, GstClockTime time, GstObject *obj) { GstClockTimeDiff diff; GList *elements; + DEBUG("gst_clock: requesting clock object 0x%p\n", obj); g_mutex_lock(clock->lock); elements = clock->sinkobjects; while (elements && clock->locking) { diff --git a/libs/Makefile.am b/libs/Makefile.am index 2e0eff5..00087c2 100644 --- a/libs/Makefile.am +++ b/libs/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = riff colorspace getbits +SUBDIRS = riff colorspace getbits videoscale -DIST_SUBDIRS = riff colorspace getbits +DIST_SUBDIRS = riff colorspace getbits videoscale diff --git a/libs/colorspace/yuv2rgb.c b/libs/colorspace/yuv2rgb.c index 0faab31..5d584f5 100644 --- a/libs/colorspace/yuv2rgb.c +++ b/libs/colorspace/yuv2rgb.c @@ -32,13 +32,13 @@ #include "yuv2rgb.h" -static GstBuffer *gst_colorspace_yuv422P_to_rgb32(GstBuffer *src, GstColorSpaceParameters *params); -static GstBuffer *gst_colorspace_yuv422P_to_bgr32(GstBuffer *src, GstColorSpaceParameters *params); -static GstBuffer *gst_colorspace_yuv422P_to_bgr32_mmx(GstBuffer *src, GstColorSpaceParameters *params); -static GstBuffer *gst_colorspace_yuv422P_to_rgb24(GstBuffer *src, GstColorSpaceParameters *params); -static GstBuffer *gst_colorspace_yuv422P_to_bgr24(GstBuffer *src, GstColorSpaceParameters *params); -static GstBuffer *gst_colorspace_yuv422P_to_rgb16(GstBuffer *src, GstColorSpaceParameters *params); -static GstBuffer *gst_colorspace_yuv422P_to_bgr16_mmx(GstBuffer *src, GstColorSpaceParameters *params); +static GstBuffer *gst_colorspace_yuv420P_to_rgb32(GstBuffer *src, GstColorSpaceParameters *params); +static GstBuffer *gst_colorspace_yuv420P_to_bgr32(GstBuffer *src, GstColorSpaceParameters *params); +static GstBuffer *gst_colorspace_yuv420P_to_bgr32_mmx(GstBuffer *src, GstColorSpaceParameters *params); +static GstBuffer *gst_colorspace_yuv420P_to_rgb24(GstBuffer *src, GstColorSpaceParameters *params); +static GstBuffer *gst_colorspace_yuv420P_to_bgr24(GstBuffer *src, GstColorSpaceParameters *params); +static GstBuffer *gst_colorspace_yuv420P_to_rgb16(GstBuffer *src, GstColorSpaceParameters *params); +static GstBuffer *gst_colorspace_yuv420P_to_bgr16_mmx(GstBuffer *src, GstColorSpaceParameters *params); static void gst_colorspace_yuv_to_rgb16(GstColorSpaceYUVTables *tables, unsigned char *lum, @@ -79,23 +79,23 @@ static GstColorSpaceYUVTables * gst_colorspace_init_yuv(long depth, GstColorSpaceConverter gst_colorspace_yuv2rgb_get_converter(GstColorSpace src, GstColorSpace dest) { DEBUG("gst_colorspace_yuv2rgb_get_converter %d\n", dest); switch(src) { - case GST_COLORSPACE_YUV422P: + case GST_COLORSPACE_YUV420P: switch(dest) { case GST_COLORSPACE_BGR32: - //return gst_colorspace_yuv422P_to_bgr32; - return gst_colorspace_yuv422P_to_bgr32_mmx; + //return gst_colorspace_yuv420P_to_bgr32; + return gst_colorspace_yuv420P_to_bgr32_mmx; case GST_COLORSPACE_RGB32: - return gst_colorspace_yuv422P_to_rgb32; + return gst_colorspace_yuv420P_to_rgb32; case GST_COLORSPACE_RGB24: - return gst_colorspace_yuv422P_to_rgb24; + return gst_colorspace_yuv420P_to_rgb24; case GST_COLORSPACE_BGR24: - return gst_colorspace_yuv422P_to_bgr24; + return gst_colorspace_yuv420P_to_bgr24; case GST_COLORSPACE_RGB555: case GST_COLORSPACE_RGB565: case GST_COLORSPACE_BGR555: - return gst_colorspace_yuv422P_to_rgb16; + return gst_colorspace_yuv420P_to_rgb16; case GST_COLORSPACE_BGR565: - return gst_colorspace_yuv422P_to_bgr16_mmx; + return gst_colorspace_yuv420P_to_bgr16_mmx; default: break; } @@ -107,12 +107,12 @@ GstColorSpaceConverter gst_colorspace_yuv2rgb_get_converter(GstColorSpace src, G return NULL; } -static GstBuffer *gst_colorspace_yuv422P_to_bgr32(GstBuffer *src, GstColorSpaceParameters *params) { +static GstBuffer *gst_colorspace_yuv420P_to_bgr32(GstBuffer *src, GstColorSpaceParameters *params) { static GstColorSpaceYUVTables *color_tables = NULL; int size; GstBuffer *buf = NULL; guchar *out; - DEBUG("gst_colorspace_yuv422P_to_bgr32\n"); + DEBUG("gst_colorspace_yuv420P_to_bgr32\n"); g_return_val_if_fail(params != NULL, NULL); @@ -142,12 +142,12 @@ static GstBuffer *gst_colorspace_yuv422P_to_bgr32(GstBuffer *src, GstColorSpaceP else return src; } -static GstBuffer *gst_colorspace_yuv422P_to_rgb32(GstBuffer *src, GstColorSpaceParameters *params) { +static GstBuffer *gst_colorspace_yuv420P_to_rgb32(GstBuffer *src, GstColorSpaceParameters *params) { static GstColorSpaceYUVTables *color_tables = NULL; int size; GstBuffer *buf = NULL; guchar *out; - DEBUG("gst_colorspace_yuv422P_to_rgb32\n"); + DEBUG("gst_colorspace_yuv420P_to_rgb32\n"); g_return_val_if_fail(params != NULL, NULL); @@ -177,12 +177,12 @@ static GstBuffer *gst_colorspace_yuv422P_to_rgb32(GstBuffer *src, GstColorSpaceP else return src; } -static GstBuffer *gst_colorspace_yuv422P_to_bgr24(GstBuffer *src, GstColorSpaceParameters *params) { +static GstBuffer *gst_colorspace_yuv420P_to_bgr24(GstBuffer *src, GstColorSpaceParameters *params) { static GstColorSpaceYUVTables *color_tables = NULL; int size; GstBuffer *buf = NULL; guchar *out; - DEBUG("gst_colorspace_yuv422P_to_bgr24\n"); + DEBUG("gst_colorspace_yuv420P_to_bgr24\n"); g_return_val_if_fail(params != NULL, NULL); @@ -211,12 +211,12 @@ static GstBuffer *gst_colorspace_yuv422P_to_bgr24(GstBuffer *src, GstColorSpaceP else return src; } -static GstBuffer *gst_colorspace_yuv422P_to_rgb24(GstBuffer *src, GstColorSpaceParameters *params) { +static GstBuffer *gst_colorspace_yuv420P_to_rgb24(GstBuffer *src, GstColorSpaceParameters *params) { static GstColorSpaceYUVTables *color_tables = NULL; int size; GstBuffer *buf = NULL; guchar *out; - DEBUG("gst_colorspace_yuv422P_to_rgb24\n"); + DEBUG("gst_colorspace_yuv420P_to_rgb24\n"); g_return_val_if_fail(params != NULL, NULL); @@ -246,10 +246,10 @@ static GstBuffer *gst_colorspace_yuv422P_to_rgb24(GstBuffer *src, GstColorSpaceP else return src; } -static GstBuffer *gst_colorspace_yuv422P_to_rgb16(GstBuffer *src, GstColorSpaceParameters *params) { +static GstBuffer *gst_colorspace_yuv420P_to_rgb16(GstBuffer *src, GstColorSpaceParameters *params) { static GstColorSpaceYUVTables *color_tables = NULL; int size; - DEBUG("gst_colorspace_yuv422P_to_rgb16\n"); + DEBUG("gst_colorspace_yuv420P_to_rgb16\n"); g_return_val_if_fail(params != NULL, NULL); g_return_val_if_fail(params->visual != NULL, NULL); @@ -274,11 +274,11 @@ static GstBuffer *gst_colorspace_yuv422P_to_rgb16(GstBuffer *src, GstColorSpaceP static mmx_t MMX16_redmask = (mmx_t)(long long)0xf800f800f800f800LL; //dd 07c00 7c00h, 07c007c00h static mmx_t MMX16_grnmask = (mmx_t)(long long)0x07e007e007e007e0LL; //dd 003e0 03e0h, 003e003e0h -static GstBuffer *gst_colorspace_yuv422P_to_bgr32_mmx(GstBuffer *src, GstColorSpaceParameters *params) { +static GstBuffer *gst_colorspace_yuv420P_to_bgr32_mmx(GstBuffer *src, GstColorSpaceParameters *params) { int size; GstBuffer *buf = NULL; guchar *out; - DEBUG("gst_colorspace_yuv422P_to_rgb32_mmx\n"); + DEBUG("gst_colorspace_yuv420P_to_rgb32_mmx\n"); g_return_val_if_fail(params != NULL, NULL); @@ -304,9 +304,9 @@ static GstBuffer *gst_colorspace_yuv422P_to_bgr32_mmx(GstBuffer *src, GstColorSp } else return src; } -static GstBuffer *gst_colorspace_yuv422P_to_bgr16_mmx(GstBuffer *src, GstColorSpaceParameters *params) { +static GstBuffer *gst_colorspace_yuv420P_to_bgr16_mmx(GstBuffer *src, GstColorSpaceParameters *params) { int size; - DEBUG("gst_colorspace_yuv422P_to_bgr16_mmx \n"); + DEBUG("gst_colorspace_yuv420P_to_bgr16_mmx \n"); g_return_val_if_fail(params != NULL, NULL); @@ -319,6 +319,7 @@ static GstBuffer *gst_colorspace_yuv422P_to_bgr16_mmx(GstBuffer *src, GstColorSp params->outbuf, params->height, params->width); + DEBUG("gst_colorspace_yuv420P_to_bgr16_mmx done\n"); return src; } @@ -772,9 +773,11 @@ gst_colorspace_yuv_to_bgr16_mmx(tables, lum, cr, cb, out, rows, cols) int y, x; + DEBUG("gst_colorspace_yuv420P_to_bgr16_mmx %p %p %p\n", lum, cr, cb); + for (y=rows>>1; y; y--) { for (x=cols8; x; x--) { - + movd_m2r(*(mmx_t *)cb, mm0); // 4 Cb 0 0 0 0 u3 u2 u1 u0 pxor_r2r(mm7, mm7); movd_m2r(*(mmx_t *)cr, mm1); // 4 Cr 0 0 0 0 v3 v2 v1 v0 diff --git a/test/.gitignore b/test/.gitignore index d5f47ee..930e53a 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -38,3 +38,4 @@ mp1parse aviparse avi2mpg vidcapture +mp2tomp1 diff --git a/test/Makefile.am b/test/Makefile.am index 7175378..27c826a 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,7 +1,7 @@ #noinst_PROGRAMS = basic m types a r plugin w s args mpg123 mcut push qtest noinst_PROGRAMS = qtest spectrum record wave mp3 teardown buffer mp3parse \ mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest \ - aviparse vidcapture avi2mpg + aviparse vidcapture avi2mpg mp2tomp1 SUBDIRS = xml cothreads bindings @@ -17,6 +17,8 @@ mp1parse_CFLAGS = $(shell gnome-config --cflags gnomeui) mp1parse_LDFLAGS = $(shell gnome-config --libs gnomeui) mpeg2parse_CFLAGS = $(shell gnome-config --cflags gnomeui) mpeg2parse_LDFLAGS = $(shell gnome-config --libs gnomeui) +mp2tomp1_CFLAGS = $(shell gnome-config --cflags gnomeui) +mp2tomp1_LDFLAGS = $(shell gnome-config --libs gnomeui) buffer_SOURCES = buffer.c mem.c teardown_SOURCES = teardown.c mem.c diff --git a/test/mp1parse.c b/test/mp1parse.c index 86bff06..b84a44a 100644 --- a/test/mp1parse.c +++ b/test/mp1parse.c @@ -49,7 +49,7 @@ void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) { // construct queue and connect everything in the main pipelie audio_queue = gst_elementfactory_make("queue","audio_queue"); - gtk_object_set(GTK_OBJECT(audio_queue),"max_level",30,NULL); + gtk_object_set(GTK_OBJECT(audio_queue),"max_level",300,NULL); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(audio_queue)); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(audio_thread)); gst_pad_connect(pad, @@ -67,14 +67,14 @@ void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) { //} else if (0) { gst_plugin_load("mp1videoparse"); - //gst_plugin_load("mpeg_play"); - gst_plugin_load("mpeg2play"); + gst_plugin_load("mpeg_play"); + //gst_plugin_load("mpeg2play"); gst_plugin_load("videosink"); // construct internal pipeline elements parse_video = gst_elementfactory_make("mp1videoparse","parse_video"); g_return_if_fail(parse_video != NULL); - //decode_video = gst_elementfactory_make("mpeg_play","decode_video"); - decode_video = gst_elementfactory_make("mpeg2play","decode_video"); + decode_video = gst_elementfactory_make("mpeg_play","decode_video"); + //decode_video = gst_elementfactory_make("mpeg2play","decode_video"); g_return_if_fail(decode_video != NULL); show = gst_elementfactory_make("videosink","show"); g_return_if_fail(show != NULL); @@ -102,7 +102,7 @@ void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) { // construct queue and connect everything in the main pipeline video_queue = gst_elementfactory_make("queue","video_queue"); - gtk_object_set(GTK_OBJECT(video_queue),"max_level",30,NULL); + gtk_object_set(GTK_OBJECT(video_queue),"max_level",300,NULL); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(video_queue)); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(video_thread)); gst_pad_connect(pad, diff --git a/test/mpeg2parse.c b/test/mpeg2parse.c index 65f7ba4..d5d7f2f 100644 --- a/test/mpeg2parse.c +++ b/test/mpeg2parse.c @@ -168,6 +168,7 @@ int main(int argc,char *argv[]) { gst_init(&argc,&argv); gnome_init("MPEG2 Video player","0.0.1",argc,argv); gst_plugin_load("mpeg2parse"); + //gst_plugin_load("mpeg1parse"); pipeline = gst_pipeline_new("pipeline"); g_return_if_fail(pipeline != NULL); @@ -187,6 +188,7 @@ int main(int argc,char *argv[]) { g_print("should be using file '%s'\n",argv[1]); parse = gst_elementfactory_make("mpeg2parse","parse"); + //parse = gst_elementfactory_make("mpeg1parse","parse"); g_return_if_fail(parse != NULL); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src)); -- 2.7.4