FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
g729postfilter.h File Reference
#include <stdint.h>
#include "dsputil.h"

Go to the source code of this file.

Macros

#define G729_TILT_FACTOR_PLUS   6554
 tilt compensation factor (G.729, k1>0) 0.2 in Q15
 
#define G729_TILT_FACTOR_MINUS   29491
 tilt compensation factor (G.729, k1<0) 0.9 in Q15
 
#define FORMANT_PP_FACTOR_NUM   18022
 
#define FORMANT_PP_FACTOR_DEN   22938
 
#define G729_AGC_FACTOR   32358
 gain adjustment factor (G.729, 4.2.4) 0.9875 in Q15
 
#define G729_AGC_FAC1   (32768-G729_AGC_FACTOR)
 
#define MIN_LT_FILT_FACTOR_A   21845
 1.0 / (1.0 + 0.5) in Q15 where 0.5 is the minimum value of weight factor, controlling amount of long-term postfiltering
 
#define SHORT_INT_FILT_LEN   2
 Short interpolation filter length.
 
#define LONG_INT_FILT_LEN   8
 Long interpolation filter length.
 
#define ANALYZED_FRAC_DELAYS   7
 Number of analyzed fractional pitch delays in second stage of long-term postfilter.
 
#define RES_PREV_DATA_SIZE   (PITCH_DELAY_MAX + LONG_INT_FILT_LEN + 1)
 Amount of past residual signal data stored in buffer.
 

Functions

void ff_g729_postfilter (DSPContext *dsp, 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)
 
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)
 

Macro Definition Documentation

#define G729_TILT_FACTOR_PLUS   6554

tilt compensation factor (G.729, k1>0) 0.2 in Q15

Definition at line 31 of file g729postfilter.h.

Referenced by apply_tilt_comp().

#define G729_TILT_FACTOR_MINUS   29491

tilt compensation factor (G.729, k1<0) 0.9 in Q15

Definition at line 37 of file g729postfilter.h.

Referenced by apply_tilt_comp().

#define FORMANT_PP_FACTOR_NUM   18022

Definition at line 40 of file g729postfilter.h.

#define FORMANT_PP_FACTOR_DEN   22938

Definition at line 41 of file g729postfilter.h.

#define G729_AGC_FACTOR   32358

gain adjustment factor (G.729, 4.2.4) 0.9875 in Q15

Definition at line 47 of file g729postfilter.h.

Referenced by ff_g729_adaptive_gain_control().

#define G729_AGC_FAC1   (32768-G729_AGC_FACTOR)

Definition at line 48 of file g729postfilter.h.

Referenced by ff_g729_adaptive_gain_control().

#define MIN_LT_FILT_FACTOR_A   21845

1.0 / (1.0 + 0.5) in Q15 where 0.5 is the minimum value of weight factor, controlling amount of long-term postfiltering

Definition at line 55 of file g729postfilter.h.

Referenced by long_term_filter().

#define SHORT_INT_FILT_LEN   2

Short interpolation filter length.

Definition at line 60 of file g729postfilter.h.

Referenced by long_term_filter().

#define LONG_INT_FILT_LEN   8

Long interpolation filter length.

Definition at line 65 of file g729postfilter.h.

Referenced by long_term_filter().

#define ANALYZED_FRAC_DELAYS   7

Number of analyzed fractional pitch delays in second stage of long-term postfilter.

Definition at line 71 of file g729postfilter.h.

Referenced by long_term_filter().

#define RES_PREV_DATA_SIZE   (PITCH_DELAY_MAX + LONG_INT_FILT_LEN + 1)

Amount of past residual signal data stored in buffer.

Definition at line 76 of file g729postfilter.h.

Referenced by ff_g729_postfilter(), and long_term_filter().

Function Documentation

void ff_g729_postfilter ( DSPContext dsp,
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)

Parameters
dspinitialized 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_intinteger 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_sizesize 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 514 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)

Parameters
gain_before(Q0) gain of speech before applying postfilters
gain_after(Q0) gain of speech after applying postfilters
speech[in/out] (Q0) signal buffer
subframe_sizelength of subframe
gain_prev(Q12) previous value of gain coefficient
Returns
(Q12) last value of gain coefficient
Parameters
gain_beforegain of speech before applying postfilters
gain_aftergain of speech after applying postfilters
speech[in/out] signal buffer
subframe_sizelength of subframe
gain_prev(3.12) previous value of gain coefficient
Returns
(3.12) last value of gain coefficient

Definition at line 574 of file g729postfilter.c.

Referenced by decode_frame().