FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 static inline int get_ue_golomb(GetBitContext *gb)
54 {
55  unsigned int buf;
56 
57  OPEN_READER(re, gb);
58  UPDATE_CACHE(re, gb);
59  buf = GET_CACHE(re, gb);
60 
61  if (buf >= (1 << 27)) {
62  buf >>= 32 - 9;
64  CLOSE_READER(re, gb);
65 
66  return ff_ue_golomb_vlc_code[buf];
67  } else {
68  int log = 2 * av_log2(buf) - 31;
69  LAST_SKIP_BITS(re, gb, 32 - log);
70  CLOSE_READER(re, gb);
71  if (log < 7) {
72  av_log(NULL, AV_LOG_ERROR, "Invalid UE golomb code\n");
73  return AVERROR_INVALIDDATA;
74  }
75  buf >>= log;
76  buf--;
77 
78  return buf;
79  }
80 }
81 
82 /**
83  * Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
84  */
85 static inline unsigned get_ue_golomb_long(GetBitContext *gb)
86 {
87  unsigned buf, log;
88 
89  buf = show_bits_long(gb, 32);
90  log = 31 - av_log2(buf);
91  skip_bits_long(gb, log);
92 
93  return get_bits_long(gb, log + 1) - 1;
94 }
95 
96 /**
97  * read unsigned exp golomb code, constraint to a max of 31.
98  * the return value is undefined if the stored value exceeds 31.
99  */
100 static inline int get_ue_golomb_31(GetBitContext *gb)
101 {
102  unsigned int buf;
103 
104  OPEN_READER(re, gb);
105  UPDATE_CACHE(re, gb);
106  buf = GET_CACHE(re, gb);
107 
108  buf >>= 32 - 9;
110  CLOSE_READER(re, gb);
111 
112  return ff_ue_golomb_vlc_code[buf];
113 }
114 
115 static inline unsigned get_interleaved_ue_golomb(GetBitContext *gb)
116 {
117  uint32_t buf;
118 
119  OPEN_READER(re, gb);
120  UPDATE_CACHE(re, gb);
121  buf = GET_CACHE(re, gb);
122 
123  if (buf & 0xAA800000) {
124  buf >>= 32 - 8;
126  CLOSE_READER(re, gb);
127 
129  } else {
130  unsigned ret = 1;
131 
132  do {
133  buf >>= 32 - 8;
134  LAST_SKIP_BITS(re, gb,
136 
137  if (ff_interleaved_golomb_vlc_len[buf] != 9) {
138  ret <<= (ff_interleaved_golomb_vlc_len[buf] - 1) >> 1;
140  break;
141  }
142  ret = (ret << 4) | ff_interleaved_dirac_golomb_vlc_code[buf];
143  UPDATE_CACHE(re, gb);
144  buf = GET_CACHE(re, gb);
145  } while (ret<0x8000000U && BITS_AVAILABLE(re, gb));
146 
147  CLOSE_READER(re, gb);
148  return ret - 1;
149  }
150 }
151 
152 /**
153  * read unsigned truncated exp golomb code.
154  */
155 static inline int get_te0_golomb(GetBitContext *gb, int range)
156 {
157  av_assert2(range >= 1);
158 
159  if (range == 1)
160  return 0;
161  else if (range == 2)
162  return get_bits1(gb) ^ 1;
163  else
164  return get_ue_golomb(gb);
165 }
166 
167 /**
168  * read unsigned truncated exp golomb code.
169  */
170 static inline int get_te_golomb(GetBitContext *gb, int range)
171 {
172  av_assert2(range >= 1);
173 
174  if (range == 2)
175  return get_bits1(gb) ^ 1;
176  else
177  return get_ue_golomb(gb);
178 }
179 
180 /**
181  * read signed exp golomb code.
182  */
183 static inline int get_se_golomb(GetBitContext *gb)
184 {
185  unsigned int buf;
186 
187  OPEN_READER(re, gb);
188  UPDATE_CACHE(re, gb);
189  buf = GET_CACHE(re, gb);
190 
191  if (buf >= (1 << 27)) {
192  buf >>= 32 - 9;
194  CLOSE_READER(re, gb);
195 
196  return ff_se_golomb_vlc_code[buf];
197  } else {
198  int log = av_log2(buf), sign;
199  LAST_SKIP_BITS(re, gb, 31 - log);
200  UPDATE_CACHE(re, gb);
201  buf = GET_CACHE(re, gb);
202 
203  buf >>= log;
204 
205  LAST_SKIP_BITS(re, gb, 32 - log);
206  CLOSE_READER(re, gb);
207 
208  sign = -(buf & 1);
209  buf = ((buf >> 1) ^ sign) - sign;
210 
211  return buf;
212  }
213 }
214 
215 static inline int get_se_golomb_long(GetBitContext *gb)
216 {
217  unsigned int buf = get_ue_golomb_long(gb);
218  int sign = (buf & 1) - 1;
219  return ((buf >> 1) ^ sign) + 1;
220 }
221 
223 {
224  unsigned int buf;
225 
226  OPEN_READER(re, gb);
227  UPDATE_CACHE(re, gb);
228  buf = GET_CACHE(re, gb);
229 
230  if (buf & 0xAA800000) {
231  buf >>= 32 - 8;
233  CLOSE_READER(re, gb);
234 
236  } else {
237  int log;
238  LAST_SKIP_BITS(re, gb, 8);
239  UPDATE_CACHE(re, gb);
240  buf |= 1 | (GET_CACHE(re, gb) >> 8);
241 
242  if ((buf & 0xAAAAAAAA) == 0)
243  return INVALID_VLC;
244 
245  for (log = 31; (buf & 0x80000000) == 0; log--)
246  buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
247 
248  LAST_SKIP_BITS(re, gb, 63 - 2 * log - 8);
249  CLOSE_READER(re, gb);
250 
251  return (signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
252  }
253 }
254 
255 static inline int dirac_get_se_golomb(GetBitContext *gb)
256 {
257  uint32_t ret = get_interleaved_ue_golomb(gb);
258 
259  if (ret) {
260  int sign = -get_bits1(gb);
261  ret = (ret ^ sign) - sign;
262  }
263 
264  return ret;
265 }
266 
267 /**
268  * read unsigned golomb rice code (ffv1).
269  */
270 static inline int get_ur_golomb(GetBitContext *gb, int k, int limit,
271  int esc_len)
272 {
273  unsigned int buf;
274  int log;
275 
276  OPEN_READER(re, gb);
277  UPDATE_CACHE(re, gb);
278  buf = GET_CACHE(re, gb);
279 
280  log = av_log2(buf);
281 
282  if (log > 31 - limit) {
283  buf >>= log - k;
284  buf += (30U - log) << k;
285  LAST_SKIP_BITS(re, gb, 32 + k - log);
286  CLOSE_READER(re, gb);
287 
288  return buf;
289  } else {
290  LAST_SKIP_BITS(re, gb, limit);
291  UPDATE_CACHE(re, gb);
292 
293  buf = SHOW_UBITS(re, gb, esc_len);
294 
295  LAST_SKIP_BITS(re, gb, esc_len);
296  CLOSE_READER(re, gb);
297 
298  return buf + limit - 1;
299  }
300 }
301 
302 /**
303  * read unsigned golomb rice code (jpegls).
304  */
305 static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
306  int esc_len)
307 {
308  unsigned int buf;
309  int log;
310 
311  OPEN_READER(re, gb);
312  UPDATE_CACHE(re, gb);
313  buf = GET_CACHE(re, gb);
314 
315  log = av_log2(buf);
316 
317  av_assert2(k <= 31);
318 
319  if (log - k >= 32 - MIN_CACHE_BITS + (MIN_CACHE_BITS == 32) &&
320  32 - log < limit) {
321  buf >>= log - k;
322  buf += (30U - log) << k;
323  LAST_SKIP_BITS(re, gb, 32 + k - log);
324  CLOSE_READER(re, gb);
325 
326  return buf;
327  } else {
328  int i;
329  for (i = 0; i < limit && SHOW_UBITS(re, gb, 1) == 0; i++) {
330  if (gb->size_in_bits <= re_index) {
331  CLOSE_READER(re, gb);
332  return -1;
333  }
334  LAST_SKIP_BITS(re, gb, 1);
335  UPDATE_CACHE(re, gb);
336  }
337  SKIP_BITS(re, gb, 1);
338 
339  if (i < limit - 1) {
340  if (k) {
341  if (k > MIN_CACHE_BITS - 1) {
342  buf = SHOW_UBITS(re, gb, 16) << (k-16);
343  LAST_SKIP_BITS(re, gb, 16);
344  UPDATE_CACHE(re, gb);
345  buf |= SHOW_UBITS(re, gb, k-16);
346  LAST_SKIP_BITS(re, gb, k-16);
347  } else {
348  buf = SHOW_UBITS(re, gb, k);
349  LAST_SKIP_BITS(re, gb, k);
350  }
351  } else {
352  buf = 0;
353  }
354 
355  buf += ((SUINT)i << k);
356  } else if (i == limit - 1) {
357  buf = SHOW_UBITS(re, gb, esc_len);
358  LAST_SKIP_BITS(re, gb, esc_len);
359 
360  buf ++;
361  } else {
362  buf = -1;
363  }
364  CLOSE_READER(re, gb);
365  return buf;
366  }
367 }
368 
369 /**
370  * read signed golomb rice code (ffv1).
371  */
372 static inline int get_sr_golomb(GetBitContext *gb, int k, int limit,
373  int esc_len)
374 {
375  unsigned v = get_ur_golomb(gb, k, limit, esc_len);
376  return (v >> 1) ^ -(v & 1);
377 }
378 
379 /**
380  * read signed golomb rice code (flac).
381  */
382 static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit,
383  int esc_len)
384 {
385  unsigned v = get_ur_golomb_jpegls(gb, k, limit, esc_len);
386  return (v >> 1) ^ -(v & 1);
387 }
388 
389 /**
390  * read unsigned golomb rice code (shorten).
391  */
392 static inline unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k)
393 {
394  return get_ur_golomb_jpegls(gb, k, INT_MAX, 0);
395 }
396 
397 /**
398  * read signed golomb rice code (shorten).
399  */
400 static inline int get_sr_golomb_shorten(GetBitContext *gb, int k)
401 {
402  int uvar = get_ur_golomb_jpegls(gb, k + 1, INT_MAX, 0);
403  return (uvar >> 1) ^ -(uvar & 1);
404 }
405 
406 #ifdef TRACE
407 
408 static inline int get_ue(GetBitContext *s, const char *file, const char *func,
409  int line)
410 {
411  int show = show_bits(s, 24);
412  int pos = get_bits_count(s);
413  int i = get_ue_golomb(s);
414  int len = get_bits_count(s) - pos;
415  int bits = show >> (24 - len);
416 
417  av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d ue @%5d in %s %s:%d\n",
418  bits, len, i, pos, file, func, line);
419 
420  return i;
421 }
422 
423 static inline int get_se(GetBitContext *s, const char *file, const char *func,
424  int line)
425 {
426  int show = show_bits(s, 24);
427  int pos = get_bits_count(s);
428  int i = get_se_golomb(s);
429  int len = get_bits_count(s) - pos;
430  int bits = show >> (24 - len);
431 
432  av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d se @%5d in %s %s:%d\n",
433  bits, len, i, pos, file, func, line);
434 
435  return i;
436 }
437 
438 static inline int get_te(GetBitContext *s, int r, char *file, const char *func,
439  int line)
440 {
441  int show = show_bits(s, 24);
442  int pos = get_bits_count(s);
443  int i = get_te0_golomb(s, r);
444  int len = get_bits_count(s) - pos;
445  int bits = show >> (24 - len);
446 
447  av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d te @%5d in %s %s:%d\n",
448  bits, len, i, pos, file, func, line);
449 
450  return i;
451 }
452 
453 #define get_ue_golomb(a) get_ue(a, __FILE__, __func__, __LINE__)
454 #define get_se_golomb(a) get_se(a, __FILE__, __func__, __LINE__)
455 #define get_te_golomb(a, r) get_te(a, r, __FILE__, __func__, __LINE__)
456 #define get_te0_golomb(a, r) get_te(a, r, __FILE__, __func__, __LINE__)
457 
458 #endif /* TRACE */
459 
460 /**
461  * write unsigned exp golomb code. 2^16 - 2 at most
462  */
463 static inline void set_ue_golomb(PutBitContext *pb, int i)
464 {
465  av_assert2(i >= 0);
466  av_assert2(i <= 0xFFFE);
467 
468  if (i < 256)
469  put_bits(pb, ff_ue_golomb_len[i], i + 1);
470  else {
471  int e = av_log2(i + 1);
472  put_bits(pb, 2 * e + 1, i + 1);
473  }
474 }
475 
476 /**
477  * write unsigned exp golomb code. 2^32-2 at most.
478  */
479 static inline void set_ue_golomb_long(PutBitContext *pb, uint32_t i)
480 {
481  av_assert2(i <= (UINT32_MAX - 1));
482 
483  if (i < 256)
484  put_bits(pb, ff_ue_golomb_len[i], i + 1);
485  else {
486  int e = av_log2(i + 1);
487  put_bits64(pb, 2 * e + 1, i + 1);
488  }
489 }
490 
491 /**
492  * write truncated unsigned exp golomb code.
493  */
494 static inline void set_te_golomb(PutBitContext *pb, int i, int range)
495 {
496  av_assert2(range >= 1);
497  av_assert2(i <= range);
498 
499  if (range == 2)
500  put_bits(pb, 1, i ^ 1);
501  else
502  set_ue_golomb(pb, i);
503 }
504 
505 /**
506  * write signed exp golomb code. 16 bits at most.
507  */
508 static inline void set_se_golomb(PutBitContext *pb, int i)
509 {
510  i = 2 * i - 1;
511  if (i < 0)
512  i ^= -1; //FIXME check if gcc does the right thing
513  set_ue_golomb(pb, i);
514 }
515 
516 /**
517  * write unsigned golomb rice code (ffv1).
518  */
519 static inline void set_ur_golomb(PutBitContext *pb, int i, int k, int limit,
520  int esc_len)
521 {
522  int e;
523 
524  av_assert2(i >= 0);
525 
526  e = i >> k;
527  if (e < limit)
528  put_bits(pb, e + k + 1, (1 << k) + av_mod_uintp2(i, k));
529  else
530  put_bits(pb, limit + esc_len, i - limit + 1);
531 }
532 
533 /**
534  * write unsigned golomb rice code (jpegls).
535  */
536 static inline void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k,
537  int limit, int esc_len)
538 {
539  int e;
540 
541  av_assert2(i >= 0);
542 
543  e = (i >> k) + 1;
544  if (e < limit) {
545  while (e > 31) {
546  put_bits(pb, 31, 0);
547  e -= 31;
548  }
549  put_bits(pb, e, 1);
550  if (k)
551  put_sbits(pb, k, i);
552  } else {
553  while (limit > 31) {
554  put_bits(pb, 31, 0);
555  limit -= 31;
556  }
557  put_bits(pb, limit, 1);
558  put_bits(pb, esc_len, i - 1);
559  }
560 }
561 
562 /**
563  * write signed golomb rice code (ffv1).
564  */
565 static inline void set_sr_golomb(PutBitContext *pb, int i, int k, int limit,
566  int esc_len)
567 {
568  int v;
569 
570  v = -2 * i - 1;
571  v ^= (v >> 31);
572 
573  set_ur_golomb(pb, v, k, limit, esc_len);
574 }
575 
576 /**
577  * write signed golomb rice code (flac).
578  */
579 static inline void set_sr_golomb_flac(PutBitContext *pb, int i, int k,
580  int limit, int esc_len)
581 {
582  int v;
583 
584  v = -2 * i - 1;
585  v ^= (v >> 31);
586 
587  set_ur_golomb_jpegls(pb, v, k, limit, esc_len);
588 }
589 
590 #endif /* AVCODEC_GOLOMB_H */
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:405
static int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len)
read signed golomb rice code (flac).
Definition: golomb.h:382
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:519
#define NULL
Definition: coverity.c:32
#define BITS_AVAILABLE(name, gb)
Definition: get_bits.h:123
const char * s
Definition: avisynth_c.h:768
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
Definition: golomb.h:183
const uint8_t ff_ue_golomb_vlc_code[512]
Definition: golomb.c:50
float re
Definition: fft.c:82
static void put_sbits(PutBitContext *pb, int n, int32_t value)
Definition: put_bits.h:240
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:207
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
Definition: get_bits.h:212
static void set_ue_golomb(PutBitContext *pb, int i)
write unsigned exp golomb code.
Definition: golomb.h:463
const int8_t ff_interleaved_se_golomb_vlc_code[256]
Definition: golomb.c:138
const uint8_t ff_interleaved_golomb_vlc_len[256]
Definition: golomb.c:100
int av_log2(unsigned v)
Definition: intmath.c:26
#define INVALID_VLC
Definition: golomb.h:38
static int get_te0_golomb(GetBitContext *gb, int range)
read unsigned truncated exp golomb code.
Definition: golomb.h:155
static int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len)
read unsigned golomb rice code (jpegls).
Definition: golomb.h:305
#define SUINT
const uint8_t ff_interleaved_dirac_golomb_vlc_code[256]
Definition: golomb.c:157
uint8_t
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
static void set_te_golomb(PutBitContext *pb, int i, int range)
write truncated unsigned exp golomb code.
Definition: golomb.h:494
static int dirac_get_se_golomb(GetBitContext *gb)
Definition: golomb.h:255
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:200
bitstream reader API header.
const uint8_t ff_golomb_vlc_len[512]
Definition: golomb.c:31
static int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len)
read unsigned golomb rice code (ffv1).
Definition: golomb.h:270
#define av_log(a,...)
#define U(x)
Definition: vp56_arith.h:37
static void put_bits64(PutBitContext *s, int n, uint64_t value)
Write up to 64 bits into a bitstream.
Definition: put_bits.h:288
#define UPDATE_CACHE(name, gb)
Definition: get_bits.h:161
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
static int get_ue_golomb(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to 8190.
Definition: golomb.h:53
const char * r
Definition: vf_curves.c:111
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
Definition: graph2dot.c:48
static int get_interleaved_se_golomb(GetBitContext *gb)
Definition: golomb.h:222
const int8_t ff_se_golomb_vlc_code[512]
Definition: golomb.c:69
#define CLOSE_READER(name, gb)
Definition: get_bits.h:132
#define SKIP_BITS(name, gb, num)
Definition: get_bits.h:176
#define FFMIN(a, b)
Definition: common.h:96
int size_in_bits
Definition: get_bits.h:59
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:304
#define LAST_SKIP_BITS(name, gb, num)
Definition: get_bits.h:182
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:536
#define SHOW_UBITS(name, gb, num)
Definition: get_bits.h:194
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:579
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:85
static int get_se_golomb_long(GetBitContext *gb)
Definition: golomb.h:215
static void set_se_golomb(PutBitContext *pb, int i)
write signed exp golomb code.
Definition: golomb.h:508
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
Definition: golomb.h:100
static void set_ue_golomb_long(PutBitContext *pb, uint32_t i)
write unsigned exp golomb code.
Definition: golomb.h:479
#define OPEN_READER(name, gb)
Definition: get_bits.h:121
void * buf
Definition: avisynth_c.h:690
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:321
const uint8_t ff_interleaved_ue_golomb_vlc_code[256]
Definition: golomb.c:119
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:565
#define GET_CACHE(name, gb)
Definition: get_bits.h:198
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:67
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:354
#define MIN_CACHE_BITS
Definition: get_bits.h:113
static int get_te_golomb(GetBitContext *gb, int range)
read unsigned truncated exp golomb code.
Definition: golomb.h:170
const uint8_t ff_ue_golomb_len[256]
Definition: golomb.c:89
int len
static unsigned get_interleaved_ue_golomb(GetBitContext *gb)
Definition: golomb.h:115
static unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k)
read unsigned golomb rice code (shorten).
Definition: golomb.h:392
static int get_sr_golomb(GetBitContext *gb, int k, int limit, int esc_len)
read signed golomb rice code (ffv1).
Definition: golomb.h:372
static int get_sr_golomb_shorten(GetBitContext *gb, int k)
read signed golomb rice code (shorten).
Definition: golomb.h:400
bitstream writer API