gst/videotestsrc/: Add a bunch of exciting new checkers patterns.

Original commit message from CVS:
* 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.
This commit is contained in:
Tim-Philipp Müller 2006-10-23 12:46:41 +00:00
parent 1b6b21adab
commit 443dfa5857
5 changed files with 203 additions and 1 deletions

View file

@ -1,3 +1,15 @@
2006-10-23 Tim-Philipp Müller <tim at centricular dot net>
* 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 <tim at centricular dot net>
* gst/subparse/Makefile.am:

View file

@ -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 ();
}

View file

@ -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;

View file

@ -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 = &pi;
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 = &pi;
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 = &pi;
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 = &pi;
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)
{

View file

@ -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;