dcmjpeg/libijg8/jchuff8.h

00001 /*
00002  * jchuff.h
00003  *
00004  * Copyright (C) 1991-1997, Thomas G. Lane.
00005  * This file is part of the Independent JPEG Group's software.
00006  * For conditions of distribution and use, see the accompanying README file.
00007  *
00008  * This file contains declarations for Huffman entropy encoding routines
00009  * that are shared between the sequential encoder (jchuff.c) and the
00010  * progressive encoder (jcphuff.c).  No other modules need to see these.
00011  */
00012 
00013 /* The legal range of a DCT coefficient is
00014  *  -1024 .. +1023  for 8-bit data;
00015  * -16384 .. +16383 for 12-bit data.
00016  * Hence the magnitude should always fit in 10 or 14 bits respectively.
00017  */
00018 
00019 #if BITS_IN_JSAMPLE == 8
00020 #define MAX_COEF_BITS 10
00021 #else
00022 #define MAX_COEF_BITS 14
00023 #endif
00024 
00025 /* The legal range of a spatial difference is
00026  * -32767 .. +32768.
00027  * Hence the magnitude should always fit in 16 bits.
00028  */
00029 
00030 #define MAX_DIFF_BITS 16
00031 
00032 /* Derived data constructed for each Huffman table */
00033 
00034 typedef struct {
00035   unsigned int ehufco[256]; /* code for each symbol */
00036   char ehufsi[256];     /* length of code for each symbol */
00037   /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */
00038 } c_derived_tbl;
00039 
00040 /* Short forms of external names for systems with brain-damaged linkers. */
00041 
00042 #ifdef NEED_SHORT_EXTERNAL_NAMES
00043 #define jpeg_make_c_derived_tbl     jpeg8_make_c_derived_tbl
00044 #define jpeg_gen_optimal_table      jpeg8_gen_optimal_table
00045 #endif /* NEED_SHORT_EXTERNAL_NAMES */
00046 
00047 /* Expand a Huffman table definition into the derived format */
00048 EXTERN(void) jpeg_make_c_derived_tbl
00049     JPP((j_compress_ptr cinfo, boolean isDC, int tblno,
00050          c_derived_tbl ** pdtbl));
00051 
00052 /* Generate an optimal table definition given the specified counts */
00053 EXTERN(void) jpeg_gen_optimal_table
00054     JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]));


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1