From c787b51b10fc2c25e6cbeddba2c10926c689c367 Mon Sep 17 00:00:00 2001 From: Buschel Date: Mon, 22 Nov 2010 23:26:39 +0000 Subject: [PATCH] Fix bug in libatrac which lead to playback errors and/or distortions with some atrac3 files. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28642 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libatrac/atrac3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c index 22e787d6e3..499a9f6572 100644 --- a/apps/codecs/libatrac/atrac3.c +++ b/apps/codecs/libatrac/atrac3.c @@ -666,7 +666,7 @@ static void applyFixGain (int32_t *pIn, int32_t *pPrev, int32_t *pOut, if (ONE_16 == gain) { /* gain1 = 1.0 -> no multiplication needed, just adding */ /* Remark: This path is called >90%. */ - do { + while (i<256) { pOut[i] = pIn[i] + pPrev[i]; i++; pOut[i] = pIn[i] + pPrev[i]; i++; pOut[i] = pIn[i] + pPrev[i]; i++; @@ -675,11 +675,11 @@ static void applyFixGain (int32_t *pIn, int32_t *pPrev, int32_t *pOut, pOut[i] = pIn[i] + pPrev[i]; i++; pOut[i] = pIn[i] + pPrev[i]; i++; pOut[i] = pIn[i] + pPrev[i]; i++; - } while (i<256); + }; } else { /* gain1 != 1.0 -> we need to do a multiplication */ /* Remark: This path is called seldom. */ - do { + while (i<256) { pOut[i] = fixmul16(pIn[i], gain) + pPrev[i]; i++; pOut[i] = fixmul16(pIn[i], gain) + pPrev[i]; i++; pOut[i] = fixmul16(pIn[i], gain) + pPrev[i]; i++; @@ -688,7 +688,7 @@ static void applyFixGain (int32_t *pIn, int32_t *pPrev, int32_t *pOut, pOut[i] = fixmul16(pIn[i], gain) + pPrev[i]; i++; pOut[i] = fixmul16(pIn[i], gain) + pPrev[i]; i++; pOut[i] = fixmul16(pIn[i], gain) + pPrev[i]; i++; - } while (i<256); + }; } } -- 2.11.4.GIT