commit 37980568fc614968f1c1f55f3ef4e0dd17f968eb
parent a2dfbb3368ce0e998f774dd294383772651d1302
Author: Mattias Andrée <maandree@kth.se>
Date: Sat, 14 Jan 2017 04:59:20 +0100
Fix blind-transpose
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat:
2 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/TODO b/TODO
@@ -1,9 +1,31 @@
-vu-transform transformation by matrix multiplication, -t for tiling, -s for improve quality
+blind-transform transformation by matrix multiplication, -t for tiling, -s for improve quality
on downscaling (pixels' neighbours must not change)
-vu-chroma-key replace a chroma with transparency
-vu-primary-key replace a primary with transparency, -g for greyscaled images
-vu-primaries given three selectable primaries split the video into three side-by-side which
+blind-chroma-key replace a chroma with transparency
+blind-primary-key replace a primary with transparency, -g for greyscaled images
+blind-primaries given three selectable primaries split the video into three side-by-side which
only one primary active
-vu-apply-map remap pixels (distortion) using the X and Y values, -t for tiling, -s for
+blind-apply-map remap pixels (distortion) using the X and Y values, -t for tiling, -s for
improve quality on downscaling (pixels' neighbours must not change)
-vu-apply-kernel apply a convolution matrix
+blind-apply-kernel apply a convolution matrix
+
+UNTESTED:
+ blind-arithm
+ blind-colour-srgb
+ blind-concat
+ blind-crop
+ blind-cut
+ blind-dissolve
+ blind-extend
+ blind-from-text
+ blind-gauss-blur
+ blind-invert-luma
+ blind-repeat
+ blind-reverse
+ blind-rewrite-head
+ blind-set-alpha
+ blind-set-luma
+ blind-set-saturation
+ blind-single-colour
+ blind-split
+ blind-stack
+ blind-to-text
diff --git a/src/blind-transpose.c b/src/blind-transpose.c
@@ -14,28 +14,33 @@ main(int argc, char *argv[])
{
struct stream stream;
char *buf, *image;
- size_t n, imgw, imgh, x, y, i, b;
+ size_t n, imgw, srcw, srch, ps, x, y, i, b, dx;
ENOFLAGS(argc);
stream.file = "<stdin>";
stream.fd = STDIN_FILENO;
einit_stream(&stream);
+ imgw = srch = stream.height;
+ stream.height = srcw = stream.width;
+ stream.width = imgw;
fprint_stream_head(stdout, &stream);
efflush(stdout, "<stdout>");
echeck_frame_size(stream.width, stream.height, stream.pixel_size, 0, "<stdin>");
- n = stream.width * stream.height * stream.pixel_size;
+ n = stream.width * stream.height * (ps = stream.pixel_size);
buf = emalloc(n);
image = emalloc(n);
- imgw = stream.width * (imgh = stream.height * stream.pixel_size);
+ srch *= ps;
+ srcw *= dx = imgw * ps;
+ imgw *= ps;
memcpy(buf, stream.buf, stream.ptr);
while (eread_frame(&stream, buf, n)) {
- for (b = y = 0; y < imgh; y += stream.pixel_size)
- for (x = 0; x < imgw; x += imgh)
- for (i = 0; i < stream.pixel_size; i++)
- image[x + y + i] = buf[b++];
+ for (b = y = 0; y < srch; y += ps)
+ for (x = 0; x < srcw; x += dx)
+ for (i = 0; i < ps; i++, b++)
+ image[y + x + i] = buf[b];
ewriteall(STDOUT_FILENO, image, n, "<stdout>");
}