(wrong string) ée

From: <git_AT_suckless.org>
Date: Mon, 8 May 2017 22:09:42 +0200 (CEST)

commit 94de8e2bd18743949bbb82d9e8cac109da4a15f3
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Mon May 8 20:25:47 2017 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Mon May 8 20:25:47 2017 +0200

    Improve performance of blind-transpose
    
    Signed-off-by: Mattias Andrée <maandree_AT_kth.se>

diff --git a/src/blind-transpose.c b/src/blind-transpose.c
index d1b4e47..c2d2d11 100644
--- a/src/blind-transpose.c
+++ b/src/blind-transpose.c
_AT_@ -13,31 +13,36 @@ int
 main(int argc, char *argv[])
 {
         struct stream stream;
- char *buf, *image;
- size_t n, imgw, srcw, srch, ps, x, y, i, b, dx;
+ char *buf, *row, *pix, *image, *imag, *img;
+ size_t n, srcw, srch, srcwps, srchps, ps, x, y, i;
 
         UNOFLAGS(argc);
 
         eopen_stream(&stream, NULL);
- imgw = srch = stream.height;
+ srch = stream.height;
         stream.height = srcw = stream.width;
- stream.width = imgw;
+ stream.width = srch;
         fprint_stream_head(stdout, &stream);
         efflush(stdout, "<stdout>");
 
         echeck_frame_size(stream.width, stream.height, stream.pixel_size, 0, stream.file);
- n = stream.width * stream.height * (ps = stream.pixel_size);
+ n = stream.height * stream.width * (ps = stream.pixel_size);
         buf = emalloc(n);
- image = emalloc(n); /* TODO optimise to a frame row */
+ image = emalloc(n);
 
- srch *= ps;
- srcw *= dx = imgw * ps;
- imgw *= ps;
+ srchps = srch * ps;
+ srcwps = srcw * ps;
         while (eread_frame(&stream, buf, n)) {
- 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];
+ for (y = 0; y < srchps; y += ps) {
+ imag = image + y;
+ row = buf + y * srcw;
+ for (x = 0; x < srcwps; x += ps) {
+ img = imag + x * srch;
+ pix = row + x;
+ for (i = 0; i < ps; i++)
+ img[i] = pix[i];
+ }
+ }
                 ewriteall(STDOUT_FILENO, image, n, "<stdout>");
         }
 
Received on Mon May 08 2017 - 22:09:42 CEST

This archive was generated by hypermail 2.3.0 : Mon May 08 2017 - 22:12:19 CEST