/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains input control logic for the JPEG decompressor.
* These routines are concerned with controlling the decompressor's input
* processing (marker reading and coefficient decoding). The actual input
* reading is done in jdmarker.c, jdhuff.c, and jdphuff.c.
*/
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
/* Private state */
typedef struct {
/* Forward declarations */
/*
* Routines to calculate various quantities related to the size of the image.
*/
LOCAL(void)
/* Called once, when first SOS marker is reached */
{
int ci;
/* Make sure image isn't bigger than I can handle */
/* For now, precision must match compiled-in value... */
/* Check that number of components won't exceed internal array sizes */
/* Compute maximum sampling factors; check factor validity */
}
/* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
* In the full decompressor, this will be overridden by jdmaster.c;
* but in the transcoder, jdmaster.c is not used, so we must do it here.
*/
/* Compute dimensions of components */
/* Size in DCT blocks */
/* downsampled_width and downsampled_height will also be overridden by
* jdmaster.c if we are doing full decompression. The transcoder library
* doesn't use these values, but the calling application might.
*/
/* Size in samples */
(long) cinfo->max_h_samp_factor);
(long) cinfo->max_v_samp_factor);
/* Mark component needed, until color conversion says otherwise */
/* Mark no quantization table yet saved for component */
}
/* Compute number of fully interleaved MCU rows. */
/* Decide whether file contains multiple scans */
else
}
LOCAL(void)
/* Do computations that are needed before processing a JPEG scan */
/* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */
{
/* Noninterleaved (single-component) scan */
/* Overall image size in MCUs */
/* For noninterleaved scan, always one block per MCU */
/* For noninterleaved scans, it is convenient to define last_row_height
* as the number of block rows present in the last iMCU row.
*/
/* Prepare array describing MCU composition */
cinfo->MCU_membership[0] = 0;
} else {
/* Interleaved (multi-component) scan */
/* Overall image size in MCUs */
cinfo->blocks_in_MCU = 0;
/* Sampling factors give # of blocks of component in each MCU */
/* Figure number of non-dummy blocks in last MCU column & row */
/* Prepare array describing MCU composition */
while (mcublks-- > 0) {
}
}
}
}
/*
* Save away a copy of the Q-table referenced by each component present
* in the current scan, unless already saved during a prior scan.
*
* In a multiple-scan JPEG file, the encoder could assign different components
* the same Q-table slot number, but change table definitions between scans
* so that each component uses a different Q-table. (The IJG encoder is not
* currently capable of doing this, but other encoders might.) Since we want
* to be able to dequantize all the components at the end of the file, this
* means that we have to save away the table actually used for each component.
* We do this by copying the table at the start of the first scan containing
* the component.
* The JPEG spec prohibits the encoder from changing the contents of a Q-table
* slot between scans of a component using that slot. If the encoder does so
* anyway, this decoder will simply use the Q-table values that were current
* at the start of the first scan for the component.
*
* The decompressor output side looks only at the saved quant tables,
* not at the current Q-table slots.
*/
LOCAL(void)
{
/* No work if we already saved Q-table for this component */
continue;
/* Make sure specified quantization table is present */
/* OK, save away the quantization table */
qtbl = (JQUANT_TBL *)
SIZEOF(JQUANT_TBL));
}
}
/*
* Initialize the input modules to read a scan of compressed data.
* The first call to this is done by jdmaster.c after initializing
* the entire decompressor (during jpeg_start_decompress).
* Subsequent calls come from consume_markers, below.
*/
METHODDEF(void)
{
}
/*
* Finish up after inputting a compressed-data scan.
* This is called by the coefficient controller after it's read all
* the expected data of the scan.
*/
METHODDEF(void)
{
}
/*
* Read JPEG markers before, between, or after compressed-data scans.
* Change state as necessary when a new scan is reached.
* Return value is JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
*
* The consume_input method pointer points either here or to the
* coefficient controller's consume_data routine, depending on whether
* we are reading a compressed data segment or inter-segment markers.
*/
METHODDEF(int)
{
int val;
return JPEG_REACHED_EOI;
switch (val) {
case JPEG_REACHED_SOS: /* Found SOS */
/* Note: start_input_pass must be called by jdmaster.c
* before any more input can be consumed. jdapimin.c is
* responsible for enforcing this sequencing.
*/
} else { /* 2nd or later SOS marker */
}
break;
case JPEG_REACHED_EOI: /* Found EOI */
} else {
/* Prevent infinite loop in coef ctlr's decompress_data routine
* if user set output_scan_number larger than number of scans.
*/
}
break;
case JPEG_SUSPENDED:
break;
}
return val;
}
/*
* Reset state to begin a fresh datastream.
*/
METHODDEF(void)
{
/* Reset other modules */
/* Reset progression state -- would be cleaner if entropy decoder did this */
}
/*
* Initialize the input controller module.
* This is called only once, when the decompression object is created.
*/
GLOBAL(void)
{
/* Create subobject in permanent pool */
/* Initialize method pointers */
/* Initialize state: can't use reset_input_controller since we don't
* want to try to reset other modules yet.
*/
}