Refactor: bitstream.h/.c renaming

This commit is contained in:
Marko Viitanen 2013-09-18 12:42:16 +03:00 committed by Ari Koivula
parent 81cb6264ab
commit a1621bf900
2 changed files with 8 additions and 8 deletions

View file

@ -40,11 +40,11 @@ void printf_bitstream(char *msg, ...)
} }
#endif #endif
bitTable *g_exp_table; bit_table *g_exp_table;
//From wikipedia //From wikipedia
//http://en.wikipedia.org/wiki/Binary_logarithm#Algorithm //http://en.wikipedia.org/wiki/Binary_logarithm#Algorithm
int floorLog2(unsigned int n) { int floor_log2(unsigned int n) {
int pos = 0; int pos = 0;
if (n >= 1<<16) { n >>= 16; pos += 16; } if (n >= 1<<16) { n >>= 16; pos += 16; }
if (n >= 1<< 8) { n >>= 8; pos += 8; } if (n >= 1<< 8) { n >>= 8; pos += 8; }
@ -60,11 +60,11 @@ void init_exp_golomb(uint32_t len)
uint32_t code_num; uint32_t code_num;
uint32_t M; uint32_t M;
uint32_t info; uint32_t info;
g_exp_table=(bitTable*)malloc(len*sizeof(bitTable)); g_exp_table=(bit_table*)malloc(len*sizeof(bit_table));
for(code_num=0;code_num<len;code_num++) for(code_num=0;code_num<len;code_num++)
{ {
M=(uint32_t)floorLog2(code_num+1); M=(uint32_t)floor_log2(code_num+1);
info=code_num+1-(uint32_t)pow(2,M); info=code_num+1-(uint32_t)pow(2,M);
g_exp_table[code_num].len=M*2+1; g_exp_table[code_num].len=M*2+1;
g_exp_table[code_num].value=(1<<M)|info; g_exp_table[code_num].value=(1<<M)|info;

View file

@ -15,7 +15,7 @@ typedef struct
{ {
uint32_t data[32]; uint32_t data[32];
uint8_t cur_byte; uint8_t cur_byte;
uint8_t cur_bit; uint8_t cur_bit;
FILE* output; FILE* output;
uint8_t* buffer; uint8_t* buffer;
uint32_t buffer_pos; uint32_t buffer_pos;
@ -26,11 +26,11 @@ typedef struct
{ {
uint8_t len; uint8_t len;
uint32_t value; uint32_t value;
}bitTable; } bit_table;
extern bitTable *g_exp_table; extern bit_table *g_exp_table;
int floorLog2(unsigned int n); int floor_log2(unsigned int n);
void bitstream_alloc(bitstream* stream, uint32_t alloc); void bitstream_alloc(bitstream* stream, uint32_t alloc);
void bitstream_clear_buffer(bitstream* stream); void bitstream_clear_buffer(bitstream* stream);