jdhuff.c File Reference

#include "jinclude.h"
#include "jpeglib.h"

Go to the source code of this file.

Classes

struct  d_derived_tbl
struct  bitread_perm_state
struct  bitread_working_state
struct  savable_state
struct  huff_entropy_decoder

Defines

#define JPEG_INTERNALS
#define HUFF_LOOKAHEAD   8
#define BIT_BUF_SIZE   32
#define BITREAD_STATE_VARS
#define BITREAD_LOAD_STATE(cinfop, permstate)
#define BITREAD_SAVE_STATE(cinfop, permstate)
#define CHECK_BIT_BUFFER(state, nbits, action)
#define GET_BITS(nbits)   (((int) (get_buffer >> (bits_left -= (nbits)))) & BIT_MASK(nbits))
#define PEEK_BITS(nbits)   (((int) (get_buffer >> (bits_left - (nbits)))) & BIT_MASK(nbits))
#define DROP_BITS(nbits)   (bits_left -= (nbits))
#define HUFF_DECODE(result, state, htbl, failaction, slowlabel)
#define ASSIGN_STATE(dest, src)   ((dest) = (src))
#define MIN_GET_BITS   (BIT_BUF_SIZE-7)
#define BIT_MASK(nbits)   bmask[nbits]
#define HUFF_EXTEND(x, s)   ((x) <= bmask[(s) - 1] ? (x) - bmask[s] : (x))

Typedefs

typedef INT32 bit_buf_type
typedef huff_entropy_decoderhuff_entropy_ptr

Functions

 jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, d_derived_tbl **pdtbl)
 jpeg_fill_bit_buffer (bitread_working_state *state, register bit_buf_type get_buffer, register int bits_left, int nbits)
 jpeg_huff_decode (bitread_working_state *state, register bit_buf_type get_buffer, register int bits_left, d_derived_tbl *htbl, int min_bits)
 process_restart (j_decompress_ptr cinfo)
 decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
 decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
 decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
 decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
 decode_mcu_sub (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
 decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
 start_pass_huff_decoder (j_decompress_ptr cinfo)
 jinit_huff_decoder (j_decompress_ptr cinfo)

Variables

static const int jpeg_zigzag_order [8][8]
static const int jpeg_zigzag_order7 [7][7]
static const int jpeg_zigzag_order6 [6][6]
static const int jpeg_zigzag_order5 [5][5]
static const int jpeg_zigzag_order4 [4][4]
static const int jpeg_zigzag_order3 [3][3]
static const int jpeg_zigzag_order2 [2][2]
static const int bmask [16]


Define Documentation

#define ASSIGN_STATE ( dest,
src   )     ((dest) = (src))

Definition at line 209 of file jdhuff.c.

#define BIT_BUF_SIZE   32

Definition at line 70 of file jdhuff.c.

#define BIT_MASK ( nbits   )     bmask[nbits]

Definition at line 577 of file jdhuff.c.

#define BITREAD_LOAD_STATE ( cinfop,
permstate   ) 

Value:

br_state.cinfo = cinfop; \
        br_state.next_input_byte = cinfop->src->next_input_byte; \
        br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
        get_buffer = permstate.get_buffer; \
        bits_left = permstate.bits_left;

Definition at line 104 of file jdhuff.c.

Referenced by decode_mcu(), decode_mcu_AC_first(), decode_mcu_AC_refine(), decode_mcu_DC_first(), decode_mcu_DC_refine(), and decode_mcu_sub().

#define BITREAD_SAVE_STATE ( cinfop,
permstate   ) 

Value:

cinfop->src->next_input_byte = br_state.next_input_byte; \
        cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
        permstate.get_buffer = get_buffer; \
        permstate.bits_left = bits_left

Definition at line 111 of file jdhuff.c.

Referenced by decode_mcu(), decode_mcu_AC_first(), decode_mcu_AC_refine(), decode_mcu_DC_first(), decode_mcu_DC_refine(), and decode_mcu_sub().

