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

📄 huffdeco.cpp

📁 超强jpeg解码程序
💻 CPP
字号:
#include <fstream>
#include "jpegdeco.h"
#include "jpdehuff.h"

using namespace std ;

JpegHuffmanDecoder table ;

main (int argc, char *argv [])
{
  unsigned int bytes ;

  if (argc != 3)
  {
    cerr << "Usage: " << argv [0] << " input-file output-file" << endl ;
    return 1 ;
  }

  ifstream input ;
  input.open (argv [1], ios::binary) ;
  if (! input)
  {
    cerr << "Can't open input file" << endl ;
    return 1 ;
  }

  JpegDecoder decoder (input) ;
  table.ReadTable (decoder) ;

  ofstream output ;
  output.open (argv [2]) ;
  if (! output)
  {
    cerr << "Can't open output file" << endl ;
    return 1 ;
  }

  UBYTE1 data = table.Decode (decoder) ;
  bytes = 0 ;
  while (! input.eof ())
  {
    ++ bytes ;
    if (bytes % 1000 == 0)
      cout << bytes << " Bytes\r" ;
    output.write ((char *) &data, 1) ;
    data = table.Decode (decoder) ;
  }
  cout << bytes << " bytes" << endl ;
  output.write ((char *) &data, 1) ;

  input.close () ;
  output.close () ;
  return 0 ;
}

⌨️ 快捷键说明

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