bitblt_table_gen.c

Wed, 19 Feb 2003 10:14:49 +0000

author
eric
date
Wed, 19 Feb 2003 10:14:49 +0000
changeset 53
bb180150e603
child 56
425e8c46d318
permissions
-rw-r--r--

rename br.c to bitblt_table_gen.c, and integrate use of it into build process

eric@53 1 /*
eric@53 2 * t2p: Create a PDF file from the contents of one or more TIFF
eric@53 3 * bilevel image files. The images in the resulting PDF file
eric@53 4 * will be compressed using ITU-T T.6 (G4) fax encoding.
eric@53 5 *
eric@53 6 * bitblt table generator
eric@53 7 * $Id: bitblt_table_gen.c,v 1.1 2003/02/19 02:14:44 eric Exp $
eric@53 8 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
eric@53 9 *
eric@53 10 * This program is free software; you can redistribute it and/or modify
eric@53 11 * it under the terms of the GNU General Public License version 2 as
eric@53 12 * published by the Free Software Foundation. Note that permission is
eric@53 13 * not granted to redistribute this program under the terms of any
eric@53 14 * other version of the General Public License.
eric@53 15 *
eric@53 16 * This program is distributed in the hope that it will be useful,
eric@53 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eric@53 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eric@53 19 * GNU General Public License for more details.
eric@53 20 *
eric@53 21 * You should have received a copy of the GNU General Public License
eric@53 22 * along with this program; if not, write to the Free Software
eric@53 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
eric@53 24 */
eric@53 25
eric@53 26
eric@53 27 #include <stdio.h>
eric@53 28
eric@53 29 int main (int argc, char *argv[])
eric@53 30 {
eric@53 31 int i, j;
eric@53 32
eric@53 33 printf ("/* This file is automatically generated; do not edit */\n");
eric@53 34 printf ("\n");
eric@53 35 printf ("static const uint8_t bit_reverse_byte [0x100] =\n");
eric@53 36 printf ("{\n");
eric@53 37 for (i = 0; i < 0x100; i++)
eric@53 38 {
eric@53 39 if ((i & 7) == 0)
eric@53 40 printf (" ");
eric@53 41 j = (((i & 0x01) << 7) |
eric@53 42 ((i & 0x02) << 5) |
eric@53 43 ((i & 0x04) << 3) |
eric@53 44 ((i & 0x08) << 1) |
eric@53 45 ((i & 0x10) >> 1) |
eric@53 46 ((i & 0x20) >> 3) |
eric@53 47 ((i & 0x40) >> 5) |
eric@53 48 ((i & 0x80) >> 7));
eric@53 49 printf ("0x%02x", j);
eric@53 50 if (i != 0xff)
eric@53 51 printf (",");
eric@53 52 if ((i & 7) == 7)
eric@53 53 printf ("\n");
eric@53 54 else
eric@53 55 printf (" ");
eric@53 56 }
eric@53 57 printf ("};\n");
eric@53 58 return (0);
eric@53 59 }