mirror of https://github.com/mstorsjo/fdk-aac.git
Improve random phase table accuracy.
Bug: 132641988 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: Ifca82aec87c0d21871d1f181b1be635c419433ee
This commit is contained in:
parent
2ef020c93a
commit
818743f718
|
@ -2439,8 +2439,7 @@ static void adjustTimeSlot_EldGrid(
|
||||||
sbNoise = *pNoiseLevel++;
|
sbNoise = *pNoiseLevel++;
|
||||||
if (((INT)sineLevel_curr | noNoiseFlag) == 0) {
|
if (((INT)sineLevel_curr | noNoiseFlag) == 0) {
|
||||||
signalReal +=
|
signalReal +=
|
||||||
(fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise)
|
fMult(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise);
|
||||||
<< 4);
|
|
||||||
}
|
}
|
||||||
signalReal += sineLevel_curr * p_harmonicPhase[0];
|
signalReal += sineLevel_curr * p_harmonicPhase[0];
|
||||||
signalReal =
|
signalReal =
|
||||||
|
@ -2474,8 +2473,7 @@ static void adjustTimeSlot_EldGrid(
|
||||||
sbNoise = *pNoiseLevel++;
|
sbNoise = *pNoiseLevel++;
|
||||||
if (((INT)sineLevel_curr | noNoiseFlag) == 0) {
|
if (((INT)sineLevel_curr | noNoiseFlag) == 0) {
|
||||||
signalReal +=
|
signalReal +=
|
||||||
(fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise)
|
fMult(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise);
|
||||||
<< 4);
|
|
||||||
}
|
}
|
||||||
signalReal += sineLevel_curr * p_harmonicPhase[0];
|
signalReal += sineLevel_curr * p_harmonicPhase[0];
|
||||||
*ptrReal++ = signalReal;
|
*ptrReal++ = signalReal;
|
||||||
|
@ -2535,8 +2533,7 @@ static void adjustTimeSlotLC(
|
||||||
else if (!noNoiseFlag)
|
else if (!noNoiseFlag)
|
||||||
/* Add noisefloor to the amplified signal */
|
/* Add noisefloor to the amplified signal */
|
||||||
signalReal +=
|
signalReal +=
|
||||||
(fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0])
|
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]);
|
||||||
<< 4);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!(harmIndex & 0x1)) {
|
if (!(harmIndex & 0x1)) {
|
||||||
|
@ -2583,9 +2580,8 @@ static void adjustTimeSlotLC(
|
||||||
!noNoiseFlag) {
|
!noNoiseFlag) {
|
||||||
/* Add noisefloor to the amplified signal */
|
/* Add noisefloor to the amplified signal */
|
||||||
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
||||||
signalReal += (fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0],
|
signalReal +=
|
||||||
pNoiseLevel[0])
|
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]);
|
||||||
<< 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The next multiplication constitutes the actual envelope adjustment of
|
/* The next multiplication constitutes the actual envelope adjustment of
|
||||||
|
@ -2610,9 +2606,8 @@ static void adjustTimeSlotLC(
|
||||||
else if (!noNoiseFlag) {
|
else if (!noNoiseFlag) {
|
||||||
/* Add noisefloor to the amplified signal */
|
/* Add noisefloor to the amplified signal */
|
||||||
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
||||||
signalReal += (fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0],
|
signalReal +=
|
||||||
pNoiseLevel[0])
|
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]);
|
||||||
<< 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pNoiseLevel++;
|
pNoiseLevel++;
|
||||||
|
@ -2641,10 +2636,8 @@ static void adjustTimeSlotLC(
|
||||||
else if (!noNoiseFlag) {
|
else if (!noNoiseFlag) {
|
||||||
/* Add noisefloor to the amplified signal */
|
/* Add noisefloor to the amplified signal */
|
||||||
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
||||||
signalReal =
|
signalReal = signalReal + fMult(FDK_sbrDecoder_sbr_randomPhase[index][0],
|
||||||
signalReal +
|
pNoiseLevel[0]);
|
||||||
(fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0])
|
|
||||||
<< 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(harmIndex & 0x1)) {
|
if (!(harmIndex & 0x1)) {
|
||||||
|
@ -2749,11 +2742,9 @@ static void adjustTimeSlotHQ_GainAndNoise(
|
||||||
/* Add noisefloor to the amplified signal */
|
/* Add noisefloor to the amplified signal */
|
||||||
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
||||||
noiseReal =
|
noiseReal =
|
||||||
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise)
|
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise);
|
||||||
<< 4;
|
|
||||||
noiseImag =
|
noiseImag =
|
||||||
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise)
|
fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise);
|
||||||
<< 4;
|
|
||||||
*ptrReal++ = (signalReal + noiseReal);
|
*ptrReal++ = (signalReal + noiseReal);
|
||||||
*ptrImag++ = (signalImag + noiseImag);
|
*ptrImag++ = (signalImag + noiseImag);
|
||||||
}
|
}
|
||||||
|
@ -2771,13 +2762,12 @@ static void adjustTimeSlotHQ_GainAndNoise(
|
||||||
smoothedNoise = noiseLevel[k];
|
smoothedNoise = noiseLevel[k];
|
||||||
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
||||||
noiseReal =
|
noiseReal =
|
||||||
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise);
|
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise);
|
||||||
noiseImag =
|
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;
|
||||||
signalReal += noiseReal << 4;
|
signalImag += noiseImag;
|
||||||
signalImag += noiseImag << 4;
|
|
||||||
}
|
}
|
||||||
*ptrReal++ = signalReal;
|
*ptrReal++ = signalReal;
|
||||||
*ptrImag++ = signalImag;
|
*ptrImag++ = signalImag;
|
||||||
|
@ -2952,13 +2942,10 @@ static void adjustTimeSlotHQ(
|
||||||
} else {
|
} else {
|
||||||
/* Add noisefloor to the amplified signal */
|
/* Add noisefloor to the amplified signal */
|
||||||
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
||||||
/* FDK_sbrDecoder_sbr_randomPhase is downscaled by 2^3 */
|
|
||||||
noiseReal =
|
noiseReal =
|
||||||
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise)
|
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise);
|
||||||
<< 4;
|
|
||||||
noiseImag =
|
noiseImag =
|
||||||
fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise)
|
fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise);
|
||||||
<< 4;
|
|
||||||
*ptrReal++ = (signalReal + noiseReal);
|
*ptrReal++ = (signalReal + noiseReal);
|
||||||
*ptrImag++ = (signalImag + noiseImag);
|
*ptrImag++ = (signalImag + noiseImag);
|
||||||
}
|
}
|
||||||
|
@ -3000,14 +2987,13 @@ static void adjustTimeSlotHQ(
|
||||||
/* Add noisefloor to the amplified signal */
|
/* Add noisefloor to the amplified signal */
|
||||||
smoothedNoise = noiseLevel[k];
|
smoothedNoise = noiseLevel[k];
|
||||||
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
index &= (SBR_NF_NO_RANDOM_VAL - 1);
|
||||||
noiseReal = fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0],
|
noiseReal =
|
||||||
smoothedNoise);
|
fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise);
|
||||||
noiseImag = fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1],
|
noiseImag =
|
||||||
smoothedNoise);
|
fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise);
|
||||||
|
|
||||||
/* FDK_sbrDecoder_sbr_randomPhase is downscaled by 2^3 */
|
signalReal += noiseReal;
|
||||||
signalReal += noiseReal << 4;
|
signalImag += noiseImag;
|
||||||
signalImag += noiseImag << 4;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*ptrReal++ = signalReal;
|
*ptrReal++ = signalReal;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue