From: Mathieu Duponchelle Date: Tue, 29 Dec 2020 22:44:42 +0000 (+0100) Subject: compositor/blend.c: fix MT checker pattern X-Git-Tag: 1.19.3~511^2~312 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e0a4d3ac4e1467073bd7e13755831888d219d246;p=platform%2Fupstream%2Fgstreamer.git 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: --- diff --git a/gst/compositor/blend.c b/gst/compositor/blend.c index 0d54335..61ac75e 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; \