summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorNedeljko Babic <nedeljko.babic@imgtec.com>2015-04-30 13:51:35 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-30 14:20:28 +0200
commita1c7fe431c5077e8bcf78d696c01ef653c34db2c (patch)
tree349ad8ddcdd9fd2821ce6ce2d3f174dc6e87cf94 /libavutil
parentd2184bf3b65354e44c177e226a6c59c5d6fdbad4 (diff)
libavutil/softfloat: exponent adjusted for aac fixed point dec
Exponent usage and calculation in softfloat adjusted to the format used in implementation of fixed point aac decoder. Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/softfloat.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index 2e85765fe9..5f4ac26ae1 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -83,7 +83,7 @@ static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){
a.exp += b.exp;
av_assert2((int32_t)((a.mant * (int64_t)b.mant) >> ONE_BITS) == (a.mant * (int64_t)b.mant) >> ONE_BITS);
a.mant = (a.mant * (int64_t)b.mant) >> ONE_BITS;
- return av_normalize1_sf(a);
+ return av_normalize1_sf((SoftFloat){a.mant, a.exp - 1});
}
/**
@@ -91,7 +91,7 @@ static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){
* @return Will not be more denormalized than a.
*/
static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){
- a.exp -= b.exp+1;
+ a.exp -= b.exp;
a.mant = ((int64_t)a.mant<<(ONE_BITS+1)) / b.mant;
return av_normalize1_sf(a);
}
@@ -121,14 +121,14 @@ static inline av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b){
* @returns a SoftFloat with value v * 2^frac_bits
*/
static inline av_const SoftFloat av_int2sf(int v, int frac_bits){
- return av_normalize_sf((SoftFloat){v, ONE_BITS-frac_bits});
+ return av_normalize_sf((SoftFloat){v, ONE_BITS + 1 - frac_bits});
}
/**
* Rounding is to -inf.
*/
static inline av_const int av_sf2int(SoftFloat v, int frac_bits){
- v.exp += frac_bits - ONE_BITS;
+ v.exp += frac_bits - (ONE_BITS + 1);
if(v.exp >= 0) return v.mant << v.exp ;
else return v.mant >>(-v.exp);
}