Linux Game Programming for PC & Embedded Systems using SDL
Presented by
Fore June
Author of Windows Fan, Linux Fan

Sample program for testing Huffman encoding of DCT coefficients.

fbitios.h
fbitios.cpp
test_huf.cpp
sample_video.dct



fbitios.h:
//fbitios.h
#ifndef FBITIOS_H
#define FBITIOS_H

#include	<stdio.h>
#include	<stdlib.h>
#include	<iostream>
#include 	<fstream>
#include	<string.h>
#include 	<set>
#include	<bitset>

using namespace std;

typedef	unsigned int	ui;
typedef unsigned long	ul;
typedef	unsigned char	uc;

class  bitFileIO{
private:
  bitset<32> ins;
  bitset<32> outs;
  fstream ifs, ofs;
  int ins_pos;
  int outs_pos;
  int progress_indicator;
  enum { max_bits = 32 };
public:
  bitFileIO ( char *argv_in,  char *argv_out );		//constructors
  bitFileIO :: bitFileIO( char *argv_out, int in_out );
  int  inputBit();		//input one bit from file
  void outputBit( int bit );  	//output one bit to file
  long  inputBits( int n );  	//input n bits from file
  void outputBits ( ul data, int n );	//output n bits to file
  void closeOutput();		//close_output
  void closeInput();		//close input
};

#endif