FFmpeg  1.2.4
g729postfilter.h
Go to the documentation of this file.
1 /*
2  * G.729, G729 Annex D postfilter
3  * Copyright (c) 2008 Vladimir Voroshilov
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef FFMPEG_G729POSTFILTER_H
22 #define FFMPEG_G729POSTFILTER_H
23 
24 #include <stdint.h>
25 #include "dsputil.h"
26 
31 #define G729_TILT_FACTOR_PLUS 6554
32 
37 #define G729_TILT_FACTOR_MINUS 29491
38 
39 /* 4.2.2 */
40 #define FORMANT_PP_FACTOR_NUM 18022 //0.55 in Q15
41 #define FORMANT_PP_FACTOR_DEN 22938 //0.70 in Q15
42 
47 #define G729_AGC_FACTOR 32358
48 #define G729_AGC_FAC1 (32768-G729_AGC_FACTOR)
49 
55 #define MIN_LT_FILT_FACTOR_A 21845
56 
60 #define SHORT_INT_FILT_LEN 2
61 
65 #define LONG_INT_FILT_LEN 8
66 
71 #define ANALYZED_FRAC_DELAYS 7
72 
76 #define RES_PREV_DATA_SIZE (PITCH_DELAY_MAX + LONG_INT_FILT_LEN + 1)
77 
97 void ff_g729_postfilter(DSPContext *dsp, int16_t* ht_prev_data, int* voicing,
98  const int16_t *lp_filter_coeffs, int pitch_delay_int,
99  int16_t* residual, int16_t* res_filter_data,
100  int16_t* pos_filter_data, int16_t *speech,
101  int subframe_size);
102 
113 int16_t ff_g729_adaptive_gain_control(int gain_before, int gain_after, int16_t *speech,
114  int subframe_size, int16_t gain_prev);
115 
116 #endif // FFMPEG_G729POSTFILTER_H