FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
ilbcdec.c File Reference
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "ilbcdata.h"

Go to the source code of this file.

Data Structures

struct  ILBCFrame
 
struct  ILBCContext
 

Macros

#define LPC_N_20MS   1
 
#define LPC_N_30MS   2
 
#define LPC_N_MAX   2
 
#define LSF_NSPLIT   3
 
#define NASUB_MAX   4
 
#define LPC_FILTERORDER   10
 
#define NSUB_MAX   6
 
#define SUBL   40
 
#define ST_MEM_L_TBL   85
 
#define MEM_LF_TBL   147
 
#define STATE_SHORT_LEN_20MS   57
 
#define STATE_SHORT_LEN_30MS   58
 
#define BLOCKL_MAX   240
 
#define CB_MEML   147
 
#define CB_NSTAGES   3
 
#define CB_HALFFILTERLEN   4
 
#define CB_FILTERLEN   8
 
#define ENH_NBLOCKS_TOT   8
 
#define ENH_BLOCKL   80
 
#define ENH_BUFL   (ENH_NBLOCKS_TOT)*ENH_BLOCKL
 
#define ENH_BUFL_FILTEROVERHEAD   3
 
#define BLOCKL_MAX   240
 
#define NSUB_20MS   4
 
#define NSUB_30MS   6
 
#define NSUB_MAX   6
 
#define NASUB_20MS   2
 
#define NASUB_30MS   4
 
#define NASUB_MAX   4
 
#define STATE_LEN   80
 
#define STATE_SHORT_LEN_30MS   58
 
#define STATE_SHORT_LEN_20MS   57
 
#define SPL_MUL_16_16(a, b)   ((int32_t) (((int16_t)(a)) * ((int16_t)(b))))
 
#define SPL_MUL_16_16_RSFT(a, b, c)   (SPL_MUL_16_16(a, b) >> (c))
 
#define SPL_SHIFT_W32(x, c)   (((c) >= 0) ? ((x) << (c)) : ((x) >> (-(c))))
 

Functions

static int unpack_frame (ILBCContext *s)
 
static void index_conv (int16_t *index)
 
static void lsf_dequantization (int16_t *lsfdeq, int16_t *index, int16_t lpc_n)
 
static void lsf_check_stability (int16_t *lsf, int dim, int nb_vectors)
 
static void lsf_interpolate (int16_t *out, int16_t *in1, int16_t *in2, int16_t coef, int size)
 
static void lsf2lsp (int16_t *lsf, int16_t *lsp, int order)
 
static void get_lsp_poly (int16_t *lsp, int32_t *f)
 
static void lsf2poly (int16_t *a, int16_t *lsf)
 
static void lsp_interpolate2polydec (int16_t *a, int16_t *lsf1, int16_t *lsf2, int coef, int length)
 
static void bw_expand (int16_t *out, const int16_t *in, const int16_t *coef, int length)
 
static void lsp_interpolate (int16_t *syntdenum, int16_t *weightdenum, int16_t *lsfdeq, int16_t length, ILBCContext *s)
 
static void filter_mafq12 (int16_t *in_ptr, int16_t *out_ptr, int16_t *B, int16_t B_length, int16_t length)
 
static void filter_arfq12 (const int16_t *data_in, int16_t *data_out, const int16_t *coefficients, int coefficients_length, int data_length)
 
static void state_construct (int16_t ifm, int16_t *idx, int16_t *synt_denum, int16_t *Out_fix, int16_t len)
 
static int16_t gain_dequantization (int index, int max_in, int stage)
 
static void vector_rmultiplication (int16_t *out, const int16_t *in, const int16_t *win, int length, int shift)
 
static void vector_multiplication (int16_t *out, const int16_t *in, const int16_t *win, int length, int shift)
 
static void add_vector_and_shift (int16_t *out, const int16_t *in1, const int16_t *in2, int length, int shift)
 
static void create_augmented_vector (int index, int16_t *buffer, int16_t *cbVec)
 
static void get_codebook (int16_t *cbvec, int16_t *mem, int16_t index, int16_t lMem, int16_t cbveclen)
 
static void construct_vector (int16_t *decvector, int16_t *index, int16_t *gain_index, int16_t *mem, int16_t lMem, int16_t veclen)
 
static void reverse_memcpy (int16_t *dest, int16_t *source, int length)
 
static void decode_residual (ILBCContext *s, ILBCFrame *encbits, int16_t *decresidual, int16_t *syntdenum)
 
static int16_t max_abs_value_w16 (const int16_t *vector, int length)
 
static int16_t get_size_in_bits (uint32_t n)
 
static int32_t scale_dot_product (const int16_t *v1, const int16_t *v2, int length, int scaling)
 
static void correlation (int32_t *corr, int32_t *ener, int16_t *buffer, int16_t lag, int16_t blen, int16_t srange, int16_t scale)
 
static int16_t norm_w32 (int32_t a)
 
static int32_t div_w32_w16 (int32_t num, int16_t den)
 
static void do_plc (int16_t *plc_residual, int16_t *plc_lpc, int16_t PLI, int16_t *decresidual, int16_t *lpc, int16_t inlag, ILBCContext *s)
 
static int xcorr_coeff (int16_t *target, int16_t *regressor, int16_t subl, int16_t searchLen, int16_t offset, int16_t step)
 
static void hp_output (int16_t *signal, const int16_t *ba, int16_t *y, int16_t *x, int16_t len)
 
static int ilbc_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
 
static av_cold int ilbc_decode_init (AVCodecContext *avctx)
 

Variables

AVCodec ff_ilbc_decoder
 

Macro Definition Documentation

#define LPC_N_20MS   1

Definition at line 38 of file ilbcdec.c.

Referenced by ilbc_decode_init().

#define LPC_N_30MS   2

Definition at line 39 of file ilbcdec.c.

Referenced by ilbc_decode_init().

#define LPC_N_MAX   2

Definition at line 40 of file ilbcdec.c.

#define LSF_NSPLIT   3

Definition at line 41 of file ilbcdec.c.

Referenced by lsf_dequantization().

#define NASUB_MAX   4

Definition at line 68 of file ilbcdec.c.

#define LPC_FILTERORDER   10
#define NSUB_MAX   6

Definition at line 65 of file ilbcdec.c.

#define SUBL   40
#define ST_MEM_L_TBL   85

Definition at line 47 of file ilbcdec.c.

Referenced by decode_residual().

#define MEM_LF_TBL   147

Definition at line 48 of file ilbcdec.c.

Referenced by decode_residual().

#define STATE_SHORT_LEN_20MS   57

Definition at line 71 of file ilbcdec.c.

Referenced by ilbc_decode_init().

#define STATE_SHORT_LEN_30MS   58

Definition at line 70 of file ilbcdec.c.

Referenced by ilbc_decode_init(), and state_construct().

#define BLOCKL_MAX   240

Definition at line 62 of file ilbcdec.c.

Referenced by do_plc().

#define CB_MEML   147

Definition at line 53 of file ilbcdec.c.

Referenced by decode_residual().

#define CB_NSTAGES   3

Definition at line 54 of file ilbcdec.c.

Referenced by construct_vector(), and decode_residual().

#define CB_HALFFILTERLEN   4

Definition at line 55 of file ilbcdec.c.

Referenced by decode_residual(), and get_codebook().

#define CB_FILTERLEN   8

Definition at line 56 of file ilbcdec.c.

Referenced by get_codebook().

#define ENH_NBLOCKS_TOT   8

Definition at line 58 of file ilbcdec.c.

#define ENH_BLOCKL   80

Definition at line 59 of file ilbcdec.c.

Referenced by ilbc_decode_frame().

#define ENH_BUFL   (ENH_NBLOCKS_TOT)*ENH_BLOCKL

Definition at line 60 of file ilbcdec.c.

#define ENH_BUFL_FILTEROVERHEAD   3

Definition at line 61 of file ilbcdec.c.

#define BLOCKL_MAX   240

Definition at line 62 of file ilbcdec.c.

#define NSUB_20MS   4

Definition at line 63 of file ilbcdec.c.

Referenced by ilbc_decode_init().

#define NSUB_30MS   6

Definition at line 64 of file ilbcdec.c.

Referenced by ilbc_decode_init().

#define NSUB_MAX   6

Definition at line 65 of file ilbcdec.c.

#define NASUB_20MS   2

Definition at line 66 of file ilbcdec.c.

Referenced by ilbc_decode_init().

#define NASUB_30MS   4

Definition at line 67 of file ilbcdec.c.

Referenced by ilbc_decode_init().

#define NASUB_MAX   4

Definition at line 68 of file ilbcdec.c.

#define STATE_LEN   80

Definition at line 69 of file ilbcdec.c.

Referenced by decode_residual().

#define STATE_SHORT_LEN_30MS   58

Definition at line 70 of file ilbcdec.c.

#define STATE_SHORT_LEN_20MS   57

Definition at line 71 of file ilbcdec.c.

#define SPL_MUL_16_16 (   a,
  b 
)    ((int32_t) (((int16_t)(a)) * ((int16_t)(b))))

Definition at line 73 of file ilbcdec.c.

Referenced by construct_vector(), do_plc(), get_codebook(), hp_output(), and state_construct().

#define SPL_MUL_16_16_RSFT (   a,
  b,
  c 
)    (SPL_MUL_16_16(a, b) >> (c))

Definition at line 74 of file ilbcdec.c.

Referenced by do_plc(), and xcorr_coeff().

#define SPL_SHIFT_W32 (   x,
  c 
)    (((c) >= 0) ? ((x) << (c)) : ((x) >> (-(c))))

Definition at line 928 of file ilbcdec.c.

Referenced by do_plc(), and xcorr_coeff().

Function Documentation

static int unpack_frame ( ILBCContext s)
static

Definition at line 128 of file ilbcdec.c.

Referenced by ilbc_decode_frame().

static void index_conv ( int16_t *  index)
static

Definition at line 268 of file ilbcdec.c.

Referenced by ilbc_decode_frame().

static void lsf_dequantization ( int16_t *  lsfdeq,
int16_t *  index,
int16_t  lpc_n 
)
static

Definition at line 281 of file ilbcdec.c.

Referenced by ilbc_decode_frame().

static void lsf_check_stability ( int16_t *  lsf,
int  dim,
int  nb_vectors 
)
static

Definition at line 309 of file ilbcdec.c.

Referenced by ilbc_decode_frame().

static void lsf_interpolate ( int16_t *  out,
int16_t *  in1,
int16_t *  in2,
int16_t  coef,
int  size 
)
static

Definition at line 332 of file ilbcdec.c.

Referenced by lsp_interpolate2polydec().

static void lsf2lsp ( int16_t *  lsf,
int16_t *  lsp,
int  order 
)
static

Definition at line 342 of file ilbcdec.c.

Referenced by lsf2poly().

static void get_lsp_poly ( int16_t *  lsp,
int32_t f 
)
static

Definition at line 365 of file ilbcdec.c.

Referenced by lsf2poly().

static void lsf2poly ( int16_t *  a,
int16_t *  lsf 
)
static

Definition at line 392 of file ilbcdec.c.

Referenced by lsp_interpolate2polydec().

static void lsp_interpolate2polydec ( int16_t *  a,
int16_t *  lsf1,
int16_t *  lsf2,
int  coef,
int  length 
)
static

Definition at line 419 of file ilbcdec.c.

Referenced by lsp_interpolate().

static void bw_expand ( int16_t *  out,
const int16_t *  in,
const int16_t *  coef,
int  length 
)
static

Definition at line 428 of file ilbcdec.c.

Referenced by lsp_interpolate().

static void lsp_interpolate ( int16_t *  syntdenum,
int16_t *  weightdenum,
int16_t *  lsfdeq,
int16_t  length,
ILBCContext s 
)
static

Definition at line 437 of file ilbcdec.c.

Referenced by ilbc_decode_frame().

static void filter_mafq12 ( int16_t *  in_ptr,
int16_t *  out_ptr,
int16_t *  B,
int16_t  B_length,
int16_t  length 
)
static

Definition at line 479 of file ilbcdec.c.

Referenced by get_codebook(), and state_construct().

static void filter_arfq12 ( const int16_t *  data_in,
int16_t *  data_out,
const int16_t *  coefficients,
int  coefficients_length,
int  data_length 
)
static

Definition at line 499 of file ilbcdec.c.

Referenced by ilbc_decode_frame(), and state_construct().

static void state_construct ( int16_t  ifm,
int16_t *  idx,
int16_t *  synt_denum,
int16_t *  Out_fix,
int16_t  len 
)
static

Definition at line 521 of file ilbcdec.c.

Referenced by decode_residual().

static int16_t gain_dequantization ( int  index,
int  max_in,
int  stage 
)
static

Definition at line 600 of file ilbcdec.c.

Referenced by construct_vector().

static void vector_rmultiplication ( int16_t *  out,
const int16_t *  in,
const int16_t *  win,
int  length,
int  shift 
)
static

Definition at line 607 of file ilbcdec.c.

Referenced by create_augmented_vector().

