jchuff.c File Reference

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

Go to the source code of this file.

Classes

struct  c_derived_tbl
struct  savable_state
struct  huff_entropy_encoder
struct  working_state

Defines

#define JPEG_INTERNALS
#define MAX_COEF_BITS   10
#define ASSIGN_STATE(dest, src)   ((dest) = (src))
#define MAX_CORR_BITS   1000
#define ISHIFT_TEMPS
#define IRIGHT_SHIFT(x, shft)   ((x) >> (shft))
#define emit_byte_s(state, val, action)
#define emit_byte_e(entropy, val)
#define MAX_CLEN   32

Typedefs

typedef huff_entropy_encoderhuff_entropy_ptr

Functions

 jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, c_derived_tbl **pdtbl)
 dump_buffer_s (working_state *state)
 dump_buffer_e (huff_entropy_ptr entropy)
INLINE emit_bits_s (working_state *state, unsigned int code, int size)
INLINE emit_bits_e (huff_entropy_ptr entropy, unsigned int code, int size)
 flush_bits_s (working_state *state)
 flush_bits_e (huff_entropy_ptr entropy)
INLINE emit_dc_symbol (huff_entropy_ptr entropy, int tbl_no, int symbol)
INLINE emit_ac_symbol (huff_entropy_ptr entropy, int tbl_no, int symbol)
 emit_buffered_bits (huff_entropy_ptr entropy, char *bufstart, unsigned int nbits)
 emit_eobrun (huff_entropy_ptr entropy)
 emit_restart_s (working_state *state, int restart_num)
 emit_restart_e (huff_entropy_ptr entropy, int restart_num)
 encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
 encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
 encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
 encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
 encode_one_block (working_state *state, JCOEFPTR block, int last_dc_val, c_derived_tbl *dctbl, c_derived_tbl *actbl)
 encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
 finish_pass_huff (j_compress_ptr cinfo)
 htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, long dc_counts[], long ac_counts[])
 encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
 jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
 finish_pass_gather (j_compress_ptr cinfo)
 start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
 jinit_huff_encoder (j_compress_ptr cinfo)


Define Documentation

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

Definition at line 67 of file jchuff.c.

Referenced by decode_mcu(), decode_mcu_DC_first(), decode_mcu_sub(), encode_mcu_huff(), and finish_pass_huff().

#define emit_byte_e ( entropy,
val   ) 

Value:

{ *(entropy)->next_output_byte++ = (JOCTET) (val);  \
          if (--(entropy)->free_in_buffer == 0)  \
            dump_buffer_e(entropy); }

Definition at line 262 of file jchuff.c.

Referenced by emit_bits_e(), and emit_restart_e().

#define emit_byte_s ( state,
val,
action   ) 

Value:

{ *(state)->next_output_byte++ = (JOCTET) (val);  \
          if (--(state)->free_in_buffer == 0)  \
            if (! dump_buffer_s(state))  \
              { action; } }

Definition at line 255 of file jchuff.c.

Referenced by emit_bits_s(), and emit_restart_s().

#define IRIGHT_SHIFT ( x,
shft   )     ((x) >> (shft))

Definition at line 151 of file jchuff.c.

#define ISHIFT_TEMPS

Definition at line 150 of file jchuff.c.

#define JPEG_INTERNALS

Definition at line 23 of file jchuff.c.

#define MAX_CLEN   32

Referenced by jpeg_gen_optimal_table().

#define MAX_COEF_BITS   10

Definition at line 35 of file jchuff.c.

Referenced by encode_mcu_AC_first(), encode_mcu_DC_first(), encode_one_block(), and htest_one_block().

#define MAX_CORR_BITS   1000

Definition at line 136 of file jchuff.c.

Referenced by encode_mcu_AC_refine(), METHODDEF(), and start_pass_huff().


Typedef Documentation

typedef huff_entropy_encoder* huff_entropy_ptr

