summaryrefslogtreecommitdiffstats
path: root/libAACenc/src/quantize.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2016-04-09 00:36:07 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-04-09 00:36:07 +0000
commit125815b0ed558c72bb019a2d36c662e5e7f7c030 (patch)
tree626b5c026f23b0c8ec4dab155faf86d55cd9d94e /libAACenc/src/quantize.cpp
parentd75233c2da4b49259d2e2de701f326d1a8d897b1 (diff)
parent46ba3676b854acbc69a4c7845f578d4c2886377b (diff)
downloadfdk-aac-125815b0ed558c72bb019a2d36c662e5e7f7c030.tar.gz
fdk-aac-125815b0ed558c72bb019a2d36c662e5e7f7c030.tar.bz2
fdk-aac-125815b0ed558c72bb019a2d36c662e5e7f7c030.zip
AAC/SBR encoder improvements
am: 46ba367 * commit '46ba3676b854acbc69a4c7845f578d4c2886377b': AAC/SBR encoder improvements Change-Id: Id839c5ba8b79eddb7e239b7ec1b26fb5079b7d81
Diffstat (limited to 'libAACenc/src/quantize.cpp')
-rw-r--r--libAACenc/src/quantize.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/libAACenc/src/quantize.cpp b/libAACenc/src/quantize.cpp
index 5380e35..a74da0e 100644
--- a/libAACenc/src/quantize.cpp
+++ b/libAACenc/src/quantize.cpp
@@ -2,7 +2,7 @@
/* -----------------------------------------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
+© Copyright 1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
All rights reserved.
1. INTRODUCTION
@@ -104,13 +104,19 @@ amm-info@iis.fraunhofer.de
static void FDKaacEnc_quantizeLines(INT gain,
INT noOfLines,
FIXP_DBL *mdctSpectrum,
- SHORT *quaSpectrum)
+ SHORT *quaSpectrum,
+ INT dZoneQuantEnable)
{
int line;
- FIXP_DBL k = FL2FXCONST_DBL(-0.0946f + 0.5f)>>16;
+ FIXP_DBL k = FL2FXCONST_DBL(0.0f);
FIXP_QTD quantizer = FDKaacEnc_quantTableQ[(-gain)&3];
INT quantizershift = ((-gain)>>2)+1;
+ const INT kShift=16;
+ if (dZoneQuantEnable)
+ k = FL2FXCONST_DBL(0.23f)>>kShift;
+ else
+ k = FL2FXCONST_DBL(-0.0946f + 0.5f)>>kShift;
for (line = 0; line < noOfLines; line++)
{
@@ -263,7 +269,8 @@ void FDKaacEnc_QuantizeSpectrum(INT sfbCnt,
FIXP_DBL *mdctSpectrum,
INT globalGain,
INT *scalefactors,
- SHORT *quantizedSpectrum)
+ SHORT *quantizedSpectrum,
+ INT dZoneQuantEnable)
{
INT sfbOffs,sfb;
@@ -280,7 +287,8 @@ void FDKaacEnc_QuantizeSpectrum(INT sfbCnt,
FDKaacEnc_quantizeLines(globalGain - scalefactor, /* QSS */
sfbOffset[sfbOffs+sfb+1] - sfbOffset[sfbOffs+sfb],
mdctSpectrum + sfbOffset[sfbOffs+sfb],
- quantizedSpectrum + sfbOffset[sfbOffs+sfb]);
+ quantizedSpectrum + sfbOffset[sfbOffs+sfb],
+ dZoneQuantEnable);
}
}
@@ -296,7 +304,8 @@ void FDKaacEnc_QuantizeSpectrum(INT sfbCnt,
FIXP_DBL FDKaacEnc_calcSfbDist(FIXP_DBL *mdctSpectrum,
SHORT *quantSpectrum,
INT noOfLines,
- INT gain
+ INT gain,
+ INT dZoneQuantEnable
)
{
INT i,scale;
@@ -311,7 +320,8 @@ FIXP_DBL FDKaacEnc_calcSfbDist(FIXP_DBL *mdctSpectrum,
FDKaacEnc_quantizeLines(gain,
1,
&mdctSpectrum[i],
- &quantSpectrum[i]);
+ &quantSpectrum[i],
+ dZoneQuantEnable);
if (fAbs(quantSpectrum[i])>MAX_QUANT) {
return FL2FXCONST_DBL(0.0f);