summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-07-29 22:18:04 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-07-29 22:18:04 +0000
commitaa2fca384a7e71b7a9afbee0d68cfb2b7a5266f5 (patch)
treecff75c9a211b84890e16eee128cda84dba33727a
parente63e19b50773393064e7a458297b18a835e8b004 (diff)
downloadrockbox-aa2fca384a7e71b7a9afbee0d68cfb2b7a5266f5.tar.gz
rockbox-aa2fca384a7e71b7a9afbee0d68cfb2b7a5266f5.tar.bz2
rockbox-aa2fca384a7e71b7a9afbee0d68cfb2b7a5266f5.zip
Maintenance and minor speedup of libwmapro. Comment unused arrays, fix comment, remove tabs and introduce WMAPRO_FRACT to wma.h to remove magic numbers. Swap operands of fixmul16-call for minor speedup on ARM (+1%).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27617 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/libwmapro/wma.c4
-rw-r--r--apps/codecs/libwmapro/wma.h2
-rw-r--r--apps/codecs/libwmapro/wmapro_math.h2
-rw-r--r--apps/codecs/libwmapro/wmaprodata.h10
-rw-r--r--apps/codecs/libwmapro/wmaprodec.c4
-rw-r--r--apps/codecs/libwmapro/wmaprodec.h1
-rw-r--r--apps/codecs/wmapro.c6
7 files changed, 17 insertions, 12 deletions
diff --git a/apps/codecs/libwmapro/wma.c b/apps/codecs/libwmapro/wma.c
index c80d433b07..64ec2405ae 100644
--- a/apps/codecs/libwmapro/wma.c
+++ b/apps/codecs/libwmapro/wma.c
@@ -116,7 +116,7 @@ int ff_wma_run_level_decode(GetBitContext* gb,
offset += run_table[code];
sign = !get_bits1(gb);
ptr[offset & coef_mask] = sign ? -level_table[code] : level_table[code];
- ptr[offset & coef_mask] <<= 17;
+ ptr[offset & coef_mask] <<= WMAPRO_FRACT;
} else if (code == 1) {
/** EOB */
break;
@@ -144,7 +144,7 @@ int ff_wma_run_level_decode(GetBitContext* gb,
}
sign = !get_bits1(gb);
ptr[offset & coef_mask] = sign ? -level : level;
- ptr[offset & coef_mask] <<=17;
+ ptr[offset & coef_mask] <<= WMAPRO_FRACT;
}
}
/** NOTE: EOB can be omitted */
diff --git a/apps/codecs/libwmapro/wma.h b/apps/codecs/libwmapro/wma.h
index 3a0948e51e..84abeb349b 100644
--- a/apps/codecs/libwmapro/wma.h
+++ b/apps/codecs/libwmapro/wma.h
@@ -25,6 +25,8 @@
#include "ffmpeg_get_bits.h"
#include "ffmpeg_put_bits.h"
+#define WMAPRO_FRACT (17)
+
/* size of blocks */
#define BLOCK_MIN_BITS 7
#define BLOCK_MAX_BITS 11
diff --git a/apps/codecs/libwmapro/wmapro_math.h b/apps/codecs/libwmapro/wmapro_math.h
index 06df737bc0..b605f275e8 100644
--- a/apps/codecs/libwmapro/wmapro_math.h
+++ b/apps/codecs/libwmapro/wmapro_math.h
@@ -276,7 +276,7 @@ static inline void vector_fixmul_window(int32_t *dst, const int32_t *src0,
dst[i+1] = fixmul24(src[i+1], mul); \
dst[i+2] = fixmul24(src[i+2], mul); \
dst[i+3] = fixmul24(src[i+3], mul);
-#endif /* CPU_ARM */
+#endif /* CPU_ARM, CPU_COLDFIRE */
static inline void vector_fixmul_scalar(int32_t *dst, const int32_t *src,
int32_t mul, int len)
diff --git a/apps/codecs/libwmapro/wmaprodata.h b/apps/codecs/libwmapro/wmaprodata.h
index ba6ca93e5b..94762f7dbf 100644
--- a/apps/codecs/libwmapro/wmaprodata.h
+++ b/apps/codecs/libwmapro/wmaprodata.h
@@ -31,6 +31,7 @@
#include <stddef.h>
#include <stdint.h>
+/* rockbox: not used
const int32_t fixed_sin64[33] = {
0x00000000, 0xF9B82685, 0xF3742CA3, 0xED37EF92, 0xE70747C5, 0xE0E60686,
0xDAD7F3A3, 0xD4E0CB16, 0xCF043AB4, 0xC945DFED, 0xC3A94591, 0xBE31E19C,
@@ -39,7 +40,7 @@ const int32_t fixed_sin64[33] = {
0x89BE50C4, 0x877B7BED, 0x8582FAA6, 0x83D60413, 0x8275A0C1, 0x8162AA05,
0x809DC972, 0x80277873, 0x80000001,
};
-
+*/
/**
* @brief frequencies to divide the frequency spectrum into scale factor bands
*/
@@ -50,7 +51,6 @@ static const uint16_t critical_freq[] = {
9500, 12000, 15500, 20675, 28575, 41375, 63875,
};
-
/**
* @name Huffman tables for DPCM-coded scale factors
* @{
@@ -581,6 +581,7 @@ static const uint8_t symbol_to_vec2[HUFF_VEC2_SIZE] = {
/**
* @brief decorrelation matrix for multichannel streams
**/
+/* rockbox: not used
static const float default_decorrelation_matrices[] = {
1.000000, 0.707031, -0.707031, 0.707031, 0.707031, 0.578125, 0.707031,
0.410156, 0.578125, -0.707031, 0.410156, 0.578125, 0.000000, -0.816406,
@@ -596,10 +597,11 @@ static const float default_decorrelation_matrices[] = {
0.289062, -0.558594, 0.410156, -0.410156, 0.000000, 0.410156, -0.578125,
0.410156, 0.410156, -0.558594, 0.500000, -0.410156, 0.289062, -0.148438,
};
-
+*/
/**
* @brief default decorrelation matrix offsets
*/
+/* rockbox: not used
static const float * const default_decorrelation[] = {
NULL,
&default_decorrelation_matrices[0],
@@ -609,5 +611,5 @@ static const float * const default_decorrelation[] = {
&default_decorrelation_matrices[30],
&default_decorrelation_matrices[55]
};
-
+*/
#endif /* AVCODEC_WMAPRODATA_H */
diff --git a/apps/codecs/libwmapro/wmaprodec.c b/apps/codecs/libwmapro/wmaprodec.c
index f3920f9d76..3431870297 100644
--- a/apps/codecs/libwmapro/wmaprodec.c
+++ b/apps/codecs/libwmapro/wmaprodec.c
@@ -877,7 +877,7 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
for (i = 0; i < 4; i++) {
if (vals[i]) {
int sign = get_bits1(&s->gb) - 1;
- ci->coeffs[cur_coeff] = (sign == -1)? -vals[i]<<17 : vals[i]<<17;
+ ci->coeffs[cur_coeff] = (sign == -1)? -vals[i]<<WMAPRO_FRACT : vals[i]<<WMAPRO_FRACT;
num_zeros = 0;
} else {
ci->coeffs[cur_coeff] = 0;
@@ -1035,7 +1035,7 @@ static void inverse_channel_transform(WMAProDecodeCtx *s)
data_ptr = data;
while (data_ptr < data_end)
- sum += fixmul16(*data_ptr++, *mat++);
+ sum += fixmul16(*mat++, *data_ptr++);
(*ch)[y] = sum;
}
diff --git a/apps/codecs/libwmapro/wmaprodec.h b/apps/codecs/libwmapro/wmaprodec.h
index 2e7d01a334..d4e0e00144 100644
--- a/apps/codecs/libwmapro/wmaprodec.h
+++ b/apps/codecs/libwmapro/wmaprodec.h
@@ -1,4 +1,5 @@
#include "codeclib.h"
+#include "wma.h"
#include "../libasf/asf.h"
#if (CONFIG_CPU == MCF5250) || defined(CPU_S5L870X)
diff --git a/apps/codecs/wmapro.c b/apps/codecs/wmapro.c
index c069e52127..2820672a50 100644
--- a/apps/codecs/wmapro.c
+++ b/apps/codecs/wmapro.c
@@ -40,11 +40,11 @@ enum codec_status codec_main(void)
int packetlength = 0; /* Logical packet size (minus the header size) */
int outlen = 0; /* Number of bytes written to the output buffer */
int pktcnt = 0; /* Count of the packets played */
- uint8_t *data; /* Pointer to decoder input buffer */
- int size; /* Size of the input frame to the decoder */
+ uint8_t *data; /* Pointer to decoder input buffer */
+ int size; /* Size of the input frame to the decoder */
/* Generic codec initialisation */
- ci->configure(DSP_SET_SAMPLE_DEPTH, 17);
+ ci->configure(DSP_SET_SAMPLE_DEPTH, WMAPRO_FRACT);
next_track: