diff options
author | Martin Storsjo <martin@martin.st> | 2012-11-01 11:08:03 +0200 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2012-11-01 11:08:03 +0200 |
commit | 54dfe1ec6972ca0d56dcb671448f84fea5e37e35 (patch) | |
tree | 5d26aa077f3aa32d3e5113546abc5a4219332640 /libFDK/include/scale.h | |
parent | fea3c1d0ffaf5975bb15462e11edf9c7a664890d (diff) | |
parent | 6ab36997af5d5acda4f21d33031f4e45c85f96b7 (diff) | |
download | ODR-AudioEnc-54dfe1ec6972ca0d56dcb671448f84fea5e37e35.tar.gz ODR-AudioEnc-54dfe1ec6972ca0d56dcb671448f84fea5e37e35.tar.bz2 ODR-AudioEnc-54dfe1ec6972ca0d56dcb671448f84fea5e37e35.zip |
Merge remote-tracking branch 'aosp/jb-mr1-release' into master
Conflicts:
libAACenc/src/band_nrg.cpp
libAACenc/src/grp_data.cpp
libSBRenc/src/env_est.cpp
Diffstat (limited to 'libFDK/include/scale.h')
-rw-r--r-- | libFDK/include/scale.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libFDK/include/scale.h b/libFDK/include/scale.h index fcb6c48..d60ed2c 100644 --- a/libFDK/include/scale.h +++ b/libFDK/include/scale.h @@ -148,12 +148,20 @@ FIXP_DBL scaleValueSaturate( { if(scalefactor > 0) { if (fNorm(value) < scalefactor && value != (FIXP_DBL)0) { - return (FIXP_DBL)MAXVAL_DBL; + if (value > (FIXP_DBL)0) { + return (FIXP_DBL)MAXVAL_DBL; + } else { + return (FIXP_DBL)MINVAL_DBL; + } } else { return (value<<scalefactor); } } else { + if (-(DFRACT_BITS-1) > scalefactor) { + return (FIXP_DBL)0; + } else { return (value>>(-scalefactor)); + } } } #endif |