#define BITREAD_STATE_VARS

Value:

register bit_buf_type get_buffer;  \
        register int bits_left;  \
        bitread_working_state br_state

Definition at line 99 of file jdhuff.c.

Referenced by decode_mcu(), decode_mcu_AC_first(), decode_mcu_AC_refine(), decode_mcu_DC_first(), decode_mcu_DC_refine(), and decode_mcu_sub().

#define CHECK_BIT_BUFFER ( state,
nbits,
action   ) 

Value:

{ if (bits_left < (nbits)) {  \
            if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits))  \
              { action; }  \
            get_buffer = (state).get_buffer; bits_left = (state).bits_left; } }

Definition at line 135 of file jdhuff.c.

Referenced by decode_mcu(), decode_mcu_AC_first(), decode_mcu_AC_refine(), decode_mcu_DC_first(), decode_mcu_DC_refine(), decode_mcu_sub(), and jpeg_huff_decode().

#define DROP_BITS ( nbits   )     (bits_left -= (nbits))

Definition at line 147 of file jdhuff.c.

Referenced by decode_mcu(), and decode_mcu_sub().

#define GET_BITS ( nbits   )     (((int) (get_buffer >> (bits_left -= (nbits)))) & BIT_MASK(nbits))

Definition at line 141 of file jdhuff.c.

Referenced by decode_mcu(), decode_mcu_AC_first(), decode_mcu_AC_refine(), decode_mcu_DC_first(), decode_mcu_DC_refine(), decode_mcu_sub(), and jpeg_huff_decode().

#define HUFF_DECODE ( result,
state,
htbl,
failaction,
slowlabel   ) 

Value:

{ register int nb, look; \
  if (bits_left < HUFF_LOOKAHEAD) { \
    if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \
    get_buffer = state.get_buffer; bits_left = state.bits_left; \
    if (bits_left < HUFF_LOOKAHEAD) { \
      nb = 1; goto slowlabel; \
    } \
  } \
  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  if ((nb = htbl->look_nbits[look]) != 0) { \
    DROP_BITS(nb); \
    result = htbl->look_sym[look]; \
  } else { \
    nb = HUFF_LOOKAHEAD+1; \
slowlabel: \
    if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \
        { failaction; } \
    get_buffer = state.get_buffer; bits_left = state.bits_left; \
  } \
}

Definition at line 168 of file jdhuff.c.

Referenced by decode_mcu(), decode_mcu_AC_first(), decode_mcu_AC_refine(), decode_mcu_DC_first(), and decode_mcu_sub().

#define HUFF_EXTEND ( x,
s   )     ((x) <= bmask[(s) - 1] ? (x) - bmask[s] : (x))

Definition at line 578 of file jdhuff.c.

Referenced by decode_mcu(), decode_mcu_AC_first(), decode_mcu_DC_first(), and decode_mcu_sub().

#define HUFF_LOOKAHEAD   8

Definition at line 26 of file jdhuff.c.

#define JPEG_INTERNALS

Definition at line 19 of file jdhuff.c.

#define MIN_GET_BITS   (BIT_BUF_SIZE-7)

Definition at line 460 of file jdhuff.c.

Referenced by jpeg_fill_bit_buffer().

#define PEEK_BITS ( nbits   )     (((int) (get_buffer >> (bits_left - (nbits)))) & BIT_MASK(nbits))

Definition at line 144 of file jdhuff.c.


Typedef Documentation

typedef INT32 bit_buf_type

Definition at line 69 of file jdhuff.c.

typedef huff_entropy_decoder* huff_entropy_ptr

Definition at line 257 of file jdhuff.c.


Function Documentation

