diff options
| author | Mohamed Tarek <mt@rockbox.org> | 2010-08-04 23:21:35 +0000 |
|---|---|---|
| committer | Mohamed Tarek <mt@rockbox.org> | 2010-08-04 23:21:35 +0000 |
| commit | 467451878726a3755eb3b2b472a3b33299cb9245 (patch) | |
| tree | 378586c8598a8b08470c6bf59de64124888bf511 /apps/codecs/libwmapro | |
| parent | 2054ca8b98ba198d77203177da0164b52adf431d (diff) | |
| download | rockbox-467451878726a3755eb3b2b472a3b33299cb9245.zip rockbox-467451878726a3755eb3b2b472a3b33299cb9245.tar.gz rockbox-467451878726a3755eb3b2b472a3b33299cb9245.tar.bz2 rockbox-467451878726a3755eb3b2b472a3b33299cb9245.tar.xz | |
Increase wmapro decoder output sample depth to 24 bits, makes the mean error between our output and the original floating point decoder ~5e-8. (FS#11498 by Buschel)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27703 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libwmapro')
| -rw-r--r-- | apps/codecs/libwmapro/wma.h | 1 | ||||
| -rw-r--r-- | apps/codecs/libwmapro/wmapro_math.h | 26 | ||||
| -rw-r--r-- | apps/codecs/libwmapro/wmaprodec.c | 6 |
3 files changed, 18 insertions, 15 deletions
diff --git a/apps/codecs/libwmapro/wma.h b/apps/codecs/libwmapro/wma.h index 84abeb3..6fa7b94 100644 --- a/apps/codecs/libwmapro/wma.h +++ b/apps/codecs/libwmapro/wma.h @@ -26,6 +26,7 @@ #include "ffmpeg_put_bits.h" #define WMAPRO_FRACT (17) +#define WMAPRO_DSP_SAMPLE_DEPTH (WMAPRO_FRACT + 8) /* size of blocks */ #define BLOCK_MIN_BITS 7 diff --git a/apps/codecs/libwmapro/wmapro_math.h b/apps/codecs/libwmapro/wmapro_math.h index f5cfa5f..17b4829 100644 --- a/apps/codecs/libwmapro/wmapro_math.h +++ b/apps/codecs/libwmapro/wmapro_math.h @@ -223,21 +223,22 @@ static inline void vector_fixmul_window(int32_t *dst, const int32_t *src0, asm volatile ( \ "ldmia %[src]!, {r1-r4} \n\t" \ "smull r0, r5, r1, %[mul] \n\t" \ - "mov r0, r0, lsr #24 \n\t" \ - "orr r0, r0, r5, lsl #8 \n\t" \ + "mov r0, r0, lsr #16 \n\t" \ + "orr r0, r0, r5, lsl #16\n\t" \ "smull r1, r5, r2, %[mul] \n\t" \ - "mov r1, r1, lsr #24 \n\t" \ - "orr r1, r1, r5, lsl #8 \n\t" \ + "mov r1, r1, lsr #16 \n\t" \ + "orr r1, r1, r5, lsl #16\n\t" \ "smull r2, r5, r3, %[mul] \n\t" \ - "mov r2, r2, lsr #24 \n\t" \ - "orr r2, r2, r5, lsl #8 \n\t" \ + "mov r2, r2, lsr #16 \n\t" \ + "orr r2, r2, r5, lsl #16\n\t" \ "smull r3, r5, r4, %[mul] \n\t" \ - "mov r3, r3, lsr #24 \n\t" \ - "orr r3, r3, r5, lsl #8 \n\t" \ + "mov r3, r3, lsr #16 \n\t" \ + "orr r3, r3, r5, lsl #16\n\t" \ "stmia %[dst]!, {r0-r3} \n" \ : [dst]"+r"(dst), [src]"+r"(src) \ : [mul]"r"(mul) \ : "r0", "r1", "r2", "r3", "r4", "r5", "memory"); +/* Disable ColdFire version until a correct version is written #elif defined (CPU_COLDFIRE) #define VECT_MUL_SCALAR_KERNEL(dst, src, mul) \ int32_t tmp; \ @@ -270,12 +271,13 @@ static inline void vector_fixmul_window(int32_t *dst, const int32_t *src0, [tmp] "=d" (tmp) \ : [mul] "r" (mul) \ : "d0", "d1", "d2", "d3", "memory", "cc"); +*/ #else #define VECT_MUL_SCALAR_KERNEL(dst, src, mul) \ - dst[i ] = fixmul24(src[i ], mul); \ - dst[i+1] = fixmul24(src[i+1], mul); \ - dst[i+2] = fixmul24(src[i+2], mul); \ - dst[i+3] = fixmul24(src[i+3], mul); + dst[i ] = fixmul16(src[i ], mul); \ + dst[i+1] = fixmul16(src[i+1], mul); \ + dst[i+2] = fixmul16(src[i+2], mul); \ + dst[i+3] = fixmul16(src[i+3], mul); #endif /* CPU_ARM, CPU_COLDFIRE */ static inline void vector_fixmul_scalar(int32_t *dst, const int32_t *src, diff --git a/apps/codecs/libwmapro/wmaprodec.c b/apps/codecs/libwmapro/wmaprodec.c index e5a5fd9..018ea7c 100644 --- a/apps/codecs/libwmapro/wmaprodec.c +++ b/apps/codecs/libwmapro/wmaprodec.c @@ -125,7 +125,7 @@ #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) /* Define some multiple used constants */ -#define SQRT2_FRACT24 0x016A09E6 /* 0x016A09E6 = (sqrt(2)*(1<<24)) */ +#define SQRT2_FRACT16 0x00016A0A /* 0x00016A0A = (sqrt(2)*(1<<16)) */ #define COS_PI4_FRACT16 0x0000B505 /* 0x0000B505 = (cos(pi/4)<<16) */ #define ONE_FRACT16 0x00010000 /* 0x00010000 = (1<<16) */ @@ -1058,10 +1058,10 @@ static void inverse_channel_transform(WMAProDecodeCtx *s) int len = FFMIN(sfb[1], s->subframe_len) - sfb[0]; vector_fixmul_scalar(ch_data[0] + sfb[0], ch_data[0] + sfb[0], - SQRT2_FRACT24, len); + SQRT2_FRACT16, len); vector_fixmul_scalar(ch_data[1] + sfb[0], ch_data[1] + sfb[0], - SQRT2_FRACT24, len); + SQRT2_FRACT16, len); } } |