FFmpeg
4.0
|
G.723.1 compatible encoder. More...
#include <stdint.h>
#include <string.h>
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "celp_math.h"
#include "g723_1.h"
#include "internal.h"
#include "put_bits.h"
Go to the source code of this file.
Macros | |
#define | BITSTREAM_WRITER_LE |
#define | get_index(num, offset, size) |
Quantize the current LSP subvector. More... | |
Functions | |
static av_cold int | g723_1_encode_init (AVCodecContext *avctx) |
static void | highpass_filter (int16_t *buf, int16_t *fir, int *iir) |
Remove DC component from the input signal. More... | |
static void | comp_autocorr (int16_t *buf, int16_t *autocorr) |
Estimate autocorrelation of the input vector. More... | |
static void | levinson_durbin (int16_t *lpc, int16_t *autocorr, int16_t error) |
Use Levinson-Durbin recursion to compute LPC coefficients from autocorrelation values. More... | |
static void | comp_lpc_coeff (int16_t *buf, int16_t *lpc) |
Calculate LPC coefficients for the current frame. More... | |
static void | lpc2lsp (int16_t *lpc, int16_t *prev_lsp, int16_t *lsp) |
static void | lsp_quantize (uint8_t *lsp_index, int16_t *lsp, int16_t *prev_lsp) |
Vector quantize the LSP frequencies. More... | |
static void | iir_filter (int16_t *fir_coef, int16_t *iir_coef, int16_t *src, int16_t *dest) |
Perform IIR filtering. More... | |
static void | perceptual_filter (G723_1_Context *p, int16_t *flt_coef, int16_t *unq_lpc, int16_t *buf) |
Apply the formant perceptual weighting filter. More... | |
static int | estimate_pitch (int16_t *buf, int start) |
Estimate the open loop pitch period. More... | |
static void | comp_harmonic_coeff (int16_t *buf, int16_t pitch_lag, HFParam *hf) |
Compute harmonic noise filter parameters. More... | |
static void | harmonic_filter (HFParam *hf, const int16_t *src, int16_t *dest) |
Apply the harmonic noise shaping filter. More... | |
static void | harmonic_noise_sub (HFParam *hf, const int16_t *src, int16_t *dest) |
static void | synth_percept_filter (int16_t *qnt_lpc, int16_t *perf_lpc, int16_t *perf_fir, int16_t *perf_iir, const int16_t *src, int16_t *dest, int scale) |
Combined synthesis and formant perceptual weighting filer. More... | |
static void | acb_search (G723_1_Context *p, int16_t *residual, int16_t *impulse_resp, const int16_t *buf, int index) |
Compute the adaptive codebook contribution. More... | |
static void | sub_acb_contrib (const int16_t *residual, const int16_t *impulse_resp, int16_t *buf) |
Subtract the adaptive codebook contribution from the input to obtain the residual. More... | |
static void | get_fcb_param (FCBParam *optim, int16_t *impulse_resp, int16_t *buf, int pulse_cnt, int pitch_lag) |
Quantize the residual signal using the fixed codebook (MP-MLQ). More... | |
static void | pack_fcb_param (G723_1_Subframe *subfrm, FCBParam *optim, int16_t *buf, int pulse_cnt) |
Encode the pulse position and gain of the current subframe. More... | |
static void | fcb_search (G723_1_Context *p, int16_t *impulse_resp, int16_t *buf, int index) |
Compute the fixed codebook excitation. More... | |
static int | pack_bitstream (G723_1_Context *p, AVPacket *avpkt) |
Pack the frame parameters into output bitstream. More... | |
static int | g723_1_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) |
Variables | |
AVCodec | ff_g723_1_encoder |
G.723.1 compatible encoder.
Definition in file g723_1enc.c.
#define BITSTREAM_WRITER_LE |
Definition at line 40 of file g723_1enc.c.
Quantize the current LSP subvector.
num | band number |
offset | offset of the current subvector in an LPC_ORDER vector |
size | size of the current subvector |
Definition at line 292 of file g723_1enc.c.
Referenced by lsp_quantize().
|
static |
Definition at line 43 of file g723_1enc.c.
Remove DC component from the input signal.
buf | input signal |
fir | zero memory |
iir | pole memory |
Definition at line 80 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Estimate autocorrelation of the input vector.
buf | input buffer |
autocorr | autocorrelation coefficients vector |
Definition at line 96 of file g723_1enc.c.
Referenced by comp_lpc_coeff().
|
static |
Use Levinson-Durbin recursion to compute LPC coefficients from autocorrelation values.
lpc | LPC coefficients vector |
autocorr | autocorrelation coefficients vector |
error | prediction error |
Definition at line 138 of file g723_1enc.c.
Referenced by comp_lpc_coeff().
|
static |
Calculate LPC coefficients for the current frame.
buf | current frame |
prev_data | 2 trailing subframes of the previous frame |
lpc | LPC coefficients vector |
Definition at line 182 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
< coefficients of the sum and difference polynomials (F1, F2) ordered as f1[0], f2[0], ...., f1[5], f2[5]
Evaluate F1 and F2 at uniform intervals of pi/256 along the unit circle and check for zero crossings.
Definition at line 198 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
Vector quantize the LSP frequencies.
lsp | the current lsp vector |
prev_lsp | the previous lsp vector |
Definition at line 318 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Perform IIR filtering.
fir_coef | FIR coefficients |
iir_coef | IIR coefficients |
src | source vector |
dest | destination vector |
Definition at line 366 of file g723_1enc.c.
Referenced by perceptual_filter().
|
static |
Apply the formant perceptual weighting filter.
flt_coef | filter coefficients |
unq_lpc | unquantized lpc vector |
Definition at line 389 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
Estimate the open loop pitch period.
buf | perceptually weighted speech |
start | estimation is carried out from this position |
Definition at line 421 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
Compute harmonic noise filter parameters.
buf | perceptually weighted speech |
pitch_lag | open loop pitch period |
hf | harmonic filter parameters |
Definition at line 494 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
Apply the harmonic noise shaping filter.
hf | filter parameters |
Definition at line 567 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
Definition at line 577 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Combined synthesis and formant perceptual weighting filer.
qnt_lpc | quantized lpc coefficients |
perf_lpc | perceptual filter coefficients |
perf_fir | perceptual filter fir memory |
perf_iir | perceptual filter iir memory |
scale | the filter output will be scaled by 2^scale |
Definition at line 596 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Compute the adaptive codebook contribution.
buf | input signal |
index | the current subframe index |
Definition at line 638 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Subtract the adaptive codebook contribution from the input to obtain the residual.
buf | target vector |
Definition at line 756 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Quantize the residual signal using the fixed codebook (MP-MLQ).
optim | optimized fixed codebook parameters |
buf | excitation vector |
Definition at line 776 of file g723_1enc.c.
Referenced by fcb_search().
|
static |
Encode the pulse position and gain of the current subframe.
optim | optimized fixed CB parameters |
buf | excitation vector |
Definition at line 931 of file g723_1enc.c.
Referenced by fcb_search().
|
static |
Compute the fixed codebook excitation.
buf | target vector |
impulse_resp | impulse response of the combined filter |
Definition at line 966 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Pack the frame parameters into output bitstream.
frame | output buffer |
size | size of the buffer |
Definition at line 998 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Compute the combined impulse response of the synthesis filter, formant perceptual weighting filter and harmonic noise shaping filter
Definition at line 1056 of file g723_1enc.c.
AVCodec ff_g723_1_encoder |
Definition at line 1192 of file g723_1enc.c.