⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jpdecomp.h

📁 超强jpeg解码程序
💻 H
字号:
#ifndef __JPDECOMP_H
#define __JPDECOMP_H
//
//  Title:  JPEG Definitions and Utility Functions
//
//  Author:  John M. Miano  miano@colosseumbuilders.com
//


//
//  Title:  JPEG Decoder Component Class Definition
//
//  Author:  John M. Miano  miano@colosseumbuilders.com
//
//  Description:
//
//    This class represents a component within the JPEG decoder.
//


#include "jpeg.h"
#include "jfif.h"
#include "jpdedu.h"
#include "jpdehuff.h"
#include "jpdecobk.h"
#include "jpdehuff.h"
#include "bitimage.h"

class JpegDecoderComponent
{
public:
  JpegDecoderComponent () ;
  ~JpegDecoderComponent () ;

  // We have made the color conversions static because RGB
  // conversion requires the data from three components.
  // Grayscale conversion is static strictly for consistency
  // with RGB.
  static void RGBConvert (JpegDecoderComponent &c1,
                          JpegDecoderComponent &c2,
                          JpegDecoderComponent &c3,
                          BitmapImage &image) ;
  static void GrayscaleConvert (JpegDecoderComponent &cc, BitmapImage &image) ;

  unsigned int HorizontalFrequency () const ;
  void HorizontalFrequency (unsigned int) ;

  unsigned int VerticalFrequency () const ;
  void VerticalFrequency (unsigned int) ;

  void SetQuantizationTable (JpegDecoderQuantizationTable &table) ;
  void AllocateComponentBuffers (const JpegDecoder &decoder) ;
  void FreeComponentBuffers () ;
  void SetHuffmanTables (JpegHuffmanDecoder &dc, JpegHuffmanDecoder &ac) ;
  void Upsample () ;

  void CheckAcTable () ;
  void CheckDcTable () ;
  void CheckQuantizationTable () ;

  void DecodeSequential (JpegDecoder &decoder,
                         unsigned int mcurow,
                         unsigned int mcucol) ;

  unsigned long NoninterleavedRows () const ;
  unsigned long NoninterleavedCols () const ;
  void ResetDcDifference () ;

  void ProgressiveInverseDct () ;

private:
  // Dummy Declarations for Required Member Functions
  JpegDecoderComponent (const JpegDecoderComponent &) ;
  JpegDecoderComponent operator=(const JpegDecoderComponent &) ;

  // Jfif/Frame component ID
  unsigned int component_id ;

  // Sampling Frequencies
  unsigned int horizontal_frequency ;
  unsigned int vertical_frequency ;

  // These values are the numnber of samples to take for each data
  // point. They come from the sampling frequencies and the maximum
  // sampling frequencies of all the components in the image.
  // sampling frequencies of all the components in the image.
  unsigned int v_sampling ;
  unsigned int h_sampling ;

  // Last encoded DC value.
  int last_dc_value ;

  // Entropy tables used by the component.
  JpegHuffmanDecoder *ac_table ;
  JpegHuffmanDecoder *dc_table ;

  // Quantization table used by the component
  JpegDecoderQuantizationTable *quantization_table ;

  // Non-interleaved dimensions.
  unsigned int noninterleaved_rows ;
  unsigned int noninterleaved_cols ;

  unsigned int du_rows ;
  unsigned int du_cols ;

  JpegDecoderDataUnit *data_units ;
  JPEGSAMPLE *upsample_data ;
} ;

inline unsigned int JpegDecoderComponent::HorizontalFrequency () const
{
  return horizontal_frequency ;
}

inline unsigned int JpegDecoderComponent::VerticalFrequency () const
{
  return vertical_frequency ;
}

inline unsigned long JpegDecoderComponent::NoninterleavedRows () const
{
  return noninterleaved_rows ;
}

inline unsigned long JpegDecoderComponent::NoninterleavedCols () const
{
  return noninterleaved_cols ;
}

inline void JpegDecoderComponent::ResetDcDifference ()
{
  last_dc_value = 0 ;
  return ;
}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -