forked from len0rd/rockbox
Fix FS#11539. Undo r23967 and use another way to achieve results for negative exponents for pow(2,x). This solves heavy distortions on some aac encoded files and clicks/noise on track change.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27941 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5be1c33521
commit
cdca5efce9
2 changed files with 51 additions and 99 deletions
|
|
@ -49,7 +49,6 @@ extern "C" {
|
|||
|
||||
typedef int32_t real_t;
|
||||
|
||||
#define UFIX_CONST(A,PRECISION) ((uint32_t)((A)*(PRECISION)+0.5))
|
||||
#define FIX_CONST(A,PRECISION) (((A) >= 0) ? ((real_t)((A)*(PRECISION)+0.5)) : ((real_t)((A)*(PRECISION)-0.5)))
|
||||
#define REAL_CONST(A) FIX_CONST((A),(REAL_PRECISION))
|
||||
#define COEF_CONST(A) FIX_CONST((A),(COEF_PRECISION))
|
||||
|
|
@ -129,8 +128,6 @@ static INLINE void ComplexMult(real_t *y1, real_t *y2,
|
|||
#define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
|
||||
#define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)
|
||||
#define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23)
|
||||
#define DESCALE(A,S) ((S)>0?(((A)>>((S)-1))+1)>>1:(A)<<-(S))
|
||||
#define DESCALE_SHIFT(A,SH,SC) DESCALE((A),(SC)-(SH))
|
||||
|
||||
#elif defined(__GNUC__) && defined (__arm__)
|
||||
|
||||
|
|
@ -208,18 +205,6 @@ static INLINE void ComplexMult(real_t *y1, real_t *y2,
|
|||
*y2 = yt2 << (FRAC_SIZE-FRAC_BITS);
|
||||
}
|
||||
|
||||
static inline real_t DESCALE_SHIFT(unsigned val, int shift, int scale)
|
||||
{
|
||||
unsigned out;
|
||||
if ((out = val >> (scale - shift - 1)))
|
||||
{
|
||||
out++;
|
||||
out >>= 1;
|
||||
} else
|
||||
out = val << (shift - scale);
|
||||
return out;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* multiply with real shift */
|
||||
|
|
@ -240,8 +225,6 @@ static inline real_t DESCALE_SHIFT(unsigned val, int shift, int scale)
|
|||
#define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
|
||||
#define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)
|
||||
#define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23)
|
||||
#define DESCALE(A,S) ((S)>0?(((A)>>((S)-1))+1)>>1:(A)<<-(S))
|
||||
#define DESCALE_SHIFT(A,SH,SC) DESCALE((A),(SC)-(SH))
|
||||
|
||||
/* Complex multiplication */
|
||||
static INLINE void ComplexMult(real_t *y1, real_t *y2,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue