📄 ebcot_encoder.h
字号:
`passes' points to an array which is capable of holding `max_passes'
entries, which describe the code size and rate-distortion slope at the
end of each coding pass. In practice, we do not allocate a separate
array for each code block, but allocate a single array which holds the
concatenated `passes' arrays from all code blocks in all tiles of the
subband. The first code block's `passes' field points to the head
of this single allocated array.
`insignificant_msbs' indicates the number of bit-planes, starting from
the most significant magnitude bit of the IMPLEMENTATION_PRECISION-bit
sign-magnitude words, for which all samples in the block were found to
have zero magnitude.
`byte_count_bits' is used by the T2 coding engine to code the
number of bytes between successive termination and/or truncation points.
Specifically, `byte_count_bits' holds the number of bytes per coding
pass which were last used to signal differential code length information.
To signal a new length quantity, L, corresponding to P new coding passes,
we required the value of `byte_count_bits', B, to satisfy
L < 2^(B*floor(log_2(P))). A comma code is used to increment the
value of B until this condition is satisfied, after which the value of
L is signalled using B*floor(log_2(P)) bits. The
`old_byte_count_bits' field is used to save the value of `byte_count_bits'
when conducting trials for rate control. For more information,
consult the "ebcot_send_bits.c" file.
CRIL Technology/SAIC Scan Buffer begin
The `next_unit' field is used by the return_units() function which
is part of the dst_codeword_heap object. This field effectively signals
the last heap for the current block by specifying the next heap used
at the beginning of any other block.
The `next_unit_used' field signals the ending location within the
last heap for current block by specifying the beginning location for any
block which uses the `next_heap' heap.
CRIL Technology/SAIC Scan Buffer end */
/*****************************************************************************/
/* ebcot_precinct_band_info */
/*****************************************************************************/
typedef
struct ebcot_precinct_band_info {
int blocks_high, blocks_wide, total_blocks, block_row_gap;
ebcot_block_info_ptr blocks;
struct ebcot_band_info *band;
struct tag_tree_node *inclusion_tree;
struct tag_tree_node *insignificant_msbs_tree;
struct tag_tree_node *inclusion_tree_copy;
struct tag_tree_node *insignificant_msbs_tree_copy;
/* SAIC General Decomp. Begin */
int valid_band;
/* SAIC General Decomp. End */
} ebcot_precinct_band_info, *ebcot_precinct_band_info_ptr;
/* Holds information specific to a given precinct within a subband.
`blocks_high' and `blocks_wide' hold the number of blocks required
to span the height and width of the precinct within the relevant subband,
while `total_blocks' holds the product of these two fields. The
`block_row_gap' field identifies the total number of code-blocks between
consecutive rows of blocks within the `blocks' array. In practice, this
is identical to the `blocks_wide' field in the corresponding
`ebcot_band_info' structure.
`blocks' points to the first block of the precinct. It is actually a
pointer into the `blocks' array managed by the corresponding
`ebcot_band_info' structure. Each entry stores code words and summary
information collected while coding the relevant block. Note that this
field may be NULL if the precinct contains no blocks; this can happen.
`band' points to corresponding `ebcot_band_info' structure.
`inclusion_tree' and `insignificant_msbs_tree' point to tag-tree
structures which manage the efficient writing of tag bits to represent
two types of information for the precinct. The `inclusion_tree' structure
is used to represent information about whether or not any coding passes
have been included into the bit-stream so far, for each of the blocks in
the precinct. The `insignificant_msbs_tree' structure is used to represent
information embodied in the `insignificant_msbs' field of each
`ebcot_block_info' structure for blocks within the precinct. Beyond this
brief description, the use of these data structures is best understood
by reading the comments appearing with the definition of tag trees in
"ebcot_send_bits.h" and the implementation of the `form_packet' function
in "ebcot_send_bits.c".
`inclusion_tree_copy' and `insignificant_msbs_tree_copy' are provided
to allow the state of a precinct construction phase to be saved and
later recalled. .
SAIC General Decomp. Begin
`valid_band' indicates which bands in the range [min_band, max_band]
are valid for a general decomposition.
SAIC General Decomp. End */
/*****************************************************************************/
/* ebcot_precinct_info */
/*****************************************************************************/
typedef
struct ebcot_precinct_info {
int tnum, component_idx, level_idx, precinct_idx;
int xref, yref;
int min_band, max_band;
ebcot_precinct_band_info_ptr bands;
int included_layers;
int *layer_bytes;
} ebcot_precinct_info, *ebcot_precinct_info_ptr;
/* Holds information specific to a given precinct.
`tnum', `component_idx', `level_idx' and `precinct_idx'
together specify the coordinates of the precinct within the entire
code-stream.
`xref' and `yref' hold the absolute coordinates of the upper left
hand corner of the precinct, mapped into the high-resolution reference
grid; these identify the location of the precinct in the same coordinate
system as the containing `ebcot_tile' structure's `reference_dims'
coordinates. The information is used only when constructing spatially
oriented precinct progression sequences.
`min_band', `max_band' and `bands' play identical roles to
their namesakes in the `ebcot_band_info' structure, except that
the `bands' array contains `ebcot_precinct_band_info' structures
which manage the state of each subband within the scope of the
precincts.
`included_layers' indicates the total number of quality layers
which have been included so far while building the packet progression
sequence managed by the `packet_sequence' array in the containing
`ebcot_tile' structure.
`layer_bytes' is an array with one entry for each quality layer
available in the containing tile. It is used to store the number of
bytes occupied by each codestream packet (i.e. each quality layer within
the scope of the current precinct). */
/* ========================================================================= */
/* ----------------------------- Line Buffering ---------------------------- */
/* ========================================================================= */
/*****************************************************************************/
/* ebcot_line_buffering */
/*****************************************************************************/
typedef
struct ebcot_line_buffering {
int num_lines;
ebcot_block_info_ptr info;
ifc_int **buffers;
} ebcot_line_buffering, *ebcot_line_buffering_ptr;
/* This structure manages buffering of subband lines within the current
tile into a row of blocks, since data arrives from the quantizer in lines
rather than blocks.
`num_lines' holds the number of lines which have arrived. Once
this reaches the height of a block (or the end of the image or tile), the
blocks will all be coded at once.
`info' points to the `ebcot_block_info' entry for the first block in
the row of blocks which is currently being accumulated.
`buffers' points to a row of block buffers. Each block buffer
conforms to the requirements of the `sample_buffer' array described
under the definition of the `block_master' structure. */
/* ========================================================================= */
/* ---------------------------- Subband Structure -------------------------- */
/* ========================================================================= */
/*****************************************************************************/
/* ebcot_band_info */
/*****************************************************************************/
typedef
struct ebcot_band_info {
int tnum, component_idx, level_idx, band_idx;
int orientation_idx;
canvas_dims dims;
frame_info frame;
int block_rows, block_cols;
std_byte *zc_lut;
dst_heap_unit_ptr heap_head, heap_tail;
int next_heap_pos;
float step_wmse;
float vpw_weight;
int extra_lsbs;
int max_passes;
float nominal_range;
float fully_masked_sensitivity_reduction;
int lossless;
ebcot_line_buffering lines;
block_coding_pass_func pass_funcs[PASSES_PER_BITPLANE];
forward_roi_ref roi;
int max_roi_boost;
int roi_implicit;
int blocks_wide, blocks_high, total_blocks;
ebcot_block_info_ptr blocks;
/* CRIL Technology/SAIC Scan Buffer begin */
int scan_buffer_lines;
int max_scan_buffer_lines;
/* CRIL Technology/SAIC Scan Buffer end */
/* SAIC/Fuji LRA begin */
int quant_to_zero;
/* SAIC/Fuji LRA end */
/* SAIC General Decomp. Begin */
int vert_hp_descent;
int horiz_hp_descent;
int vert_hp_descent_chg[4];
int horiz_hp_descent_chg[4];
int valid_band;
/* SAIC General Decomp. End */
} ebcot_band_info, *ebcot_band_info_ptr;
/* This structure describes a single subband within the wavelet
decomposition for a single tile.
`tnum', `component_idx', `level_idx' and `band_idx' identify
the complete coordinates of the subband.
`orientation_idx' holds one of LL_BAND, HL_BAND, LH_BAND or HH_BAND,
depending upon whether the subband's primary orientation corresponds to
low-pass filtering in both directions, high-pass filtering in the
horizontal direction, high-pass filtering in the vertical direction or
high-pass filtering in both directions, respectively. For Mallat
decompositions, all subbands will have `band_idx' = `orientation_idx'.
This is not true, however, for more complex decompositions in which
the primary subbands in the relevant resolution level are decomposed
further. This is carefully explained in the master "ifc.h" header
file.
`dims' holds the location and dimensions of the subband within the
relevant tile.
`frame' holds framing information for the subband.
`block_rows' and `block_cols' identify the dimensions of the
actual code-block partition for the subband within the relevant tile.
These are determined from the nominal code-block dimensions for the
entire tile, the frame dimensions mapped into the subband (if they are
to be respected) and the precinct partition dimensions mapped into the
subband.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -