commit c295bcecda2cdf04b28c1b4767e05e815b41a04e
parent 4751eda976c09f2409e93364b6b76fdc950bcda6
Author: Mattias Andrée <maandree@kth.se>
Date: Fri, 2 Jun 2017 22:31:08 +0200
Fix blind-cat-cols and blind-cat-rows cmdline and document blind-disperse, blind-interleave, blind-split-cols, and blind-split-rows
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat:
12 files changed, 213 insertions(+), 33 deletions(-)
diff --git a/README b/README
@@ -15,6 +15,12 @@ UTILITIES
blind-arithm(1)
Perform simple arithmetic on a video
+ blind-cat-cols(1)
+ Place videos side by side
+
+ blind-cat-rows(1)
+ Stack videos vertically
+
blind-colour-ciexyz(1)
Convert CIE XYZ for use with blind-single-colour(1)
@@ -36,6 +42,9 @@ UTILITIES
blind-dissolve(1)
Fade a video by chaning it's alpha channel
+ blind-disperse(1)
+ Framewise split a video into multiple videos
+
blind-extend(1)
Add margins to a video
@@ -63,6 +72,9 @@ UTILITIES
blind-gauss-blur(1)
Apply Gaussian blur to a video
+ blind-interleave(1)
+ Framewise interleave videos
+
blind-invert-luma(1)
Invert the luminosity of a video
@@ -111,6 +123,12 @@ UTILITIES
blind-split(1)
Split a video, by frame, into multiple videos
+ blind-split-cols(1)
+ Split a video vertically into multiple videos
+
+ blind-split-rows(1)
+ Split a video horizontally into multiple videos
+
blind-stack(1)
Overlay videos
diff --git a/TODO b/TODO
@@ -1,9 +1,4 @@
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)
diff --git a/man/blind-concat.1 b/man/blind-concat.1
@@ -40,7 +40,10 @@ processes are rendering.
.SH SEE ALSO
.BR blind (7),
.BR blind-to-video (1),
-.BR blind-split (1)
+.BR blind-split (1),
+.BR blind-interleave (1),
+.BR blind-cat-rows (1),
+.BR blind-cat-cols (1)
.SH AUTHORS
Mattias Andrée
.RI < maandree@kth.se >
diff --git a/man/blind-cut.1 b/man/blind-cut.1
@@ -29,7 +29,10 @@ is specified instead of
.BR blind (7),
.BR blind-from-video (1),
.BR blind-split (1),
-.BR blind-concat (1)
+.BR blind-concat (1),
+.BR blind-disperse (1),
+.BR blind-split-cols (1),
+.BR blind-split-rows (1)
.SH AUTHORS
Mattias Andrée
.RI < maandree@kth.se >
diff --git a/man/blind-disperse.1 b/man/blind-disperse.1
@@ -0,0 +1,36 @@
+.TH BLIND-DISPERSE 1 blind
+.SH NAME
+blind-disperse - Framewise split a video into multiple videos
+.SH SYNOPSIS
+.B blind-disperse
+.RI ( file
+.IR frames )\ ...
+.SH DESCRIPTION
+.B blind-disperse
+reads a video from stdin and splits into multiple videos.
+Starting from the first frame in stdin, it writes a video
+to the first specified
+.I file
+until the first specified number of
+.I frames
+have been written.
+.B blind-disperse
+then proceeds to do to the same for the next pair of
+.I file
+and
+.I frames
+until, and in including, the last pair. This process
+is repeated until the last frame in stdin has been read.
+.SH RATIONALE
+This is useful processing a video on multiple computers.
+.SH SEE ALSO
+.BR blind (7),
+.BR blind-interleave (1),
+.BR blind-cut (1),
+.BR blind-split (1),
+.BR blind-split-cols (1),
+.BR blind-split-rows (1),
+.BR blind-skip-pattern (1)
+.SH AUTHORS
+Mattias Andrée
+.RI < maandree@kth.se >
diff --git a/man/blind-interleave.1 b/man/blind-interleave.1
@@ -0,0 +1,31 @@
+.TH BLIND-INTERLEAVE 1 blind
+.SH NAME
+blind-interleave - Framewise interleave videos
+.SH SYNOPSIS
+.B blind-interleave
+.RI ( file
+.IR frames )\ ...
+.SH DESCRIPTION
+.BR blind-interleave ,
+for each specified pair of
+.I file
+and
+.IR frames ,
+in order, reads
+.I frames
+frames from
+.R file
+and writes the read frames to stdout.
+This process is repeated until the number of specified
+.I frames
+cannot be read from a
+.IR file .
+.SH SEE ALSO
+.BR blind (7),
+.BR blind-disperse (1),
+.BR blind-concat (1),
+.BR blind-cat-cols (1),
+.BR blind-cat-rows (1),
+.SH AUTHORS
+Mattias Andrée
+.RI < maandree@kth.se >
diff --git a/man/blind-split-cols.1 b/man/blind-split-cols.1
@@ -0,0 +1,38 @@
+.TH BLIND-SPLIT-COLS 1 blind
+.SH NAME
+blind-split-cols - Split a video horizontally into multiple videos
+.SH SYNOPSIS
+.B blind-split-cols
+.RI ( file
+.IR columns )\ ...
+.SH DESCRIPTION
+.B blind-split-cols
+reads a video from stdin and splits into multiple videos.
+Starting from the first column in stdin, it writes a video
+to the first specified
+.I file
+until the first specified number of
+.I columns
+have been written.
+.B blind-split-cols
+then proceeds to do to the same for the next pair of
+.I file
+and
+.I columns
+until, and in including, the last pair. This process
+is repeated until the last column in stdin has been read.
+(In this context a column is technically defined as a segment of a row.)
+.P
+The sum of all
+.I columns
+must add up exactly to the width of the input video.
+.SH SEE ALSO
+.BR blind (7),
+.BR blind-cat-cols (1),
+.BR blind-cut (1),
+.BR blind-split (1),
+.BR blind-disperse (1),
+.BR blind-split-rows (1)
+.SH AUTHORS
+Mattias Andrée
+.RI < maandree@kth.se >
diff --git a/man/blind-split-rows.1 b/man/blind-split-rows.1
@@ -0,0 +1,37 @@
+.TH BLIND-SPLIT-ROWS 1 blind
+.SH NAME
+blind-split-rows - Split a video horizontally into multiple videos
+.SH SYNOPSIS
+.B blind-split-rows
+.RI ( file
+.IR rows )\ ...
+.SH DESCRIPTION
+.B blind-split-rows
+reads a video from stdin and splits into multiple videos.
+Starting from the first row in stdin, it writes a video
+to the first specified
+.I file
+until the first specified number of
+.I rows
+have been written.
+.B blind-split-rows
+then proceeds to do to the same for the next pair of
+.I file
+and
+.I rows
+until, and in including, the last pair. This process
+is repeated until the last row in stdin has been read.
+.P
+The sum of all
+.I rows
+must add up exactly to the height of the input video.
+.SH SEE ALSO
+.BR blind (7),
+.BR blind-cat-rows (1),
+.BR blind-cut (1),
+.BR blind-split (1),
+.BR blind-disperse (1),
+.BR blind-split-cols (1)
+.SH AUTHORS
+Mattias Andrée
+.RI < maandree@kth.se >
diff --git a/man/blind-split.1 b/man/blind-split.1
@@ -11,14 +11,14 @@ blind-split - Split a video, by frame, into multiple videos
.SH DESCRIPTION
.B blind-split
reads a video from stdin and splits into multiple videos.
-Starting from the first frame in stdin, it write a video
+Starting from the first frame in stdin, it writes a video
to the first specified
.I file
until the first specified
.I end-point
number of frames have been written.
.B blind-split
-the proceeds to write the following frames to the next
+then proceeds to write the following frames to the next
specified
.B file
until a total of
@@ -85,6 +85,9 @@ rewrite its head with
.BR blind-to-video (1),
.BR blind-cut (1),
.BR blind-concat (1),
+.BR blind-disperse (1),
+.BR blind-split-cols (1),
+.BR blind-split-rows (1),
.BR blind-rewrite-head (1)
.SH AUTHORS
Mattias Andrée
diff --git a/man/blind.7 b/man/blind.7
@@ -22,6 +22,12 @@ first convert it with
.BR blind-arithm (1)
Perform simple arithmetic on a video
.TP
+.BR blind-cat-cols (1)
+Place videos side by side
+.TP
+.BR blind-cat-rows (1)
+Stack videos vertically
+.TP
.BR blind-colour-ciexyz (1)
Convert CIE XYZ for use with blind-single-colour(1)
.TP
@@ -49,6 +55,9 @@ Decompress a video compressed by blind-compress(1)
.BR blind-dissolve (1)
Fade a video by chaning it's alpha channel
.TP
+.BR blind-disperse (1)
+Framewise split a video into multiple videos
+.TP
.BR blind-extend (1)
Add margins to a video
.TP
@@ -76,6 +85,9 @@ Converts a regular, cooked video to a blind video
.BR blind-gauss-blur (1)
Apply Gaussian blur to a video
.TP
+.BR blind-interleave (1)
+Framewise interleave videos
+.TP
.BR blind-invert-luma (1)
Invert the luminosity of a video
.TP
@@ -124,6 +136,12 @@ Skips frames in a video according to pattern
.BR blind-split (1)
Split a video, by frame, into multiple videos
.TP
+.BR blind-split-cols (1)
+Split a video vertically into multiple videos
+.TP
+.BR blind-split-rows (1)
+Split a video horizontally into multiple videos
+.TP
.BR blind-stack (1)
Overlay videos
.TP
diff --git a/src/blind-cat-cols.c b/src/blind-cat-cols.c
@@ -1,26 +1,25 @@
/* See LICENSE file for copyright and license details. */
#include "common.h"
-USAGE("(file columns) ...")
+USAGE("file ...")
int
main(int argc, char *argv[])
{
struct stream *streams;
- size_t parts, width = 0, *cols, i;
+ size_t width = 0, *cols;
+ int i;
- UNOFLAGS(argc % 2 || !argc);
+ UNOFLAGS(!argc);
- parts = (size_t)argc / 2;
- streams = emalloc2(parts, sizeof(*streams));
- cols = alloca(parts * sizeof(*cols));
+ streams = emalloc2((size_t)argc, sizeof(*streams));
+ cols = alloca((size_t)argc * 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);
+ for (i = 0; i < argc; i++) {
+ eopen_stream(streams + i, argv[i]);
if (streams[i].width > SIZE_MAX - width)
eprintf("output video is too tall\n");
- width += streams[i].width;
+ width += cols[i] = streams[i].width;
if (i) {
streams[i].width = streams->width;
echeck_compat(streams, streams + i);
@@ -31,10 +30,10 @@ main(int argc, char *argv[])
fprint_stream_head(stdout, streams);
efflush(stdout, "<stdout>");
- for (i = 0; i < parts; i++, i = i == parts ? 0 : i)
+ for (i = 0; i < argc; i++, i = i == argc ? 0 : i)
if (esend_pixels(streams + i, STDOUT_FILENO, cols[i], "<stdout>") != cols[i])
break;
- for (i = 0; i < parts; i++)
+ for (i = 0; i < argc; i++)
close(streams[i].fd);
free(streams);
diff --git a/src/blind-cat-rows.c b/src/blind-cat-rows.c
@@ -1,26 +1,25 @@
/* See LICENSE file for copyright and license details. */
#include "common.h"
-USAGE("(file rows) ...")
+USAGE("file ...")
int
main(int argc, char *argv[])
{
struct stream *streams;
- size_t parts, height = 0, *rows, i;
+ size_t height = 0, *rows;
+ int i;
- UNOFLAGS(argc % 2 || !argc);
+ UNOFLAGS(!argc);
- parts = (size_t)argc / 2;
- streams = emalloc2(parts, sizeof(*streams));
- rows = alloca(parts * sizeof(*rows));
+ streams = emalloc2((size_t)argc, sizeof(*streams));
+ rows = alloca((size_t)argc * 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);
+ for (i = 0; i < argc; i++) {
+ eopen_stream(streams + i, argv[i]);
if (streams[i].height > SIZE_MAX - height)
eprintf("output video is too wide\n");
- height += streams[i].height;
+ height += rows[i] = streams[i].height;
if (i) {
streams[i].height = streams->height;
echeck_compat(streams, streams + i);
@@ -31,10 +30,10 @@ main(int argc, char *argv[])
fprint_stream_head(stdout, streams);
efflush(stdout, "<stdout>");
- for (i = 0; i < parts; i++, i = i == parts ? 0 : i)
+ for (i = 0; i < argc; i++, i = i == argc ? 0 : i)
if (esend_rows(streams + i, STDOUT_FILENO, rows[i], "<stdout>") != rows[i])
break;
- for (i = 0; i < parts; i++)
+ for (i = 0; i < argc; i++)
close(streams[i].fd);
free(streams);