aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2013-08-08 17:47:33 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2013-08-20 15:05:08 -0700
commitfc4d7b0e73a87042f87ab847cfbe60e4d2dddf71 (patch)
tree2ee8a3fef769c6f4724562c80c774df5b367ef3a
parent60a27b7fe5bf2c3b07ae7f679ca67c0c5cba3b00 (diff)
downloadODR-AudioEnc-fc4d7b0e73a87042f87ab847cfbe60e4d2dddf71.tar.gz
ODR-AudioEnc-fc4d7b0e73a87042f87ab847cfbe60e4d2dddf71.tar.bz2
ODR-AudioEnc-fc4d7b0e73a87042f87ab847cfbe60e4d2dddf71.zip
SBR encoder improvement
SBR encoder: Introduce coupling energy ratio limitation to prevent undesirable SBR band amplification while decoding. Bug 9428126 Change-Id: I18a77cd1a178fff7531b490779a29a0df7d993af
-rw-r--r--libAACenc/src/aacenc_lib.cpp2
-rw-r--r--libSBRenc/src/env_est.cpp18
-rw-r--r--libSBRenc/src/sbr_encoder.cpp2
3 files changed, 11 insertions, 11 deletions
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index dd6767f..f298ab3 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -98,7 +98,7 @@ amm-info@iis.fraunhofer.de
/* Encoder library info */
#define AACENCODER_LIB_VL0 3
#define AACENCODER_LIB_VL1 4
-#define AACENCODER_LIB_VL2 3
+#define AACENCODER_LIB_VL2 4
#define AACENCODER_LIB_TITLE "AAC Encoder"
#define AACENCODER_LIB_BUILD_DATE __DATE__
#define AACENCODER_LIB_BUILD_TIME __TIME__
diff --git a/libSBRenc/src/env_est.cpp b/libSBRenc/src/env_est.cpp
index e441cbd..9924348 100644
--- a/libSBRenc/src/env_est.cpp
+++ b/libSBRenc/src/env_est.cpp
@@ -817,22 +817,22 @@ calculateSbrEnvelope (FIXP_DBL **RESTRICT YBufferLeft, /*! energy buffer left *
}
/* ld64 to integer conversion */
- nrgLeft = fixMin(fixMax(nrgLeft,FL2FXCONST_DBL(0.0f)),FL2FXCONST_DBL(0.5f));
+ nrgLeft = fixMin(fixMax(nrgLeft,FL2FXCONST_DBL(0.0f)),(FL2FXCONST_DBL(0.5f)>>oneBitLess));
nrgLeft = (FIXP_DBL)(LONG)nrgLeft >> (DFRACT_BITS-1-LD_DATA_SHIFT-1-oneBitLess-1);
sfb_nrgLeft[m] = ((INT)nrgLeft+1)>>1; /* rounding */
if (stereoMode == SBR_COUPLING) {
FIXP_DBL scaleFract;
+ int sc0, sc1;
- if (nrgRight != FL2FXCONST_DBL(0.0f)) {
- int sc0 = CountLeadingBits(nrgLeft2);
- int sc1 = CountLeadingBits(nrgRight);
+ nrgLeft2 = fixMax((FIXP_DBL)0x1, nrgLeft2);
+ nrgRight = fixMax((FIXP_DBL)0x1, nrgRight);
- scaleFract = ((FIXP_DBL)(sc0-sc1)) << (DFRACT_BITS-1-LD_DATA_SHIFT); /* scale value in ld64 representation */
- nrgRight = CalcLdData(nrgLeft2<<sc0) - CalcLdData(nrgRight<<sc1) - scaleFract;
- }
- else
- nrgRight = FL2FXCONST_DBL(0.5f); /* ld64(4294967296.0f) */
+ sc0 = CountLeadingBits(nrgLeft2);
+ sc1 = CountLeadingBits(nrgRight);
+
+ scaleFract = ((FIXP_DBL)(sc0-sc1)) << (DFRACT_BITS-1-LD_DATA_SHIFT); /* scale value in ld64 representation */
+ nrgRight = CalcLdData(nrgLeft2<<sc0) - CalcLdData(nrgRight<<sc1) - scaleFract;
/* ld64 to integer conversion */
nrgRight = (FIXP_DBL)(LONG)(nrgRight) >> (DFRACT_BITS-1-LD_DATA_SHIFT-1-oneBitLess);
diff --git a/libSBRenc/src/sbr_encoder.cpp b/libSBRenc/src/sbr_encoder.cpp
index ce02cf5..ac0c869 100644
--- a/libSBRenc/src/sbr_encoder.cpp
+++ b/libSBRenc/src/sbr_encoder.cpp
@@ -103,7 +103,7 @@ amm-info@iis.fraunhofer.de
#define SBRENCODER_LIB_VL0 3
#define SBRENCODER_LIB_VL1 3
-#define SBRENCODER_LIB_VL2 0
+#define SBRENCODER_LIB_VL2 1