#include <bitstrm.h>
Definition at line 31 of file bitstrm.h.
R_BITSTREAM::R_BITSTREAM | ( | ) | [inline] |
Read a code from the static member.
Definition at line 84 of file bitstrm.cpp.
References bitmasks.
Referenced by read_tif_image().
00086 { 00087 return bitmasks[index]; 00088 }
UINT16 R_BITSTREAM::open | ( | int | fd | ) |
Establish a bitstream for reading.
Definition at line 38 of file bitstrm.cpp.
References bitbit, bitbuf, BITBUFSIZE, bitfd, bitindex, bitword, bufsize, ERRCODE::error(), LOG, NULL, and READFAILED.
Referenced by read_tif_image().
00040 { 00041 bitfd = fd; 00042 bufsize = read (fd, (char *) bitbuf, BITBUFSIZE * sizeof (UINT8)); 00043 //fill buffer 00044 if (bufsize < 0) { 00045 READFAILED.error ("R_BITSTREAM::open", LOG, NULL); 00046 return 0; 00047 } 00048 bitword = bitbuf[0] | (bitbuf[1] << 8); 00049 bitindex = 2; 00050 bitbit = 16; 00051 return (UINT16) bitword; 00052 }
Remove a code from the bitstream.
Definition at line 58 of file bitstrm.cpp.
References bitbit, bitbuf, BITBUFSIZE, bitfd, bitindex, bitword, bufsize, ERRCODE::error(), LOG, NULL, and READFAILED.
Referenced by read_eol(), and read_tif_image().
00060 { 00061 bitbit -= length; //no of bits left 00062 bitword >>= length; //remove bits 00063 while (bitbit < 16) { 00064 //get next byte 00065 bitword |= bitbuf[bitindex++] << bitbit; 00066 bitbit += 8; 00067 if (bitindex >= bufsize) { 00068 bufsize = 00069 read (bitfd, (char *) bitbuf, BITBUFSIZE * sizeof (UINT8)); 00070 if (bufsize < 0) { 00071 READFAILED.error ("R_BITSTREAM::read_code", LOG, NULL); 00072 return 0; 00073 } 00074 bitindex = 0; //newly filled buffer 00075 } 00076 } 00077 return (UINT16) bitword; 00078 }
INT32 R_BITSTREAM::bitbit [private] |
UINT8 R_BITSTREAM::bitbuf[BITBUFSIZE] [private] |
int R_BITSTREAM::bitfd [private] |
INT32 R_BITSTREAM::bitindex [private] |
const UINT16 R_BITSTREAM::bitmasks [static, private] |
UINT32 R_BITSTREAM::bitword [private] |
INT32 R_BITSTREAM::bufsize [private] |