summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2020-12-29 23:44:42 +0100
committerMathieu Duponchelle <mduponchelle1@gmail.com>2020-12-29 22:48:08 +0000
commite0a4d3ac4e1467073bd7e13755831888d219d246 (patch)
tree545ce4b967b4c8062fc463f9f4ca46e0789fa13c /gst
parent247f821826c644889fd981e7d86ecec745eb9600 (diff)
downloadgstreamer-plugins-base-e0a4d3ac4e1467073bd7e13755831888d219d246.tar.gz
compositor/blend.c: fix MT checker pattern
When filling the checker pattern from multiple threads, y_start needs to be taken into account to determine the shade of the current pixel. Example pipeline: gst-launch-1.0 videotestsrc ! video/x-raw, width=1920, height=1080, format=I420 ! \ queue ! compositor sink_0::xpos=200 ! video/x-raw, format=I420 ! videoconvert ! \ xvimagesink Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/988>
Diffstat (limited to 'gst')
-rw-r--r--gst/compositor/blend.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gst/compositor/blend.c b/gst/compositor/blend.c
index 0d5433524..61ac75e92 100644
--- a/gst/compositor/blend.c
+++ b/gst/compositor/blend.c
@@ -428,7 +428,7 @@ fill_checker_##format_name (GstVideoFrame * frame, guint y_start, guint y_end) \
\
for (i = 0; i < comp_height; i++) { \
for (j = 0; j < comp_width; j++) { \
- *p++ = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; \
+ *p++ = tab[(((i + y_start) & 0x8) >> 3) + ((j & 0x8) >> 3)]; \
} \
p += rowstride - comp_width; \
} \
@@ -682,7 +682,7 @@ fill_checker_##format_name (GstVideoFrame * frame, guint y_start, guint y_end) \
\
for (i = 0; i < comp_height; i++) { \
for (j = 0; j < comp_width; j++) { \
- *p++ = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; \
+ *p++ = tab[(((i + y_start) & 0x8) >> 3) + ((j & 0x8) >> 3)]; \
} \
p += rowstride - comp_width; \
} \
@@ -845,9 +845,9 @@ fill_checker_##name##_c (GstVideoFrame * frame, guint y_start, guint y_end) \
dest += y_start * stride; \
for (i = 0; i < height; i++) { \
for (j = 0; j < width; j++) { \
- dest[r] = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* red */ \
- dest[g] = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* green */ \
- dest[b] = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* blue */ \
+ dest[r] = tab[(((i + y_start) & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* red */ \
+ dest[g] = tab[(((i + y_start) & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* green */ \
+ dest[b] = tab[(((i + y_start) & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* blue */ \
dest += bpp; \
} \
dest += dest_add; \
@@ -1029,8 +1029,8 @@ fill_checker_##name##_c (GstVideoFrame * frame, guint y_start, guint y_end) \
dest += GST_VIDEO_FRAME_COMP_STRIDE (frame, 0) * y_start; \
for (i = 0; i < height; i++) { \
for (j = 0; j < width; j++) { \
- dest[Y1] = tab[((i & 0x8) >> 3) + (((2 * j + 0) & 0x8) >> 3)]; \
- dest[Y2] = tab[((i & 0x8) >> 3) + (((2 * j + 1) & 0x8) >> 3)]; \
+ dest[Y1] = tab[(((i + y_start) & 0x8) >> 3) + (((2 * j + 0) & 0x8) >> 3)]; \
+ dest[Y2] = tab[(((i + y_start) & 0x8) >> 3) + (((2 * j + 1) & 0x8) >> 3)]; \
dest[U] = 128; \
dest[V] = 128; \
dest += 4; \