diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2013-08-29 12:24:04 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2013-08-29 12:24:04 -0700 |
commit | 3aec97e388e29a1d03f0197b27b893bc6aaf8ac3 (patch) | |
tree | 0cbc01e83d71aec25704fd9a6dd80b339d06c27a /libSBRenc/src/nf_est.cpp | |
parent | 7ad97579f8ccb843afdb5b184c4b209253839fe3 (diff) | |
download | ODR-AudioEnc-3aec97e388e29a1d03f0197b27b893bc6aaf8ac3.tar.gz ODR-AudioEnc-3aec97e388e29a1d03f0197b27b893bc6aaf8ac3.tar.bz2 ODR-AudioEnc-3aec97e388e29a1d03f0197b27b893bc6aaf8ac3.zip |
Encoder downsampled SBR
* AAC-Encoder
- Introduce optional AACENC_SBR_RATIO encoder API parameter to configure
dualrate or downsampled SBR explicitely. ELD makes use of downsampled SBR
in default configuration.
Modified file(s):
documentation\aacEncoder.pdf
libAACenc\include\aacenc_lib.h
libAACenc\src\aacenc.h
libAACenc\src\aacenc_lib.cpp
* SBR-Encoder
- Implement downsampled SBR feature.
- Revise sbr tuning parameter selection.
Modified file(s):
libSBRenc\include\sbr_encoder.h
libSBRenc\src\bit_sbr.h
libSBRenc\src\env_est.cpp
libSBRenc\src\mh_det.cpp
libSBRenc\src\nf_est.cpp
libSBRenc\src\ps_main.cpp
libSBRenc\src\sbr.h
libSBRenc\src\sbr_def.h
libSBRenc\src\sbr_encoder.cpp
libSBRenc\src\sbr_rom.cpp
libSBRenc\src\sbr_rom.h
libSBRenc\src\sbrenc_freq_sca.cpp
libSBRenc\src\sbrenc_freq_sca.h
libSBRenc\src\ton_corr.cpp
Bug 9428126
Change-Id: I731720a10829272acaaf70b84525df00a09ff3d2
Diffstat (limited to 'libSBRenc/src/nf_est.cpp')
-rw-r--r-- | libSBRenc/src/nf_est.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/libSBRenc/src/nf_est.cpp b/libSBRenc/src/nf_est.cpp index 851584f..7a3c022 100644 --- a/libSBRenc/src/nf_est.cpp +++ b/libSBRenc/src/nf_est.cpp @@ -102,7 +102,7 @@ static const FIXP_DBL QuantOffset = (INT)0xfc000000; /* ld64(0.25) */ #define max(a,b) ( a > b ? a:b) #endif -#define NOISE_FLOOR_OFFSET_SCALING (3) +#define NOISE_FLOOR_OFFSET_SCALING (4) @@ -484,11 +484,13 @@ FDKsbrEnc_InitSbrNoiseFloorEstimate (HANDLE_SBR_NOISE_FLOOR_ESTIMATE h_sbrNoise tmp = ((FIXP_DBL)MAXVAL_DBL)>>NOISE_FLOOR_OFFSET_SCALING; } else { - FDK_ASSERT(noiseFloorOffset<=8); /* because of NOISE_FLOOR_OFFSET_SCALING */ + /* noiseFloorOffset has to be smaller than 12, because + the result of the calculation below must be smaller than 1: + (2^(noiseFloorOffset/3))*2^4<1 */ + FDK_ASSERT(noiseFloorOffset<12); - /* Assumes the noise floor offset in tuning table are in q31 */ - /* Currently the table contains only 0 for noise floor offset */ - /* Change the qformat here when non-zero values would be filled */ + /* Assumes the noise floor offset in tuning table are in q31 */ + /* Change the qformat here when non-zero values would be filled */ exp = fDivNorm((FIXP_DBL)noiseFloorOffset, 3, &qexp); tmp = fPow(2, DFRACT_BITS-1, exp, qexp, &qtmp); tmp = scaleValue(tmp, qtmp-NOISE_FLOOR_OFFSET_SCALING); @@ -527,24 +529,30 @@ FDKsbrEnc_resetSbrNoiseFloorEstimate (HANDLE_SBR_NOISE_FLOOR_ESTIMATE h_sbrNoise h_sbrNoiseFloorEstimate->noNoiseBands = 1; } else{ - /* - * Calculate number of noise bands 1,2 or 3 bands/octave + /* + * Calculate number of noise bands 1,2 or 3 bands/octave ********************************************************/ FIXP_DBL tmp, ratio, lg2; - INT ratio_e, qlg2; + INT ratio_e, qlg2, nNoiseBands; ratio = fDivNorm(k2, kx, &ratio_e); lg2 = fLog2(ratio, ratio_e, &qlg2); tmp = fMult((FIXP_DBL)(h_sbrNoiseFloorEstimate->noiseBands<<24), lg2); tmp = scaleValue(tmp, qlg2-23); - h_sbrNoiseFloorEstimate->noNoiseBands = (INT)((tmp + (FIXP_DBL)1) >> 1); + nNoiseBands = (INT)((tmp + (FIXP_DBL)1) >> 1); + + + if (nNoiseBands > MAX_NUM_NOISE_COEFFS ) { + nNoiseBands = MAX_NUM_NOISE_COEFFS; + } + + if( nNoiseBands == 0 ) { + nNoiseBands = 1; + } - if (h_sbrNoiseFloorEstimate->noNoiseBands > MAX_NUM_NOISE_COEFFS) - h_sbrNoiseFloorEstimate->noNoiseBands = MAX_NUM_NOISE_COEFFS; + h_sbrNoiseFloorEstimate->noNoiseBands = nNoiseBands; - if( h_sbrNoiseFloorEstimate->noNoiseBands==0) - h_sbrNoiseFloorEstimate->noNoiseBands=1; } |