FFmpeg
Macros | Functions | Variables
bgmc.c File Reference
#include "libavutil/attributes.h"
#include "libavutil/mem.h"
#include "bgmc.h"

Go to the source code of this file.

Macros

#define FREQ_BITS   14
 
#define VALUE_BITS   18
 
#define TOP_VALUE   ((1 << VALUE_BITS) - 1)
 
#define FIRST_QTR   (TOP_VALUE / 4 + 1)
 
#define HALF   (2 * FIRST_QTR)
 
#define THIRD_QTR   (3 * FIRST_QTR)
 
#define LUT_BITS   (FREQ_BITS - 8)
 
#define LUT_SIZE   (1 << LUT_BITS)
 
#define LUT_BUFF   4
 

Functions

static void bgmc_lut_fillp (uint8_t *lut, int *lut_status, int delta)
 Initialize a given lookup table using a given delta. More...
 
static uint8_t * bgmc_lut_getp (uint8_t *lut, int *lut_status, int delta)
 Retune the index of a suitable lookup table for a given delta. More...
 
av_cold int ff_bgmc_init (void *logctx, uint8_t **cf_lut, int **cf_lut_status)
 Initialize the lookup table arrays. More...
 
av_cold void ff_bgmc_end (uint8_t **cf_lut, int **cf_lut_status)
 Release the lookup table arrays. More...
 
int ff_bgmc_decode_init (GetBitContext *gb, unsigned int *h, unsigned int *l, unsigned int *v)
 Initialize decoding and reads the first value. More...
 
void ff_bgmc_decode_end (GetBitContext *gb)
 Finish decoding. More...
 
void ff_bgmc_decode (GetBitContext *gb, unsigned int num, int32_t *dst, int delta, unsigned int sx, unsigned int *h, unsigned int *l, unsigned int *v, uint8_t *cf_lut, int *cf_lut_status)
 Read and decode a block Gilbert-Moore coded symbol. More...
 

Variables

static const uint16_t cf_tables_1 [3][129]
 Cumulative frequency tables for block Gilbert-Moore coding. More...
 
static const uint16_t cf_tables_2 [8][193]
 
static const uint16_t cf_tables_3 [5][257]
 
static const uint16_t *const cf_table [16]
 

Detailed Description

Block Gilbert-Moore decoder as used by MPEG-4 ALS

Author
Thilo Borgmann <thilo.borgmann at mail.de>

Definition in file bgmc.c.

Macro Definition Documentation

◆ FREQ_BITS

#define FREQ_BITS   14

Definition at line 32 of file bgmc.c.

◆ VALUE_BITS

#define VALUE_BITS   18

Definition at line 33 of file bgmc.c.

◆ TOP_VALUE

#define TOP_VALUE   ((1 << VALUE_BITS) - 1)

Definition at line 34 of file bgmc.c.

◆ FIRST_QTR

#define FIRST_QTR   (TOP_VALUE / 4 + 1)

Definition at line 35 of file bgmc.c.

◆ HALF

#define HALF   (2 * FIRST_QTR)

Definition at line 36 of file bgmc.c.

◆ THIRD_QTR

#define THIRD_QTR   (3 * FIRST_QTR)

Definition at line 37 of file bgmc.c.

◆ LUT_BITS

#define LUT_BITS   (FREQ_BITS - 8)

Definition at line 39 of file bgmc.c.

◆ LUT_SIZE

#define LUT_SIZE   (1 << LUT_BITS)

Definition at line 40 of file bgmc.c.

◆ LUT_BUFF

#define LUT_BUFF   4

Definition at line 41 of file bgmc.c.

Function Documentation

◆ bgmc_lut_fillp()

static void bgmc_lut_fillp ( uint8_t *  lut,
int *  lut_status,
int  delta 
)
static

Initialize a given lookup table using a given delta.

Definition at line 427 of file bgmc.c.

Referenced by bgmc_lut_getp().

◆ bgmc_lut_getp()

static uint8_t* bgmc_lut_getp ( uint8_t *  lut,
int *  lut_status,
int  delta 
)
static

Retune the index of a suitable lookup table for a given delta.

Definition at line 447 of file bgmc.c.

Referenced by ff_bgmc_decode().

◆ ff_bgmc_init()

av_cold int ff_bgmc_init ( void *  logctx,
uint8_t **  cf_lut,
int **  cf_lut_status 
)

Initialize the lookup table arrays.

Definition at line 461 of file bgmc.c.

Referenced by decode_init().

◆ ff_bgmc_end()

av_cold void ff_bgmc_end ( uint8_t **  cf_lut,
int **  cf_lut_status 
)

Release the lookup table arrays.

Definition at line 481 of file bgmc.c.

Referenced by decode_end(), and ff_bgmc_init().

◆ ff_bgmc_decode_init()

int ff_bgmc_decode_init ( GetBitContext gb,
unsigned int *  h,
unsigned int *  l,
unsigned int *  v 
)

Initialize decoding and reads the first value.

Definition at line 489 of file bgmc.c.

Referenced by read_var_block_data().

◆ ff_bgmc_decode_end()

void ff_bgmc_decode_end ( GetBitContext gb)

Finish decoding.

Definition at line 504 of file bgmc.c.

Referenced by read_var_block_data().

◆ ff_bgmc_decode()

void ff_bgmc_decode ( GetBitContext gb,
unsigned int  num,
int32_t dst,
int  delta,
unsigned int  sx,
unsigned int *  h,
unsigned int *  l,
unsigned int *  v,
uint8_t *  cf_lut,
int *  cf_lut_status 
)

Read and decode a block Gilbert-Moore coded symbol.

Definition at line 511 of file bgmc.c.

Referenced by read_var_block_data().

Variable Documentation

◆ cf_tables_1

const uint16_t cf_tables_1[3][129]
static

Cumulative frequency tables for block Gilbert-Moore coding.

Definition at line 45 of file bgmc.c.

◆ cf_tables_2

const uint16_t cf_tables_2[8][193]
static

Definition at line 94 of file bgmc.c.

◆ cf_tables_3

const uint16_t cf_tables_3[5][257]
static

Definition at line 274 of file bgmc.c.

◆ cf_table

const uint16_t* const cf_table[16]
static
Initial value:

Definition at line 418 of file bgmc.c.

Referenced by bgmc_lut_fillp(), and ff_bgmc_decode().

cf_tables_2
static const uint16_t cf_tables_2[8][193]
Definition: bgmc.c:94
cf_tables_1
static const uint16_t cf_tables_1[3][129]
Cumulative frequency tables for block Gilbert-Moore coding.
Definition: bgmc.c:45
cf_tables_3
static const uint16_t cf_tables_3[5][257]
Definition: bgmc.c:274