Definition at line 117 of file jchuff.c.


Function Documentation

dump_buffer_e ( huff_entropy_ptr  entropy  ) 

Definition at line 284 of file jchuff.c.

References ERREXIT, jpeg_destination_mgr::free_in_buffer, and jpeg_destination_mgr::next_output_byte.

dump_buffer_s ( working_state state  ) 

Definition at line 269 of file jchuff.c.

References FALSE, jpeg_destination_mgr::free_in_buffer, jpeg_destination_mgr::next_output_byte, and TRUE.

INLINE emit_ac_symbol ( huff_entropy_ptr  entropy,
int  tbl_no,
int  symbol 
)

Definition at line 424 of file jchuff.c.

References c_derived_tbl::ehufco, c_derived_tbl::ehufsi, and emit_bits_e().

Referenced by emit_eobrun(), encode_mcu_AC_first(), and encode_mcu_AC_refine().

INLINE emit_bits_e ( huff_entropy_ptr  entropy,
unsigned int  code,
int  size 
)

Definition at line 346 of file jchuff.c.

References c, emit_byte_e, ERREXIT, and int.

Referenced by emit_ac_symbol(), emit_buffered_bits(), emit_dc_symbol(), emit_eobrun(), encode_mcu_AC_first(), encode_mcu_AC_refine(), encode_mcu_DC_first(), encode_mcu_DC_refine(), and flush_bits_e().

INLINE emit_bits_s ( working_state state,
unsigned int  code,
int  size 
)

Definition at line 307 of file jchuff.c.

References c, emit_byte_s, ERREXIT, FALSE, int, and TRUE.

Referenced by encode_one_block(), and flush_bits_s().

emit_buffered_bits ( huff_entropy_ptr  entropy,
char *  bufstart,
unsigned int  nbits 
)

Definition at line 440 of file jchuff.c.

References emit_bits_e().

Referenced by emit_eobrun(), and encode_mcu_AC_refine().

INLINE emit_dc_symbol ( huff_entropy_ptr  entropy,
int  tbl_no,
int  symbol 
)

Definition at line 411 of file jchuff.c.

References c_derived_tbl::ehufco, c_derived_tbl::ehufsi, and emit_bits_e().

Referenced by encode_mcu_DC_first().

emit_eobrun ( huff_entropy_ptr  entropy  ) 

Definition at line 459 of file jchuff.c.

References emit_ac_symbol(), emit_bits_e(), emit_buffered_bits(), ERREXIT, and nbits.

Referenced by emit_restart(), emit_restart_e(), encode_mcu_AC_first(), encode_mcu_AC_refine(), finish_pass_gather(), finish_pass_gather_phuff(), finish_pass_huff(), and finish_pass_phuff().

emit_restart_e ( huff_entropy_ptr  entropy,
int  restart_num 
)

Definition at line 511 of file jchuff.c.

References emit_byte_e, emit_eobrun(), flush_bits_e(), and JPEG_RST0.

Referenced by encode_mcu_AC_first(), encode_mcu_AC_refine(), encode_mcu_DC_first(), and encode_mcu_DC_refine().

emit_restart_s ( working_state state,
int  restart_num 
)

Definition at line 490 of file jchuff.c.

References emit_byte_s, FALSE, flush_bits_s(), JPEG_RST0, and TRUE.

Referenced by encode_mcu_huff().

