30 #ifndef AVCODEC_GOLOMB_H
31 #define AVCODEC_GOLOMB_H
37 #define INVALID_VLC 0x80000000
68 log= 2*av_log2(buf) - 31;
86 log = 31 - av_log2(buf);
151 if(range==1)
return 0;
152 else if(range==2)
return get_bits1(gb)^1;
185 log= 2*av_log2(buf) - 31;
191 if(buf&1) buf= -(buf>>1);
217 if((buf & 0xAAAAAAAA) == 0)
220 for(log=31; (buf & 0x80000000) == 0; log--){
221 buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
227 return (
signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
242 ret = (ret ^ buf) - buf;
278 return buf + limit - 1;
320 }
else if(i == limit - 1){
338 if (v&1)
return v>>1;
349 return (v>>1) ^ -(v&1);
375 static inline int get_ue(
GetBitContext *s,
char *file,
const char *func,
int line){
382 print_bin(bits, len);
389 static inline int get_se(
GetBitContext *s,
char *file,
const char *func,
int line){
396 print_bin(bits, len);
403 static inline int get_te(
GetBitContext *s,
int r,
char *file,
const char *func,
int line){
410 print_bin(bits, len);
417 #define get_ue_golomb(a) get_ue(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
418 #define get_se_golomb(a) get_se(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
419 #define get_te_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
420 #define get_te0_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
487 put_bits(pb, e + k + 1, (1<<k) + (i&((1<<k)-1)));
489 put_bits(pb, limit + esc_len, i - limit + 1);
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
static int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len)
read signed golomb rice code (flac).
static void set_ur_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len)
write unsigned golomb rice code (ffv1).
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
const uint8_t ff_ue_golomb_vlc_code[512]
static void put_sbits(PutBitContext *pb, int n, int32_t value)
static void skip_bits_long(GetBitContext *s, int n)
static void set_ue_golomb(PutBitContext *pb, int i)
write unsigned exp golomb code.
const int8_t ff_interleaved_se_golomb_vlc_code[256]
const uint8_t ff_interleaved_golomb_vlc_len[256]
static int get_te0_golomb(GetBitContext *gb, int range)
read unsigned truncated exp golomb code.
static int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len)
read unsigned golomb rice code (jpegls).
const uint8_t ff_interleaved_dirac_golomb_vlc_code[256]
static void set_te_golomb(PutBitContext *pb, int i, int range)
write truncated unsigned exp golomb code.
static int dirac_get_se_golomb(GetBitContext *gb)
static int get_bits_count(const GetBitContext *s)
bitstream reader API header.
const uint8_t ff_golomb_vlc_len[512]
static int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len)
read unsigned golomb rice code (ffv1).
#define UPDATE_CACHE(name, gb)
static int get_ue_golomb(GetBitContext *gb)
read unsigned exp golomb code.
void av_log(void *avcl, int level, const char *fmt,...)
const int8_t ff_se_golomb_vlc_code[512]
static void put_bits(PutBitContext *s, int n, unsigned int value)
Write up to 31 bits into a bitstream.
#define CLOSE_READER(name, gb)
#define SKIP_BITS(name, gb, num)
static int svq3_get_se_golomb(GetBitContext *gb)
#define HAVE_BITS_REMAINING(name, gb)
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
#define LAST_SKIP_BITS(name, gb, num)
static void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k, int limit, int esc_len)
write unsigned golomb rice code (jpegls).
#define SHOW_UBITS(name, gb, num)
static void set_sr_golomb_flac(PutBitContext *pb, int i, int k, int limit, int esc_len)
write signed golomb rice code (flac).
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
static void set_se_golomb(PutBitContext *pb, int i)
write signed exp golomb code.
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
static int svq3_get_ue_golomb(GetBitContext *gb)
#define OPEN_READER(name, gb)
static unsigned int get_bits1(GetBitContext *s)
const uint8_t ff_interleaved_ue_golomb_vlc_code[256]
static void set_sr_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len)
write signed golomb rice code (ffv1).
#define GET_CACHE(name, gb)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
#define SHOW_SBITS(name, gb, num)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int get_te_golomb(GetBitContext *gb, int range)
read unsigned truncated exp golomb code.
const uint8_t ff_ue_golomb_len[256]
static unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k)
read unsigned golomb rice code (shorten).
static int get_sr_golomb(GetBitContext *gb, int k, int limit, int esc_len)
read signed golomb rice code (ffv1).
static int get_sr_golomb_shorten(GetBitContext *gb, int k)
read signed golomb rice code (shorten).