From 4674ec0e4b833ab0d0365225ba99228df14abe87 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 13 Jan 2017 09:05:08 +0100 Subject: Rename to blind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/vu-stack.c | 80 ---------------------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 src/vu-stack.c (limited to 'src/vu-stack.c') diff --git a/src/vu-stack.c b/src/vu-stack.c deleted file mode 100644 index a03fd91..0000000 --- a/src/vu-stack.c +++ /dev/null @@ -1,80 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#include "stream.h" -#include "util.h" - -#include -#include -#include -#include - -USAGE("[-b] bottom-stream ... top-stream") - -#define PROCESS_LINEAR_3CH_ALPHA(TYPE, BLEND)\ - do {\ - TYPE x1, y1, z1, a1;\ - TYPE x2, y2, z2, a2;\ - size_t i, j;\ - for (i = 0; i < n; i += streams->pixel_size) {\ - x1 = ((TYPE *)(streams[0].buf + i))[0];\ - y1 = ((TYPE *)(streams[0].buf + i))[1];\ - z1 = ((TYPE *)(streams[0].buf + i))[2];\ - a1 = ((TYPE *)(streams[0].buf + i))[3];\ - for (j = 1; j < n_streams; j++) {\ - x2 = ((TYPE *)(streams[j].buf + i))[0];\ - y2 = ((TYPE *)(streams[j].buf + i))[1];\ - z2 = ((TYPE *)(streams[j].buf + i))[2];\ - a2 = ((TYPE *)(streams[j].buf + i))[3];\ - if (BLEND)\ - a2 /= j + 1;\ - x1 = x1 * a1 * (1 - a2) + x2 * a2;\ - y1 = y1 * a1 * (1 - a2) + y2 * a2;\ - z1 = z1 * a1 * (1 - a2) + z2 * a2;\ - a1 = a1 * (1 - a2) + a2;\ - }\ - ((TYPE *)(streams[0].buf + i))[0] = x1;\ - ((TYPE *)(streams[0].buf + i))[1] = y1;\ - ((TYPE *)(streams[0].buf + i))[2] = z1;\ - ((TYPE *)(streams[0].buf + i))[3] = a1;\ - }\ - } while (0) - -static void process_xyza (struct stream *streams, size_t n_streams, size_t n) { PROCESS_LINEAR_3CH_ALPHA(double, 0); } -static void process_xyza_b(struct stream *streams, size_t n_streams, size_t n) { PROCESS_LINEAR_3CH_ALPHA(double, 1); } - -int -main(int argc, char *argv[]) -{ - struct stream *streams; - size_t n_streams, i; - int blend = 0; - void (*process)(struct stream *streams, size_t n_streams, size_t n) = NULL; - - ARGBEGIN { - case 'b': - blend = 1; - break; - default: - usage(); - } ARGEND; - - if (argc < 2) - usage(); - - n_streams = (size_t)argc; - streams = ecalloc(n_streams, sizeof(*streams)); - - for (i = 0; i < n_streams; i++) { - streams[i].file = argv[i]; - streams[i].fd = eopen(streams[i].file, O_RDONLY); - } - - if (!strcmp(streams->pixfmt, "xyza")) - process = blend ? process_xyza_b : process_xyza; - else - eprintf("pixel format %s is not supported, try xyza\n", streams->pixfmt); - - process_multiple_streams(streams, n_streams, STDOUT_FILENO, "", process); - - free(streams); - return 0; -} -- cgit v1.2.3-70-g09d2