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