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

📄 jpeg.h

📁 In term project, we will take the baseline JPEG codec in ARM-based platform system as an example to
💻 H
字号:
#ifndef __jpeg__
#define __jpeg__

#include "type.h"
#include "stream.h"

#include "marker.h"

struct HuffmanDC
{ Byte CodeLength[16];
  Word CodeWord  [16];
};


struct HuffmanAC
{ Byte CodeLength[16][11];
  Word CodeWord  [16][11];
};

class JPEG: public BitStream , public Picture
{private:
   Byte Nf, Ss, Se, Precision;

   void _initial_dc_table(Byte identifier, Byte (*dc_length)[17], Byte (*dc_value)[12 ]);
   void _initial_ac_table(Byte identifier, Byte (*ac_length)[17], Byte (*ac_value)[162]);

   void _encoding_block_value(Byte identifier, int (*block)[8]);
   void _decoding_block_value(Byte identifier, int (*block)[8]);

   void _quantize(Byte identifier, int (*block)[8] );
   void _dequantize(Byte identifier, int (*block)[8] );

 protected:
   HuffmanDC DC[3];
   HuffmanAC AC[3];

   void ChenFDCT(int (*block)[8]);
   void ChenIDCT(int (*block)[8]);
   
   friend void _fdct( int (*m)[8] );
   friend void _idct( int (*m)[8] );
   
   inline void Marker_SOI(){ PutStream(0xFFD8, 16); };

          bool Marker_DQT(Byte identifier, bool extend=false);
          bool Marker_SOF(Byte index=0);

          bool Marker_DHT(Byte identifier, Byte table_class); /* table_class==0 for DC */
          bool Marker_SOS();

   inline void Marker_EOI(){ PutStream(0xFFD9, 16); };

          bool Rip_DQT();
          bool Rip_SOF(Byte index=0);

          bool Rip_DHT();
          bool Rip_SOS();

          void Rip_Marker();

 public:

   bool Encode();
   bool Decode();

   JPEG();
  ~JPEG();
};

#endif

⌨️ 快捷键说明

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