Improve random phase table accuracy.

Bug: 132641988
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc

Change-Id: Ifca82aec87c0d21871d1f181b1be635c419433ee
This commit is contained in:
Fraunhofer IIS FDK 2019-03-08 16:10:05 +01:00 committed by Jean-Michel Trivi
parent 2ef020c93a
commit 818743f718
2 changed files with 536 additions and 1062 deletions

View File

@ -2439,8 +2439,7 @@ static void adjustTimeSlot_EldGrid(
sbNoise = *pNoiseLevel++;
if (((INT)sineLevel_curr | noNoiseFlag) == 0) {
signalReal +=
(fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise)
<< 4);
fMult(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise);
}
signalReal += sineLevel_curr * p_harmonicPhase[0];
signalReal =
@ -2474,8 +2473,7 @@ static void adjustTimeSlot_EldGrid(
sbNoise = *pNoiseLevel++;
if (((INT)sineLevel_curr | noNoiseFlag) == 0) {
signalReal +=
(fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise)
<< 4);
fMult(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise);
}
signalReal += sineLevel_curr * p_harmonicPhase[0];
*ptrReal++ = signalReal;
@ -2535,8 +2533,7 @@ static void adjustTimeSlotLC(
else if (!noNoiseFlag)
/* Add noisefloor to the amplified signal */
signalReal +=
(fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0])
<< 4);
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]);
{
if (!(harmIndex & 0x1)) {
@ -2583,9 +2580,8 @@ static void adjustTimeSlotLC(
!noNoiseFlag) {
/* Add noisefloor to the amplified signal */
index &= (SBR_NF_NO_RANDOM_VAL - 1);
signalReal += (fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0],
pNoiseLevel[0])
<< 4);
signalReal +=
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]);
}
/* The next multiplication constitutes the actual envelope adjustment of
@ -2610,9 +2606,8 @@ static void adjustTimeSlotLC(
else if (!noNoiseFlag) {
/* Add noisefloor to the amplified signal */
index &= (SBR_NF_NO_RANDOM_VAL - 1);
signalReal += (fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0],
pNoiseLevel[0])
<< 4);
signalReal +=
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]);
}
pNoiseLevel++;
@ -2641,10 +2636,8 @@ static void adjustTimeSlotLC(
else if (!noNoiseFlag) {
/* Add noisefloor to the amplified signal */
index &= (SBR_NF_NO_RANDOM_VAL - 1);
signalReal =
signalReal +
(fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0])
<< 4);
signalReal = signalReal + fMult(FDK_sbrDecoder_sbr_randomPhase[index][0],
pNoiseLevel[0]);
}
if (!(harmIndex & 0x1)) {
@ -2749,11 +2742,9 @@ static void adjustTimeSlotHQ_GainAndNoise(
/* Add noisefloor to the amplified signal */
index &= (SBR_NF_NO_RANDOM_VAL - 1);
noiseReal =
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise)
<< 4;
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise);
noiseImag =
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise)
<< 4;
fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise);
*ptrReal++ = (signalReal + noiseReal);
*ptrImag++ = (signalImag + noiseImag);
}
@ -2771,13 +2762,12 @@ static void adjustTimeSlotHQ_GainAndNoise(
smoothedNoise = noiseLevel[k];
index &= (SBR_NF_NO_RANDOM_VAL - 1);
noiseReal =
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise);
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise);
noiseImag =
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise);
fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise);
/* FDK_sbrDecoder_sbr_randomPhase is downscaled by 2^3 */
signalReal += noiseReal << 4;
signalImag += noiseImag << 4;
signalReal += noiseReal;
signalImag += noiseImag;
}
*ptrReal++ = signalReal;
*ptrImag++ = signalImag;
@ -2952,13 +2942,10 @@ static void adjustTimeSlotHQ(
} else {
/* Add noisefloor to the amplified signal */
index &= (SBR_NF_NO_RANDOM_VAL - 1);
/* FDK_sbrDecoder_sbr_randomPhase is downscaled by 2^3 */
noiseReal =
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise)
<< 4;
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise);
noiseImag =
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise)
<< 4;
fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise);
*ptrReal++ = (signalReal + noiseReal);
*ptrImag++ = (signalImag + noiseImag);
}
@ -3000,14 +2987,13 @@ static void adjustTimeSlotHQ(
/* Add noisefloor to the amplified signal */
smoothedNoise = noiseLevel[k];
index &= (SBR_NF_NO_RANDOM_VAL - 1);
noiseReal = fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0],
smoothedNoise);
noiseImag = fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1],
smoothedNoise);
noiseReal =
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise);
noiseImag =
fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise);
/* FDK_sbrDecoder_sbr_randomPhase is downscaled by 2^3 */
signalReal += noiseReal << 4;
signalImag += noiseImag << 4;
signalReal += noiseReal;
signalImag += noiseImag;
}
}
*ptrReal++ = signalReal;

File diff suppressed because it is too large Load Diff