mirror of https://github.com/mstorsjo/fdk-aac.git
Snap for 5571274 from dc920b39e5
to rvc-release
Change-Id: If61eb33f0d0965a0503e5b49d09566e3de5087ae
This commit is contained in:
commit
a410a74fcc
|
@ -1,7 +1,7 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
||||
|
||||
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
Forschung e.V. All rights reserved.
|
||||
|
||||
1. INTRODUCTION
|
||||
|
@ -1761,6 +1761,10 @@ AACENC_ERROR aacEncEncode(const HANDLE_AACENCODER hAacEncoder,
|
|||
hAacEncoder->inputBuffer +
|
||||
(hAacEncoder->inputBufferOffset + hAacEncoder->nSamplesRead) /
|
||||
hAacEncoder->aacConfig.nChannels;
|
||||
newSamples -=
|
||||
(newSamples %
|
||||
hAacEncoder->extParam
|
||||
.nChannels); /* process multiple samples of input channels */
|
||||
|
||||
/* Copy new input samples to internal buffer */
|
||||
if (inBufDesc->bufElSizes[idx] == (INT)sizeof(INT_PCM)) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
||||
|
||||
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
Forschung e.V. All rights reserved.
|
||||
|
||||
1. INTRODUCTION
|
||||
|
@ -123,7 +123,7 @@ void scaleValues(FIXP_DBL *dst, const FIXP_DBL *src, INT len, INT scalefactor);
|
|||
#if (SAMPLE_BITS == 16)
|
||||
void scaleValues(FIXP_PCM *dst, const FIXP_DBL *src, INT len, INT scalefactor);
|
||||
#endif
|
||||
void scaleValues(FIXP_PCM *dst, const FIXP_SGL *src, INT len, INT scalefactor);
|
||||
void scaleValues(FIXP_SGL *dst, const FIXP_SGL *src, INT len, INT scalefactor);
|
||||
void scaleCplxValues(FIXP_DBL *r_dst, FIXP_DBL *i_dst, const FIXP_DBL *r_src,
|
||||
const FIXP_DBL *i_src, INT len, INT scalefactor);
|
||||
void scaleValuesWithFactor(FIXP_DBL *vector, FIXP_DBL factor, INT len,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
||||
|
||||
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
Forschung e.V. All rights reserved.
|
||||
|
||||
1. INTRODUCTION
|
||||
|
@ -474,80 +474,6 @@ static const FIXP_DBL CLD_m[N_CLD] = {
|
|||
FL2FXCONST_DBL(0.888178419700125),
|
||||
};
|
||||
|
||||
static FIXP_DBL dequantIPD_CLD_ICC_splitAngle__FDK_Function(INT ipdIdx,
|
||||
INT cldIdx,
|
||||
INT iccIdx) {
|
||||
FIXP_DBL cld;
|
||||
SpatialDequantGetCLD2Values(cldIdx, &cld);
|
||||
|
||||
/*const FIXP_DBL one_m = (FIXP_DBL)MAXVAL_DBL;
|
||||
const int one_e = 0;*/
|
||||
const FIXP_DBL one_m = FL2FXCONST_DBL(0.5f);
|
||||
const int one_e = 1;
|
||||
/* iidLin = sqrt(cld); */
|
||||
FIXP_DBL iidLin_m = sqrt_CLD_m[cldIdx];
|
||||
int iidLin_e = sqrt_CLD_e[cldIdx];
|
||||
/* iidLin2 = cld; */
|
||||
FIXP_DBL iidLin2_m = CLD_m[cldIdx];
|
||||
int iidLin2_e = sqrt_CLD_e[cldIdx] << 1;
|
||||
/* iidLin21 = iidLin2 + 1.0f; */
|
||||
int iidLin21_e;
|
||||
FIXP_DBL iidLin21_m =
|
||||
fAddNorm(iidLin2_m, iidLin2_e, one_m, one_e, &iidLin21_e);
|
||||
/* iidIcc2 = iidLin * icc * 2.0f; */
|
||||
FIXP_CFG icc = dequantICC__FDK[iccIdx];
|
||||
FIXP_DBL temp1_m, temp1c_m;
|
||||
int temp1_e, temp1c_e;
|
||||
temp1_m = fMult(iidLin_m, icc);
|
||||
temp1_e = iidLin_e + 1;
|
||||
|
||||
FIXP_DBL cosIpd, sinIpd;
|
||||
cosIpd = COS_IPD(ipdIdx);
|
||||
sinIpd = SIN_IPD(ipdIdx);
|
||||
|
||||
temp1c_m = fMult(temp1_m, cosIpd);
|
||||
temp1c_e = temp1_e; //+cosIpd_e;
|
||||
|
||||
int temp2_e, temp3_e, inv_temp3_e, ratio_e;
|
||||
FIXP_DBL temp2_m =
|
||||
fAddNorm(iidLin21_m, iidLin21_e, temp1c_m, temp1c_e, &temp2_e);
|
||||
FIXP_DBL temp3_m =
|
||||
fAddNorm(iidLin21_m, iidLin21_e, temp1_m, temp1_e, &temp3_e);
|
||||
/* calculate 1/temp3 needed later */
|
||||
inv_temp3_e = temp3_e;
|
||||
FIXP_DBL inv_temp3_m = invFixp(temp3_m, &inv_temp3_e);
|
||||
FIXP_DBL ratio_m =
|
||||
fAddNorm(fMult(inv_temp3_m, temp2_m), (inv_temp3_e + temp2_e),
|
||||
FL2FXCONST_DBL(1e-9f), 0, &ratio_e);
|
||||
|
||||
int weight2_e, tempb_atan2_e;
|
||||
FIXP_DBL weight2_m =
|
||||
fPow(ratio_m, ratio_e, FL2FXCONST_DBL(0.5f), -1, &weight2_e);
|
||||
/* atan2(w2*sinIpd, w1*iidLin + w2*cosIpd) = atan2(w2*sinIpd, (2 - w2)*iidLin
|
||||
* + w2*cosIpd) = atan2(w2*sinIpd, 2*iidLin + w2*(cosIpd - iidLin)); */
|
||||
/* tmpa_atan2 = w2*sinIpd; tmpb_atan2 = 2*iidLin + w2*(cosIpd - iidLin); */
|
||||
FIXP_DBL tempb_atan2_m = iidLin_m;
|
||||
tempb_atan2_e = iidLin_e + 1;
|
||||
int add_tmp1_e = 0;
|
||||
FIXP_DBL add_tmp1_m = fAddNorm(cosIpd, 0, -iidLin_m, iidLin_e, &add_tmp1_e);
|
||||
FIXP_DBL add_tmp2_m = fMult(add_tmp1_m, weight2_m);
|
||||
int add_tmp2_e = add_tmp1_e + weight2_e;
|
||||
tempb_atan2_m = fAddNorm(tempb_atan2_m, tempb_atan2_e, add_tmp2_m, add_tmp2_e,
|
||||
&tempb_atan2_e);
|
||||
|
||||
FIXP_DBL tempa_atan2_m = fMult(weight2_m, sinIpd);
|
||||
int tempa_atan2_e = weight2_e; // + sinIpd_e;
|
||||
|
||||
if (tempa_atan2_e > tempb_atan2_e) {
|
||||
tempb_atan2_m = (tempb_atan2_m >> (tempa_atan2_e - tempb_atan2_e));
|
||||
tempb_atan2_e = tempa_atan2_e;
|
||||
} else if (tempb_atan2_e > tempa_atan2_e) {
|
||||
tempa_atan2_m = (tempa_atan2_m >> (tempb_atan2_e - tempa_atan2_e));
|
||||
}
|
||||
|
||||
return fixp_atan2(tempa_atan2_m, tempb_atan2_m);
|
||||
}
|
||||
|
||||
static void calculateOpd(spatialDec* self, INT ottBoxIndx, INT parameterSetIndx,
|
||||
FIXP_DBL opd[MAX_PARAMETER_BANDS]) {
|
||||
INT band;
|
||||
|
@ -563,12 +489,12 @@ static void calculateOpd(spatialDec* self, INT ottBoxIndx, INT parameterSetIndx,
|
|||
SpatialDequantGetCLD2Values(idxCld, &cld);
|
||||
|
||||
/* ipd(idxIpd==8) == PI */
|
||||
if ((cld == FL2FXCONST_DBL(0.0f)) && (idxIpd == 8)) {
|
||||
if (((cld == FL2FXCONST_DBL(0.0f)) && (idxIpd == 8)) || (idxIpd == 0)) {
|
||||
opd[2 * band] = FL2FXCONST_DBL(0.0f);
|
||||
} else {
|
||||
opd[2 * band] = (dequantIPD_CLD_ICC_splitAngle__FDK_Function(
|
||||
idxIpd, idxCld, idxIcc) >>
|
||||
(IPD_SCALE - AT2O_SF));
|
||||
FDK_ASSERT(idxIpd > 0);
|
||||
opd[2 * band] =
|
||||
dequantIPD_CLD_ICC_splitAngle__FDK[idxIpd - 1][idxCld][idxIcc];
|
||||
}
|
||||
opd[2 * band + 1] = opd[2 * band] - ipd;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
||||
|
||||
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
Forschung e.V. All rights reserved.
|
||||
|
||||
1. INTRODUCTION
|
||||
|
@ -147,7 +147,7 @@ amm-info@iis.fraunhofer.de
|
|||
#define CLIP_PROTECT_GAIN_1(x) FL2FXCONST_CFG(((x) / (float)(1 << 1)))
|
||||
#define CLIP_PROTECT_GAIN_2(x) FL2FXCONST_CFG(((x) / (float)(1 << 2)))
|
||||
|
||||
#define SF_CLD_C1C2 (8)
|
||||
#define SF_CLD_C1C2 (9)
|
||||
|
||||
extern const FIXP_CFG dequantCPC__FDK[];
|
||||
extern const FIXP_CFG dequantICC__FDK[8];
|
||||
|
@ -160,6 +160,7 @@ extern const FIXP_CFG dequantCLD__FDK[31];
|
|||
(FL2FXCONST_DBL(3.1415926535897932f / (float)(1 << (IPD_SCALE - 1))))
|
||||
|
||||
extern const FIXP_CFG dequantIPD__FDK[16];
|
||||
extern const FIXP_DBL dequantIPD_CLD_ICC_splitAngle__FDK[15][31][8];
|
||||
|
||||
extern const FIXP_CFG H11_nc[31][8];
|
||||
extern const FIXP_CFG H12_nc[31][8];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
||||
|
||||
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
Forschung e.V. All rights reserved.
|
||||
|
||||
1. INTRODUCTION
|
||||
|
@ -493,7 +493,7 @@ static void mapSineFlags(
|
|||
}
|
||||
}
|
||||
|
||||
#define INTER_TES_SF_CHANGE 3
|
||||
#define INTER_TES_SF_CHANGE 4
|
||||
|
||||
typedef struct {
|
||||
FIXP_DBL subsample_power_low[(((1024) / (32) * (4) / 2) + (3 * (4)))];
|
||||
|
@ -2325,7 +2325,15 @@ static void calcSubbandGain(
|
|||
}
|
||||
|
||||
/* gain = nrgRef / B */
|
||||
FDK_divide_MantExp(nrgRef, nrgRef_e, b, b_e, ptrNrgGain, ptrNrgGain_e);
|
||||
INT result_exp = 0;
|
||||
*ptrNrgGain = fDivNorm(nrgRef, b, &result_exp);
|
||||
*ptrNrgGain_e = (SCHAR)result_exp + (nrgRef_e - b_e);
|
||||
|
||||
/* There could be a one bit diffs. This is important to compensate,
|
||||
because later in the code values are compared by exponent only. */
|
||||
int headroom = CountLeadingBits(*ptrNrgGain);
|
||||
*ptrNrgGain <<= headroom;
|
||||
*ptrNrgGain_e -= headroom;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2431,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 =
|
||||
|
@ -2466,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;
|
||||
|
@ -2527,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)) {
|
||||
|
@ -2575,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
|
||||
|
@ -2602,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++;
|
||||
|
@ -2633,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)) {
|
||||
|
@ -2741,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);
|
||||
}
|
||||
|
@ -2763,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;
|
||||
|
@ -2944,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);
|
||||
}
|
||||
|
@ -2992,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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
||||
|
||||
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||
Forschung e.V. All rights reserved.
|
||||
|
||||
1. INTRODUCTION
|
||||
|
@ -446,8 +446,26 @@ void lppTransposer(
|
|||
pSettings->nCols) +
|
||||
lowBandShift);
|
||||
}
|
||||
dynamicScale = fixMax(
|
||||
0, dynamicScale - 1); /* one additional bit headroom to prevent -1.0 */
|
||||
|
||||
if (dynamicScale == 0) {
|
||||
/* In this special case the available headroom bits as well as
|
||||
ovLowBandShift and lowBandShift are zero. The spectrum is limited to
|
||||
prevent -1.0, so negative values for dynamicScale can be avoided. */
|
||||
for (i = 0; i < (LPC_ORDER + pSettings->overlap + pSettings->nCols);
|
||||
i++) {
|
||||
lowBandReal[i] = fixMax(lowBandReal[i], (FIXP_DBL)0x80000001);
|
||||
}
|
||||
if (!useLP) {
|
||||
for (i = 0; i < (LPC_ORDER + pSettings->overlap + pSettings->nCols);
|
||||
i++) {
|
||||
lowBandImag[i] = fixMax(lowBandImag[i], (FIXP_DBL)0x80000001);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dynamicScale =
|
||||
fixMax(0, dynamicScale -
|
||||
1); /* one additional bit headroom to prevent -1.0 */
|
||||
}
|
||||
|
||||
/*
|
||||
Scale temporal QMF buffer.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue