Commit 08be25ce authored by David Schleef's avatar David Schleef
Browse files

videotestsrc: Various improvements

Replace moving-color-bars pattern with smpte100, and change
moving-speed to horizontal-speed.  Default is now 0.  Add
a rotation stage to pattern building.
Allocate a temporary scanline for building images.  Remove
unused code.  Disable several patterns that we're unable to
test and probably never used.  Add other variants of bayer
sampling.  Convert some patterns to use videotestsrc_blend_line.
parent 8e60eca3
......@@ -53,7 +53,7 @@ GST_DEBUG_CATEGORY_STATIC (video_test_src_debug);
#define DEFAULT_COLOR_SPEC GST_VIDEO_TEST_SRC_BT601
#define DEFAULT_FOREGROUND_COLOR 0xffffffff
#define DEFAULT_BACKGROUND_COLOR 0xff000000
#define DEFAULT_MOVING_SPEED 1
#define DEFAULT_HORIZONTAL_SPEED 0
enum
{
......@@ -77,7 +77,7 @@ enum
PROP_YOFFSET,
PROP_FOREGROUND_COLOR,
PROP_BACKGROUND_COLOR,
PROP_MOVING_SPEED,
PROP_HORIZONTAL_SPEED,
PROP_LAST
};
......@@ -134,8 +134,7 @@ gst_video_test_src_pattern_get_type (void)
"chroma-zone-plate"},
{GST_VIDEO_TEST_SRC_SOLID, "Solid color", "solid-color"},
{GST_VIDEO_TEST_SRC_BALL, "Moving ball", "ball"},
{GST_VIDEO_TEST_SRC_MOVING_COLOR_BARS, "Moving color bars",
"moving-color-bars"},
{GST_VIDEO_TEST_SRC_SMPTE100, "SMPTE 100% color bars", "smpte100"},
{0, NULL, NULL}
};
......@@ -297,10 +296,10 @@ gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
DEFAULT_BACKGROUND_COLOR,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MOVING_SPEED,
g_param_spec_int ("moving-speed", "Move color bars with this speed",
"Move bars every frame with this amount of pixels (negative is inverse direction)",
G_MININT32, G_MAXINT32, DEFAULT_MOVING_SPEED,
g_object_class_install_property (gobject_class, PROP_HORIZONTAL_SPEED,
g_param_spec_int ("horizontal-speed", "Horizontal Speed",
"Scroll image number of pixels per frame (positive is scroll to the left)",
G_MININT32, G_MAXINT32, DEFAULT_HORIZONTAL_SPEED,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gstbasesrc_class->get_caps = gst_video_test_src_getcaps;
......@@ -326,7 +325,7 @@ gst_video_test_src_init (GstVideoTestSrc * src, GstVideoTestSrcClass * g_class)
src->timestamp_offset = DEFAULT_TIMESTAMP_OFFSET;
src->foreground_color = DEFAULT_FOREGROUND_COLOR;
src->background_color = DEFAULT_BACKGROUND_COLOR;
src->moving_speed = DEFAULT_MOVING_SPEED;
src->horizontal_speed = DEFAULT_HORIZONTAL_SPEED;
/* we operate in time */
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
......@@ -422,8 +421,8 @@ gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
case GST_VIDEO_TEST_SRC_BALL:
videotestsrc->make_image = gst_video_test_src_ball;
break;
case GST_VIDEO_TEST_SRC_MOVING_COLOR_BARS:
videotestsrc->make_image = gst_video_test_src_moving_color_bars;
case GST_VIDEO_TEST_SRC_SMPTE100:
videotestsrc->make_image = gst_video_test_src_smpte100;
break;
default:
g_assert_not_reached ();
......@@ -493,8 +492,8 @@ gst_video_test_src_set_property (GObject * object, guint prop_id,
case PROP_BACKGROUND_COLOR:
src->background_color = g_value_get_uint (value);
break;
case PROP_MOVING_SPEED:
src->moving_speed = g_value_get_int (value);
case PROP_HORIZONTAL_SPEED:
src->horizontal_speed = g_value_get_int (value);
default:
break;
}
......@@ -563,8 +562,8 @@ gst_video_test_src_get_property (GObject * object, guint prop_id,
case PROP_BACKGROUND_COLOR:
g_value_set_uint (value, src->background_color);
break;
case PROP_MOVING_SPEED:
g_value_set_int (value, src->moving_speed);
case PROP_HORIZONTAL_SPEED:
g_value_set_int (value, src->horizontal_speed);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -872,12 +871,16 @@ gst_video_test_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
}
memset (GST_BUFFER_DATA (outbuf), 0, GST_BUFFER_SIZE (outbuf));
src->tmpline = g_malloc (src->width * 4);
src->tmpline_u8 = g_malloc (src->width + 8);
src->tmpline = g_malloc ((src->width + 8) * 4);
src->tmpline2 = g_malloc ((src->width + 8) * 4);
src->make_image (src, (void *) GST_BUFFER_DATA (outbuf),
src->width, src->height);
g_free (src->tmpline);
g_free (src->tmpline2);
g_free (src->tmpline_u8);
GST_BUFFER_TIMESTAMP (outbuf) = src->timestamp_offset + src->running_time;
GST_BUFFER_OFFSET (outbuf) = src->n_frames;
......
......@@ -57,7 +57,7 @@ G_BEGIN_DECLS
* @GST_VIDEO_TEST_SRC_GAMUT: Gamut checking pattern
* @GST_VIDEO_TEST_SRC_CHROMA_ZONE_PLATE: Chroma zone plate
* @GST_VIDEO_TEST_SRC_BALL: Moving ball
* @GST_VIDEO_TEST_SRC_MOVING_COLOR_BARS: Moving color bars
* @GST_VIDEO_TEST_SRC_SMPTE100: SMPTE test pattern (100% color bars)
*
* The test pattern to produce.
*
......@@ -98,7 +98,7 @@ typedef enum {
GST_VIDEO_TEST_SRC_CHROMA_ZONE_PLATE,
GST_VIDEO_TEST_SRC_SOLID,
GST_VIDEO_TEST_SRC_BALL,
GST_VIDEO_TEST_SRC_MOVING_COLOR_BARS
GST_VIDEO_TEST_SRC_SMPTE100
} GstVideoTestSrcPattern;
/**
......@@ -165,16 +165,16 @@ struct _GstVideoTestSrc {
guint foreground_color;
guint background_color;
gint zoneplate_t;
/* moving color bars */
gint moving_offset;
gint moving_speed;
gint horizontal_offset;
gint horizontal_speed;
void (*make_image) (GstVideoTestSrc *v, unsigned char *dest, int w, int h);
/* temporary AYUV/ARGB scanline */
guint8 *tmpline_u8;
guint8 *tmpline;
guint8 *tmpline2;
};
struct _GstVideoTestSrcClass {
......
This diff is collapsed.
......@@ -29,6 +29,13 @@ enum {
VTS_BAYER
};
enum {
VTS_BAYER_BGGR,
VTS_BAYER_RGGB,
VTS_BAYER_GRBG,
VTS_BAYER_GBRG
};
struct vts_color_struct {
guint8 Y, U, V, A;
guint8 R, G, B;
......@@ -55,8 +62,14 @@ struct paintinfo_struct
void (*paint_hline) (paintinfo * p, int x, int y, int w);
void (*paint_tmpline) (paintinfo * p, int x, int w);
void (*convert_tmpline) (paintinfo * p, int y);
int x_offset;
unsigned char *tmpline;
int bayer_x_invert;
int bayer_y_invert;
guint8 *tmpline;
guint8 *tmpline2;
guint8 *tmpline_u8;
struct vts_color_struct foreground_color;
struct vts_color_struct background_color;
......@@ -124,8 +137,8 @@ void gst_video_test_src_chromazoneplate (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
void gst_video_test_src_ball (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
void gst_video_test_src_moving_color_bars (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
void gst_video_test_src_smpte100 (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
extern struct fourcc_list_struct fourcc_list[];
extern int n_fourccs;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment