FFmpeg
|
#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_ChannelContext *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_ChannelContext *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_ChannelContext *p, int16_t *impulse_resp, int16_t *buf, int index) |
Compute the fixed codebook excitation. More... | |
static int | pack_bitstream (G723_1_ChannelContext *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 | |
static const AVCodecDefault | defaults [] |
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 293 of file g723_1enc.c.
|
static |
Definition at line 43 of file g723_1enc.c.
|
static |
Remove DC component from the input signal.
buf | input signal |
fir | zero memory |
iir | pole memory |
Definition at line 81 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 97 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 139 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 183 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 199 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Vector quantize the LSP frequencies.
lsp | the current lsp vector |
prev_lsp | the previous lsp vector |
Definition at line 319 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 367 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 390 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 422 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Compute harmonic noise filter parameters.
buf | perceptually weighted speech |
pitch_lag | open loop pitch period |
hf | harmonic filter parameters |
Definition at line 495 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Apply the harmonic noise shaping filter.
hf | filter parameters |
Definition at line 568 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Definition at line 578 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 597 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 639 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 757 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 777 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 932 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 967 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 999 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 1057 of file g723_1enc.c.
|
static |
Definition at line 1194 of file g723_1enc.c.
AVCodec ff_g723_1_encoder |
Definition at line 1199 of file g723_1enc.c.