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 "encode.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 void | pack_bitstream (G723_1_ChannelContext *p, AVPacket *avpkt, int info_bits) |
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 int16_t | hamming_window [LPC_FRAME] |
Hamming window coefficients scaled by 2^15. More... | |
static const int16_t | binomial_window [LPC_ORDER] |
Binomial window coefficients scaled by 2^15. More... | |
static const int16_t | bandwidth_expand [LPC_ORDER] |
0.994^i scaled by 2^15 More... | |
static const int16_t | percept_flt_tbl [2][LPC_ORDER] |
0.5^i scaled by 2^15 More... | |
static const AVCodecDefault | defaults [] |
const AVCodec | ff_g723_1_encoder |
G.723.1 compatible encoder
Definition in file g723_1enc.c.
#define BITSTREAM_WRITER_LE |
Definition at line 41 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 342 of file g723_1enc.c.
|
static |
Definition at line 92 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 130 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 146 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 188 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 232 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 248 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 368 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 416 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 439 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 471 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 544 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Apply the harmonic noise shaping filter.
hf | filter parameters |
Definition at line 617 of file g723_1enc.c.
Referenced by g723_1_encode_frame().
|
static |
Definition at line 627 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 646 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 688 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 806 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 826 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 981 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 1016 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 1048 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 1104 of file g723_1enc.c.
|
static |
Hamming window coefficients scaled by 2^15.
Definition at line 47 of file g723_1enc.c.
Referenced by comp_autocorr().
|
static |
Binomial window coefficients scaled by 2^15.
Definition at line 71 of file g723_1enc.c.
Referenced by comp_autocorr().
|
static |
0.994^i scaled by 2^15
Definition at line 78 of file g723_1enc.c.
Referenced by lpc2lsp().
|
static |
0.5^i scaled by 2^15
Definition at line 85 of file g723_1enc.c.
Referenced by perceptual_filter().
|
static |
Definition at line 1241 of file g723_1enc.c.
const AVCodec ff_g723_1_encoder |
Definition at line 1246 of file g723_1enc.c.