summaryrefslogtreecommitdiff
path: root/libavcodec/g723_1.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2012-08-02 07:54:16 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2012-08-03 07:07:07 +0200
commit802bcdcb2f177b84cdf8e0197338a808fc26fbff (patch)
treec51ee373323dc25fdd3851fd5e6ddb85418e50ec /libavcodec/g723_1.c
parent8ddadea171fa38563cc1ff9a78d4cd07655c0e1b (diff)
g723_1: fix upper bound parameter from inverse maximum autocorrelation
Diffstat (limited to 'libavcodec/g723_1.c')
-rw-r--r--libavcodec/g723_1.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index 4ad74f4448..883c9498a4 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -630,7 +630,10 @@ static int autocorr_max(G723_1_Context *p, int offset, int *ccr_max,
int i;
pitch_lag = FFMIN(PITCH_MAX - 3, pitch_lag);
- limit = FFMIN(FRAME_LEN + PITCH_MAX - offset - length, pitch_lag + 3);
+ if (dir > 0)
+ limit = FFMIN(FRAME_LEN + PITCH_MAX - offset - length, pitch_lag + 3);
+ else
+ limit = pitch_lag + 3;
for (i = pitch_lag - 3; i <= limit; i++) {
ccr = dot_product(buf, buf + dir * i, length, 1);