bitblt_table_gen.c

changeset 53
bb180150e603
child 56
425e8c46d318
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/bitblt_table_gen.c	Wed Feb 19 10:14:49 2003 +0000
     1.3 @@ -0,0 +1,59 @@
     1.4 +/*
     1.5 + * t2p: Create a PDF file from the contents of one or more TIFF
     1.6 + *      bilevel image files.  The images in the resulting PDF file
     1.7 + *      will be compressed using ITU-T T.6 (G4) fax encoding.
     1.8 + *
     1.9 + * bitblt table generator
    1.10 + * $Id: bitblt_table_gen.c,v 1.1 2003/02/19 02:14:44 eric Exp $
    1.11 + * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    1.12 + *
    1.13 + * This program is free software; you can redistribute it and/or modify
    1.14 + * it under the terms of the GNU General Public License version 2 as
    1.15 + * published by the Free Software Foundation.  Note that permission is
    1.16 + * not granted to redistribute this program under the terms of any
    1.17 + * other version of the General Public License.
    1.18 + *
    1.19 + * This program is distributed in the hope that it will be useful,
    1.20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.22 + * GNU General Public License for more details.
    1.23 + *
    1.24 + * You should have received a copy of the GNU General Public License
    1.25 + * along with this program; if not, write to the Free Software
    1.26 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
    1.27 + */
    1.28 +
    1.29 +
    1.30 +#include <stdio.h>
    1.31 +
    1.32 +int main (int argc, char *argv[])
    1.33 +{
    1.34 +  int i, j;
    1.35 +
    1.36 +  printf ("/* This file is automatically generated; do not edit */\n");
    1.37 +  printf ("\n");
    1.38 +  printf ("static const uint8_t bit_reverse_byte [0x100] =\n");
    1.39 +  printf ("{\n");
    1.40 +  for (i = 0; i < 0x100; i++)
    1.41 +    {
    1.42 +      if ((i & 7) == 0)
    1.43 +	printf ("  ");
    1.44 +      j = (((i & 0x01) << 7) |
    1.45 +	   ((i & 0x02) << 5) |
    1.46 +	   ((i & 0x04) << 3) |
    1.47 +	   ((i & 0x08) << 1) |
    1.48 +	   ((i & 0x10) >> 1) |
    1.49 +	   ((i & 0x20) >> 3) |
    1.50 +	   ((i & 0x40) >> 5) |
    1.51 +	   ((i & 0x80) >> 7));
    1.52 +      printf ("0x%02x", j);
    1.53 +      if (i != 0xff)
    1.54 +	printf (",");
    1.55 +      if ((i & 7) == 7)
    1.56 +	printf ("\n");
    1.57 +      else
    1.58 +	printf (" ");
    1.59 +    }
    1.60 +  printf ("};\n");
    1.61 +  return (0);
    1.62 +}