jdk/src/share/native/sun/awt/image/jpeg/jchuff.h
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * jchuff.h
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * Copyright (C) 1991-1997, Thomas G. Lane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This file is part of the Independent JPEG Group's software.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * For conditions of distribution and use, see the accompanying README file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * This file contains declarations for Huffman entropy encoding routines
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * that are shared between the sequential encoder (jchuff.c) and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * progressive encoder (jcphuff.c).  No other modules need to see these.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
/* The legal range of a DCT coefficient is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *  -1024 .. +1023  for 8-bit data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * -16384 .. +16383 for 12-bit data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * Hence the magnitude should always fit in 10 or 14 bits respectively.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
#if BITS_IN_JSAMPLE == 8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#define MAX_COEF_BITS 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#define MAX_COEF_BITS 14
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/* Derived data constructed for each Huffman table */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
  unsigned int ehufco[256];     /* code for each symbol */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
  char ehufsi[256];             /* length of code for each symbol */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
  /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
} c_derived_tbl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/* Short forms of external names for systems with brain-damaged linkers. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#ifdef NEED_SHORT_EXTERNAL_NAMES
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#define jpeg_make_c_derived_tbl jMkCDerived
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define jpeg_gen_optimal_table  jGenOptTbl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#endif /* NEED_SHORT_EXTERNAL_NAMES */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/* Expand a Huffman table definition into the derived format */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
EXTERN(void) jpeg_make_c_derived_tbl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        JPP((j_compress_ptr cinfo, boolean isDC, int tblno,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
             c_derived_tbl ** pdtbl));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
/* Generate an optimal table definition given the specified counts */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
EXTERN(void) jpeg_gen_optimal_table
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
        JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]));