From ba67e5506bd93eef064d72883ff94dbadee14082 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 5 Aug 2017 00:03:44 +0200 Subject: Add support for skipping conversion to CIEXYZ (not complete) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some tools are colour space agnostic or even encoding agnostic, by skipping conversion to CIEXYZ when these tools are used, the rendering time can be significantly reduced. The video can also be split horizontally and vertically, and latted merged back, so it is not necessary to convert the entire video if only parts of it actually need it. Because some tools are less agnostic than other tools, partial conversion to CIEXYZ is also added. blind-convert must be updated, and all tools most be test Signed-off-by: Mattias Andrée --- src/blind-from-video.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'src/blind-from-video.c') diff --git a/src/blind-from-video.c b/src/blind-from-video.c index 07f4bda..8f53af2 100644 --- a/src/blind-from-video.c +++ b/src/blind-from-video.c @@ -1,7 +1,7 @@ /* See LICENSE file for copyright and license details. */ #include "common.h" -USAGE("[-F pixel-format] [-r frame-rate] [-w width -h height] [-dL] input-file output-file") +USAGE("[-F pixel-format] [-r frame-rate] [-w width -h height] [-dL] input-file [output-file]") static int draft = 0; static void (*convert_segment)(char *buf, size_t n, int fd, const char *file); @@ -153,16 +153,21 @@ convert(const char *infile, int outfd, const char *outfile, size_t width, size_t close(pipe_rw[1]); - for (ptr = 0;;) { - if (!(n = eread(pipe_rw[0], buf + ptr, sizeof(buf) - ptr, ""))) - break; - ptr += n; - n = ptr - (ptr % 8); - convert_segment(buf, n, outfd, outfile); - memmove(buf, buf + n, ptr -= n); + if (convert_segment) { + for (ptr = 0;;) { + if (!(n = eread(pipe_rw[0], buf + ptr, sizeof(buf) - ptr, ""))) + break; + ptr += n; + n = ptr - (ptr % 8); + convert_segment(buf, n, outfd, outfile); + memmove(buf, buf + n, ptr -= n); + } + if (ptr) + eprintf(": incomplete frame\n"); + } else { + while ((n = eread(pipe_rw[0], buf, sizeof(buf), ""))) + ewriteall(outfd, buf, (size_t)n, outfile); } - if (ptr) - eprintf(": incomplete frame\n"); close(pipe_rw[0]); ewaitpid(pid, &status, 0); @@ -208,19 +213,21 @@ main(int argc, char *argv[]) usage(); } ARGEND; - if (argc != 2 || !width != !height) + if (argc < 1 || argc > 2 || !width != !height) usage(); infile = argv[0]; - outfile = argv[1]; + outfile = argv[1] ? argv[1] : "-"; pixfmt = get_pixel_format(pixfmt, "xyza"); if (!strcmp(pixfmt, "xyza")) convert_segment = convert_segment_xyza; else if (!strcmp(pixfmt, "xyza f")) convert_segment = convert_segment_xyzaf; + else if (!strcmp(pixfmt, "raw0")) + convert_segment = NULL; else - eprintf("pixel format %s is not supported, try xyza\n", pixfmt); + eprintf("pixel format %s is not supported, try xyza or raw0 and blind-convert\n", pixfmt); if (!width) get_metadata(infile, &width, &height); -- cgit v1.2.3-70-g09d2