diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-28 14:04:43 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-28 14:24:27 +0100 |
commit | c73fcc8de3e314304819eed89216727a20e5e8a0 (patch) | |
tree | badd72ed694f9712c3cfdc92bac9f88f97e6b106 /libavcodec/amrwbdec.c | |
parent | 8943ad40146d322f5a5bf2bab790d117ec7a4c37 (diff) | |
parent | 424b1e764263b1493de4c34365ef367ddae856db (diff) | |
download | ffmpeg-c73fcc8de3e314304819eed89216727a20e5e8a0.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
yuv4mpeg: reject unsupported codecs
nutenc: K&R formatting cosmetics
assdec: fix qsort() callback signature
configure: detect sparc64 automatically
vp8: fix memset() crossing array boundary
h264: fix invalid pointer arithmetic
amrwbdec: fix invalid pointer arithmetic
Conflicts:
libavformat/nutenc.c
libavformat/yuv4mpeg.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/amrwbdec.c')
-rw-r--r-- | libavcodec/amrwbdec.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 7e45f42554..eaaf66bf00 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -918,10 +918,9 @@ static float auto_correlation(float *diff_isf, float mean, int lag) static void extrapolate_isf(float isf[LP_ORDER_16k]) { float diff_isf[LP_ORDER - 2], diff_mean; - float *diff_hi = diff_isf - LP_ORDER + 1; // diff array for extrapolated indexes float corr_lag[3]; float est, scale; - int i, i_max_corr; + int i, j, i_max_corr; isf[LP_ORDER_16k - 1] = isf[LP_ORDER - 1]; @@ -952,20 +951,20 @@ static void extrapolate_isf(float isf[LP_ORDER_16k]) scale = 0.5 * (FFMIN(est, 7600) - isf[LP_ORDER - 2]) / (isf[LP_ORDER_16k - 2] - isf[LP_ORDER - 2]); - for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++) - diff_hi[i] = scale * (isf[i] - isf[i - 1]); + for (i = LP_ORDER - 1, j = 0; i < LP_ORDER_16k - 1; i++, j++) + diff_isf[j] = scale * (isf[i] - isf[i - 1]); /* Stability insurance */ - for (i = LP_ORDER; i < LP_ORDER_16k - 1; i++) - if (diff_hi[i] + diff_hi[i - 1] < 5.0) { - if (diff_hi[i] > diff_hi[i - 1]) { - diff_hi[i - 1] = 5.0 - diff_hi[i]; + for (i = 1; i < LP_ORDER_16k - LP_ORDER; i++) + if (diff_isf[i] + diff_isf[i - 1] < 5.0) { + if (diff_isf[i] > diff_isf[i - 1]) { + diff_isf[i - 1] = 5.0 - diff_isf[i]; } else - diff_hi[i] = 5.0 - diff_hi[i - 1]; + diff_isf[i] = 5.0 - diff_isf[i - 1]; } - for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++) - isf[i] = isf[i - 1] + diff_hi[i] * (1.0f / (1 << 15)); + for (i = LP_ORDER - 1, j = 0; i < LP_ORDER_16k - 1; i++, j++) + isf[i] = isf[i - 1] + diff_isf[j] * (1.0f / (1 << 15)); /* Scale the ISF vector for 16000 Hz */ for (i = 0; i < LP_ORDER_16k - 1; i++) |