static void vector_multiplication ( int16_t *  out,
const int16_t *  in,
const int16_t *  win,
int  length,
int  shift 
)
static

Definition at line 615 of file ilbcdec.c.

Referenced by create_augmented_vector().

static void add_vector_and_shift ( int16_t *  out,
const int16_t *  in1,
const int16_t *  in2,
int  length,
int  shift 
)
static

Definition at line 623 of file ilbcdec.c.

Referenced by create_augmented_vector().

static void create_augmented_vector ( int  index,
int16_t *  buffer,
int16_t *  cbVec 
)
static

Definition at line 631 of file ilbcdec.c.

Referenced by get_codebook().

static void get_codebook ( int16_t *  cbvec,
int16_t *  mem,
int16_t  index,
int16_t  lMem,
int16_t  cbveclen 
)
static

Definition at line 646 of file ilbcdec.c.

Referenced by construct_vector().

static void construct_vector ( int16_t *  decvector,
int16_t *  index,
int16_t *  gain_index,
int16_t *  mem,
int16_t  lMem,
int16_t  veclen 
)
static

Definition at line 715 of file ilbcdec.c.

Referenced by decode_residual().

static void reverse_memcpy ( int16_t *  dest,
int16_t *  source,
int  length 
)
static

Definition at line 754 of file ilbcdec.c.

Referenced by decode_residual().

static void decode_residual ( ILBCContext s,
ILBCFrame encbits,
int16_t *  decresidual,
int16_t *  syntdenum 
)
static

Definition at line 764 of file ilbcdec.c.

Referenced by ilbc_decode_frame().

static int16_t max_abs_value_w16 ( const int16_t *  vector,
int  length 
)
static

Definition at line 865 of file ilbcdec.c.

Referenced by do_plc(), and xcorr_coeff().

static int16_t get_size_in_bits ( uint32_t  n)
static

Definition at line 883 of file ilbcdec.c.

Referenced by do_plc().

static int32_t scale_dot_product ( const int16_t *  v1,
const int16_t *  v2,
int  length,
int  scaling 
)
static

Definition at line 902 of file ilbcdec.c.

Referenced by correlation(), do_plc(), and xcorr_coeff().

static void correlation ( int32_t corr,
int32_t ener,
int16_t *  buffer,
int16_t  lag,
int16_t  blen,
int16_t  srange,
int16_t  scale 
)
static

Definition at line 912 of file ilbcdec.c.

Referenced by do_plc().

static int16_t norm_w32 ( int32_t  a)
static

Definition at line 930 of file ilbcdec.c.

Referenced by do_plc(), and xcorr_coeff().

static int32_t div_w32_w16 ( int32_t  num,
int16_t  den 
)
static

Definition at line 941 of file ilbcdec.c.

Referenced by do_plc().

static void do_plc ( int16_t *  plc_residual,
int16_t *  plc_lpc,
int16_t  PLI,
int16_t *  decresidual,
int16_t *  lpc,
int16_t  inlag,
ILBCContext s 
)
static

Definition at line 949 of file ilbcdec.c.

Referenced by ilbc_decode_frame().

static int xcorr_coeff ( int16_t *  target,
int16_t *  regressor,
int16_t  subl,
int16_t  searchLen,
int16_t  offset,
int16_t  step 
)
static

Definition at line 1203 of file ilbcdec.c.

Referenced by ilbc_decode_frame().

static void hp_output ( int16_t *  signal,
const int16_t *  ba,
int16_t *  y,
int16_t *  x,
int16_t  len 
)
static

Definition at line 1314 of file ilbcdec.c.

Referenced by ilbc_decode_frame().

static int ilbc_decode_frame ( AVCodecContext avctx,
void data,
int got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 1356 of file ilbcdec.c.

static av_cold int ilbc_decode_init ( AVCodecContext avctx)
static

Definition at line 1444 of file ilbcdec.c.

Variable Documentation

AVCodec ff_ilbc_decoder
Initial value:
= {
.name = "ilbc",
.long_name = NULL_IF_CONFIG_SMALL("iLBC (Internet Low Bitrate Codec)"),
.decode = ilbc_decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
.priv_data_size = sizeof(ILBCContext),
}
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static av_cold int ilbc_decode_init(AVCodecContext *avctx)
Definition: ilbcdec.c:1444
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:968
static int ilbc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: ilbcdec.c:1356

Definition at line 1479 of file ilbcdec.c.