comparison vp56.h @ 12250:0d81ba00151a libavcodec

vp56's arith decoder's code_word is only 16 bits, no need for unsigned long
author conrad
date Fri, 23 Jul 2010 21:46:01 +0000
parents f6b229456bdf
children bbe8e7233c5d
comparison
equal deleted inserted replaced
12249:35ee666e4496 12250:0d81ba00151a
54 int high; 54 int high;
55 int bits; /* stored negated (i.e. negative "bits" is a positive number of 55 int bits; /* stored negated (i.e. negative "bits" is a positive number of
56 bits left) in order to eliminate a negate in cache refilling */ 56 bits left) in order to eliminate a negate in cache refilling */
57 const uint8_t *buffer; 57 const uint8_t *buffer;
58 const uint8_t *end; 58 const uint8_t *end;
59 unsigned long code_word; 59 unsigned int code_word;
60 } VP56RangeCoder; 60 } VP56RangeCoder;
61 61
62 typedef struct { 62 typedef struct {
63 uint8_t not_null_dc; 63 uint8_t not_null_dc;
64 VP56Frame ref_frame; 64 VP56Frame ref_frame;
194 static inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob) 194 static inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob)
195 { 195 {
196 /* Don't put c->high in a local variable; if we do that, gcc gets 196 /* Don't put c->high in a local variable; if we do that, gcc gets
197 * the stupids and turns the code below into a branch again. */ 197 * the stupids and turns the code below into a branch again. */
198 int bits = c->bits; 198 int bits = c->bits;
199 unsigned long code_word = c->code_word; 199 unsigned int code_word = c->code_word;
200 unsigned int low = 1 + (((c->high - 1) * prob) >> 8); 200 unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
201 unsigned int low_shift = low << 8; 201 unsigned int low_shift = low << 8;
202 int bit = code_word >= low_shift; 202 int bit = code_word >= low_shift;
203 int shift; 203 int shift;
204 204