C# Class BitMiracle.LibJpeg.Classic.Internal.jpeg_c_prep_controller

Compression preprocessing (downsampling input buffer control). For the simple (no-context-row) case, we just need to buffer one row group's worth of pixels for the downsampling step. At the bottom of the image, we pad to a full row group by replicating the last pixel row. The downsampler's last output row is then replicated if needed to pad out to a full iMCU row. When providing context rows, we must buffer three row groups' worth of pixels. Three row groups are physically allocated, but the row pointer arrays are made five row groups high, with the extra pointers above and below "wrapping around" to point to the last and first real row groups. This allows the downsampler to access the proper context rows. At the top and bottom of the image, we create dummy context rows by copying the first or last real pixel row. This copying could be avoided by pointer hacking as is done in jdmainct.c, but it doesn't seem worth the trouble on the compression side.
Show file Open project: prepare/HTML-Renderer Class Usage Examples

Public Methods

Method Description
jpeg_c_prep_controller ( jpeg_compress_struct cinfo ) : System
pre_process_data ( byte input_buf, int &in_row_ctr, int in_rows_avail, byte output_buf, int &out_row_group_ctr, int out_row_groups_avail ) : void
start_pass ( J_BUF_MODE pass_mode ) : void

Initialize for a processing pass.

Private Methods

Method Description
create_context_buffer ( ) : void

Create the wrapped-around downsampling input buffer needed for context mode.

expand_bottom_edge ( byte image_data, int rowsOffset, int num_cols, int input_rows, int output_rows ) : void

Expand an image vertically from height input_rows to height output_rows, by duplicating the bottom row.

pre_process_WithoutContext ( byte input_buf, int &in_row_ctr, int in_rows_avail, byte output_buf, int &out_row_group_ctr, int out_row_groups_avail ) : void

Process some data in the simple no-context case. Preprocessor output data is counted in "row groups". A row group is defined to be v_samp_factor sample rows of each component. Downsampling will produce this much data from each max_v_samp_factor input rows.

pre_process_context ( byte input_buf, int &in_row_ctr, int in_rows_avail, byte output_buf, int &out_row_group_ctr, int out_row_groups_avail ) : void

Process some data in the context case.

Method Details

jpeg_c_prep_controller() public method

public jpeg_c_prep_controller ( jpeg_compress_struct cinfo ) : System
cinfo jpeg_compress_struct
return System

pre_process_data() public method

public pre_process_data ( byte input_buf, int &in_row_ctr, int in_rows_avail, byte output_buf, int &out_row_group_ctr, int out_row_groups_avail ) : void
input_buf byte
in_row_ctr int
in_rows_avail int
output_buf byte
out_row_group_ctr int
out_row_groups_avail int
return void

start_pass() public method

Initialize for a processing pass.
public start_pass ( J_BUF_MODE pass_mode ) : void
pass_mode J_BUF_MODE
return void