Blame thirdparty/libjpeg-turbo/libjpeg-turbo-2.0.6/jchuff.h
|
shun-iwasawa |
82a8f5 |
/*
|
|
shun-iwasawa |
82a8f5 |
* jchuff.h
|
|
shun-iwasawa |
82a8f5 |
*
|
|
shun-iwasawa |
82a8f5 |
* This file was part of the Independent JPEG Group's software:
|
|
shun-iwasawa |
82a8f5 |
* Copyright (C) 1991-1997, Thomas G. Lane.
|
|
shun-iwasawa |
82a8f5 |
* It was modified by The libjpeg-turbo Project to include only code relevant
|
|
shun-iwasawa |
82a8f5 |
* to libjpeg-turbo.
|
|
shun-iwasawa |
82a8f5 |
* For conditions of distribution and use, see the accompanying README.ijg
|
|
shun-iwasawa |
82a8f5 |
* file.
|
|
shun-iwasawa |
82a8f5 |
*
|
|
shun-iwasawa |
82a8f5 |
* This file contains declarations for Huffman entropy encoding routines
|
|
shun-iwasawa |
82a8f5 |
* that are shared between the sequential encoder (jchuff.c) and the
|
|
shun-iwasawa |
82a8f5 |
* progressive encoder (jcphuff.c). No other modules need to see these.
|
|
shun-iwasawa |
82a8f5 |
*/
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
/* The legal range of a DCT coefficient is
|
|
shun-iwasawa |
82a8f5 |
* -1024 .. +1023 for 8-bit data;
|
|
shun-iwasawa |
82a8f5 |
* -16384 .. +16383 for 12-bit data.
|
|
shun-iwasawa |
82a8f5 |
* Hence the magnitude should always fit in 10 or 14 bits respectively.
|
|
shun-iwasawa |
82a8f5 |
*/
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
#if BITS_IN_JSAMPLE == 8
|
|
shun-iwasawa |
82a8f5 |
#define MAX_COEF_BITS 10
|
|
shun-iwasawa |
82a8f5 |
#else
|
|
shun-iwasawa |
82a8f5 |
#define MAX_COEF_BITS 14
|
|
shun-iwasawa |
82a8f5 |
#endif
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
/* Derived data constructed for each Huffman table */
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
typedef struct {
|
|
shun-iwasawa |
82a8f5 |
unsigned int ehufco[256]; /* code for each symbol */
|
|
shun-iwasawa |
82a8f5 |
char ehufsi[256]; /* length of code for each symbol */
|
|
shun-iwasawa |
82a8f5 |
/* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */
|
|
shun-iwasawa |
82a8f5 |
} c_derived_tbl;
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
/* Expand a Huffman table definition into the derived format */
|
|
shun-iwasawa |
82a8f5 |
EXTERN(void) jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC,
|
|
shun-iwasawa |
82a8f5 |
int tblno, c_derived_tbl **pdtbl);
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
/* Generate an optimal table definition given the specified counts */
|
|
shun-iwasawa |
82a8f5 |
EXTERN(void) jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl,
|
|
shun-iwasawa |
82a8f5 |
long freq[]);
|