encode_mcu_AC_first ( j_compress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 628 of file jchuff.c.

References huff_entropy_encoder::ac_tbl_no, Al, emit_ac_symbol(), emit_bits_e(), emit_eobrun(), emit_restart_e(), huff_entropy_encoder::EOBRUN, ERREXIT, huff_entropy_encoder::free_in_buffer, if(), k, MAX_COEF_BITS, nbits, huff_entropy_encoder::next_output_byte, huff_entropy_encoder::next_restart_num, huff_entropy_encoder::restarts_to_go, and TRUE.

encode_mcu_AC_refine ( j_compress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 786 of file jchuff.c.

References huff_entropy_encoder::ac_tbl_no, Al, huff_entropy_encoder::BE, huff_entropy_encoder::bit_buffer, DCTSIZE2, emit_ac_symbol(), emit_bits_e(), emit_buffered_bits(), emit_eobrun(), emit_restart_e(), huff_entropy_encoder::EOBRUN, huff_entropy_encoder::free_in_buffer, if(), k, MAX_CORR_BITS, huff_entropy_encoder::next_output_byte, huff_entropy_encoder::next_restart_num, huff_entropy_encoder::restarts_to_go, and TRUE.

encode_mcu_DC_first ( j_compress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 541 of file jchuff.c.

References Al, compptr, jpeg_component_info::dc_tbl_no, emit_bits_e(), emit_dc_symbol(), emit_restart_e(), ERREXIT, huff_entropy_encoder::free_in_buffer, if(), IRIGHT_SHIFT, ISHIFT_TEMPS, savable_state::last_dc_val, MAX_COEF_BITS, nbits, huff_entropy_encoder::next_output_byte, huff_entropy_encoder::next_restart_num, huff_entropy_encoder::restarts_to_go, huff_entropy_encoder::saved, and TRUE.

encode_mcu_DC_refine ( j_compress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 739 of file jchuff.c.

References Al, emit_bits_e(), emit_restart_e(), huff_entropy_encoder::free_in_buffer, if(), huff_entropy_encoder::next_output_byte, huff_entropy_encoder::next_restart_num, huff_entropy_encoder::restarts_to_go, and TRUE.

encode_mcu_gather ( j_compress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 1197 of file jchuff.c.

References huff_entropy_encoder::ac_count_ptrs, compptr, huff_entropy_encoder::dc_count_ptrs, htest_one_block(), if(), savable_state::last_dc_val, huff_entropy_encoder::restarts_to_go, huff_entropy_encoder::saved, and TRUE.

Referenced by start_pass_huff().

encode_mcu_huff ( j_compress_ptr  cinfo,
JBLOCKROW MCU_data 
)

Definition at line 1016 of file jchuff.c.

References huff_entropy_encoder::ac_derived_tbls, jpeg_component_info::ac_tbl_no, ASSIGN_STATE, compptr, huff_entropy_encoder::dc_derived_tbls, jpeg_component_info::dc_tbl_no, emit_restart_s(), encode_one_block(), FALSE, if(), huff_entropy_encoder::next_restart_num, huff_entropy_encoder::restarts_to_go, huff_entropy_encoder::saved, and TRUE.

Referenced by start_pass_huff().

encode_one_block ( working_state state,
JCOEFPTR  block,
int  last_dc_val,
c_derived_tbl dctbl,
c_derived_tbl actbl 
)

Definition at line 916 of file jchuff.c.

References emit_bits_s(), ERREXIT, FALSE, i, if(), k, MAX_COEF_BITS, nbits, and TRUE.

Referenced by encode_mcu_huff().

finish_pass_gather ( j_compress_ptr  cinfo  ) 

Definition at line 1397 of file jchuff.c.

References jpeg_component_info::ac_tbl_no, compptr, jpeg_component_info::dc_tbl_no, emit_eobrun(), if(), jpeg_alloc_huff_table(), jpeg_gen_optimal_table(), MEMZERO, NULL, NUM_HUFF_TBLS, SIZEOF, and TRUE.

Referenced by start_pass_huff().

finish_pass_huff ( j_compress_ptr  cinfo  ) 

Definition at line 1073 of file jchuff.c.

References ASSIGN_STATE, working_state::cinfo, working_state::cur, emit_eobrun(), ERREXIT, flush_bits_e(), flush_bits_s(), huff_entropy_encoder::free_in_buffer, working_state::free_in_buffer, if(), working_state::next_output_byte, huff_entropy_encoder::next_output_byte, and huff_entropy_encoder::saved.

Referenced by start_pass_huff().

flush_bits_e ( huff_entropy_ptr  entropy  ) 

Definition at line 397 of file jchuff.c.

References emit_bits_e().

Referenced by emit_restart_e(), and finish_pass_huff().

flush_bits_s ( working_state state  ) 

Definition at line 386 of file jchuff.c.

References emit_bits_s(), FALSE, and TRUE.

Referenced by emit_restart_s(), and finish_pass_huff().

htest_one_block ( j_compress_ptr  cinfo,
JCOEFPTR  block,
int  last_dc_val,
long  dc_counts[],
long  ac_counts[] 
)

Definition at line 1122 of file jchuff.c.

References ERREXIT, k, MAX_COEF_BITS, and nbits.

Referenced by encode_mcu_gather().

jinit_huff_encoder ( j_compress_ptr  cinfo  ) 

Definition at line 1557 of file jchuff.c.

References huff_entropy_encoder::ac_count_ptrs, huff_entropy_encoder::ac_derived_tbls, huff_entropy_encoder::bit_buffer, huff_entropy_encoder::dc_count_ptrs, huff_entropy_encoder::dc_derived_tbls, i, JPOOL_IMAGE, NULL, NUM_HUFF_TBLS, huff_entropy_encoder::pub, SIZEOF, and start_pass_huff().

Referenced by jinit_compress_master(), and transencode_master_selection().

jpeg_gen_optimal_table ( j_compress_ptr  cinfo,
JHUFF_TBL htbl,
long  freq[] 
)

Definition at line 1256 of file jchuff.c.

References bits, c1, ERREXIT, FALSE, i, j, RooFitShortHand::L(), MAX_CLEN, MEMCOPY, MEMZERO, p, and SIZEOF.

Referenced by finish_pass_gather(), and finish_pass_gather_phuff().

jpeg_make_c_derived_tbl ( j_compress_ptr  cinfo,
boolean  isDC,
int  tblno,
c_derived_tbl **  pdtbl 
)

Definition at line 161 of file jchuff.c.

References JHUFF_TBL::bits, c_derived_tbl::ehufco, c_derived_tbl::ehufsi, ERREXIT, ERREXIT1, htbl, JHUFF_TBL::huffval, i, if(), JPOOL_IMAGE, l, MEMZERO, NULL, NUM_HUFF_TBLS, p, and SIZEOF.

Referenced by METHODDEF(), and start_pass_huff().

start_pass_huff ( j_compress_ptr  cinfo,
boolean  gather_statistics 
)

Definition at line 1451 of file jchuff.c.

References huff_entropy_encoder::ac_count_ptrs, huff_entropy_encoder::ac_derived_tbls, jpeg_component_info::ac_tbl_no, huff_entropy_encoder::ac_tbl_no, huff_entropy_encoder::BE, huff_entropy_encoder::bit_buffer, huff_entropy_encoder::cinfo, compptr, huff_entropy_encoder::dc_count_ptrs, huff_entropy_encoder::dc_derived_tbls, jpeg_component_info::dc_tbl_no, encode_mcu_AC_first(), encode_mcu_AC_refine(), encode_mcu_DC_first(), encode_mcu_DC_refine(), encode_mcu_gather(), encode_mcu_huff(), huff_entropy_encoder::EOBRUN, ERREXIT1, FALSE, finish_pass_gather(), finish_pass_huff(), huff_entropy_encoder::gather_statistics, if(), jpeg_make_c_derived_tbl(), JPOOL_IMAGE, savable_state::last_dc_val, MAX_CORR_BITS, MEMZERO, NULL, NUM_HUFF_TBLS, huff_entropy_encoder::pub, huff_entropy_encoder::saved, SIZEOF, and TRUE.

Referenced by jinit_huff_encoder().


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