FFmpeg
golomb.h
Go to the documentation of this file.
1 /*
2  * exp golomb vlc stuff
3  * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
4  * Copyright (c) 2004 Alex Beregszaszi
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * @brief
26  * exp golomb vlc stuff
27  * @author Michael Niedermayer <michaelni@gmx.at> and Alex Beregszaszi
28  */
29 
30 #ifndef AVCODEC_GOLOMB_H
31 #define AVCODEC_GOLOMB_H
32 
33 #include <stdint.h>
34 
35 #include "get_bits.h"
36 #include "put_bits.h"
37 
38 #define INVALID_VLC 0x80000000
39 
40 extern const uint8_t ff_golomb_vlc_len[512];
41 extern const uint8_t ff_ue_golomb_vlc_code[512];
42 extern const int8_t ff_se_golomb_vlc_code[512];
43 extern const uint8_t ff_ue_golomb_len[256];
44 
45 extern const uint8_t ff_interleaved_golomb_vlc_len[256];
47 extern const int8_t ff_interleaved_se_golomb_vlc_code[256];
49 
50 /**
51  * Read an unsigned Exp-Golomb code in the range 0 to 8190.
52  *
53  * @returns the read value or a negative error code.
54  */
55 static inline int get_ue_golomb(GetBitContext *gb)
56 {
57  unsigned int buf;
58 
59 #if CACHED_BITSTREAM_READER
60  buf = show_bits_long(gb, 32);
61 
62  if (buf >= (1 << 27)) {
63  buf >>= 32 - 9;
65 
66  return ff_ue_golomb_vlc_code[buf];
67  } else {
68  int log = 2 * av_log2(buf) - 31;
69 
70  skip_bits_long(gb, 32 - log);
71  if (log < 7)
72  return AVERROR_INVALIDDATA;
73  buf >>= log;
74  buf--;
75 
76  return buf;
77  }
78 #else
79  OPEN_READER(re, gb);
80  UPDATE_CACHE(re, gb);
81  buf = GET_CACHE(re, gb);
82 
83  if (buf >= (1 << 27)) {
84  buf >>= 32 - 9;
86  CLOSE_READER(re, gb);
87 
88  return ff_ue_golomb_vlc_code[buf];
89  } else {
90  int log = 2 * av_log2(buf) - 31;
91  LAST_SKIP_BITS(re, gb, 32 - log);
92  CLOSE_READER(re, gb);
93  if (log < 7)
94  return AVERROR_INVALIDDATA;
95  buf >>= log;
96  buf--;
97 
98  return buf;
99  }
100 #endif
101 }
102 
103 /**
104  * Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
105  */
106 static inline unsigned get_ue_golomb_long(GetBitContext *gb)
107 {
108  unsigned buf, log;
109 
110  buf = show_bits_long(gb, 32);
111  log = 31 - av_log2(buf);
112  skip_bits_long(gb, log);
113 
114  return get_bits_long(gb, log + 1) - 1;
115 }
116 
117 /**
118  * read unsigned exp golomb code, constraint to a max of 31.
119  * If the value encountered is not in 0..31, the return value
120  * is outside the range 0..30.
121  */
122 static inline int get_ue_golomb_31(GetBitContext *gb)
123 {
124  unsigned int buf;
125 
126 #if CACHED_BITSTREAM_READER
127  buf = show_bits_long(gb, 32);
128 
129  buf >>= 32 - 9;
131 #else
132 
133  OPEN_READER(re, gb);
134  UPDATE_CACHE(re, gb);
135  buf = GET_CACHE(re, gb);
136 
137  buf >>= 32 - 9;
139  CLOSE_READER(re, gb);
140 #endif
141 
142  return ff_ue_golomb_vlc_code[buf];
143 }
144 
145 static inline unsigned get_interleaved_ue_golomb(GetBitContext *gb)
146 {
147  uint32_t buf;
148 
149 #if CACHED_BITSTREAM_READER
150  buf = show_bits_long(gb, 32);
151 
152  if (buf & 0xAA800000) {
153  buf >>= 32 - 8;
155 
157  } else {
158  unsigned ret = 1;
159 
160  do {
161  buf >>= 32 - 8;
163 
164  if (ff_interleaved_golomb_vlc_len[buf] != 9) {
165  ret <<= (ff_interleaved_golomb_vlc_len[buf] - 1) >> 1;
167  break;
168  }
170  buf = show_bits_long(gb, 32);
171  } while (get_bits_left(gb) > 0);
172 
173  return ret - 1;
174  }
175 #else
176  OPEN_READER(re, gb);
177  UPDATE_CACHE(re, gb);
178  buf = GET_CACHE(re, gb);
179 
180  if (buf & 0xAA800000) {
181  buf >>= 32 - 8;
183  CLOSE_READER(re, gb);
184 
186  } else {
187  unsigned ret = 1;
188 
189  do {
190  buf >>= 32 - 8;
191  LAST_SKIP_BITS(re, gb,
193 
194  if (ff_interleaved_golomb_vlc_len[buf] != 9) {
195  ret <<= (ff_interleaved_golomb_vlc_len[buf] - 1) >> 1;
197  break;
198  }
200  UPDATE_CACHE(re, gb);
201  buf = GET_CACHE(re, gb);
202  } while (ret<0x8000000U && BITS_AVAILABLE(re, gb));
203 
204  CLOSE_READER(re, gb);
205  return ret - 1;
206  }
207 #endif
208 }
209 
210 /**
211  * read unsigned truncated exp golomb code.
212  */
213 static inline int get_te0_golomb(GetBitContext *gb, int range)
214 {
215  av_assert2(range >= 1);
216 
217  if (range == 1)
218  return 0;
219  else if (range == 2)
220  return get_bits1(gb) ^ 1;
221  else
222  return get_ue_golomb(gb);
223 }
224 
225 /**
226  * read unsigned truncated exp golomb code.
227  */
228 static inline int get_te_golomb(GetBitContext *gb, int range)
229 {
230  av_assert2(range >= 1);
231 
232  if (range == 2)
233  return get_bits1(gb) ^ 1;
234  else
235  return get_ue_golomb(gb);
236 }
237 
238 /**
239  * read signed exp golomb code.
240  */
241 static inline int get_se_golomb(GetBitContext *gb)
242 {
243  unsigned int buf;
244 
245 #if CACHED_BITSTREAM_READER
246  buf = show_bits_long(gb, 32);
247 
248  if (buf >= (1 << 27)) {
249  buf >>= 32 - 9;
251 
252  return ff_se_golomb_vlc_code[buf];
253  } else {
254  int log = 2 * av_log2(buf) - 31;
255  buf >>= log;
256 
257  skip_bits_long(gb, 32 - log);
258 
259  if (buf & 1)
260  buf = -(buf >> 1);
261  else
262  buf = (buf >> 1);
263 
264  return buf;
265  }
266 #else
267  OPEN_READER(re, gb);
268  UPDATE_CACHE(re, gb);
269  buf = GET_CACHE(re, gb);
270 
271  if (buf >= (1 << 27)) {
272  buf >>= 32 - 9;
274  CLOSE_READER(re, gb);
275 
276  return ff_se_golomb_vlc_code[buf];
277  } else {
278  int log = av_log2(buf), sign;
279  LAST_SKIP_BITS(re, gb, 31 - log);
280  UPDATE_CACHE(re, gb);
281  buf = GET_CACHE(re, gb);
282 
283  buf >>= log;
284 
285  LAST_SKIP_BITS(re, gb, 32 - log);
286  CLOSE_READER(re, gb);
287 
288  sign = -(buf & 1);
289  buf = ((buf >> 1) ^ sign) - sign;
290 
291  return buf;
292  }
293 #endif
294 }
295 
296 static inline int get_se_golomb_long(GetBitContext *gb)
297 {
298  unsigned int buf = get_ue_golomb_long(gb);
299  int sign = (buf & 1) - 1;
300  return ((buf >> 1) ^ sign) + 1;
301 }
302 
304 {
305  unsigned int buf;
306 
307 #if CACHED_BITSTREAM_READER
308  buf = show_bits_long(gb, 32);
309 
310  if (buf & 0xAA800000) {
311  buf >>= 32 - 8;
313 
315  } else {
316  int log;
317  skip_bits(gb, 8);
318  buf |= 1 | show_bits(gb, 24);
319 
320  if ((buf & 0xAAAAAAAA) == 0)
321  return INVALID_VLC;
322 
323  for (log = 31; (buf & 0x80000000) == 0; log--)
324  buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
325 
326  skip_bits_long(gb, 63 - 2 * log - 8);
327 
328  return (signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
329  }
330 #else
331  OPEN_READER(re, gb);
332  UPDATE_CACHE(re, gb);
333  buf = GET_CACHE(re, gb);
334 
335  if (buf & 0xAA800000) {
336  buf >>= 32 - 8;
338  CLOSE_READER(re, gb);
339 
341  } else {
342  int log;
343  LAST_SKIP_BITS(re, gb, 8);
344  UPDATE_CACHE(re, gb);
345  buf |= 1 | (GET_CACHE(re, gb) >> 8);
346 
347  if ((buf & 0xAAAAAAAA) == 0)
348  return INVALID_VLC;
349 
350  for (log = 31; (buf & 0x80000000) == 0; log--)
351  buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
352 
353  LAST_SKIP_BITS(re, gb, 63 - 2 * log - 8);
354  CLOSE_READER(re, gb);
355 
356  return (signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
357  }
358 #endif
359 }
360 
361 static inline int dirac_get_se_golomb(GetBitContext *gb)
362 {
363  uint32_t ret = get_interleaved_ue_golomb(gb);
364 
365  if (ret) {
366  int sign = -get_bits1(gb);
367  ret = (ret ^ sign) - sign;
368  }
369 
370  return ret;
371 }
372 
373 /**
374  * read unsigned golomb rice code (ffv1).
375  */
376 static inline int get_ur_golomb(GetBitContext *gb, int k, int limit,
377  int esc_len)
378 {
379  unsigned int buf;
380  int log;
381 
382 #if CACHED_BITSTREAM_READER
383  buf = show_bits_long(gb, 32);
384 
385  log = av_log2(buf);
386 
387  if (log > 31 - limit) {
388  buf >>= log - k;
389  buf += (30 - log) << k;
390  skip_bits_long(gb, 32 + k - log);
391 
392  return buf;
393  } else {
394  skip_bits_long(gb, limit);
395  buf = get_bits_long(gb, esc_len);
396 
397  return buf + limit - 1;
398  }
399 #else
400  OPEN_READER(re, gb);
401  UPDATE_CACHE(re, gb);
402  buf = GET_CACHE(re, gb);
403 
404  log = av_log2(buf);
405 
406  if (log > 31 - limit) {
407  buf >>= log - k;
408  buf += (30U - log) << k;
409  LAST_SKIP_BITS(re, gb, 32 + k - log);
410  CLOSE_READER(re, gb);
411 
412  return buf;
413  } else {
414  LAST_SKIP_BITS(re, gb, limit);
415  UPDATE_CACHE(re, gb);
416 
417  buf = SHOW_UBITS(re, gb, esc_len);
418 
419  LAST_SKIP_BITS(re, gb, esc_len);
420  CLOSE_READER(re, gb);
421 
422  return buf + limit - 1;
423  }
424 #endif
425 }
426 
427 /**
428  * read unsigned golomb rice code (jpegls).
429  */
430 static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
431  int esc_len)
432 {
433  unsigned int buf;
434  int log;
435 
436 #if CACHED_BITSTREAM_READER
437  buf = show_bits_long(gb, 32);
438 
439  log = av_log2(buf);
440 
441  if (log - k >= 1 && 32 - log < limit) {
442  buf >>= log - k;
443  buf += (30 - log) << k;
444  skip_bits_long(gb, 32 + k - log);
445 
446  return buf;
447  } else {
448  int i;
449  for (i = 0;
450  i < limit && get_bits1(gb) == 0 && get_bits_left(gb) > 0;
451  i++);
452 
453  if (i < limit - 1) {
454  buf = get_bits_long(gb, k);
455 
456  return buf + (i << k);
457  } else if (i == limit - 1) {
458  buf = get_bits_long(gb, esc_len);
459 
460  return buf + 1;
461  } else
462  return -1;
463  }
464 #else
465  OPEN_READER(re, gb);
466  UPDATE_CACHE(re, gb);
467  buf = GET_CACHE(re, gb);
468 
469  log = av_log2(buf);
470 
471  av_assert2(k <= 31);
472 
473  if (log - k >= 32 - MIN_CACHE_BITS + (MIN_CACHE_BITS == 32) &&
474  32 - log < limit) {
475  buf >>= log - k;
476  buf += (30U - log) << k;
477  LAST_SKIP_BITS(re, gb, 32 + k - log);
478  CLOSE_READER(re, gb);
479 
480  return buf;
481  } else {
482  int i;
483  for (i = 0; i + MIN_CACHE_BITS <= limit && SHOW_UBITS(re, gb, MIN_CACHE_BITS) == 0; i += MIN_CACHE_BITS) {
484  if (gb->size_in_bits <= re_index) {
485  CLOSE_READER(re, gb);
486  return -1;
487  }
489  UPDATE_CACHE(re, gb);
490  }
491  for (; i < limit && SHOW_UBITS(re, gb, 1) == 0; i++) {
492  SKIP_BITS(re, gb, 1);
493  }
494  LAST_SKIP_BITS(re, gb, 1);
495  UPDATE_CACHE(re, gb);
496 
497  if (i < limit - 1) {
498  if (k) {
499  if (k > MIN_CACHE_BITS - 1) {
500  buf = SHOW_UBITS(re, gb, 16) << (k-16);
501  LAST_SKIP_BITS(re, gb, 16);
502  UPDATE_CACHE(re, gb);
503  buf |= SHOW_UBITS(re, gb, k-16);
504  LAST_SKIP_BITS(re, gb, k-16);
505  } else {
506  buf = SHOW_UBITS(re, gb, k);
507  LAST_SKIP_BITS(re, gb, k);
508  }
509  } else {
510  buf = 0;
511  }
512 
513  buf += ((SUINT)i << k);
514  } else if (i == limit - 1) {
515  buf = SHOW_UBITS(re, gb, esc_len);
516  LAST_SKIP_BITS(re, gb, esc_len);
517 
518  buf ++;
519  } else {
520  buf = -1;
521  }
522  CLOSE_READER(re, gb);
523  return buf;
524  }
525 #endif
526 }
527 
528 /**
529  * read signed golomb rice code (ffv1).
530  */
531 static inline int get_sr_golomb(GetBitContext *gb, int k, int limit,
532  int esc_len)
533 {
534  unsigned v = get_ur_golomb(gb, k, limit, esc_len);
535  return (v >> 1) ^ -(v & 1);
536 }
537 
538 /**
539  * read signed golomb rice code (flac).
540  */
541 static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit,
542  int esc_len)
543 {
544  unsigned v = get_ur_golomb_jpegls(gb, k, limit, esc_len);
545  return (v >> 1) ^ -(v & 1);
546 }
547 
548 /**
549  * read unsigned golomb rice code (shorten).
550  */
551 static inline unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k)
552 {
553  return get_ur_golomb_jpegls(gb, k, INT_MAX, 0);
554 }
555 
556 /**
557  * read signed golomb rice code (shorten).
558  */
559 static inline int get_sr_golomb_shorten(GetBitContext *gb, int k)
560 {
561  int uvar = get_ur_golomb_jpegls(gb, k + 1, INT_MAX, 0);
562  return (uvar >> 1) ^ -(uvar & 1);
563 }
564 
565 #ifdef TRACE
566 
567 static inline int get_ue(GetBitContext *s, const char *file, const char *func,
568  int line)
569 {
570  int show = show_bits(s, 24);
571  int pos = get_bits_count(s);
572  int i = get_ue_golomb(s);
573  int len = get_bits_count(s) - pos;
574  int bits = show >> (24 - len);
575 
576  av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d ue @%5d in %s %s:%d\n",
577  bits, len, i, pos, file, func, line);
578 
579  return i;
580 }
581 
582 static inline int get_se(GetBitContext *s, const char *file, const char *func,
583  int line)
584 {
585  int show = show_bits(s, 24);
586  int pos = get_bits_count(s);
587  int i = get_se_golomb(s);
588  int len = get_bits_count(s) - pos;
589  int bits = show >> (24 - len);
590 
591  av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d se @%5d in %s %s:%d\n",
592  bits, len, i, pos, file, func, line);
593 
594  return i;
595 }
596 
597 static inline int get_te(GetBitContext *s, int r, char *file, const char *func,
598  int line)
599 {
600  int show = show_bits(s, 24);
601  int pos = get_bits_count(s);
602  int i = get_te0_golomb(s, r);
603  int len = get_bits_count(s) - pos;
604  int bits = show >> (24 - len);
605 
606  av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d te @%5d in %s %s:%d\n",
607  bits, len, i, pos, file, func, line);
608 
609  return i;
610 }
611 
612 #define get_ue_golomb(a) get_ue(a, __FILE__, __func__, __LINE__)
613 #define get_se_golomb(a) get_se(a, __FILE__, __func__, __LINE__)
614 #define get_te_golomb(a, r) get_te(a, r, __FILE__, __func__, __LINE__)
615 #define get_te0_golomb(a, r) get_te(a, r, __FILE__, __func__, __LINE__)
616 
617 #endif /* TRACE */
618 
619 /**
620  * write unsigned exp golomb code. 2^16 - 2 at most
621  */
622 static inline void set_ue_golomb(PutBitContext *pb, int i)
623 {
624  av_assert2(i >= 0);
625  av_assert2(i <= 0xFFFE);
626 
627  if (i < 256)
628  put_bits(pb, ff_ue_golomb_len[i], i + 1);
629  else {
630  int e = av_log2(i + 1);
631  put_bits(pb, 2 * e + 1, i + 1);
632  }
633 }
634 
635 /**
636  * write unsigned exp golomb code. 2^32-2 at most.
637  */
638 static inline void set_ue_golomb_long(PutBitContext *pb, uint32_t i)
639 {
640  av_assert2(i <= (UINT32_MAX - 1));
641 
642  if (i < 256)
643  put_bits(pb, ff_ue_golomb_len[i], i + 1);
644  else {
645  int e = av_log2(i + 1);
646  put_bits64(pb, 2 * e + 1, i + 1);
647  }
648 }
649 
650 /**
651  * write truncated unsigned exp golomb code.
652  */
653 static inline void set_te_golomb(PutBitContext *pb, int i, int range)
654 {
655  av_assert2(range >= 1);
656  av_assert2(i <= range);
657 
658  if (range == 2)
659  put_bits(pb, 1, i ^ 1);
660  else
661  set_ue_golomb(pb, i);
662 }
663 
664 /**
665  * write signed exp golomb code. 16 bits at most.
666  */
667 static inline void set_se_golomb(PutBitContext *pb, int i)
668 {
669  i = 2 * i - 1;
670  if (i < 0)
671  i ^= -1; //FIXME check if gcc does the right thing
672  set_ue_golomb(pb, i);
673 }
674 
675 /**
676  * write unsigned golomb rice code (ffv1).
677  */
678 static inline void set_ur_golomb(PutBitContext *pb, int i, int k, int limit,
679  int esc_len)
680 {
681  int e;
682 
683  av_assert2(i >= 0);
684 
685  e = i >> k;
686  if (e < limit)
687  put_bits(pb, e + k + 1, (1 << k) + av_mod_uintp2(i, k));
688  else
689  put_bits(pb, limit + esc_len, i - limit + 1);
690 }
691 
692 /**
693  * write unsigned golomb rice code (jpegls).
694  */
695 static inline void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k,
696  int limit, int esc_len)
697 {
698  int e;
699 
700  av_assert2(i >= 0);
701 
702  e = (i >> k) + 1;
703  if (e < limit) {
704  while (e > 31) {
705  put_bits(pb, 31, 0);
706  e -= 31;
707  }
708  put_bits(pb, e, 1);
709  if (k)
710  put_sbits(pb, k, i);
711  } else {
712  while (limit > 31) {
713  put_bits(pb, 31, 0);
714  limit -= 31;
715  }
716  put_bits(pb, limit, 1);
717  put_bits(pb, esc_len, i - 1);
718  }
719 }
720 
721 /**
722  * write signed golomb rice code (ffv1).
723  */
724 static inline void set_sr_golomb(PutBitContext *pb, int i, int k, int limit,
725  int esc_len)
726 {
727  int v;
728 
729  v = -2 * i - 1;
730  v ^= (v >> 31);
731 
732  set_ur_golomb(pb, v, k, limit, esc_len);
733 }
734 
735 /**
736  * write signed golomb rice code (flac).
737  */
738 static inline void set_sr_golomb_flac(PutBitContext *pb, int i, int k,
739  int limit, int esc_len)
740 {
741  int v;
742 
743  v = -2 * i - 1;
744  v ^= (v >> 31);
745 
746  set_ur_golomb_jpegls(pb, v, k, limit, esc_len);
747 }
748 
749 #endif /* AVCODEC_GOLOMB_H */
func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:67
skip_bits_long
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
Definition: get_bits.h:291
show_bits_long
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:602
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:849
r
const char * r
Definition: vf_curves.c:116
set_sr_golomb_flac
static void set_sr_golomb_flac(PutBitContext *pb, int i, int k, int limit, int esc_len)
write signed golomb rice code (flac).
Definition: golomb.h:738
get_se_golomb_long
static int get_se_golomb_long(GetBitContext *gb)
Definition: golomb.h:296
get_bits_long
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:546
put_sbits
static void put_sbits(PutBitContext *pb, int n, int32_t value)
Definition: put_bits.h:253
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:219
get_interleaved_ue_golomb
static unsigned get_interleaved_ue_golomb(GetBitContext *gb)
Definition: golomb.h:145
av_mod_uintp2
#define av_mod_uintp2
Definition: common.h:149
GetBitContext::size_in_bits
int size_in_bits
Definition: get_bits.h:68
get_sr_golomb
static int get_sr_golomb(GetBitContext *gb, int k, int limit, int esc_len)
read signed golomb rice code (ffv1).
Definition: golomb.h:531
put_bits
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:218
get_ue_golomb
static int get_ue_golomb(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to 8190.
Definition: golomb.h:55
get_ur_golomb_shorten
static unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k)
read unsigned golomb rice code (shorten).
Definition: golomb.h:551
set_ue_golomb_long
static void set_ue_golomb_long(PutBitContext *pb, uint32_t i)
write unsigned exp golomb code.
Definition: golomb.h:638
put_bits64
static void put_bits64(PutBitContext *s, int n, uint64_t value)
Write up to 64 bits into a bitstream.
Definition: put_bits.h:306
ff_interleaved_ue_golomb_vlc_code
const uint8_t ff_interleaved_ue_golomb_vlc_code[256]
Definition: golomb.c:119
get_ur_golomb
static int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len)
read unsigned golomb rice code (ffv1).
Definition: golomb.h:376
UPDATE_CACHE
#define UPDATE_CACHE(name, gb)
Definition: get_bits.h:178
set_ur_golomb
static void set_ur_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len)
write unsigned golomb rice code (ffv1).
Definition: golomb.h:678
ff_ue_golomb_len
const uint8_t ff_ue_golomb_len[256]
Definition: golomb.c:89
GET_CACHE
#define GET_CACHE(name, gb)
Definition: get_bits.h:215
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:467
U
#define U(x)
Definition: vp56_arith.h:37
GetBitContext
Definition: get_bits.h:61
get_ur_golomb_jpegls
static int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len)
read unsigned golomb rice code (jpegls).
Definition: golomb.h:430
CLOSE_READER
#define CLOSE_READER(name, gb)
Definition: get_bits.h:149
s
#define s(width, name)
Definition: cbs_vp9.c:257
bits
uint8_t bits
Definition: vp3data.h:141
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:215
get_bits.h
ff_interleaved_dirac_golomb_vlc_code
const uint8_t ff_interleaved_dirac_golomb_vlc_code[256]
Definition: golomb.c:157
SKIP_BITS
#define SKIP_BITS(name, gb, num)
Definition: get_bits.h:193
set_ur_golomb_jpegls
static void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k, int limit, int esc_len)
write unsigned golomb rice code (jpegls).
Definition: golomb.h:695
get_se_golomb
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
Definition: golomb.h:241
PutBitContext
Definition: put_bits.h:44
get_te_golomb
static int get_te_golomb(GetBitContext *gb, int range)
read unsigned truncated exp golomb code.
Definition: golomb.h:228
NULL
#define NULL
Definition: coverity.c:32
get_sr_golomb_flac
static int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len)
read signed golomb rice code (flac).
Definition: golomb.h:541
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
LAST_SKIP_BITS
#define LAST_SKIP_BITS(name, gb, num)
Definition: get_bits.h:199
ff_golomb_vlc_len
const uint8_t ff_golomb_vlc_len[512]
Definition: golomb.c:31
set_te_golomb
static void set_te_golomb(PutBitContext *pb, int i, int range)
write truncated unsigned exp golomb code.
Definition: golomb.h:653
set_sr_golomb
static void set_sr_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len)
write signed golomb rice code (ffv1).
Definition: golomb.h:724
get_interleaved_se_golomb
static int get_interleaved_se_golomb(GetBitContext *gb)
Definition: golomb.h:303
ff_ue_golomb_vlc_code
const uint8_t ff_ue_golomb_vlc_code[512]
Definition: golomb.c:50
OPEN_READER
#define OPEN_READER(name, gb)
Definition: get_bits.h:138
FFMIN
#define FFMIN(a, b)
Definition: common.h:105
dirac_get_se_golomb
static int dirac_get_se_golomb(GetBitContext *gb)
Definition: golomb.h:361
line
Definition: graph2dot.c:48
set_ue_golomb
static void set_ue_golomb(PutBitContext *pb, int i)
write unsigned exp golomb code.
Definition: golomb.h:622
av_assert2
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
i
int i
Definition: input.c:407
show_bits
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:446
MIN_CACHE_BITS
#define MIN_CACHE_BITS
Definition: get_bits.h:128
SUINT
#define SUINT
Definition: dct32_template.c:30
uint8_t
uint8_t
Definition: audio_convert.c:194
len
int len
Definition: vorbis_enc_data.h:452
get_sr_golomb_shorten
static int get_sr_golomb_shorten(GetBitContext *gb, int k)
read signed golomb rice code (shorten).
Definition: golomb.h:559
ret
ret
Definition: filter_design.txt:187
INVALID_VLC
#define INVALID_VLC
Definition: golomb.h:38
pos
unsigned int pos
Definition: spdifenc.c:412
get_ue_golomb_31
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
Definition: golomb.h:122
SHOW_UBITS
#define SHOW_UBITS(name, gb, num)
Definition: get_bits.h:211
ff_se_golomb_vlc_code
const int8_t ff_se_golomb_vlc_code[512]
Definition: golomb.c:69
get_ue_golomb_long
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
Definition: golomb.h:106
get_te0_golomb
static int get_te0_golomb(GetBitContext *gb, int range)
read unsigned truncated exp golomb code.
Definition: golomb.h:213
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
ff_interleaved_se_golomb_vlc_code
const int8_t ff_interleaved_se_golomb_vlc_code[256]
Definition: golomb.c:138
put_bits.h
av_log2
int av_log2(unsigned v)
Definition: intmath.c:26
ff_interleaved_golomb_vlc_len
const uint8_t ff_interleaved_golomb_vlc_len[256]
Definition: golomb.c:100
BITS_AVAILABLE
#define BITS_AVAILABLE(name, gb)
Definition: get_bits.h:140
re
float re
Definition: fft.c:82
set_se_golomb
static void set_se_golomb(PutBitContext *pb, int i)
write signed exp golomb code.
Definition: golomb.h:667