libavutil/softfloat: Added av_normalize_sf in av_add_sf

This will normalize sums for which mantissa is smaller than the lower boundary
(needed for implementation of fixed point aac decoder).

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Nedeljko Babic 2015-04-30 13:51:36 +02:00 committed by Michael Niedermayer
parent a1c7fe431c
commit 7bab281475

View File

@ -105,8 +105,8 @@ static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){
static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){ static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){
int t= a.exp - b.exp; int t= a.exp - b.exp;
if (t <-31) return b; if (t <-31) return b;
else if (t < 0) return av_normalize1_sf((SoftFloat){b.mant + (a.mant >> (-t)), b.exp}); else if (t < 0) return av_normalize_sf(av_normalize1_sf((SoftFloat){ b.mant + (a.mant >> (-t)), b.exp}));
else if (t < 32) return av_normalize1_sf((SoftFloat){a.mant + (b.mant >> t ), a.exp}); else if (t < 32) return av_normalize_sf(av_normalize1_sf((SoftFloat){ a.mant + (b.mant >> t ), a.exp}));
else return a; else return a;
} }