1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // INTEL CORPORATION PROPRIETARY INFORMATION
4 // This software is supplied under the terms of a license agreement or
5 // nondisclosure agreement with Intel Corporation and may not be copied
6 // or disclosed except in accordance with the terms of that agreement.
7 // Copyright (c) 1999 Intel Corporation. All Rights Reserved.
14 // Authors: Vadim Pisarevsky
23 class rm_jpeg_bit_stream : public rm_bit_stream
26 rm_byte_stream m_low_strm;
29 ~rm_jpeg_bit_stream();
31 virtual bool open( const char* filename );
34 void flush(); // flushes high-level bit stream
39 virtual void read_block();
43 //////////////////// JPEG reader /////////////////////
45 class grfmt_jpeg_reader : public graphics_format_reader
54 bool read_data( byte* data, int pitch, int color );
59 int m_offset; // offset of first scan
60 int m_version; // JFIF version
61 int m_planes; // 3 (YCrCb) or 1 (Gray)
62 int m_precision; // 8 or 12-bit per sample
63 int m_type; // SOF type
64 int m_MCUs; // MCUs in restart interval
65 int m_ss, m_se, m_ah, m_al; // progressive JPEG parameters
67 // information about each component
70 char h; // horizontal sampling factor
71 char v; // vertical sampling factor
72 char tq; // quantization table index
73 char td, ta; // DC & AC huffman tables
74 int dc_pred; // DC predictor
88 rm_jpeg_bit_stream m_strm;
92 bool load_quant_tables( int length );
93 bool load_huffman_tables( int length );
94 void process_scan( int* idx, int ns, byte* data, int pitch, int color );
96 void get_block( int* block, int c );