mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
videotestsrc: Keep tmpline unchanged in_convert_tmpline
This will allow us to repeatedly call it to render subsequent lines. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1063>
This commit is contained in:
parent
d8a7fc0a0b
commit
96decaf7ef
1 changed files with 18 additions and 3 deletions
|
@ -256,11 +256,21 @@ videotestsrc_convert_tmpline (paintinfo * p, GstVideoFrame * frame, int j)
|
|||
int height = frame->info.height;
|
||||
int n_lines = p->n_lines;
|
||||
int offset = p->offset;
|
||||
guint8 *tmpline = p->tmpline, *tmpline2 = p->tmpline2;
|
||||
|
||||
/* `tmpline2` is only used here and when the shift amount `x` is
|
||||
* non-zero, which only applies when `horizontal-speed` is set.
|
||||
*
|
||||
* Instead of copying the rotated line back to `tmpline` for
|
||||
* `p->convert_tmpline` to use, swap the pointers briefly. Besides
|
||||
* being cheaper, this also lets us reuse the painted `tmpline` for
|
||||
* subsequent lines.
|
||||
*/
|
||||
if (x != 0) {
|
||||
memcpy (p->tmpline2, p->tmpline, width * 4);
|
||||
memcpy (p->tmpline, p->tmpline2 + x * 4, (width - x) * 4);
|
||||
memcpy (p->tmpline + (width - x) * 4, p->tmpline2, x * 4);
|
||||
memcpy (tmpline2, tmpline + x * 4, (width - x) * 4);
|
||||
memcpy (tmpline2 + (width - x) * 4, tmpline, x * 4);
|
||||
p->tmpline = tmpline2;
|
||||
p->tmpline2 = tmpline;
|
||||
}
|
||||
|
||||
for (i = width; i < width + 5; i++) {
|
||||
|
@ -278,6 +288,11 @@ videotestsrc_convert_tmpline (paintinfo * p, GstVideoFrame * frame, int j)
|
|||
p->convert_tmpline (p, frame, j);
|
||||
}
|
||||
}
|
||||
|
||||
if (x != 0) {
|
||||
p->tmpline = tmpline;
|
||||
p->tmpline2 = tmpline2;
|
||||
}
|
||||
}
|
||||
|
||||
#define BLEND1(a,b,x) ((a)*(x) + (b)*(255-(x)))
|
||||
|
|
Loading…
Reference in a new issue