libavcodec/g729postfilter.h
Go to the documentation of this file.
00001 /*
00002  * G.729, G729 Annex D postfilter
00003  * Copyright (c) 2008 Vladimir Voroshilov
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 #ifndef FFMPEG_G729POSTFILTER_H
00022 #define FFMPEG_G729POSTFILTER_H
00023 
00024 #include <stdint.h>
00025 
00030 #define G729_TILT_FACTOR_PLUS       6554
00031 
00036 #define G729_TILT_FACTOR_MINUS     29491
00037 
00038 /* 4.2.2 */
00039 #define FORMANT_PP_FACTOR_NUM  18022             //0.55 in Q15
00040 #define FORMANT_PP_FACTOR_DEN  22938             //0.70 in Q15
00041 
00046 #define G729_AGC_FACTOR            32358
00047 #define G729_AGC_FAC1 (32768-G729_AGC_FACTOR)
00048 
00054 #define MIN_LT_FILT_FACTOR_A       21845
00055 
00059 #define SHORT_INT_FILT_LEN         2
00060 
00064 #define LONG_INT_FILT_LEN          8
00065 
00070 #define ANALYZED_FRAC_DELAYS       7
00071 
00075 #define RES_PREV_DATA_SIZE (PITCH_DELAY_MAX + LONG_INT_FILT_LEN + 1)
00076 
00096 void ff_g729_postfilter(DSPContext *dsp, int16_t* ht_prev_data, int* voicing,
00097                      const int16_t *lp_filter_coeffs, int pitch_delay_int,
00098                      int16_t* residual, int16_t* res_filter_data,
00099                      int16_t* pos_filter_data, int16_t *speech,
00100                      int subframe_size);
00101 
00112 int16_t ff_g729_adaptive_gain_control(int gain_before, int gain_after, int16_t *speech,
00113                                    int subframe_size, int16_t gain_prev);
00114 
00115 #endif // FFMPEG_G729POSTFILTER_H