summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>2021-03-12 20:58:40 +0100
committerFrancisco Javier Velázquez-García <francisco.velazquez@ltnglobal.com>2021-07-01 18:03:14 +0200
commit7ab7a8ad7c4bd4437f0b60d26f5c076576e57087 (patch)
tree7f15cfef754443fea89d674a79b7a59472b572e2 /gst
parent96decaf7efda9c31309aae4a2593bad1bd9c5108 (diff)
downloadgstreamer-plugins-base-7ab7a8ad7c4bd4437f0b60d26f5c076576e57087.tar.gz
videotestsrc: Add a start parameter to _blend_line
Makes it easier to paint part of a line. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1063>
Diffstat (limited to 'gst')
-rw-r--r--gst/videotestsrc/videotestsrc.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c
index 7457ab588..2724a8cc5 100644
--- a/gst/videotestsrc/videotestsrc.c
+++ b/gst/videotestsrc/videotestsrc.c
@@ -316,19 +316,20 @@ videotestsrc_blend_color (struct vts_color_struct *dest,
#endif
static void
-videotestsrc_blend_line (GstVideoTestSrc * v, guint8 * dest, guint8 * src,
- struct vts_color_struct *a, struct vts_color_struct *b, int n)
+videotestsrc_blend_line (GstVideoTestSrc * v, guint8 * dest,
+ const guint8 * src, const struct vts_color_struct *a,
+ const struct vts_color_struct *b, int x1, int x2)
{
int i;
if (v->bayer || GST_VIDEO_INFO_IS_RGB (&v->info)) {
- for (i = 0; i < n; i++) {
+ for (i = x1; i < x2; i++) {
dest[i * 4 + 0] = BLEND (a->A, b->A, src[i]);
dest[i * 4 + 1] = BLEND (a->R, b->R, src[i]);
dest[i * 4 + 2] = BLEND (a->G, b->G, src[i]);
dest[i * 4 + 3] = BLEND (a->B, b->B, src[i]);
}
} else {
- for (i = 0; i < n; i++) {
+ for (i = x1; i < x2; i++) {
dest[i * 4 + 0] = BLEND (a->A, b->A, src[i]);
dest[i * 4 + 1] = BLEND (a->Y, b->Y, src[i]);
dest[i * 4 + 2] = BLEND (a->U, b->U, src[i]);
@@ -430,8 +431,8 @@ gst_video_test_src_smpte (GstVideoTestSrc * v, GstClockTime pts,
int y = random_char (&v->random_state);
p->tmpline_u8[i] = y;
}
- videotestsrc_blend_line (v, p->tmpline + x1 * 4, p->tmpline_u8 + x1,
- &p->foreground_color, &p->background_color, w - x1);
+ videotestsrc_blend_line (v, p->tmpline, p->tmpline_u8,
+ &p->foreground_color, &p->background_color, x1, w);
}
videotestsrc_convert_tmpline (p, frame, j);
@@ -539,7 +540,7 @@ gst_video_test_src_snow (GstVideoTestSrc * v, GstClockTime pts,
p->tmpline_u8[i] = y;
}
videotestsrc_blend_line (v, p->tmpline, p->tmpline_u8,
- &p->foreground_color, &p->background_color, w);
+ &p->foreground_color, &p->background_color, 0, w);
videotestsrc_convert_tmpline (p, frame, j);
}
}
@@ -895,7 +896,7 @@ gst_video_test_src_zoneplate (GstVideoTestSrc * v, GstClockTime pts,
p->tmpline_u8[i] = sine_table[phase & 0xff];
}
videotestsrc_blend_line (v, p->tmpline, p->tmpline_u8,
- &p->foreground_color, &p->background_color, w);
+ &p->foreground_color, &p->background_color, 0, w);
videotestsrc_convert_tmpline (p, frame, j);
}
}
@@ -1031,7 +1032,7 @@ gst_video_test_src_circular (GstVideoTestSrc * v, GstClockTime pts,
}
}
videotestsrc_blend_line (v, p->tmpline, p->tmpline_u8,
- &p->foreground_color, &p->background_color, w);
+ &p->foreground_color, &p->background_color, 0, w);
videotestsrc_convert_tmpline (p, frame, j);
}
}
@@ -1196,7 +1197,7 @@ gst_video_test_src_ball (GstVideoTestSrc * v, GstClockTime pts,
}
videotestsrc_blend_line (v, p->tmpline, p->tmpline_u8,
- foreground_color, background_color, w);
+ foreground_color, background_color, 0, w);
videotestsrc_convert_tmpline (p, frame, i);
}
@@ -1207,7 +1208,7 @@ gst_video_test_src_ball (GstVideoTestSrc * v, GstClockTime pts,
p->tmpline_u8[i] = 255;
}
videotestsrc_blend_line (v, p->tmpline, p->tmpline_u8,
- foreground_color, background_color, w);
+ foreground_color, background_color, 0, w);
videotestsrc_convert_tmpline (p, frame, h / 2);
videotestsrc_convert_tmpline (p, frame, y);
}
@@ -1384,7 +1385,7 @@ gst_video_test_src_pinwheel (GstVideoTestSrc * v, GstClockTime pts,
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);
+ &p->foreground_color, &p->background_color, 0, w);
videotestsrc_convert_tmpline (p, frame, j);
}
}
@@ -1436,7 +1437,7 @@ gst_video_test_src_spokes (GstVideoTestSrc * v, GstClockTime pts,
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);
+ &p->foreground_color, &p->background_color, 0, w);
videotestsrc_convert_tmpline (p, frame, j);
}
}
@@ -1463,7 +1464,7 @@ gst_video_test_src_gradient (GstVideoTestSrc * v, GstClockTime pts,
p->tmpline_u8[i] = y;
}
videotestsrc_blend_line (v, p->tmpline, p->tmpline_u8,
- &p->foreground_color, &p->background_color, w);
+ &p->foreground_color, &p->background_color, 0, w);
videotestsrc_convert_tmpline (p, frame, j);
}
}