FFmpeg
|
#include "libavutil/channel_layout.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "acelp_vectors.h"
#include "avcodec.h"
#include "celp_filters.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"
#include "g723_1.h"
Go to the source code of this file.
Macros | |
#define | BITSTREAM_READER_LE |
#define | CNG_RANDOM_SEED 12345 |
#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 |
Functions | |
static av_cold int | g723_1_decode_init (AVCodecContext *avctx) |
static int | unpack_bitstream (G723_1_ChannelContext *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 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 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_ChannelContext *p, int offset, int pitch_lag, PPFParam *ppf, enum Rate cur_rate) |
Calculate pitch postfilter parameters. More... | |
static int | comp_interp_index (G723_1_ChannelContext *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) |
Perform residual interpolation based on frame classification. More... | |
static void | gain_scale (G723_1_ChannelContext *p, int16_t *buf, int energy) |
Adjust gain of postfiltered signal. More... | |
static void | formant_postfilter (G723_1_ChannelContext *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_ChannelContext *p) |
static void | generate_noise (G723_1_ChannelContext *p) |
static int | g723_1_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt) |
Variables | |
static const int16_t | ppf_gain_weight [2] = {0x1800, 0x2000} |
Postfilter gain weighting factors scaled by 2^15. More... | |
static const int16_t | pitch_contrib [340] |
static const int32_t | max_pos [4] = {593775, 142506, 593775, 142506} |
Size of the MP-MLQ fixed excitation codebooks. More... | |
static const int16_t | postfilter_tbl [2][LPC_ORDER] |
0.65^i (Zero part) and 0.75^i (Pole part) scaled by 2^15 More... | |
static const int | cng_adaptive_cb_lag [4] = { 1, 0, 1, 3 } |
static const int | cng_filt [4] = { 273, 998, 499, 333 } |
static const int | cng_bseg [3] = { 2048, 18432, 231233 } |
static const AVOption | options [] |
static const AVClass | g723_1dec_class |
const FFCodec | ff_g723_1_decoder |
G.723.1 compatible decoder
Definition in file g723_1dec.c.
#define BITSTREAM_READER_LE |
Definition at line 32 of file g723_1dec.c.
#define CNG_RANDOM_SEED 12345 |
Definition at line 41 of file g723_1dec.c.
Perform IIR filtering.
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 589 of file g723_1dec.c.
#define OFFSET | ( | x | ) | offsetof(G723_1_Context, x) |
Definition at line 1096 of file g723_1dec.c.
#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM |
Definition at line 1097 of file g723_1dec.c.
|
static |
Definition at line 115 of file g723_1dec.c.
|
static |
Unpack the frame into parameters.
p | the context |
buf | pointer to the input buffer |
buf_size | size of the input buffer |
Definition at line 147 of file g723_1dec.c.
Referenced by g723_1_decode_frame().
|
static |
Bitexact implementation of sqrt(val/2).
Definition at line 265 of file g723_1dec.c.
Referenced by comp_ppf_gains(), gain_scale(), and generate_noise().
|
static |
Generate fixed codebook excitation vector.
vector | decoded excitation vector |
subfrm | current subframe |
cur_rate | current bitrate |
pitch_lag | closed loop pitch lag |
index | current subframe index |
Definition at line 281 of file g723_1dec.c.
Referenced by g723_1_decode_frame().
|
static |
Estimate maximum auto-correlation around pitch lag.
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 348 of file g723_1dec.c.
Referenced by comp_interp_index(), and comp_ppf_coeff().
|
static |
Calculate pitch postfilter optimal and scaling gains.
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 381 of file g723_1dec.c.
Referenced by comp_ppf_coeff().
|
static |
Calculate pitch postfilter 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 429 of file g723_1dec.c.
Referenced by g723_1_decode_frame().
|
static |
Classify frames as voiced/unvoiced.
p | the context |
pitch_lag | decoded pitch_lag |
exc_eng | excitation energy estimation |
scale | scaling factor of exc_eng |
Definition at line 515 of file g723_1dec.c.
Referenced by g723_1_decode_frame().
Perform residual interpolation based on frame classification.
buf | decoded excitation vector |
out | output vector |
lag | decoded pitch lag |
gain | interpolated gain |
rseed | seed for random number generator |
Definition at line 560 of file g723_1dec.c.
Referenced by g723_1_decode_frame().
|
static |
Adjust gain of postfiltered signal.
p | the context |
buf | postfiltered output vector |
energy | input energy coefficient |
Definition at line 614 of file g723_1dec.c.
Referenced by formant_postfilter().
|
static |
Perform formant filtering.
p | the context |
lpc | quantized lpc coefficients |
buf | input buffer |
dst | output buffer |
Definition at line 657 of file g723_1dec.c.
Referenced by g723_1_decode_frame().
Definition at line 724 of file g723_1dec.c.
Referenced by g723_1_decode_frame().
Definition at line 734 of file g723_1dec.c.
Referenced by generate_noise().
|
static |
Definition at line 740 of file g723_1dec.c.
Referenced by g723_1_decode_frame().
|
static |
Definition at line 802 of file g723_1dec.c.
Referenced by g723_1_decode_frame().
|
static |
Definition at line 927 of file g723_1dec.c.
|
static |
Postfilter gain weighting factors scaled by 2^15.
Definition at line 46 of file g723_1dec.c.
Referenced by comp_ppf_gains().
|
static |
Definition at line 48 of file g723_1dec.c.
Referenced by gen_fcb_excitation().
|
static |
Size of the MP-MLQ fixed excitation codebooks.
Definition at line 97 of file g723_1dec.c.
Referenced by amf_parse_object(), gen_fcb_excitation(), and parse_keyframes_index().
|
static |
0.65^i (Zero part) and 0.75^i (Pole part) scaled by 2^15
Definition at line 102 of file g723_1dec.c.
Referenced by formant_postfilter().
|
static |
Definition at line 109 of file g723_1dec.c.
Referenced by generate_noise().
|
static |
Definition at line 111 of file g723_1dec.c.
Referenced by estimate_sid_gain().
|
static |
Definition at line 113 of file g723_1dec.c.
Referenced by estimate_sid_gain().
|
static |
Definition at line 1099 of file g723_1dec.c.
|
static |
Definition at line 1106 of file g723_1dec.c.
const FFCodec ff_g723_1_decoder |
Definition at line 1113 of file g723_1dec.c.