Class jpeg_decompress_struct
JPEG decompression routine.
Inherited Members
Namespace: BitMiracle.LibJpeg.Classic
Assembly: BitMiracle.LibJpeg.NET.dll
Syntax
public class jpeg_decompress_struct : jpeg_common_struct
Constructors
| Improve this Doc View Sourcejpeg_decompress_struct()
Initializes a new instance of the jpeg_decompress_struct class.
Declaration
public jpeg_decompress_struct()
See Also
| Improve this Doc View Sourcejpeg_decompress_struct(jpeg_error_mgr)
Initializes a new instance of the jpeg_decompress_struct class.
Declaration
public jpeg_decompress_struct(jpeg_error_mgr errorManager)
Parameters
Type | Name | Description |
---|---|---|
jpeg_error_mgr | errorManager | The error manager. |
See Also
Properties
| Improve this Doc View SourceActual_number_of_colors
The number of colors in the color map.
Declaration
public int Actual_number_of_colors { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of colors in the color map. |
See Also
| Improve this Doc View SourceBuffered_image
Gets or sets a value indicating whether to use buffered-image mode.
Declaration
public bool Buffered_image { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
See Also
| Improve this Doc View SourceCoef_bits
Gets the current progression status..
Declaration
public int[][] Coef_bits { get; }
Property Value
Type | Description |
---|---|
System.Int32[][] |
|
See Also
| Improve this Doc View SourceColormap
The color map, represented as a 2-D pixel array of Out_color_components rows and Actual_number_of_colors columns.
Declaration
public byte[][] Colormap { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[][] | Colormap is set to |
Remarks
Ignored if not quantizing.
Implementation restriction: at present, an externally supplied Colormap
is only accepted for 3-component output color spaces.
See Also
| Improve this Doc View SourceComp_info
Comp_info[i] describes component that appears i'th in SOF
Declaration
public jpeg_component_info[] Comp_info { get; }
Property Value
Type | Description |
---|---|
jpeg_component_info[] | The components in SOF. |
See Also
| Improve this Doc View SourceData_precision
Gets the data precision.
Declaration
public int Data_precision { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The data precision. |
Dct_method
Gets or sets the algorithm used for the DCT step.
Declaration
public J_DCT_METHOD Dct_method { get; set; }
Property Value
Type | Description |
---|---|
J_DCT_METHOD | The algorithm used for the DCT step. |
See Also
| Improve this Doc View SourceDensity_unit
Gets the resolution information from JFIF marker.
Declaration
public DensityUnit Density_unit { get; }
Property Value
Type | Description |
---|---|
DensityUnit | The information from JFIF marker. |
See Also
| Improve this Doc View SourceDesired_number_of_colors
Maximum number of colors to use in generating a library-supplied color map.
Declaration
public int Desired_number_of_colors { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Default value: 256. |
Remarks
Ignored if Quantize_colors is false
.
The actual number of colors is returned in a Actual_number_of_colors.
See Also
| Improve this Doc View SourceDither_mode
Selects color dithering method.
Declaration
public J_DITHER_MODE Dither_mode { get; set; }
Property Value
Type | Description |
---|---|
J_DITHER_MODE | Default value: JDITHER_FS. |
Remarks
Ignored if Quantize_colors is false
.
At present, ordered dither is implemented only in the single-pass, standard-colormap case.
If you ask for ordered dither when Two_pass_quantize is true
or when you supply an external color map, you'll get F-S dithering.
See Also
| Improve this Doc View SourceDo_block_smoothing
Apply interblock smoothing in early stages of decoding progressive JPEG files.
Declaration
public bool Do_block_smoothing { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If |
Remarks
Default value: true
In any case, block smoothing ceases to be applied after the first few AC coefficients are
known to full accuracy, so it is relevant only when using
buffered-image mode for progressive images.
See Also
| Improve this Doc View SourceDo_fancy_upsampling
Enable or disable upsampling of chroma components.
Declaration
public bool Do_fancy_upsampling { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If |
Remarks
Default value: true
See Also
| Improve this Doc View SourceEnable_1pass_quant
Enable future use of 1-pass quantizer.
Declaration
public bool Enable_1pass_quant { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Default value: |
Remarks
Significant only in buffered-image mode.
See Also
| Improve this Doc View SourceEnable_2pass_quant
Enable future use of 2-pass quantizer.
Declaration
public bool Enable_2pass_quant { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Default value: |
Remarks
Significant only in buffered-image mode.
See Also
| Improve this Doc View SourceEnable_external_quant
Enable future use of external colormap.
Declaration
public bool Enable_external_quant { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Default value: |
Remarks
Significant only in buffered-image mode.
See Also
| Improve this Doc View SourceImage_height
Gets the height of image, set by jpeg_read_header(Boolean)
Declaration
public int Image_height { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The height of image. |
See Also
| Improve this Doc View SourceImage_width
Gets the width of image, set by jpeg_read_header(Boolean)
Declaration
public int Image_width { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The width of image. |
See Also
| Improve this Doc View SourceInput_iMCU_row
Gets the number of iMCU rows completed.
Declaration
public int Input_iMCU_row { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of iMCU rows completed. |
Remarks
Indicates the progress of the decompressor input side.
Input_scan_number
Gets the number of SOS markers seen so far.
Declaration
public int Input_scan_number { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of SOS markers seen so far. |
Remarks
Indicates the progress of the decompressor input side.
IsDecompressor
Retrieves true
because this is a decompressor.
Declaration
public override bool IsDecompressor { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Overrides
| Improve this Doc View SourceJpeg_color_space
Gets or sets the colorspace of JPEG image.
Declaration
public J_COLOR_SPACE Jpeg_color_space { get; set; }
Property Value
Type | Description |
---|---|
J_COLOR_SPACE | The colorspace of JPEG image. |
See Also
| Improve this Doc View SourceMarker_list
Gets the list of loaded special markers.
Declaration
public ReadOnlyCollection<jpeg_marker_struct> Marker_list { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<jpeg_marker_struct> | The list of loaded special markers. |
Remarks
All the special markers in the file appear in this list, in order of their occurrence in the file (but omitting any markers of types you didn't ask for)
See Also
| Improve this Doc View SourceMax_v_samp_factor
Gets the largest vertical sample factor.
Declaration
public int Max_v_samp_factor { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The largest vertical sample factor. |
Num_components
Gets the number of color components in JPEG image.
Declaration
public int Num_components { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of color components. |
See Also
| Improve this Doc View SourceOut_color_components
Gets the number of color components in Out_color_space.
Declaration
public int Out_color_components { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of color components. |
Remarks
Computed by jpeg_start_decompress(). You can also use jpeg_calc_output_dimensions() to determine this value in advance of calling jpeg_start_decompress().
See Also
| Improve this Doc View SourceOut_color_space
Gets or sets the output color space.
Declaration
public J_COLOR_SPACE Out_color_space { get; set; }
Property Value
Type | Description |
---|---|
J_COLOR_SPACE | The output color space. |
See Also
| Improve this Doc View SourceOutput_components
Gets the number of color components returned.
Declaration
public int Output_components { get; }
Property Value
Type | Description |
---|---|
System.Int32 | When Quantize_colors,
|
Remarks
Computed by jpeg_start_decompress(). You can also use jpeg_calc_output_dimensions() to determine this value in advance of calling jpeg_start_decompress().
See Also
| Improve this Doc View SourceOutput_height
Gets the actual height of output image.
Declaration
public int Output_height { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The height of output image. |
Remarks
Computed by jpeg_start_decompress(). You can also use jpeg_calc_output_dimensions() to determine this value in advance of calling jpeg_start_decompress().
See Also
| Improve this Doc View SourceOutput_iMCU_row
Gets the number of iMCU rows read.
Declaration
public int Output_iMCU_row { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of iMCU rows read. |
Output_scan_number
Gets the nominal scan number being displayed.
Declaration
public int Output_scan_number { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The nominal scan number being displayed. |
Output_scanline
Gets the number of scanlines returned so far.
Declaration
public int Output_scanline { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The output_scanline. |
Remarks
Usually you can just use this variable as the loop counter,
so that the loop test looks like
while (cinfo.Output_scanline < cinfo.Output_height)
See Also
| Improve this Doc View SourceOutput_width
Gets the actual width of output image.
Declaration
public int Output_width { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The width of output image. |
Remarks
Computed by jpeg_start_decompress(). You can also use jpeg_calc_output_dimensions() to determine this value in advance of calling jpeg_start_decompress().
See Also
| Improve this Doc View SourceQuantize_colors
Colors quantization.
Declaration
public bool Quantize_colors { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If set |
See Also
| Improve this Doc View SourceRaw_data_out
Enable or disable raw data output.
Declaration
public bool Raw_data_out { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Default value: false
Set this to true before jpeg_start_decompress()
if you need to obtain raw data output.
See Also
| Improve this Doc View SourceRec_outbuf_height
Gets the recommended height of scanline buffer.
Declaration
public int Rec_outbuf_height { get; }
Property Value
Type | Description |
---|---|
System.Int32 | In high-quality modes, |
Remarks
Computed by jpeg_start_decompress().
You can also use jpeg_calc_output_dimensions() to determine this value
in advance of calling jpeg_start_decompress().
Rec_outbuf_height
is the recommended minimum height (in scanlines)
of the buffer passed to jpeg_read_scanlines(Byte[][], Int32).
If the buffer is smaller, the library will still work, but time will be wasted due
to unnecessary data copying. If you are going to ask for a high-speed processing mode,
you may as well go to the trouble of honoring Rec_outbuf_height
so as to avoid data copying.
(An output buffer larger than Rec_outbuf_height
lines is OK, but won't provide
any material speed improvement over that height.)
See Also
| Improve this Doc View SourceScale_denom
Gets or sets the denominator of the fraction of image scaling.
Declaration
public int Scale_denom { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Scale the image by the fraction Scale_num/Scale_denom. Default is 1/1, or no scaling. Currently, the only supported scaling ratios are 1/1, 1/2, 1/4, and 1/8. (The library design allows for arbitrary scaling ratios but this is not likely to be implemented any time soon.) |
Remarks
Smaller scaling ratios permit significantly faster decoding since fewer pixels need to be processed and a simpler J_DCT_METHOD can be used.
See Also
| Improve this Doc View SourceScale_num
Gets or sets the numerator of the fraction of image scaling.
Declaration
public int Scale_num { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Scale the image by the fraction Scale_num/Scale_denom. Default is 1/1, or no scaling. Currently, the only supported scaling ratios are 1/1, 1/2, 1/4, and 1/8. (The library design allows for arbitrary scaling ratios but this is not likely to be implemented any time soon.) |
Remarks
Smaller scaling ratios permit significantly faster decoding since fewer pixels need to be processed and a simpler J_DCT_METHOD can be used.
See Also
| Improve this Doc View SourceSrc
Gets or sets the source for decompression.
Declaration
public jpeg_source_mgr Src { get; set; }
Property Value
Type | Description |
---|---|
jpeg_source_mgr | The source for decompression. |
Two_pass_quantize
Gets or sets a value indicating whether to use two-pass color quantization.
Declaration
public bool Two_pass_quantize { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If Default value: |
Remarks
Ignored if Quantize_colors is false
.
See Also
| Improve this Doc View SourceUnread_marker
Gets the last read and unprocessed JPEG marker.
Declaration
public int Unread_marker { get; }
Property Value
Type | Description |
---|---|
System.Int32 | It is either zero or the code of a JPEG marker that has been read from the data source, but has not yet been processed. |
See Also
| Improve this Doc View SourceX_density
Gets the horizontal component of pixel ratio.
Declaration
public short X_density { get; }
Property Value
Type | Description |
---|---|
System.Int16 | The horizontal component of pixel ratio. |
See Also
| Improve this Doc View SourceY_density
Gets the vertical component of pixel ratio.
Declaration
public short Y_density { get; }
Property Value
Type | Description |
---|---|
System.Int16 | The vertical component of pixel ratio. |
See Also
Methods
| Improve this Doc View Sourcejpeg_abort_decompress()
Aborts processing of a JPEG decompression operation.
Declaration
public void jpeg_abort_decompress()
See Also
| Improve this Doc View Sourcejpeg_calc_output_dimensions()
Pre-calculate output image dimensions and related values for current decompression parameters.
Declaration
public void jpeg_calc_output_dimensions()
Remarks
This is allowed for possible use by application. Hence it mustn't do anything that can't be done twice. Also note that it may be called before the master module is initialized!
jpeg_consume_input()
Consume data in advance of what the decompressor requires.
Declaration
public ReadResult jpeg_consume_input()
Returns
Type | Description |
---|---|
ReadResult | The result of data consumption. |
Remarks
This routine can be called at any time after initializing the JPEG object. It reads some additional data and returns when one of the indicated significant events occurs. If called after the EOI marker is reached, it will immediately return JPEG_REACHED_EOI without attempting to read more data.
jpeg_copy_critical_parameters(jpeg_compress_struct)
Initializes the compression object with default parameters, then copy from the source object all parameters needed for lossless transcoding.
Declaration
public void jpeg_copy_critical_parameters(jpeg_compress_struct dstinfo)
Parameters
Type | Name | Description |
---|---|---|
jpeg_compress_struct | dstinfo | Target JPEG compression object. |
Remarks
Parameters that can be varied without loss (such as scan script and Huffman optimization) are left in their default states.
jpeg_finish_decompress()
Finish JPEG decompression.
Declaration
public bool jpeg_finish_decompress()
Returns
Type | Description |
---|---|
System.Boolean | Returns |
Remarks
This will normally just verify the file trailer and release temp storage.
See Also
| Improve this Doc View Sourcejpeg_finish_output()
Finish up after an output pass in buffered-image mode.
Declaration
public bool jpeg_finish_output()
Returns
Type | Description |
---|---|
System.Boolean | Returns |
See Also
| Improve this Doc View Sourcejpeg_has_multiple_scans()
Is there more than one scan?
Declaration
public bool jpeg_has_multiple_scans()
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
If you are concerned about maximum performance on baseline JPEG files, you should use buffered-image mode only when the incoming file actually has multiple scans. This can be tested by calling this method.
jpeg_input_complete()
Indicates if we have finished reading the input file.
Declaration
public bool jpeg_input_complete()
Returns
Type | Description |
---|---|
System.Boolean |
|
See Also
| Improve this Doc View Sourcejpeg_read_coefficients()
Read or write the raw DCT coefficient arrays from a JPEG file (useful for lossless transcoding).
Declaration
public jvirt_array<JBLOCK>[] jpeg_read_coefficients()
Returns
Type | Description |
---|---|
jvirt_array<JBLOCK>[] | Returns |
Remarks
jpeg_read_header(Boolean) must be completed before calling this.
The entire image is read into a set of virtual coefficient-block arrays, one per component.
The return value is an array of virtual-array descriptors.
An alternative usage is to simply obtain access to the coefficient arrays during a buffered-image mode decompression operation. This is allowed after any jpeg_finish_output() call. The arrays can be accessed until jpeg_finish_decompress() is called. Note that any call to the library may reposition the arrays, so don't rely on Access(Int32, Int32) results to stay valid across library calls.
jpeg_read_header(Boolean)
Decompression startup: this will read the source datastream header markers, up to the beginning of the compressed data proper.
Declaration
public ReadResult jpeg_read_header(bool require_image)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | require_image | Read a description of Return Value. |
Returns
Type | Description |
---|---|
ReadResult | If you pass This method will read as far as the first SOS marker (ie, actual start of compressed data),
and will save all tables and parameters in the JPEG object. It will also initialize the
decompression parameters to default values, and finally return JPEG_HEADER_OK.
On return, the application may adjust the decompression parameters and then call
jpeg_start_decompress(). (Or, if the application only wanted to
determine the image parameters, the data need not be decompressed. In that case, call
jpeg_abort() to release any temporary space.) If an abbreviated (tables only) datastream is presented, the routine will return
JPEG_HEADER_TABLES_ONLY upon reaching EOI. The application may then re-use
the JPEG object to read the abbreviated image datastream(s). It is unnecessary (but OK) to call
jpeg_abort() in this case.
The JPEG_SUSPENDED return code only occurs if the data source module
requests suspension of the decompressor. In this case the application should load more source
data and then re-call If a non-suspending data source is used and |
Remarks
Need only initialize JPEG object and supply a data source before calling.
On return, the image dimensions and other info have been stored in the JPEG object.
The application may wish to consult this information before selecting decompression parameters.
This routine is now just a front end to jpeg_consume_input(), with some extra error checking.
See Also
| Improve this Doc View Sourcejpeg_read_raw_data(Byte[][][], Int32)
Alternate entry point to read raw data.
Declaration
public int jpeg_read_raw_data(byte[][][] data, int max_lines)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[][][] | data | The raw data. |
System.Int32 | max_lines | The number of scanlines for reading. |
Returns
Type | Description |
---|---|
System.Int32 | The number of lines actually read. |
Remarks
Replaces jpeg_read_scanlines(Byte[][], Int32) when reading raw downsampled data. Processes exactly one iMCU row per call, unless suspended.
jpeg_read_scanlines(Byte[][], Int32)
Read some scanlines of data from the JPEG decompressor.
Declaration
public int jpeg_read_scanlines(byte[][] scanlines, int max_lines)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[][] | scanlines | Buffer for filling. |
System.Int32 | max_lines | Required number of lines. |
Returns
Type | Description |
---|---|
System.Int32 | The return value will be the number of lines actually read. This may be less than the number requested in several cases, including bottom of image, data source suspension, and operating modes that emit multiple scanlines at a time. |
Remarks
We warn about excess calls to jpeg_read_scanlines
since this likely signals an
application programmer error. However, an oversize buffer (max_lines > scanlines remaining)
is not an error.
See Also
| Improve this Doc View Sourcejpeg_save_markers(Int32, Int32)
Control saving of COM and APPn markers into Marker_list.
Declaration
public void jpeg_save_markers(int marker_code, int length_limit)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | marker_code | The marker type to save (see JPEG_MARKER enumeration). |
System.Int32 | length_limit | If the incoming marker is longer than |
See Also
| Improve this Doc View Sourcejpeg_set_marker_processor(Int32, jpeg_decompress_struct.jpeg_marker_parser_method)
Sets processor for special marker.
Declaration
public void jpeg_set_marker_processor(int marker_code, jpeg_decompress_struct.jpeg_marker_parser_method routine)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | marker_code | The marker code. |
jpeg_decompress_struct.jpeg_marker_parser_method | routine | The processor. |
Remarks
Allows you to supply your own routine to process COM and/or APPn markers on-the-fly as they are read.
See Also
| Improve this Doc View Sourcejpeg_start_decompress()
Decompression initialization.
Declaration
public bool jpeg_start_decompress()
Returns
Type | Description |
---|---|
System.Boolean | Returns |
Remarks
jpeg_read_header(Boolean) must be completed before calling this.
If a multipass operating mode was selected, this will do all but the last pass, and thus may take a great deal of time.
See Also
| Improve this Doc View Sourcejpeg_start_output(Int32)
Initialize for an output pass in buffered-image mode.
Declaration
public bool jpeg_start_output(int scan_number)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | scan_number | Indicates which scan of the input file is to be displayed; the scans are numbered starting at 1 for this purpose. |
Returns
Type | Description |
---|---|
System.Boolean |
|
See Also
| Improve this Doc View Sourcejpeg_stdio_src(Stream)
Sets input stream.
Declaration
public void jpeg_stdio_src(Stream infile)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | infile | The input stream. |
Remarks
The caller must have already opened the stream, and is responsible for closing it after finishing decompression.