FFmpeg
|
G.723.1 compatible decoder. More...
#include "libavutil/channel_layout.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "acelp_vectors.h"
#include "celp_filters.h"
#include "celp_math.h"
#include "g723_1_data.h"
Go to the source code of this file.
Data Structures | |
struct | g723_1_context |
Macros | |
#define | BITSTREAM_READER_LE |
#define | CNG_RANDOM_SEED 12345 |
#define | normalize_bits_int16(num) normalize_bits(num, 15) |
#define | normalize_bits_int32(num) normalize_bits(num, 31) |
#define | MULL2(a, b) MULL(a,b,15) |
Bitexact implementation of 2ab scaled by 1/2^16. More... | |
#define | iir_filter(fir_coef, iir_coef, src, dest, width) |
Perform IIR filtering. More... | |
#define | OFFSET(x) offsetof(G723_1_Context, x) |
#define | AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM |
Typedefs | |
typedef struct g723_1_context | G723_1_Context |
Functions | |
static av_cold int | g723_1_decode_init (AVCodecContext *avctx) |
static int | unpack_bitstream (G723_1_Context *p, const uint8_t *buf, int buf_size) |
Unpack the frame into parameters. More... | |
static int16_t | square_root (unsigned val) |
Bitexact implementation of sqrt(val/2). More... | |
static int | normalize_bits (int num, int width) |
Calculate the number of left-shifts required for normalizing the input. More... | |
static int | scale_vector (int16_t *dst, const int16_t *vector, int length) |
Scale vector contents based on the largest of their absolutes. More... | |
static void | inverse_quant (int16_t *cur_lsp, int16_t *prev_lsp, uint8_t *lsp_index, int bad_frame) |
Perform inverse quantization of LSP frequencies. More... | |
static void | lsp2lpc (int16_t *lpc) |
Convert LSP frequencies to LPC coefficients. More... | |
static void | lsp_interpolate (int16_t *lpc, int16_t *cur_lsp, int16_t *prev_lsp) |
Quantize LSP frequencies by interpolation and convert them to the corresponding LPC coefficients. More... | |
static void | gen_dirac_train (int16_t *buf, int pitch_lag) |
Generate a train of dirac functions with period as pitch lag. More... | |
static void | gen_fcb_excitation (int16_t *vector, G723_1_Subframe *subfrm, enum Rate cur_rate, int pitch_lag, int index) |
Generate fixed codebook excitation vector. More... | |
static void | get_residual (int16_t *residual, int16_t *prev_excitation, int lag) |
Get delayed contribution from the previous excitation vector. More... | |
static int | dot_product (const int16_t *a, const int16_t *b, int length) |
static void | gen_acb_excitation (int16_t *vector, int16_t *prev_excitation, int pitch_lag, G723_1_Subframe *subfrm, enum Rate cur_rate) |
Generate adaptive codebook excitation. More... | |
static int | autocorr_max (const int16_t *buf, int offset, int *ccr_max, int pitch_lag, int length, int dir) |
Estimate maximum auto-correlation around pitch lag. More... | |
static void | comp_ppf_gains (int lag, PPFParam *ppf, enum Rate cur_rate, int tgt_eng, int ccr, int res_eng) |
Calculate pitch postfilter optimal and scaling gains. More... | |
static void | comp_ppf_coeff (G723_1_Context *p, int offset, int pitch_lag, PPFParam *ppf, enum Rate cur_rate) |
Calculate pitch postfilter parameters. More... | |
static int | comp_interp_index (G723_1_Context *p, int pitch_lag, int *exc_eng, int *scale) |
Classify frames as voiced/unvoiced. More... | |
static void | residual_interp (int16_t *buf, int16_t *out, int lag, int gain, int *rseed) |
Peform residual interpolation based on frame classification. More... | |
static void | gain_scale (G723_1_Context *p, int16_t *buf, int energy) |
Adjust gain of postfiltered signal. More... | |
static void | formant_postfilter (G723_1_Context *p, int16_t *lpc, int16_t *buf, int16_t *dst) |
Perform formant filtering. More... | |
static int | sid_gain_to_lsp_index (int gain) |
static int | cng_rand (int *state, int base) |
static int | estimate_sid_gain (G723_1_Context *p) |
static void | generate_noise (G723_1_Context *p) |
static int | g723_1_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) |
Variables | |
static const AVOption | options [] |
static const AVClass | g723_1dec_class |
AVCodec | ff_g723_1_decoder |
Detailed Description
G.723.1 compatible decoder.
Definition in file libavcodec/g723_1.c.
Macro Definition Documentation
#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM |
Definition at line 1317 of file libavcodec/g723_1.c.
#define BITSTREAM_READER_LE |
Definition at line 28 of file libavcodec/g723_1.c.
#define CNG_RANDOM_SEED 12345 |
Definition at line 41 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame(), and g723_1_decode_init().
Perform IIR filtering.
- Parameters
-
fir_coef FIR coefficients iir_coef IIR coefficients src source vector dest destination vector width width of the output, 16 bits(0) / 32 bits(1)
Definition at line 822 of file libavcodec/g723_1.c.
Referenced by formant_postfilter().
Bitexact implementation of 2ab scaled by 1/2^16.
- Parameters
-
a 32 bit multiplicand b 16 bit multiplier
Definition at line 343 of file libavcodec/g723_1.c.
Referenced by lsp2lpc().
#define normalize_bits_int16 | ( | num | ) | normalize_bits(num, 15) |
Definition at line 244 of file libavcodec/g723_1.c.
#define normalize_bits_int32 | ( | num | ) | normalize_bits(num, 31) |
Definition at line 245 of file libavcodec/g723_1.c.
#define OFFSET | ( | x | ) | offsetof(G723_1_Context, x) |
Definition at line 1316 of file libavcodec/g723_1.c.
Typedef Documentation
typedef struct g723_1_context G723_1_Context |
Function Documentation
|
static |
Estimate maximum auto-correlation around pitch lag.
- Parameters
-
buf buffer with offset applied offset offset of the excitation vector ccr_max pointer to the maximum auto-correlation pitch_lag decoded pitch lag length length of autocorrelation dir forward lag(1) / backward lag(-1)
Definition at line 584 of file libavcodec/g723_1.c.
Referenced by comp_interp_index(), and comp_ppf_coeff().
|
inlinestatic |
Definition at line 968 of file libavcodec/g723_1.c.
Referenced by generate_noise().
|
static |
Classify frames as voiced/unvoiced.
- Parameters
-
p the context pitch_lag decoded pitch_lag exc_eng excitation energy estimation scale scaling factor of exc_eng
- Returns
- residual interpolation index if voiced, 0 otherwise
Definition at line 749 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
|
static |
Calculate pitch postfilter parameters.
- Parameters
-
p the context offset offset of the excitation vector pitch_lag decoded pitch lag ppf pitch postfilter parameters cur_rate current bitrate
Definition at line 665 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
|
static |
Calculate pitch postfilter optimal and scaling gains.
- Parameters
-
lag pitch postfilter forward/backward lag ppf pitch postfilter parameters cur_rate current bitrate tgt_eng target energy ccr cross-correlation res_eng residual energy
Definition at line 617 of file libavcodec/g723_1.c.
Referenced by comp_ppf_coeff().
|
static |
Definition at line 538 of file libavcodec/g723_1.c.
Referenced by autocorr_max(), comp_interp_index(), comp_ppf_coeff(), and formant_postfilter().
|
static |
Definition at line 974 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
|
static |
Perform formant filtering.
- Parameters
-
p the context lpc quantized lpc coefficients buf input buffer dst output buffer
Definition at line 890 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
|
static |
Definition at line 1153 of file libavcodec/g723_1.c.
|
static |
Definition at line 86 of file libavcodec/g723_1.c.
|
static |
Adjust gain of postfiltered signal.
- Parameters
-
p the context buf postfiltered output vector energy input energy coefficient
Definition at line 847 of file libavcodec/g723_1.c.
Referenced by formant_postfilter().
|
static |
Generate adaptive codebook excitation.
Definition at line 547 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame(), and generate_noise().
|
static |
Generate a train of dirac functions with period as pitch lag.
Definition at line 444 of file libavcodec/g723_1.c.
Referenced by gen_fcb_excitation().
|
static |
Generate fixed codebook excitation vector.
- Parameters
-
vector decoded excitation vector subfrm current subframe cur_rate current bitrate pitch_lag closed loop pitch lag index current subframe index
Definition at line 465 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
|
static |
Definition at line 1028 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
|
static |
Get delayed contribution from the previous excitation vector.
Definition at line 525 of file libavcodec/g723_1.c.
Referenced by gen_acb_excitation().
|
static |
Perform inverse quantization of LSP frequencies.
- Parameters
-
cur_lsp the current LSP vector prev_lsp the previous LSP vector lsp_index VQ indices bad_frame bad frame flag
Definition at line 275 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
|
static |
Convert LSP frequencies to LPC coefficients.
- Parameters
-
lpc buffer for LPC coefficients
Definition at line 351 of file libavcodec/g723_1.c.
Referenced by lsp_interpolate().
|
static |
Quantize LSP frequencies by interpolation and convert them to the corresponding LPC coefficients.
- Parameters
-
lpc buffer for LPC coefficients cur_lsp the current LSP vector prev_lsp the previous LSP vector
Definition at line 421 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
|
static |
Calculate the number of left-shifts required for normalizing the input.
- Parameters
-
num input number width width of the input, 15 or 31 bits
Definition at line 239 of file libavcodec/g723_1.c.
Referenced by comp_ppf_coeff(), and gain_scale().
|
static |
Peform residual interpolation based on frame classification.
- Parameters
-
buf decoded excitation vector out output vector lag decoded pitch lag gain interpolated gain rseed seed for random number generator
Definition at line 793 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
|
static |
Scale vector contents based on the largest of their absolutes.
Definition at line 250 of file libavcodec/g723_1.c.
Referenced by comp_interp_index(), and formant_postfilter().
|
static |
Definition at line 958 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
|
static |
Bitexact implementation of sqrt(val/2).
Definition at line 226 of file libavcodec/g723_1.c.
Referenced by comp_ppf_gains(), gain_scale(), and generate_noise().
|
static |
Unpack the frame into parameters.
- Parameters
-
p the context buf pointer to the input buffer buf_size size of the input buffer
Definition at line 111 of file libavcodec/g723_1.c.
Referenced by g723_1_decode_frame().
Variable Documentation
AVCodec ff_g723_1_decoder |
Definition at line 1333 of file libavcodec/g723_1.c.
|
static |
Definition at line 1326 of file libavcodec/g723_1.c.
|
static |
Definition at line 1319 of file libavcodec/g723_1.c.
Generated on Mon Nov 18 2024 06:52:06 for FFmpeg by 1.8.11