From da0e76b53bb7981c3164389cfff0e88612bd300c Mon Sep 17 00:00:00 2001 From: Boram Park Date: Fri, 16 Mar 2018 16:42:40 +0900 Subject: [PATCH] buffers: use rand_r to draw noise color Change-Id: I44ce0464c620b77ab20540b75b9dcaeb49202040 --- tools/buffers.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/buffers.c b/tools/buffers.c index 5cf58ef..ea88179 100644 --- a/tools/buffers.c +++ b/tools/buffers.c @@ -254,8 +254,12 @@ fill_smpte_yuv_planar(const struct yuv_info *yuv, for (; x < width * 6 / 7; ++x) y_mem[x] = colors_bottom[(x - width * 5 / 7) * 3 / (width / 7) + 4].y; - for (; x < width; ++x) - y_mem[x] = colors_bottom[7].y; + for (; x < width; ++x) { + if (rand_r(&rand_seed) % 2) + y_mem[x] = colors_bottom[1].y; + else + y_mem[x] = colors_bottom[7].y; + } y_mem += stride; } @@ -292,8 +296,13 @@ fill_smpte_yuv_planar(const struct yuv_info *yuv, 3 / (width / 7) + 4].v; } for (; x < width; x += xsub) { - u_mem[x * cs / xsub] = colors_bottom[7].u; - v_mem[x * cs / xsub] = colors_bottom[7].v; + if (rand_r(&rand_seed) % 2) { + u_mem[x * cs / xsub] = colors_bottom[1].u; + v_mem[x * cs / xsub] = colors_bottom[1].v; + } else { + u_mem[x * cs / xsub] = colors_bottom[7].u; + v_mem[x * cs / xsub] = colors_bottom[7].v; + } } u_mem += stride * cs / xsub; v_mem += stride * cs / xsub; -- 2.7.4