FFmpeg
Data Structures | Macros | Functions
rangecoder.h File Reference
#include <stdint.h>
#include "libavutil/common.h"
#include "libavutil/avassert.h"

Go to the source code of this file.

Data Structures

struct  RangeCoder
 

Macros

#define MAX_OVERREAD   2
 

Functions

void ff_init_range_encoder (RangeCoder *c, uint8_t *buf, int buf_size)
 
void ff_init_range_decoder (RangeCoder *c, const uint8_t *buf, int buf_size)
 
int ff_rac_terminate (RangeCoder *c, int version)
 Terminates the range coder. More...
 
int ff_rac_check_termination (RangeCoder *c, int version)
 Check if at the current position there is a valid looking termination. More...
 
void ff_build_rac_states (RangeCoder *c, int factor, int max_p)
 
static void renorm_encoder (RangeCoder *c)
 
static int get_rac_count (RangeCoder *c)
 
static void put_rac (RangeCoder *c, uint8_t *const state, int bit)
 
static void refill (RangeCoder *c)
 
static int get_rac (RangeCoder *c, uint8_t *const state)
 

Detailed Description

Range coder.

Definition in file rangecoder.h.

Macro Definition Documentation

◆ MAX_OVERREAD

#define MAX_OVERREAD   2

Definition at line 46 of file rangecoder.h.

Function Documentation

◆ ff_init_range_encoder()

void ff_init_range_encoder ( RangeCoder c,
uint8_t buf,
int  buf_size 
)

Definition at line 42 of file rangecoder.c.

Referenced by encode_frame(), ff_init_range_decoder(), main(), and write_extradata().

◆ ff_init_range_decoder()

void ff_init_range_decoder ( RangeCoder c,
const uint8_t buf,
int  buf_size 
)

Definition at line 53 of file rangecoder.c.

Referenced by decode_frame(), main(), and read_extra_header().

◆ ff_rac_terminate()

int ff_rac_terminate ( RangeCoder c,
int  version 
)

Terminates the range coder.

Parameters
versionversion 0 requires the decoder to know the data size in bytes version 1 needs about 1 bit more space but does not need to carry the size from encoder to decoder

Definition at line 109 of file rangecoder.c.

Referenced by encode_frame(), encode_slice(), main(), and write_extradata().

◆ ff_rac_check_termination()

int ff_rac_check_termination ( RangeCoder c,
int  version 
)

Check if at the current position there is a valid looking termination.

Parameters
versionversion 0 requires the decoder to know the data size in bytes version 1 needs about 1 bit more space but does not need to carry the size from encoder to decoder
Returns
negative AVERROR code on error or non negative.

Definition at line 125 of file rangecoder.c.

Referenced by main().

◆ ff_build_rac_states()

void ff_build_rac_states ( RangeCoder c,
int  factor,
int  max_p 
)

◆ renorm_encoder()

static void renorm_encoder ( RangeCoder c)
inlinestatic

Definition at line 71 of file rangecoder.h.

Referenced by ff_rac_terminate(), and put_rac().

◆ get_rac_count()

static int get_rac_count ( RangeCoder c)
inlinestatic

Definition at line 96 of file rangecoder.h.

Referenced by encode_q_branch().

◆ put_rac()

static void put_rac ( RangeCoder c,
uint8_t *const  state,
int  bit 
)
inlinestatic

Definition at line 104 of file rangecoder.h.

◆ refill()

static void refill ( RangeCoder c)
inlinestatic

Definition at line 123 of file rangecoder.h.

Referenced by get_rac().

◆ get_rac()

static int get_rac ( RangeCoder c,
uint8_t *const  state 
)
inlinestatic