(wrong string) ée

From: <git_AT_suckless.org>
Date: Fri, 2 Jun 2017 22:32:22 +0200 (CEST)

commit 4751eda976c09f2409e93364b6b76fdc950bcda6
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Fri Jun 2 21:30:19 2017 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Fri Jun 2 21:30:19 2017 +0200

    Add blind-interleave, blind-cat-rows, and blind-cat-cols
    
    Signed-off-by: Mattias Andrée <maandree_AT_kth.se>

diff --git a/Makefile b/Makefile
index f7de021..be882d8 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -3,6 +3,8 @@ include $(CONFIGFILE)
 
 BIN =\
         blind-arithm\
+ blind-cat-cols\
+ blind-cat-rows\
         blind-colour-ciexyz\
         blind-colour-srgb\
         blind-compress\
_AT_@ -22,6 +24,7 @@ BIN =\
         blind-from-text\
         blind-from-video\
         blind-gauss-blur\
+ blind-interleave\
         blind-invert-luma\
         blind-make-kernel\
         blind-next-frame\
diff --git a/TODO b/TODO
index 82a1fed..943f19a 100644
--- a/TODO
+++ b/TODO
_AT_@ -1,8 +1,11 @@
 Write manpages for:
+ blind-interleave framewise interleave videos
         blind-disperse inverse of blind-interleave
                                         Useful for processing a video on multiple computers
         blind-split-rows split stream into multiple streams by splitting video horizontally
         blind-split-cols split stream into multiple streams by splitting video vertically
