📄 ebcot_encoder.h
字号:
int first_level, first_component;
int max_layers, max_levels, max_components;
int tpart;
struct ebcot_order *next;
} ebcot_order, *ebcot_order_ptr;
/* Used to record each new change in packet progression order. The
`first_level', `first_component', `max_layers', `max_levels'
and `max_components' fields identify constraints on the
progression order specified by `progression'. The `tpart' field
holds the index of the particular tile-part in which the relevant
POC marker should be placed. */
/* End DST POC mod */
/*****************************************************************************/
/* ebcot_sequence */
/*****************************************************************************/
typedef
struct ebcot_sequence {
int layer_idx;
ebcot_precinct_info_ptr precinct;
int tpart; /* DST POC mod */
} ebcot_sequence, *ebcot_sequence_ptr;
/* This structure is used to maintain the identity of a particular
codestream packet in sequence. A codestream packet consists of
a particular quality layer within the region identified by the
`precinct' pointer; this simply points into the `precincts' array managed
by the appropriate `ebcot_level_info' structure. The `tpart' field
identifies the particular tile-part in which the relevant packet is
to be included. */
/*****************************************************************************/
/* ebcot_tile */
/*****************************************************************************/
typedef
struct ebcot_tile {
int tnum;
canvas_dims reference_dims;
int overlapped;
int num_components;
ebcot_component_info_ptr components;
int num_layers;
int total_packets;
ebcot_sequence_ptr packet_sequence;
ebcot_order_ptr progressions; /* DST POC mod */
int tpart_bytes[256]; /* DST POC mod */
int num_tparts; /* DST POC mod */
} ebcot_tile, *ebcot_tile_ptr;
/* This structure encapsulates all state information for a single tile.
All parameters, with the exception of the number of
image components, may change from tile-to-tile.
The `tnum' field identifies the coordinate of the tile.
The `reference_dims' structure describes the location and dimensions
of the tile on the reference grid.
The `overlapped' flag holds 1 if any of the tile's image components
uses tile overlapping. If true then spatially oriented packet
progression orders for the tile are not currently well defined.
The `num_components' field indicates the number of image components.
This is the same in every tile, but it is convenient to keep it here.
The `components' array manages the state information for each
image component within the tile. We call these tile-components.
The `num_layers' field holds the number of quality layers for
the tile; in the current implementation it is always identical to
the value held in its namesake within the `ebcot_encoder' object
itself.
The `total_packets' field indicates the total number of packets
contained in the tile. This is the sum of the `total_precincts' fields
from all `ebcot_level_info' structures, all multiplied by the number
of quality layers.
The `packet_sequence' field points to an array with `total_packets'
entries, each of which corresponds to a particular packet, in the
sequence in which packets appear in the codestream.
The `progression' and `progression_changes' fields are used to
derive the packet sequence; they represent the progression style from the
COD marker and the additional information from any POC marker,
respectively.
The `tpart_bytes' array holds the total number of bytes required
to represent all packets from each tile-part of the tile, in the
codestream; it is computed during layer formation, immediately before
outputting packets to the codestream. The value is required because
tile-part headers must include a field identifying their length. */
/* ========================================================================= */
/* ---------------------------- Bit-Stream Layers -------------------------- */
/* ========================================================================= */
/*****************************************************************************/
/* ebcot_layer_info */
/*****************************************************************************/
typedef
struct ebcot_layer_info {
int max_cumulative_bytes;
int actual_cumulative_bytes;
int optimize;
rd_slope_type rd_threshold;
} ebcot_layer_info, *ebcot_layer_info_ptr;
/* This structure keeps track of information involved in the formation of
bit-stream layers. A bit-stream layer is composed of a collection of
coding passes from some or all of the subband code blocks. The layer
may be assembled in an optimal way subject to some target bit-rate.
Alternatively, it may be assembled more rapidly to approximately
achieve some target bit-rate. The encoder accepts command line
arguments to identify the number of bit-stream layers and any special
bit-rates for which a full optimization is requested. The fields of
this structure have the following interpretation:
`max_cumulative_bytes' holds the maximum number of bytes which
can be consumed by this and any previous bit-stream layers, together.
This is a hard maximum if `optimize' is non-zero (true); othewise, it
represents a target bit-rate.
`actual_cumulative_bytes' identifies the actual number of bytes
which are consumed by this and any previous bit-stream layers. It
is not known until after the bit-stream layer has been formed.
`rd_threshold' is the rate-distortion threshold associated with
the bit-stream layer. The layer includes all coding passes from all
code blocks, such that the rate-distortion slope associated with that
coding pass is greater than or equal to this threshold. The threshold
is determined iteratively if `optimize' is true, in order to find the
smallest threshold which is compatible with the `max_cumulative_bytes'
constraint. If `optimize' is zero (false), however, the threshold is
estimated from summary information accumulated during block coding. */
/* ========================================================================= */
/* ----------------------------- Encoder Object ---------------------------- */
/* ========================================================================= */
/*****************************************************************************/
/* ebcot_encoder */
/*****************************************************************************/
typedef
struct ebcot_encoder {
encoder_obj base;
stream_out_ref stream;
forward_roi_ref roi;
int num_components;
int num_tiles;
int current_tile_idx;
ebcot_tile_ptr tiles;
int max_component_rows, max_component_cols;
int num_layers;
ebcot_layer_info_ptr layer_info;
dst_codeword_heap_ref code_heap_mgr;
ebcot_vpw_info_ptr vpw_info;
std_int rd_slope_rates[1<<RD_SLOPE_EXPONENT_BITS];
int reverse_tiles;
int omit_last_tile_length;
std_int cpu_time;
/* CRIL Technology/SAIC Scan Buffer begin */
float desired_bpp;
long desired_file_size;
long image_size;
long no_excess_bytes_released;
long *scan_element_pixel_cnt;
long orig_buffer_size_bytes;
int last_tnum_header_written;
int num_scan_elements;
int num_scan_elements_in_buffer;
int buffer_start;
int buffer_end;
int *tile_start, *precinct_start, *tile_end, *precinct_end;
long buffer_size_bytes;
long buffer_size_scan_elements;
/* CRIL Technology/SAIC Scan Buffer end */
} ebcot_encoder_obj, *ebcot_encoder_ref;
/* This structure represents the encoder object itself. The additional
fields have the following interpretations:
forward_info_ref info;
`stream' holds a reference to the `stream_out' object to which
the final bit-stream should be written. Interaction with this object
is essential to ensure correct rate-control behaviour.
`roi' holds a reference to the ROI object which may modify the
entropy coder's behaviour in particular code-blocks.
`num_tiles' indicates the total number of tiles which represent
the image.
`current_tile_idx' holds the zero-based index of the current tile
for which information is being passed across the `encoder__push_line'
interface function.
`tiles' points to an array with `num_tiles' structures, which manage
the state and coding parameters of each tile. Most properties of the
coder are derived separately from each `ebcot_tile' structure.
`num_layers' holds the number of R-D optimal quality layers which
we will use to represent the compressed image. It makes relatively
little sense to deliberately construct a bit-stream with different
numbers of quality layers in each tile, so we make no provision for
this during compression; the decompressor should be able to deal
with the possibility though.
`layer_info' points to an array with one entry for each quality
layer, which identifies the target size for that layer and other
information which is used during bit-stream formation to produce
bit-streams which have particular properties. The information in this
array need never be included in the codestream itself, since the decoder
need only be aware of the number of layers to expect.
`code_heap_mgr' references an object which manages the dynamic memory
allocation for storage of generated code words.
`vpw_info' points to an `ebcot_vpw_info' structure which manages
all progressive visual weighting information.
`rd_slope_rates' is an array with one entry for each valid exponent
in the exponent-mantissa representation used for rate-distortion
slopes, as discussed in the definition of the `rd_slope_type' data type.
The entry at location k in this array accumulates the total number of
code bytes from all code blocks in all subbands from all coding passes
whose rate-distortion slope is greater than or equal to 2^k, where
k runs from 0 to 2^{Ebits}-1.
`reverse_tiles' is a flag indicating whether or not we should reverse
the order of appearance of tiles in the codestream, just for a lark.
`omit_last_tile_length' is a flag indicating whether or not th
tile-length field should be set to 0 for the last tile in the codestream.
`cpu_time' accumulates the CPU time associated with all block
coding operations. If CPU time is not required, it should hold a
negative value. */
/* ========================================================================= */
/* --------------------------- External Functions -------------------------- */
/* ========================================================================= */
extern void
ebcot_set_pass_funcs(ebcot_band_info_ptr band, block_master_ptr master);
#endif /* EBCOT_ENCODER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -