diff --git a/src/lib/exhaleEnc.cpp b/src/lib/exhaleEnc.cpp index a5f76a4..4af64d1 100644 --- a/src/lib/exhaleEnc.cpp +++ b/src/lib/exhaleEnc.cpp @@ -731,9 +731,8 @@ unsigned ExhaleEncoder::getOptParCorCoeffs (const SfbGroupData& grpData, const u predGainCurr = (temp >> 24) & UCHAR_MAX; predGainPrev = (temp >> 16) & UCHAR_MAX; - while ((bestOrder > 1) && (predGainPrev >= predGainCurr)) // lowest-order gain max. + while ((predGainPrev >= predGainCurr) && --bestOrder > 1) // lowest-order gain max. { - bestOrder--; predGainCurr = predGainPrev; predGainPrev = (temp >> (8 * bestOrder - 16)) & UCHAR_MAX; } diff --git a/src/lib/specAnalysis.cpp b/src/lib/specAnalysis.cpp index f1e79b2..24f95cb 100644 --- a/src/lib/specAnalysis.cpp +++ b/src/lib/specAnalysis.cpp @@ -66,9 +66,8 @@ unsigned SpecAnalyzer::getLinPredCoeffs (short parCorCoeffs[MAX_PREDICTION_ORDER predGainCurr = (m_tnsPredGains[channelIndex] >> 24) & UCHAR_MAX; predGainPrev = (m_tnsPredGains[channelIndex] >> 16) & UCHAR_MAX; - while ((bestOrder > 1) && (predGainPrev >= predGainCurr)) // find lowest-order gain maximum + while ((predGainPrev >= predGainCurr) && --bestOrder > 1) // find lowest-order gain maximum { - bestOrder--; predGainCurr = predGainPrev; predGainPrev = (m_tnsPredGains[channelIndex] >> (8 * bestOrder - 16)) & UCHAR_MAX; }