summaryrefslogtreecommitdiff
path: root/libavcodec/g729postfilter.h
diff options
context:
space:
mode:
authorVladimir Voroshilov <voroshil@gmail.com>2009-06-28 21:01:23 +0700
committerMichael Niedermayer <michaelni@gmx.at>2011-09-24 21:11:01 +0200
commit682337672cd38b8e85acf11578a5130fa87ea1d7 (patch)
tree9f667e00a6f95bce67f65cb466690939c69ad1a0 /libavcodec/g729postfilter.h
parentaca516cd676f5646004c649dc614760b937f4624 (diff)
downloadffmpeg-682337672cd38b8e85acf11578a5130fa87ea1d7.tar.gz
Adaptive gain control
Diffstat (limited to 'libavcodec/g729postfilter.h')
-rw-r--r--libavcodec/g729postfilter.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/g729postfilter.h b/libavcodec/g729postfilter.h
index 07667994d5..956cde9ab7 100644
--- a/libavcodec/g729postfilter.h
+++ b/libavcodec/g729postfilter.h
@@ -40,6 +40,13 @@
#define FORMANT_PP_FACTOR_DEN 22938 //0.70 in Q15
/**
+ * gain adjustment factor (G.729, 4.2.4)
+ * 0.9875 in Q15
+ */
+#define G729_AGC_FACTOR 32358
+#define G729_AGC_FAC1 (32768-G729_AGC_FACTOR)
+
+/**
* 1.0 / (1.0 + 0.5) in Q15
* where 0.5 is the minimum value of
* weight factor, controlling amount of long-term postfiltering
@@ -92,4 +99,17 @@ void g729_postfilter(DSPContext *dsp, int16_t* ht_prev_data, int16_t* voicing,
int16_t* pos_filter_data, int16_t *speech,
int subframe_size);
+/**
+ * \brief Adaptive gain control (4.2.4)
+ * \param gain_before (Q0) gain of speech before applying postfilters
+ * \param gain_after (Q0) gain of speech after applying postfilters
+ * \param speech [in/out] (Q0) signal buffer
+ * \param subframe_size length of subframe
+ * \param gain_prev (Q12) previous value of gain coefficient
+ *
+ * \return (Q12) last value of gain coefficient
+ */
+int16_t g729_adaptive_gain_control(int gain_before, int gain_after, int16_t *speech,
+ int subframe_size, int16_t gain_prev);
+
#endif // FFMPEG_G729POSTFILTER_H