FFmpeg
|
#include <inttypes.h>
#include <limits.h>
#include "avcodec.h"
#include "g729.h"
#include "acelp_pitch_delay.h"
#include "g729postfilter.h"
#include "celp_math.h"
#include "acelp_filters.h"
#include "acelp_vectors.h"
#include "celp_filters.h"
#include "mathops.h"
Go to the source code of this file.
Macros | |
#define | FRAC_BITS 15 |
Functions | |
static void | residual_filter (int16_t *out, const int16_t *filter_coeffs, const int16_t *in, int subframe_size) |
Residual signal calculation (4.2.1 if G.729) More... | |
static int16_t | long_term_filter (AudioDSPContext *adsp, int pitch_delay_int, const int16_t *residual, int16_t *residual_filt, int subframe_size) |
long-term postfilter (4.2.1) More... | |
static int16_t | get_tilt_comp (AudioDSPContext *adsp, int16_t *lp_gn, const int16_t *lp_gd, int16_t *speech, int subframe_size) |
Calculate reflection coefficient for tilt compensation filter (4.2.3). More... | |
static int16_t | apply_tilt_comp (int16_t *out, int16_t *res_pst, int refl_coeff, int subframe_size, int16_t ht_prev_data) |
Apply tilt compensation filter (4.2.3). More... | |
void | ff_g729_postfilter (AudioDSPContext *adsp, int16_t *ht_prev_data, int *voicing, const int16_t *lp_filter_coeffs, int pitch_delay_int, int16_t *residual, int16_t *res_filter_data, int16_t *pos_filter_data, int16_t *speech, int subframe_size) |
Signal postfiltering (4.2) More... | |
int16_t | ff_g729_adaptive_gain_control (int gain_before, int gain_after, int16_t *speech, int subframe_size, int16_t gain_prev) |
Adaptive gain control (4.2.4) More... | |
Variables | |
static const int16_t | ff_g729_interp_filt_short [(ANALYZED_FRAC_DELAYS+1) *SHORT_INT_FILT_LEN] |
short interpolation filter (of length 33, according to spec) for computing signal with non-integer delay More... | |
static const int16_t | ff_g729_interp_filt_long [(ANALYZED_FRAC_DELAYS+1) *LONG_INT_FILT_LEN] |
long interpolation filter (of length 129, according to spec) for computing signal with non-integer delay More... | |
static const int16_t | formant_pp_factor_num_pow [10] |
formant_pp_factor_num_pow[i] = FORMANT_PP_FACTOR_NUM^(i+1) More... | |
static const int16_t | formant_pp_factor_den_pow [10] |
formant_pp_factor_den_pow[i] = FORMANT_PP_FACTOR_DEN^(i+1) More... | |
#define FRAC_BITS 15 |
Definition at line 33 of file g729postfilter.c.
|
static |
Residual signal calculation (4.2.1 if G.729)
out | [out] output data filtered through A(z/FORMANT_PP_FACTOR_NUM) |
filter_coeffs | (3.12) A(z/FORMANT_PP_FACTOR_NUM) filter coefficients |
in | input speech data to process |
subframe_size | size of one subframe |
Definition at line 86 of file g729postfilter.c.
Referenced by ff_g729_postfilter().
|
static |
long-term postfilter (4.2.1)
dsp | initialized DSP context |
pitch_delay_int | integer part of the pitch delay in the first subframe |
residual | filtering input data |
residual_filt | [out] speech signal with applied A(z/FORMANT_PP_FACTOR_NUM) filter |
subframe_size | size of subframe |
Definition at line 110 of file g729postfilter.c.
Referenced by ff_g729_postfilter().
|
static |
Calculate reflection coefficient for tilt compensation filter (4.2.3).
dsp | initialized DSP context |
lp_gn | (3.12) coefficients of A(z/FORMANT_PP_FACTOR_NUM) filter |
lp_gd | (3.12) coefficients of A(z/FORMANT_PP_FACTOR_DEN) filter |
speech | speech to update |
subframe_size | size of subframe |
Definition at line 427 of file g729postfilter.c.
Referenced by ff_g729_postfilter().
|
static |
Apply tilt compensation filter (4.2.3).
res_pst | [in/out] residual signal (partially filtered) |
k1 | (3.12) reflection coefficient |
subframe_size | size of subframe |
ht_prev_data | previous data for 4.2.3, equation 86 |
Definition at line 479 of file g729postfilter.c.
Referenced by ff_g729_postfilter().
void ff_g729_postfilter | ( | AudioDSPContext * | adsp, |
int16_t * | ht_prev_data, | ||
int * | voicing, | ||
const int16_t * | lp_filter_coeffs, | ||
int | pitch_delay_int, | ||
int16_t * | residual, | ||
int16_t * | res_filter_data, | ||
int16_t * | pos_filter_data, | ||
int16_t * | speech, | ||
int | subframe_size | ||
) |
Signal postfiltering (4.2)
dsp | initialized DSP context |
ht_prev_data | [in/out] (Q12) pointer to variable receiving tilt compensation filter data from previous subframe |
voicing | [in/out] (Q0) pointer to variable receiving voicing decision |
lp_filter_coeffs | (Q12) LP filter coefficients |
pitch_delay_int | integer part of the pitch delay |
residual | [in/out] (Q0) residual signal buffer (used in long-term postfilter) |
res_filter_data | [in/out] (Q0) speech data of previous subframe |
pos_filter_data | [in/out] (Q0) previous speech data for short-term postfilter |
speech | [in/out] (Q0) signal buffer |
subframe_size | size of subframe |
Filtering has the following stages: Long-term postfilter (4.2.1) Short-term postfilter (4.2.2). Tilt-compensation (4.2.3)
Definition at line 517 of file g729postfilter.c.
Referenced by decode_frame().
int16_t ff_g729_adaptive_gain_control | ( | int | gain_before, |
int | gain_after, | ||
int16_t * | speech, | ||
int | subframe_size, | ||
int16_t | gain_prev | ||
) |
Adaptive gain control (4.2.4)
gain_before | gain of speech before applying postfilters |
gain_after | gain of speech after applying postfilters |
speech | [in/out] signal buffer |
subframe_size | length of subframe |
gain_prev | (3.12) previous value of gain coefficient |
Definition at line 578 of file g729postfilter.c.
Referenced by decode_frame().
|
static |
short interpolation filter (of length 33, according to spec) for computing signal with non-integer delay
Definition at line 40 of file g729postfilter.c.
Referenced by long_term_filter().
|
static |
long interpolation filter (of length 129, according to spec) for computing signal with non-integer delay
Definition at line 49 of file g729postfilter.c.
Referenced by long_term_filter().
|
static |
formant_pp_factor_num_pow[i] = FORMANT_PP_FACTOR_NUM^(i+1)
Definition at line 63 of file g729postfilter.c.
Referenced by ff_g729_postfilter().
|
static |
formant_pp_factor_den_pow[i] = FORMANT_PP_FACTOR_DEN^(i+1)
Definition at line 71 of file g729postfilter.c.
Referenced by ff_g729_postfilter().