(wrong string) ée

From: <git_AT_suckless.org>
Date: Fri, 20 Jan 2017 02:00:07 +0100 (CET)

commit 431e28b386fe4b63fd530e68b7d6b53d3c98b786
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Fri Jan 20 01:59:37 2017 +0100
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Fri Jan 20 01:59:44 2017 +0100

    Add blind-time-blur
    
    Signed-off-by: Mattias Andrée <maandree_AT_kth.se>

diff --git a/Makefile b/Makefile
index cee5f8c..5bf35fc 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -27,6 +27,7 @@ BIN =\
         blind-single-colour\
         blind-split\
         blind-stack\
+ blind-time-blur\
         blind-to-image\
         blind-to-text\
         blind-to-video\
diff --git a/src/blind-time-blur.c b/src/blind-time-blur.c
new file mode 100644
index 0000000..feb6102
--- /dev/null
+++ b/src/blind-time-blur.c
_AT_@ -0,0 +1,79 @@
+/* See LICENSE file for copyright and license details. */
+#include "stream.h"
+#include "util.h"
+
+#include <string.h>
+#include <unistd.h>
+
+USAGE("alpha-stream")
+
+static int first = 1;
+
+static void
+process_xyza(char *output, char *restrict cbuf, char *restrict abuf,
+ struct stream *colour, struct stream *alpha, size_t cn, size_t an)
+{
+ typedef double pixel_t[4];
+ pixel_t *restrict clr = (pixel_t *)cbuf;
+ pixel_t *restrict alf = (pixel_t *)abuf;
+ pixel_t *img = (pixel_t *)output;
+ size_t i, n = cn / sizeof(pixel_t);
+ double a1, a2;
+
+ if (first) {
+ memcpy(output, cbuf, cn);
+ first = 0;
+ return;
+ }
+
+ for (i = 0; i < n; i++, clr++, alf++, img++) {
+ a1 = (*img)[3];
+ a2 = (*clr)[3] * (*alf)[1] * (*alf)[3];
+ a1 *= (1 - a2);
+ (*img)[0] = (*img)[0] * a1 + (*clr)[0] * a2;
+ (*img)[1] = (*img)[1] * a1 + (*clr)[1] * a2;
+ (*img)[2] = (*img)[2] * a1 + (*clr)[2] * a2;
+ (*img)[3] = a1 + a2;
+ }
+
+ (void) colour;
+ (void) alpha;
+ (void) an;
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct stream colour, alpha;
+ void (*process)(char *restrict output, char *restrict cbuf, char *restrict abuf,
+ struct stream *colour, struct stream *alpha, size_t cn, size_t an);
+
+ ARGBEGIN {
+ default:
+ usage();
+ } ARGEND;
+
+ if (argc != 1)
+ usage();
+
+ colour.file = "<stdin>";
+ colour.fd = STDIN_FILENO;
+ einit_stream(&colour);
+
+ alpha.file = argv[0];
+ alpha.fd = eopen(alpha.file, O_RDONLY);
+ einit_stream(&alpha);
+
+ if (!strcmp(colour.pixfmt, "xyza"))
+ process = process_xyza;
+ else
+ eprintf("pixel format %s is not supported, try xyza\n", colour.pixfmt);
+
+ echeck_compat(&colour, &alpha);
+
+ fprint_stream_head(stdout, &colour);
+ efflush(stdout, "<stdout>");
+ process_each_frame_two_streams(&colour, &alpha, STDOUT_FILENO, "<stdout>", process);
+
+ return 0;
+}
Received on Fri Jan 20 2017 - 02:00:07 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 20 2017 - 02:12:14 CET