{GST_VIDEO_TEST_SRC_BALL, "Moving ball", "ball"},
{GST_VIDEO_TEST_SRC_SMPTE100, "SMPTE 100% color bars", "smpte100"},
{GST_VIDEO_TEST_SRC_BAR, "Bar", "bar"},
+ {GST_VIDEO_TEST_SRC_PINWHEEL, "Pinwheel", "pinwheel"},
+ {GST_VIDEO_TEST_SRC_SPOKES, "Spokes", "spokes"},
{0, NULL, NULL}
};
{
videotestsrc->pattern_type = pattern_type;
- GST_DEBUG_OBJECT (videotestsrc, "setting pattern to %d", pattern_type);
+ GST_ERROR_OBJECT (videotestsrc, "setting pattern to %d", pattern_type);
switch (pattern_type) {
case GST_VIDEO_TEST_SRC_SMPTE:
case GST_VIDEO_TEST_SRC_BAR:
videotestsrc->make_image = gst_video_test_src_bar;
break;
+ case GST_VIDEO_TEST_SRC_PINWHEEL:
+ videotestsrc->make_image = gst_video_test_src_pinwheel;
+ break;
+ case GST_VIDEO_TEST_SRC_SPOKES:
+ videotestsrc->make_image = gst_video_test_src_spokes;
+ break;
default:
g_assert_not_reached ();
}
* @GST_VIDEO_TEST_SRC_BALL: Moving ball
* @GST_VIDEO_TEST_SRC_SMPTE100: SMPTE test pattern (100% color bars)
* @GST_VIDEO_TEST_SRC_BAR: Bar with foreground color
+ * @GST_VIDEO_TEST_SRC_PINWHEEL: Pinwheel
+ * @GST_VIDEO_TEST_SRC_SPOKES: Spokes
*
* The test pattern to produce.
*
GST_VIDEO_TEST_SRC_SOLID,
GST_VIDEO_TEST_SRC_BALL,
GST_VIDEO_TEST_SRC_SMPTE100,
- GST_VIDEO_TEST_SRC_BAR
+ GST_VIDEO_TEST_SRC_BAR,
+ GST_VIDEO_TEST_SRC_PINWHEEL,
+ GST_VIDEO_TEST_SRC_SPOKES
} GstVideoTestSrcPattern;
typedef struct _GstVideoTestSrc GstVideoTestSrc;
}
}
}
+
+void
+gst_video_test_src_pinwheel (GstVideoTestSrc * v, GstVideoFrame * frame)
+{
+ int i;
+ int j;
+ int k;
+ int t = v->n_frames;
+ paintinfo pi = PAINT_INFO_INIT;
+ paintinfo *p = π
+ struct vts_color_struct color;
+ int w = frame->info.width, h = frame->info.height;
+ double c[20];
+ double s[20];
+
+ videotestsrc_setup_paintinfo (v, p, w, h);
+
+ color = p->colors[COLOR_BLACK];
+ p->color = &color;
+
+ for (k = 0; k < 19; k++) {
+ double theta = M_PI / 19 * k + 0.001 * v->kt * t;
+ c[k] = cos (theta);
+ s[k] = sin (theta);
+ }
+
+ for (j = 0; j < h; j++) {
+ for (i = 0; i < w; i++) {
+ double v;
+ v = 0;
+ for (k = 0; k < 19; k++) {
+ double x, y;
+
+ x = c[k] * (i - 0.5 * w) + s[k] * (j - 0.5 * h);
+ x *= 1.0;
+
+ y = CLAMP (x, -1, 1);
+ if (k & 1)
+ y = -y;
+
+ v += y;
+ }
+
+ p->tmpline_u8[i] = CLAMP (rint (v * 128 + 128), 0, 255);
+ }
+ videotestsrc_blend_line (v, p->tmpline, p->tmpline_u8,
+ &p->foreground_color, &p->background_color, w);
+ videotestsrc_convert_tmpline (p, frame, j);
+ }
+}
+
+void
+gst_video_test_src_spokes (GstVideoTestSrc * v, GstVideoFrame * frame)
+{
+ int i;
+ int j;
+ int k;
+ int t = v->n_frames;
+ paintinfo pi = PAINT_INFO_INIT;
+ paintinfo *p = π
+ struct vts_color_struct color;
+ int w = frame->info.width, h = frame->info.height;
+ double c[20];
+ double s[20];
+
+ videotestsrc_setup_paintinfo (v, p, w, h);
+
+ color = p->colors[COLOR_BLACK];
+ p->color = &color;
+
+ for (k = 0; k < 19; k++) {
+ double theta = M_PI / 19 * k + 0.001 * v->kt * t;
+ c[k] = cos (theta);
+ s[k] = sin (theta);
+ }
+
+ for (j = 0; j < h; j++) {
+ for (i = 0; i < w; i++) {
+ double v;
+ v = 0;
+ for (k = 0; k < 19; k++) {
+ double x, y;
+ double sharpness = 1.0;
+ double linewidth = 2.0;
+
+ x = c[k] * (i - 0.5 * w) + s[k] * (j - 0.5 * h);
+ x = linewidth * 0.5 - fabs (x);
+ x *= sharpness;
+
+ y = CLAMP (x + 0.5, 0.0, 1.0);
+
+ v += y;
+ }
+
+ p->tmpline_u8[i] = CLAMP (rint (v * 255), 0, 255);
+ }
+ videotestsrc_blend_line (v, p->tmpline, p->tmpline_u8,
+ &p->foreground_color, &p->background_color, w);
+ videotestsrc_convert_tmpline (p, frame, j);
+ }
+}