about summary refs log tree commit diff
path: root/editor/pnminvert.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2010-08-27 03:11:45 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2010-08-27 03:11:45 +0000
commit17830f0c122c8914b2b569ee5dc6a3091017be88 (patch)
tree118f5aca5a2f0d0999bb99da8bcf66c3f9b785c4 /editor/pnminvert.c
parent444320669366ce8ba982609e9f16432fdd1314ab (diff)
downloadnetpbm-mirror-17830f0c122c8914b2b569ee5dc6a3091017be88.tar.gz
netpbm-mirror-17830f0c122c8914b2b569ee5dc6a3091017be88.tar.xz
netpbm-mirror-17830f0c122c8914b2b569ee5dc6a3091017be88.zip
Add comment about tree vectorization
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1277 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pnminvert.c')
-rw-r--r--editor/pnminvert.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/editor/pnminvert.c b/editor/pnminvert.c
index 40fee9be..ceb1ef81 100644
--- a/editor/pnminvert.c
+++ b/editor/pnminvert.c
@@ -12,6 +12,17 @@
 
 #include "pnm.h"
 
+/* Implementation note: A suitably advanced compiler, such as Gcc 4,
+   implements the for statements in our algorithm with instructions that do 16
+   bytes at a time on CPUs that have them (movdqa on x86).  This is "tree
+   vectorization."  A more primitive compiler will do one byte at a time; we
+   could change the code to use libnetpbm's wordaccess.h facility and it will
+   do one word at a time.  (But we don't think it's worth complicating the
+   code for that).
+*/
+
+
+
 #define CHARBITS (sizeof(unsigned char)*8)
 
 
@@ -25,9 +36,6 @@ invertPbm(FILE * const ifP,
 /*----------------------------------------------------------------------------
    Invert a PBM image.  Use the "packed" PBM functions for speed.
 -----------------------------------------------------------------------------*/
-    /* We could make this faster by inverting whole words at a time,
-       using libnetpbm's wordaccess.h facility.
-    */
     int const colChars = pbm_packed_bytes(cols);
 
     unsigned char * bitrow;