home *** CD-ROM | disk | FTP | other *** search
- #ifndef __JPDEQUAN_H
- #define __JPDEQUAN_H
- #include <iostream>
- #include "jpeg.h"
- #include "bitimage.h"
-
- class JpegDecoder ;
-
- class JpegDecoderQuantizationTable
- {
- public:
- JpegDecoderQuantizationTable() ;
- ~JpegDecoderQuantizationTable() {}
-
- // This function tells the caller if the quantization table has been
- // defined by the JPEG input stream.
- bool Defined () const ;
-
- // Function to read the quantization table from the input stream.
- void ReadTable (JpegDecoder &decoder, unsigned int precision) ;
-
- // This function builds the scaled quantization tables used in
- // fast IDCT implementations.
- void BuildScaledTables () ;
-
- // This function prints the contents of the quantization table to
- // an output stream.
- void Print (std::ostream &) const ;
-
- UBYTE2 operator[](unsigned int) const ;
- UBYTE2 &operator[](unsigned int) ;
- private:
- // Dummy Declarations for Required Member Functions
- JpegDecoderQuantizationTable (const JpegDecoderQuantizationTable&) ;
- JpegDecoderQuantizationTable &operator=(const JpegDecoderQuantizationTable&) ;
-
- // Quantization Values in Zig-Zag Order.
- UBYTE2 data_values [JpegSampleSize] ;
-
-
- // This flag gets set to true when the quantization is defined in the
- // JPEG input stream. It is used to ensure that an compressed scan does
- // not attempt to use an undefined quantization table.
- bool table_defined ;
-
- friend class JpegDecoderDataUnit ;
- } ;
-
- inline bool JpegDecoderQuantizationTable::Defined () const
- {
- return table_defined ;
- }
-
-
- inline std::ostream &operator<<(std::ostream &strm,
- const JpegDecoderQuantizationTable &du)
- {
- du.Print (strm) ;
- return strm ;
- }
-
- inline UBYTE2 &JpegDecoderQuantizationTable::operator[](unsigned int index)
- {
- return data_values [index] ;
- }
-
- inline UBYTE2 JpegDecoderQuantizationTable::operator[](unsigned int index) const
- {
- return data_values [index] ;
- }
-
-
- #endif
-