30 #ifndef AVCODEC_GOLOMB_H
31 #define AVCODEC_GOLOMB_H
38 #define INVALID_VLC 0x80000000
61 if (buf >= (1 << 27)) {
68 int log = 2 *
av_log2(buf) - 31;
71 if (CONFIG_FTRAPV && log < 0) {
123 if (buf & 0xAA800000) {
191 if (buf >= (1 << 27)) {
222 buf = (buf + 1) >> 1;
237 if (buf & 0xAA800000) {
249 if ((buf & 0xAAAAAAAA) == 0)
252 for (log = 31; (buf & 0x80000000) == 0; log--)
253 buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
258 return (
signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
272 ret = (ret ^
buf) - buf;
294 if (log > 31 - limit) {
296 buf += (30 - log) << k;
310 return buf + limit - 1;
332 buf += (30 - log) << k;
339 for (i = 0; i < limit &&
SHOW_UBITS(
re, gb, 1) == 0; i++) {
356 return buf + (i << k);
357 }
else if (i == limit - 1) {
392 return (v >> 1) ^ -(v & 1);
426 print_bin(bits, len);
429 bits, len, i, pos, file, func, line);
443 print_bin(bits, len);
446 bits, len, i, pos, file, func, line);
460 print_bin(bits, len);
463 bits, len, i, pos, file, func, line);
468 #define get_ue_golomb(a) get_ue(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
469 #define get_se_golomb(a) get_se(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
470 #define get_te_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
471 #define get_te0_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
543 put_bits(pb, e + k + 1, (1 << k) + (i & ((1 << k) - 1)));
545 put_bits(pb, limit + esc_len, i - limit + 1);
552 int limit,
int esc_len)
595 int limit,
int esc_len)