00001 00019 #ifndef BITSTRM_H 00020 #define BITSTRM_H 00021 00022 #include "host.h" 00023 00025 #define BITBUFSIZE 8192 00026 00031 class DLLSYM R_BITSTREAM 00032 { 00033 private: 00034 int bitfd; //file descriptor 00035 INT32 bitindex; //current byte 00036 UINT32 bitword; //current word 00037 INT32 bitbit; //current bit 00038 INT32 bufsize; //size of buffer 00039 UINT8 bitbuf[BITBUFSIZE]; //bitstream buffer 00040 //for reading codes 00041 static const UINT16 bitmasks[17]; 00042 00043 public: 00044 00045 R_BITSTREAM() { 00046 }; //Null constructor 00047 00048 UINT16 open( //open to read 00049 int fd); //file to read 00050 00051 UINT16 read_code( //read a code 00052 UINT8 length); //bits to lose 00053 UINT16 masks( //read a code 00054 INT32 index); //bits to lose 00055 }; 00056 00061 class DLLSYM W_BITSTREAM 00062 { 00063 private: 00065 int bitfd; 00067 INT32 bitindex; 00069 UINT32 bitword; 00071 INT32 bitbit; 00073 UINT8 bitbuf[BITBUFSIZE]; 00074 00075 public: 00076 W_BITSTREAM() { 00077 }; //Null constructor 00078 00079 void open( //open to write 00080 int fd); //file to write 00081 00082 INT8 write_code( //write a code 00083 UINT16 code, //code to write 00084 UINT8 length); //bits to lose 00085 }; 00086 #endif