+ blind-cat-rows merge video by vertically stacking streams (inverse of blind-split-rows)
+ blind-cat-cols merge video by putting streams beside each other (inverse of blind-split-cols)
 
 blind-transform affine transformation by matrix multiplication, -t for tiling, -s for
                                 improve quality on downscaling (pixels' neighbours must not change).
_AT_@ -22,7 +25,6 @@ blind-affine-colour apply an affine transformation to the colour of each pixel,
                                 -p for transforming each pixel with their own transformation.
 blind-invert-chroma invert the chroma
 blind-from-sent convert a sent presentation to a one-frame-per-slide blind video.
-blind-interleave framewise interleave videos
 
 blind-kirsch https://en.wikipedia.org/wiki/Kirsch_operator
 blind-gaussian-noise https://en.wikipedia.org/wiki/Gaussian_noise
_AT_@ -48,8 +50,6 @@ blind-mean mean of multiple streams
                         https://en.wikipedia.org/wiki/Logarithmic_mean
                         https://en.wikipedia.org/wiki/Stolarsky_mean
 blind-temporal-arithm blind-arithm but over all frames in a video instead of over all streams
-blind-cat-rows merge video by vertically stacking streams (inverse of blind-split-rows)
-blind-cat-cols merge video by putting streams beside each other (inverse of blind-split-cols)
 
 blind-from-video: add options to:
         * just run ffmpeg just print the output
diff --git a/src/blind-cat-cols.c b/src/blind-cat-cols.c
new file mode 100644
index 0000000..e20e913
--- /dev/null
+++ b/src/blind-cat-cols.c
_AT_@ -0,0 +1,42 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+USAGE("(file columns) ...")
+
+int
+main(int argc, char *argv[])
+{
+ struct stream *streams;
+ size_t parts, width = 0, *cols, i;
+
+ UNOFLAGS(argc % 2 || !argc);
+
+ parts = (size_t)argc / 2;
+ streams = emalloc2(parts, sizeof(*streams));
+ cols = alloca(parts * sizeof(*cols));
+
+ for (i = 0; i < parts; i++) {
+ eopen_stream(streams + i, argv[i * 2]);
+ cols[i] = etozu_arg("columns", argv[i * 2 + 1], 1, SIZE_MAX);
+ if (streams[i].width > SIZE_MAX - width)
+ eprintf("output video is too tall\n");
+ width += streams[i].width;
+ if (i) {
+ streams[i].width = streams->width;
+ echeck_compat(streams, streams + i);
+ }
+ }
+
+ streams->width = width;
+ fprint_stream_head(stdout, streams);
+ efflush(stdout, "<stdout>");
+
+ for (i = 0; i < parts; i++, i = i == parts ? 0 : i)
+ if (esend_pixels(streams + i, STDOUT_FILENO, cols[i], "<stdout>") != cols[i])
+ break;
+ for (i = 0; i < parts; i++)
+ close(streams[i].fd);
+
+ free(streams);
+ return 0;
+}
diff --git a/src/blind-cat-rows.c b/src/blind-cat-rows.c
new file mode 100644
index 0000000..32113e5
--- /dev/null
+++ b/src/blind-cat-rows.c
_AT_@ -0,0 +1,42 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+USAGE("(file rows) ...")
+
+int
+main(int argc, char *argv[])
+{
+ struct stream *streams;
+ size_t parts, height = 0, *rows, i;
+
+ UNOFLAGS(argc % 2 || !argc);
+
+ parts = (size_t)argc / 2;
+ streams = emalloc2(parts, sizeof(*streams));
+ rows = alloca(parts * sizeof(*rows));
+
+ for (i = 0; i < parts; i++) {
+ eopen_stream(streams + i, argv[i * 2]);
+ rows[i] = etozu_arg("rows", argv[i * 2 + 1], 1, SIZE_MAX);
+ if (streams[i].height > SIZE_MAX - height)
+ eprintf("output video is too wide\n");
+ height += streams[i].height;
+ if (i) {
+ streams[i].height = streams->height;
+ echeck_compat(streams, streams + i);
+ }
+ }
+
+ streams->height = height;
+ fprint_stream_head(stdout, streams);
+ efflush(stdout, "<stdout>");
+
+ for (i = 0; i < parts; i++, i = i == parts ? 0 : i)
+ if (esend_rows(streams + i, STDOUT_FILENO, rows[i], "<stdout>") != rows[i])
+ break;
+ for (i = 0; i < parts; i++)
+ close(streams[i].fd);
+
+ free(streams);
+ return 0;
+}
diff --git a/src/blind-interleave.c b/src/blind-interleave.c
new file mode 100644
index 0000000..bc3bcac
--- /dev/null
+++ b/src/blind-interleave.c
_AT_@ -0,0 +1,44 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+USAGE("(file frames) ...")
+
+int
+main(int argc, char *argv[])
+{
+ struct stream *streams;
+ size_t parts, length = 0, *frames, i;
+
+ UNOFLAGS(argc % 2 || !argc);
+
+ parts = (size_t)argc / 2;
+ streams = emalloc2(parts, sizeof(*streams));
+ frames = alloca(parts * sizeof(*frames));
+
+ for (i = 0; i < parts; i++) {
+ eopen_stream(streams + i, argv[i * 2]);
+ frames[i] = etozu_arg("frames", argv[i * 2 + 1], 1, SIZE_MAX);
+ if (i)
+ echeck_compat(streams, streams + i);
+ }
+ for (i = 0; i < parts; i++) {
+ if (!streams[i].frames || streams[i].frames > SIZE_MAX - length) {
+ length = 0;
+ break;
+ }
+ length += streams[i].frames;
+ }
+
+ streams->frames = length;
+ fprint_stream_head(stdout, streams);
+ efflush(stdout, "<stdout>");
+
+ for (i = 0; i < parts; i++, i = i == parts ? 0 : i)
+ if (esend_frames(streams + i, STDOUT_FILENO, frames[i], "<stdout>") != frames[i])
+ break;
+ for (i = 0; i < parts; i++)
+ close(streams[i].fd);
+
+ free(streams);
+ return 0;
+}
Received on Fri Jun 02 2017 - 22:32:22 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 02 2017 - 22:36:30 CEST