iOS/buildlibs/armv7/allegro-4.4.2/addons/jpgalleg/src/decode.c
/* read_sos_chunk:
 *  Reads a SOS (Start Of Scan) chunk from the input stream.
 */
Reads a SOS (Start Of Scan) chunk from the input stream.
Reads a SOS ( Start Of Scan ) chunk from the input stream .
static int
read_sos_chunk(void)
{
	int i, data;
	_jpeg_open_chunk();
	scan_components = _jpeg_getc();
	if (scan_components > 3) {
		TRACE("Unsupported number of scan components (%d)", scan_components);
		jpgalleg_error = JPG_ERROR_UNSUPPORTED_COLOR_SPACE;
		return -1;
	}
	for (i = 0; i < scan_components; i++) {
		component[i] = _jpeg_getc();
		switch (component[i]) {
			case 1:
				data = _jpeg_getc();
				if (((data & 0xf) > 3) || ((data >> 4) > 3)) {
					TRACE("Bad huffman table specified for %s component", _jpeg_component_name[component[i] - 1]);
					jpgalleg_error = JPG_ERROR_BAD_IMAGE;
					return -1;
				}
				ac_luminance_table = &_jpeg_huffman_ac_table[data & 0xf];
				dc_luminance_table = &_jpeg_huffman_dc_table[data >> 4];
				break;
			case 2:
			case 3:
				data = _jpeg_getc();
				if (((data & 0xf) > 3) || ((data >> 4) > 3)) {
					TRACE("Bad huffman table specified for %s component", _jpeg_component_name[component[i] - 1]);
					jpgalleg_error = JPG_ERROR_BAD_IMAGE;
					return -1;
				}
				ac_chrominance_table = &_jpeg_huffman_ac_table[data & 0xf];
				dc_chrominance_table = &_jpeg_huffman_dc_table[data >> 4];
				break;
			default:
				TRACE("Unsupported component id (%d)", component[i]);
				jpgalleg_error = JPG_ERROR_BAD_IMAGE;
				break;
		}
	}
	spectrum_start = _jpeg_getc();
	spectrum_end = _jpeg_getc();
	data = _jpeg_getc();
	successive_high = data >> 4;
	successive_low = data & 0xf;
	_jpeg_close_chunk();
	skip_count = 0;
	return 0;
}
static int read_sos_chunk ( void ) { int i , data ; _jpeg_open_chunk ( ) ; scan_components = _jpeg_getc ( ) ; if ( scan_components > 3 ) { TRACE ( " " , scan_components ) ; jpgalleg_error = JPG_ERROR_UNSUPPORTED_COLOR_SPACE ; return -1 ; } for ( i = 0 ; i < scan_components ; i ++ ) { component [ i ] = _jpeg_getc ( ) ; switch ( component [ i ] ) { case 1 : data = _jpeg_getc ( ) ; if ( ( ( data & 0xf ) > 3 ) || ( ( data >> 4 ) > 3 ) ) { TRACE ( " " , _jpeg_component_name [ component [ i ] - 1 ] ) ; jpgalleg_error = JPG_ERROR_BAD_IMAGE ; return -1 ; } ac_luminance_table = & _jpeg_huffman_ac_table [ data & 0xf ] ; dc_luminance_table = & _jpeg_huffman_dc_table [ data >> 4 ] ; break ; case 2 : case 3 : data = _jpeg_getc ( ) ; if ( ( ( data & 0xf ) > 3 ) || ( ( data >> 4 ) > 3 ) ) { TRACE ( " " , _jpeg_component_name [ component [ i ] - 1 ] ) ; jpgalleg_error = JPG_ERROR_BAD_IMAGE ; return -1 ; } ac_chrominance_table = & _jpeg_huffman_ac_table [ data & 0xf ] ; dc_chrominance_table = & _jpeg_huffman_dc_table [ data >> 4 ] ; break ; default : TRACE ( " " , component [ i ] ) ; jpgalleg_error = JPG_ERROR_BAD_IMAGE ; break ; } } spectrum_start = _jpeg_getc ( ) ; spectrum_end = _jpeg_getc ( ) ; data = _jpeg_getc ( ) ; successive_high = data >> 4 ; successive_low = data & 0xf ; _jpeg_close_chunk ( ) ; skip_count = 0 ; return 0 ; }
read_sos_chunk:
  Reads a SOS (Start Of Scan) chunk from the input stream.
read_sos_chunk : Reads a SOS ( Start Of Scan ) chunk from the input stream .