[FFmpeg-cvslog] r22932 - in trunk/libavcodec: acelp_vectors.c acelp_vectors.h amrnbdec.c sipr.c
rbultje
subversion
Wed Apr 21 19:43:53 CEST 2010
Author: rbultje
Date: Wed Apr 21 19:43:52 2010
New Revision: 22932
Log:
Split the input/output data arguments to ff_adaptive_gain_control().
Modified:
trunk/libavcodec/acelp_vectors.c
trunk/libavcodec/acelp_vectors.h
trunk/libavcodec/amrnbdec.c
trunk/libavcodec/sipr.c
Modified: trunk/libavcodec/acelp_vectors.c
==============================================================================
--- trunk/libavcodec/acelp_vectors.c Wed Apr 21 15:19:00 2010 (r22931)
+++ trunk/libavcodec/acelp_vectors.c Wed Apr 21 19:43:52 2010 (r22932)
@@ -207,11 +207,11 @@ void ff_weighted_vector_sumf(float *out,
+ weight_coeff_b * in_b[i];
}
-void ff_adaptive_gain_control(float *buf_out, float speech_energ,
+void ff_adaptive_gain_control(float *out, const float *in, float speech_energ,
int size, float alpha, float *gain_mem)
{
int i;
- float postfilter_energ = ff_dot_productf(buf_out, buf_out, size);
+ float postfilter_energ = ff_dot_productf(in, in, size);
float gain_scale_factor = 1.0;
float mem = *gain_mem;
@@ -222,7 +222,7 @@ void ff_adaptive_gain_control(float *buf
for (i = 0; i < size; i++) {
mem = alpha * mem + gain_scale_factor;
- buf_out[i] *= mem;
+ out[i] = in[i] * mem;
}
*gain_mem = mem;
Modified: trunk/libavcodec/acelp_vectors.h
==============================================================================
--- trunk/libavcodec/acelp_vectors.h Wed Apr 21 15:19:00 2010 (r22931)
+++ trunk/libavcodec/acelp_vectors.h Wed Apr 21 19:43:52 2010 (r22932)
@@ -214,13 +214,14 @@ void ff_weighted_vector_sumf(float *out,
/**
* Adaptive gain control (as used in AMR postfiltering)
*
- * @param buf_out the input speech buffer
+ * @param out output buffer for filtered speech data
+ * @param in the input speech buffer (may be the same as out)
* @param speech_energ input energy
* @param size the input buffer size
* @param alpha exponential filter factor
* @param gain_mem a pointer to the filter memory (single float of size)
*/
-void ff_adaptive_gain_control(float *buf_out, float speech_energ,
+void ff_adaptive_gain_control(float *out, const float *in, float speech_energ,
int size, float alpha, float *gain_mem);
/**
Modified: trunk/libavcodec/amrnbdec.c
==============================================================================
--- trunk/libavcodec/amrnbdec.c Wed Apr 21 15:19:00 2010 (r22931)
+++ trunk/libavcodec/amrnbdec.c Wed Apr 21 19:43:52 2010 (r22932)
@@ -943,7 +943,7 @@ static void postfilter(AMRContext *p, fl
ff_tilt_compensation(&p->tilt_mem, tilt_factor(lpc_n, lpc_d), buf_out,
AMR_SUBFRAME_SIZE);
- ff_adaptive_gain_control(buf_out, speech_gain, AMR_SUBFRAME_SIZE,
+ ff_adaptive_gain_control(buf_out, buf_out, speech_gain, AMR_SUBFRAME_SIZE,
AMR_AGC_ALPHA, &p->postfilter_agc);
}
Modified: trunk/libavcodec/sipr.c
==============================================================================
--- trunk/libavcodec/sipr.c Wed Apr 21 15:19:00 2010 (r22931)
+++ trunk/libavcodec/sipr.c Wed Apr 21 19:43:52 2010 (r22932)
@@ -479,7 +479,8 @@ static void decode_frame(SiprContext *ct
float energy = ff_dot_productf(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE,
ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE,
SUBFR_SIZE);
- ff_adaptive_gain_control(&synth[i * SUBFR_SIZE], energy,
+ ff_adaptive_gain_control(&synth[i * SUBFR_SIZE],
+ &synth[i * SUBFR_SIZE], energy,
SUBFR_SIZE, 0.9, &ctx->postfilter_agc);
}
More information about the ffmpeg-cvslog
mailing list