Improve random phase table accuracy. am: 818743f718

am: 5871d262db

Change-Id: Idf934c1b9660ebafe22510c1909ad94967cd3978
This commit is contained in:
Fraunhofer IIS FDK 2019-05-15 09:34:58 -07:00 committed by android-build-merger
commit 6a3ca8a76d
2 changed files with 536 additions and 1062 deletions

View File

@ -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