diff --git a/ChangeLog b/ChangeLog index 43e3e53ad6..3f05de7a1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-10-23 Tim-Philipp Müller + + * gst/videotestsrc/gstvideotestsrc.c: + (gst_video_test_src_pattern_get_type), + (gst_video_test_src_set_pattern): + * gst/videotestsrc/gstvideotestsrc.h: + * gst/videotestsrc/videotestsrc.c: (gst_video_test_src_checkers1), + (gst_video_test_src_checkers2), (gst_video_test_src_checkers4), + (gst_video_test_src_checkers8): + * gst/videotestsrc/videotestsrc.h: + Add a bunch of exciting new checkers patterns. + 2006-10-23 Tim-Philipp Müller * gst/subparse/Makefile.am: diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index 7a71059f71..08f8f92d59 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -109,6 +109,10 @@ gst_video_test_src_pattern_get_type (void) {GST_VIDEO_TEST_SRC_RED, "Red", "red"}, {GST_VIDEO_TEST_SRC_GREEN, "Green", "green"}, {GST_VIDEO_TEST_SRC_BLUE, "Blue", "blue"}, + {GST_VIDEO_TEST_SRC_CHECKERS1, "Checkers 1px", "checkers-1"}, + {GST_VIDEO_TEST_SRC_CHECKERS2, "Checkers 2px", "checkers-2"}, + {GST_VIDEO_TEST_SRC_CHECKERS4, "Checkers 4px", "checkers-4"}, + {GST_VIDEO_TEST_SRC_CHECKERS8, "Checkers 8px", "checkers-8"}, {0, NULL, NULL} }; @@ -227,6 +231,18 @@ gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc, case GST_VIDEO_TEST_SRC_BLUE: videotestsrc->make_image = gst_video_test_src_blue; break; + case GST_VIDEO_TEST_SRC_CHECKERS1: + videotestsrc->make_image = gst_video_test_src_checkers1; + break; + case GST_VIDEO_TEST_SRC_CHECKERS2: + videotestsrc->make_image = gst_video_test_src_checkers2; + break; + case GST_VIDEO_TEST_SRC_CHECKERS4: + videotestsrc->make_image = gst_video_test_src_checkers4; + break; + case GST_VIDEO_TEST_SRC_CHECKERS8: + videotestsrc->make_image = gst_video_test_src_checkers8; + break; default: g_assert_not_reached (); } diff --git a/gst/videotestsrc/gstvideotestsrc.h b/gst/videotestsrc/gstvideotestsrc.h index 9d108024b5..8e05d657a6 100644 --- a/gst/videotestsrc/gstvideotestsrc.h +++ b/gst/videotestsrc/gstvideotestsrc.h @@ -46,6 +46,10 @@ G_BEGIN_DECLS * @GST_VIDEO_TEST_SRC_RED: A red image * @GST_VIDEO_TEST_SRC_GREEN: A green image * @GST_VIDEO_TEST_SRC_BLUE: A blue image + * @GST_VIDEO_TEST_SRC_CHECKERS1: Checkers pattern (1px) + * @GST_VIDEO_TEST_SRC_CHECKERS2: Checkers pattern (2px) + * @GST_VIDEO_TEST_SRC_CHECKERS4: Checkers pattern (4px) + * @GST_VIDEO_TEST_SRC_CHECKERS8: Checkers pattern (8px) * * The test pattern to produce. */ @@ -56,7 +60,11 @@ typedef enum { GST_VIDEO_TEST_SRC_WHITE, GST_VIDEO_TEST_SRC_RED, GST_VIDEO_TEST_SRC_GREEN, - GST_VIDEO_TEST_SRC_BLUE + GST_VIDEO_TEST_SRC_BLUE, + GST_VIDEO_TEST_SRC_CHECKERS1, + GST_VIDEO_TEST_SRC_CHECKERS2, + GST_VIDEO_TEST_SRC_CHECKERS4, + GST_VIDEO_TEST_SRC_CHECKERS8 } GstVideoTestSrcPattern; typedef struct _GstVideoTestSrc GstVideoTestSrc; @@ -70,6 +78,8 @@ typedef struct _GstVideoTestSrcClass GstVideoTestSrcClass; struct _GstVideoTestSrc { GstPushSrc element; + /*< private >*/ + /* type of output */ GstVideoTestSrcPattern pattern_type; diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c index ec404c4437..c68b3f8822 100644 --- a/gst/videotestsrc/videotestsrc.c +++ b/gst/videotestsrc/videotestsrc.c @@ -745,6 +745,162 @@ gst_video_test_src_blue (GstVideoTestSrc * v, guchar * dest, int w, int h) gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_BLUE); } +void +gst_video_test_src_checkers1 (GstVideoTestSrc * v, guchar * dest, int w, int h) +{ + int x, y; + paintinfo pi = { NULL, }; + paintinfo *p = π + struct fourcc_list_struct *fourcc; + + p->width = w; + p->height = h; + fourcc = v->fourcc; + if (fourcc == NULL) + return; + + fourcc->paint_setup (p, dest); + p->paint_hline = fourcc->paint_hline; + + for (y = 0; y < h; y++) { + p->color = vts_colors + COLOR_GREEN; + p->paint_hline (p, 0, y, w); + for (x = (y % 2); x < w; x += 2) { + p->color = vts_colors + COLOR_RED; + p->paint_hline (p, x, y, 1); + } + } +} + +void +gst_video_test_src_checkers2 (GstVideoTestSrc * v, guchar * dest, int w, int h) +{ + int x, y; + paintinfo pi = { NULL, }; + paintinfo *p = π + struct fourcc_list_struct *fourcc; + + p->width = w; + p->height = h; + fourcc = v->fourcc; + if (fourcc == NULL) + return; + + fourcc->paint_setup (p, dest); + p->paint_hline = fourcc->paint_hline; + + p->color = vts_colors + COLOR_GREEN; + for (y = 0; y < h; y++) { + p->paint_hline (p, 0, y, w); + } + + for (y = 0; y < h; y += 2) { + for (x = ((y % 4) == 0) ? 0 : 2; x < w; x += 4) { + guint len = (x < (w - 1)) ? 2 : (w - x); + + p->color = vts_colors + COLOR_RED; + p->paint_hline (p, x, y + 0, len); + if (G_LIKELY ((y + 1) < h)) { + p->paint_hline (p, x, y + 1, len); + } + } + } +} + +void +gst_video_test_src_checkers4 (GstVideoTestSrc * v, guchar * dest, int w, int h) +{ + int x, y; + paintinfo pi = { NULL, }; + paintinfo *p = π + struct fourcc_list_struct *fourcc; + + p->width = w; + p->height = h; + fourcc = v->fourcc; + if (fourcc == NULL) + return; + + fourcc->paint_setup (p, dest); + p->paint_hline = fourcc->paint_hline; + + p->color = vts_colors + COLOR_GREEN; + for (y = 0; y < h; y++) { + p->paint_hline (p, 0, y, w); + } + + for (y = 0; y < h; y += 4) { + for (x = ((y % 8) == 0) ? 0 : 4; x < w; x += 8) { + guint len = (x < (w - 3)) ? 4 : (w - x); + + p->color = vts_colors + COLOR_RED; + p->paint_hline (p, x, y + 0, len); + if (G_LIKELY ((y + 1) < h)) { + p->paint_hline (p, x, y + 1, len); + if (G_LIKELY ((y + 2) < h)) { + p->paint_hline (p, x, y + 2, len); + if (G_LIKELY ((y + 3) < h)) { + p->paint_hline (p, x, y + 3, len); + } + } + } + } + } +} + +void +gst_video_test_src_checkers8 (GstVideoTestSrc * v, guchar * dest, int w, int h) +{ + int x, y; + paintinfo pi = { NULL, }; + paintinfo *p = π + struct fourcc_list_struct *fourcc; + + p->width = w; + p->height = h; + fourcc = v->fourcc; + if (fourcc == NULL) + return; + + fourcc->paint_setup (p, dest); + p->paint_hline = fourcc->paint_hline; + + p->color = vts_colors + COLOR_GREEN; + for (y = 0; y < h; y++) { + p->paint_hline (p, 0, y, w); + } + + for (y = 0; y < h; y += 8) { + for (x = ((GST_ROUND_UP_8 (y) % 16) == 0) ? 0 : 8; x < w; x += 16) { + guint len = (x < (w - 7)) ? 8 : (w - x); + + p->color = vts_colors + COLOR_RED; + p->paint_hline (p, x, y + 0, len); + if (G_LIKELY ((y + 1) < h)) { + p->paint_hline (p, x, y + 1, len); + if (G_LIKELY ((y + 2) < h)) { + p->paint_hline (p, x, y + 2, len); + if (G_LIKELY ((y + 3) < h)) { + p->paint_hline (p, x, y + 3, len); + if (G_LIKELY ((y + 4) < h)) { + p->paint_hline (p, x, y + 4, len); + if (G_LIKELY ((y + 5) < h)) { + p->paint_hline (p, x, y + 5, len); + if (G_LIKELY ((y + 6) < h)) { + p->paint_hline (p, x, y + 6, len); + if (G_LIKELY ((y + 7) < h)) { + p->paint_hline (p, x, y + 7, len); + } + } + } + } + } + } + } + } + } +} + static void paint_setup_I420 (paintinfo * p, unsigned char *dest) { diff --git a/gst/videotestsrc/videotestsrc.h b/gst/videotestsrc/videotestsrc.h index 8e3caed3f3..c9d522436e 100644 --- a/gst/videotestsrc/videotestsrc.h +++ b/gst/videotestsrc/videotestsrc.h @@ -83,6 +83,14 @@ void gst_video_test_src_green (GstVideoTestSrc * v, unsigned char *dest, int w, int h); void gst_video_test_src_blue (GstVideoTestSrc * v, unsigned char *dest, int w, int h); +void gst_video_test_src_checkers1 (GstVideoTestSrc * v, + unsigned char *dest, int w, int h); +void gst_video_test_src_checkers2 (GstVideoTestSrc * v, + unsigned char *dest, int w, int h); +void gst_video_test_src_checkers4 (GstVideoTestSrc * v, + unsigned char *dest, int w, int h); +void gst_video_test_src_checkers8 (GstVideoTestSrc * v, + unsigned char *dest, int w, int h); extern struct fourcc_list_struct fourcc_list[]; extern int n_fourccs;