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)) {
209 buf = ((buf >> 1) ^ sign) - sign;
220 sign = (buf & 1) - 1;
221 return ((buf >> 1) ^ sign) + 1;
232 if (buf & 0xAA800000) {
244 if ((buf & 0xAAAAAAAA) == 0)
247 for (log = 31; (buf & 0x80000000) == 0; log--)
248 buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
253 return (
signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
264 ret = (ret ^ sign) - sign;
285 if (log > 31 - limit) {
287 buf += (30 - log) << k;
301 return buf + limit - 1;
323 buf += (30 - log) << k;
330 for (i = 0; i < limit &&
SHOW_UBITS(
re, gb, 1) == 0; i++) {
347 return buf + (i << k);
348 }
else if (i == limit - 1) {
370 return ((v >> 1) ^ sign) - sign;
380 return (v >> 1) ^ -(v & 1);
397 return (uvar >> 1) ^ -(uvar & 1);
411 print_bin(bits, len);
414 bits, len, i, pos, file, func, line);
428 print_bin(bits, len);
431 bits, len, i, pos, file, func, line);
445 print_bin(bits, len);
448 bits, len, i, pos, file, func, line);
453 #define get_ue_golomb(a) get_ue(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
454 #define get_se_golomb(a) get_se(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
455 #define get_te_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
456 #define get_te0_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
528 put_bits(pb, e + k + 1, (1 << k) + (i & ((1 << k) - 1)));
530 put_bits(pb, limit + esc_len, i - limit + 1);
537 int limit,
int esc_len)
580 int limit,
int esc_len)