From 1b61303fc7e61f87539d3398c8c5ed3343b60b8d Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@jmvalin.ca>
Date: Tue, 9 Oct 2012 20:18:28 -0400
Subject: [PATCH] Fixes a bug in the LSB_DEPTH code introduced in cf1053dc

---
 celt/celt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/celt/celt.c b/celt/celt.c
index 4bb935009..f7a2eeee9 100644
--- a/celt/celt.c
+++ b/celt/celt.c
@@ -1174,8 +1174,8 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
 
    ALLOC(in, CC*(N+st->overlap), celt_sig);
 
-   sample_max=MAX16(st->overlap_max, celt_maxabs16(pcm, C*(N-st->mode->overlap)));
-   st->overlap_max=celt_maxabs16(pcm+C*(N-st->mode->overlap), C*st->mode->overlap);
+   sample_max=MAX16(st->overlap_max, celt_maxabs16(pcm, C*(N-st->mode->overlap)/st->upsample));
+   st->overlap_max=celt_maxabs16(pcm+C*(N-st->mode->overlap)/st->upsample, C*st->mode->overlap/st->upsample);
    sample_max=MAX16(sample_max, st->overlap_max);
    /* Find pitch period and gain */
    {
-- 
GitLab