decode_mcu ( j_decompress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 1187 of file jdhuff.c.

References ASSIGN_STATE, BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, CHECK_BIT_BUFFER, DCTSIZE2, DROP_BITS, FALSE, GET_BITS, htbl, HUFF_DECODE, HUFF_EXTEND, if(), jpeg_natural_order, k, process_restart(), huff_entropy_encoder::restarts_to_go, s, huff_entropy_encoder::saved, and TRUE.

decode_mcu_AC_first ( j_decompress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 766 of file jdhuff.c.

References Al, BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, CHECK_BIT_BUFFER, savable_state::EOBRUN, FALSE, GET_BITS, HUFF_DECODE, HUFF_EXTEND, if(), k, process_restart(), huff_entropy_encoder::restarts_to_go, s, huff_entropy_encoder::saved, and TRUE.

decode_mcu_AC_refine ( j_decompress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 904 of file jdhuff.c.

References BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, CHECK_BIT_BUFFER, DCTSIZE2, savable_state::EOBRUN, FALSE, GET_BITS, HUFF_DECODE, if(), k, p1(), process_restart(), huff_entropy_encoder::restarts_to_go, s, huff_entropy_encoder::saved, TRUE, and WARNMS.

decode_mcu_DC_first ( j_decompress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 695 of file jdhuff.c.

References Al, ASSIGN_STATE, BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, CHECK_BIT_BUFFER, compptr, FALSE, GET_BITS, HUFF_DECODE, HUFF_EXTEND, if(), process_restart(), huff_entropy_encoder::restarts_to_go, s, huff_entropy_encoder::saved, and TRUE.

decode_mcu_DC_refine ( j_decompress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 855 of file jdhuff.c.

References BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, CHECK_BIT_BUFFER, FALSE, GET_BITS, if(), p1(), process_restart(), huff_entropy_encoder::restarts_to_go, and TRUE.

decode_mcu_sub ( j_decompress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 1059 of file jdhuff.c.

References ASSIGN_STATE, BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, CHECK_BIT_BUFFER, DROP_BITS, FALSE, GET_BITS, htbl, HUFF_DECODE, HUFF_EXTEND, if(), k, process_restart(), huff_entropy_encoder::restarts_to_go, s, huff_entropy_encoder::saved, and TRUE.

jinit_huff_decoder ( j_decompress_ptr  cinfo  ) 

Definition at line 1509 of file jdhuff.c.

References huff_entropy_encoder::ac_derived_tbls, huff_entropy_encoder::dc_derived_tbls, DCTSIZE2, i, int, JPOOL_IMAGE, NULL, NUM_HUFF_TBLS, huff_entropy_encoder::pub, SIZEOF, and start_pass_huff_decoder().

Referenced by master_selection(), and transdecode_master_selection().

jpeg_fill_bit_buffer ( bitread_working_state state,
register bit_buf_type  get_buffer,
register int  bits_left,
int  nbits 
)

Definition at line 465 of file jdhuff.c.

References jpeg_source_mgr::bytes_in_buffer, c, jpeg_decompress_struct::entropy, FALSE, GETJOCTET, MIN_GET_BITS, jpeg_source_mgr::next_input_byte, size_t, jpeg_decompress_struct::src, TRUE, jpeg_decompress_struct::unread_marker, and WARNMS.

jpeg_huff_decode ( bitread_working_state state,
register bit_buf_type  get_buffer,
register int  bits_left,
d_derived_tbl htbl,
int  min_bits 
)

Definition at line 592 of file jdhuff.c.

References CHECK_BIT_BUFFER, GET_BITS, int, l, and WARNMS.

jpeg_make_d_derived_tbl ( j_decompress_ptr  cinfo,
boolean  isDC,
int  tblno,
d_derived_tbl **  pdtbl 
)

Definition at line 323 of file jdhuff.c.

References JHUFF_TBL::bits, ERREXIT, ERREXIT1, htbl, i, if(), JPOOL_IMAGE, l, d_derived_tbl::maxcode, NULL, NUM_HUFF_TBLS, p, d_derived_tbl::pub, SIZEOF, and d_derived_tbl::valoffset.

process_restart ( j_decompress_ptr  cinfo  ) 

Definition at line 636 of file jdhuff.c.

References savable_state::EOBRUN, FALSE, if(), savable_state::last_dc_val, huff_entropy_encoder::restarts_to_go, huff_entropy_encoder::saved, and TRUE.

start_pass_huff_decoder ( j_decompress_ptr  cinfo  ) 

Definition at line 1310 of file jdhuff.c.

References compptr, decode_mcu_AC_first(), decode_mcu_DC_first(), ERREXIT4, i, if(), JERR_BAD_PROGRESSION, JWRN_BOGUS_PROGRESSION, huff_entropy_encoder::pub, and WARNMS2.

Referenced by jinit_huff_decoder().


Variable Documentation

const int bmask[16] [static]

Initial value:

        
  { 0, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF,
    0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF }

Definition at line 580 of file jdhuff.c.

Referenced by XrdCmsCluster::Broadcast(), init_true_color(), and XrdCmsCluster::Space().

const int jpeg_zigzag_order[8][8] [static]

Initial value:

 {
  {  0,  1,  5,  6, 14, 15, 27, 28 },
  {  2,  4,  7, 13, 16, 26, 29, 42 },
  {  3,  8, 12, 17, 25, 30, 41, 43 },
  {  9, 11, 18, 24, 31, 40, 44, 53 },
  { 10, 19, 23, 32, 39, 45, 52, 54 },
  { 20, 22, 33, 38, 46, 51, 55, 60 },
  { 21, 34, 37, 47, 50, 56, 59, 61 },
  { 35, 36, 48, 49, 57, 58, 62, 63 }
}

Definition at line 260 of file jdhuff.c.

const int jpeg_zigzag_order2[2][2] [static]

Initial value:

 {
  { 0, 1 },
  { 2, 3 }
}

Definition at line 311 of file jdhuff.c.

const int jpeg_zigzag_order3[3][3] [static]

Initial value:

 {
  { 0, 1, 5 },
  { 2, 4, 6 },
  { 3, 7, 8 }
}

Definition at line 305 of file jdhuff.c.

const int jpeg_zigzag_order4[4][4] [static]

Initial value:

 {
  { 0,  1,  5,  6 },
  { 2,  4,  7, 12 },
  { 3,  8, 11, 13 },
  { 9, 10, 14, 15 }
}

Definition at line 298 of file jdhuff.c.

const int jpeg_zigzag_order5[5][5] [static]

Initial value:

 {
  {  0,  1,  5,  6, 14 },
  {  2,  4,  7, 13, 15 },
  {  3,  8, 12, 16, 21 },
  {  9, 11, 17, 20, 22 },
  { 10, 18, 19, 23, 24 }
}

Definition at line 290 of file jdhuff.c.

const int jpeg_zigzag_order6[6][6] [static]

Initial value:

 {
  {  0,  1,  5,  6, 14, 15 },
  {  2,  4,  7, 13, 16, 25 },
  {  3,  8, 12, 17, 24, 26 },
  {  9, 11, 18, 23, 27, 32 },
  { 10, 19, 22, 28, 31, 33 },
  { 20, 21, 29, 30, 34, 35 }
}

Definition at line 281 of file jdhuff.c.

const int jpeg_zigzag_order7[7][7] [static]

Initial value:

 {
  {  0,  1,  5,  6, 14, 15, 27 },
  {  2,  4,  7, 13, 16, 26, 28 },
  {  3,  8, 12, 17, 25, 29, 38 },
  {  9, 11, 18, 24, 30, 37, 39 },
  { 10, 19, 23, 31, 36, 40, 45 },
  { 20, 22, 32, 35, 41, 44, 46 },
  { 21, 33, 34, 42, 43, 47, 48 }
}

Definition at line 271 of file jdhuff.c.


Generated on Tue Jul 5 15:57:56 2011 for ROOT_528-00b_version by  doxygen 1.5.1