[FFmpeg-devel] [PATCH]Fix an endless loop when decoding amr-nb

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Dec 16 02:52:22 CET 2011


Hi!

Attached patch fixes an endless loop with the sample from bug 151 for me.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/acelp_vectors.c b/libavcodec/acelp_vectors.c
index a44ab8c..5916b88 100644
--- a/libavcodec/acelp_vectors.c
+++ b/libavcodec/acelp_vectors.c
@@ -237,6 +237,7 @@ void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size)
         int x   = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1);
         float y = in->y[i] * scale;
 
+        if (in->pitch_lag)
         do {
             out[x] += y;
             y *= in->pitch_fac;
@@ -252,6 +253,7 @@ void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size)
     for (i=0; i < in->n; i++) {
         int x  = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1);
 
+        if (in->pitch_lag)
         do {
             out[x] = 0.0;
             x += in->pitch_lag;


More information about the ffmpeg-devel mailing list