30 #ifndef AVCODEC_GOLOMB_H
31 #define AVCODEC_GOLOMB_H
37 #define INVALID_VLC 0x80000000
152 if(range==1)
return 0;
153 else if(range==2)
return get_bits1(gb)^1;
192 if(buf&1) buf= -(buf>>1);
218 if((buf & 0xAAAAAAAA) == 0)
221 for(log=31; (buf & 0x80000000) == 0; log--){
222 buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
228 return (
signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
243 ret = (ret ^ buf) - buf;
279 return buf + limit - 1;
305 for (i = 0; i < limit &&
SHOW_UBITS(
re, gb, 1) == 0; i++) {
323 }
else if(i == limit - 1){
341 if (v&1)
return v>>1;
352 return (v>>1) ^ -(v&1);
387 print_bin(bits, len);
403 print_bin(bits, len);
417 print_bin(bits, len);
424 #define get_ue_golomb(a) get_ue(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
425 #define get_se_golomb(a) get_se(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
426 #define get_te_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
427 #define get_te0_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
492 put_bits(pb, e + k + 1, (1<<k) + (i&((1<<k)-1)));
494 put_bits(pb, limit + esc_len, i - limit + 1);