FFmpeg
Macros | Functions
g729postfilter.h File Reference
#include <stdint.h>
#include "acelp_pitch_delay.h"
#include "audiodsp.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 More...
 
#define G729_TILT_FACTOR_MINUS   29491
 tilt compensation factor (G.729, k1<0) 0.9 in Q15 More...
 
#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 More...
 
#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 More...
 
#define SHORT_INT_FILT_LEN   2
 Short interpolation filter length. More...
 
#define LONG_INT_FILT_LEN   8
 Long interpolation filter length. More...
 
#define ANALYZED_FRAC_DELAYS   7
 Number of analyzed fractional pitch delays in second stage of long-term postfilter. More...
 
#define RES_PREV_DATA_SIZE   (PITCH_DELAY_MAX + LONG_INT_FILT_LEN + 1)
 Amount of past residual signal data stored in buffer. More...
 

Functions

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...
 

Macro Definition Documentation

◆ G729_TILT_FACTOR_PLUS

#define G729_TILT_FACTOR_PLUS   6554

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

Definition at line 32 of file g729postfilter.h.

◆ G729_TILT_FACTOR_MINUS

#define G729_TILT_FACTOR_MINUS   29491

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

Definition at line 38 of file g729postfilter.h.

◆ FORMANT_PP_FACTOR_NUM

#define FORMANT_PP_FACTOR_NUM   18022

Definition at line 41 of file g729postfilter.h.

◆ FORMANT_PP_FACTOR_DEN

#define FORMANT_PP_FACTOR_DEN   22938

Definition at line 42 of file g729postfilter.h.

◆ G729_AGC_FACTOR

#define G729_AGC_FACTOR   32358

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

Definition at line 48 of file g729postfilter.h.

◆ G729_AGC_FAC1

#define G729_AGC_FAC1   (32768-G729_AGC_FACTOR)

Definition at line 49 of file g729postfilter.h.

◆ MIN_LT_FILT_FACTOR_A

#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 56 of file g729postfilter.h.

◆ SHORT_INT_FILT_LEN

#define SHORT_INT_FILT_LEN   2

Short interpolation filter length.

Definition at line 61 of file g729postfilter.h.

◆ LONG_INT_FILT_LEN

#define LONG_INT_FILT_LEN   8

Long interpolation filter length.

Definition at line 66 of file g729postfilter.h.

◆ ANALYZED_FRAC_DELAYS

#define ANALYZED_FRAC_DELAYS   7

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

Definition at line 72 of file g729postfilter.h.

◆ RES_PREV_DATA_SIZE

#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 77 of file g729postfilter.h.

Function Documentation

◆ 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)

Parameters
dspinitialized DSP context
[in,out]ht_prev_data(Q12) pointer to variable receiving tilt compensation filter data from previous subframe
[in,out]voicing(Q0) pointer to variable receiving voicing decision
lp_filter_coeffs(Q12) LP filter coefficients
pitch_delay_intinteger part of the pitch delay
[in,out]residual(Q0) residual signal buffer (used in long-term postfilter)
[in,out]res_filter_data(Q0) speech data of previous subframe
[in,out]pos_filter_data(Q0) previous speech data for short-term postfilter
[in,out]speech(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 520 of file g729postfilter.c.

Referenced by decode_frame().

◆ ff_g729_adaptive_gain_control()

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
[in,out]speech(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
[in,out]speechsignal 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 581 of file g729postfilter.c.

Referenced by decode_frame().