public void jpeg_set_defaults()
{
/* Safety check to ensure start_compress not called yet. */
if (m_global_state != JpegState.CSTATE_START)
ERREXIT(J_MESSAGE_CODE.JERR_BAD_STATE, (int)m_global_state);
/* Allocate comp_info array large enough for maximum component count.
* Array is made permanent in case application wants to compress
* multiple images at same param settings.
*/
if (m_comp_info == null)
{
m_comp_info = jpeg_component_info.createArrayOfComponents(JpegConstants.MAX_COMPONENTS);
}
/* Initialize everything not dependent on the color space */
scale_num = 1; /* 1:1 scaling */
scale_denom = 1;
m_data_precision = JpegConstants.BITS_IN_JSAMPLE;
/* Set up two quantization tables using default quality of 75 */
jpeg_set_quality(75, true);
/* Set up two Huffman tables */
std_huff_tables();
/* Default is no multiple-scan output */
m_scan_info = null;
m_num_scans = 0;
/* Expect normal source image, not raw downsampled data */
m_raw_data_in = false;
/* The standard Huffman tables are only valid for 8-bit data precision.
* If the precision is higher, use arithmetic coding.
* (Alternatively, using Huffman coding would be possible with forcing
* optimization on so that usable tables will be computed, or by
* supplying default tables that are valid for the desired precision.)
* Otherwise, use Huffman coding by default.
*/
arith_code = (m_data_precision > 8);
/* By default, don't do extra passes to optimize entropy coding */
m_optimize_coding = false;
/* By default, use the simpler non-cosited sampling alignment */
m_CCIR601_sampling = false;
/* By default, apply fancy downsampling */
do_fancy_downsampling = true;
/* No input smoothing */
m_smoothing_factor = 0;
/* DCT algorithm preference */
m_dct_method = JpegConstants.JDCT_DEFAULT;
/* No restart markers */
m_restart_interval = 0;
m_restart_in_rows = 0;
/* Fill in default JFIF marker parameters. Note that whether the marker
* will actually be written is determined by jpeg_set_colorspace.
*
* By default, the library emits JFIF version code 1.01.
* An application that wants to emit JFIF 1.02 extension markers should set
* JFIF_minor_version to 2. We could probably get away with just defaulting
* to 1.02, but there may still be some decoders in use that will complain
* about that; saying 1.01 should minimize compatibility problems.
*
* For wide gamut colorspaces (BG_RGB and BG_YCC), the major version will be
* overridden by jpeg_set_colorspace and set to 2.
*/
m_JFIF_major_version = 1; /* Default JFIF version = 1.01 */
m_JFIF_minor_version = 1;
m_density_unit = DensityUnit.Unknown; /* Pixel size is unknown by default */
m_X_density = 1; /* Pixel aspect ratio is square by default */
m_Y_density = 1;
/* No color transform */
color_transform = J_COLOR_TRANSFORM.JCT_NONE;
/* Choose JPEG colorspace based on input space, set defaults accordingly */
jpeg_default_colorspace();
}