diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-07-29 22:18:04 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-07-29 22:18:04 +0000 |
commit | aa2fca384a7e71b7a9afbee0d68cfb2b7a5266f5 (patch) | |
tree | cff75c9a211b84890e16eee128cda84dba33727a | |
parent | e63e19b50773393064e7a458297b18a835e8b004 (diff) | |
download | rockbox-aa2fca384a7e71b7a9afbee0d68cfb2b7a5266f5.tar.gz 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.c | 4 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wma.h | 2 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wmapro_math.h | 2 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wmaprodata.h | 10 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wmaprodec.c | 4 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wmaprodec.h | 1 | ||||
-rw-r--r-- | apps/codecs/wmapro.c | 6 |
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, | |||
116 | offset += run_table[code]; | 116 | offset += run_table[code]; |
117 | sign = !get_bits1(gb); | 117 | sign = !get_bits1(gb); |
118 | ptr[offset & coef_mask] = sign ? -level_table[code] : level_table[code]; | 118 | ptr[offset & coef_mask] = sign ? -level_table[code] : level_table[code]; |
119 | ptr[offset & coef_mask] <<= 17; | 119 | ptr[offset & coef_mask] <<= WMAPRO_FRACT; |
120 | } else if (code == 1) { | 120 | } else if (code == 1) { |
121 | /** EOB */ | 121 | /** EOB */ |
122 | break; | 122 | break; |
@@ -144,7 +144,7 @@ int ff_wma_run_level_decode(GetBitContext* gb, | |||
144 | } | 144 | } |
145 | sign = !get_bits1(gb); | 145 | sign = !get_bits1(gb); |
146 | ptr[offset & coef_mask] = sign ? -level : level; | 146 | ptr[offset & coef_mask] = sign ? -level : level; |
147 | ptr[offset & coef_mask] <<=17; | 147 | ptr[offset & coef_mask] <<= WMAPRO_FRACT; |
148 | } | 148 | } |
149 | } | 149 | } |
150 | /** NOTE: EOB can be omitted */ | 150 | /** 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 @@ | |||
25 | #include "ffmpeg_get_bits.h" | 25 | #include "ffmpeg_get_bits.h" |
26 | #include "ffmpeg_put_bits.h" | 26 | #include "ffmpeg_put_bits.h" |
27 | 27 | ||
28 | #define WMAPRO_FRACT (17) | ||
29 | |||
28 | /* size of blocks */ | 30 | /* size of blocks */ |
29 | #define BLOCK_MIN_BITS 7 | 31 | #define BLOCK_MIN_BITS 7 |
30 | #define BLOCK_MAX_BITS 11 | 32 | #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, | |||
276 | dst[i+1] = fixmul24(src[i+1], mul); \ | 276 | dst[i+1] = fixmul24(src[i+1], mul); \ |
277 | dst[i+2] = fixmul24(src[i+2], mul); \ | 277 | dst[i+2] = fixmul24(src[i+2], mul); \ |
278 | dst[i+3] = fixmul24(src[i+3], mul); | 278 | dst[i+3] = fixmul24(src[i+3], mul); |
279 | #endif /* CPU_ARM */ | 279 | #endif /* CPU_ARM, CPU_COLDFIRE */ |
280 | 280 | ||
281 | static inline void vector_fixmul_scalar(int32_t *dst, const int32_t *src, | 281 | static inline void vector_fixmul_scalar(int32_t *dst, const int32_t *src, |
282 | int32_t mul, int len) | 282 | 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 @@ | |||
31 | #include <stddef.h> | 31 | #include <stddef.h> |
32 | #include <stdint.h> | 32 | #include <stdint.h> |
33 | 33 | ||
34 | /* rockbox: not used | ||
34 | const int32_t fixed_sin64[33] = { | 35 | const int32_t fixed_sin64[33] = { |
35 | 0x00000000, 0xF9B82685, 0xF3742CA3, 0xED37EF92, 0xE70747C5, 0xE0E60686, | 36 | 0x00000000, 0xF9B82685, 0xF3742CA3, 0xED37EF92, 0xE70747C5, 0xE0E60686, |
36 | 0xDAD7F3A3, 0xD4E0CB16, 0xCF043AB4, 0xC945DFED, 0xC3A94591, 0xBE31E19C, | 37 | 0xDAD7F3A3, 0xD4E0CB16, 0xCF043AB4, 0xC945DFED, 0xC3A94591, 0xBE31E19C, |
@@ -39,7 +40,7 @@ const int32_t fixed_sin64[33] = { | |||
39 | 0x89BE50C4, 0x877B7BED, 0x8582FAA6, 0x83D60413, 0x8275A0C1, 0x8162AA05, | 40 | 0x89BE50C4, 0x877B7BED, 0x8582FAA6, 0x83D60413, 0x8275A0C1, 0x8162AA05, |
40 | 0x809DC972, 0x80277873, 0x80000001, | 41 | 0x809DC972, 0x80277873, 0x80000001, |
41 | }; | 42 | }; |
42 | 43 | */ | |
43 | /** | 44 | /** |
44 | * @brief frequencies to divide the frequency spectrum into scale factor bands | 45 | * @brief frequencies to divide the frequency spectrum into scale factor bands |
45 | */ | 46 | */ |
@@ -50,7 +51,6 @@ static const uint16_t critical_freq[] = { | |||
50 | 9500, 12000, 15500, 20675, 28575, 41375, 63875, | 51 | 9500, 12000, 15500, 20675, 28575, 41375, 63875, |
51 | }; | 52 | }; |
52 | 53 | ||
53 | |||
54 | /** | 54 | /** |
55 | * @name Huffman tables for DPCM-coded scale factors | 55 | * @name Huffman tables for DPCM-coded scale factors |
56 | * @{ | 56 | * @{ |
@@ -581,6 +581,7 @@ static const uint8_t symbol_to_vec2[HUFF_VEC2_SIZE] = { | |||
581 | /** | 581 | /** |
582 | * @brief decorrelation matrix for multichannel streams | 582 | * @brief decorrelation matrix for multichannel streams |
583 | **/ | 583 | **/ |
584 | /* rockbox: not used | ||
584 | static const float default_decorrelation_matrices[] = { | 585 | static const float default_decorrelation_matrices[] = { |
585 | 1.000000, 0.707031, -0.707031, 0.707031, 0.707031, 0.578125, 0.707031, | 586 | 1.000000, 0.707031, -0.707031, 0.707031, 0.707031, 0.578125, 0.707031, |
586 | 0.410156, 0.578125, -0.707031, 0.410156, 0.578125, 0.000000, -0.816406, | 587 | 0.410156, 0.578125, -0.707031, 0.410156, 0.578125, 0.000000, -0.816406, |
@@ -596,10 +597,11 @@ static const float default_decorrelation_matrices[] = { | |||
596 | 0.289062, -0.558594, 0.410156, -0.410156, 0.000000, 0.410156, -0.578125, | 597 | 0.289062, -0.558594, 0.410156, -0.410156, 0.000000, 0.410156, -0.578125, |
597 | 0.410156, 0.410156, -0.558594, 0.500000, -0.410156, 0.289062, -0.148438, | 598 | 0.410156, 0.410156, -0.558594, 0.500000, -0.410156, 0.289062, -0.148438, |
598 | }; | 599 | }; |
599 | 600 | */ | |
600 | /** | 601 | /** |
601 | * @brief default decorrelation matrix offsets | 602 | * @brief default decorrelation matrix offsets |
602 | */ | 603 | */ |
604 | /* rockbox: not used | ||
603 | static const float * const default_decorrelation[] = { | 605 | static const float * const default_decorrelation[] = { |
604 | NULL, | 606 | NULL, |
605 | &default_decorrelation_matrices[0], | 607 | &default_decorrelation_matrices[0], |
@@ -609,5 +611,5 @@ static const float * const default_decorrelation[] = { | |||
609 | &default_decorrelation_matrices[30], | 611 | &default_decorrelation_matrices[30], |
610 | &default_decorrelation_matrices[55] | 612 | &default_decorrelation_matrices[55] |
611 | }; | 613 | }; |
612 | 614 | */ | |
613 | #endif /* AVCODEC_WMAPRODATA_H */ | 615 | #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) | |||
877 | for (i = 0; i < 4; i++) { | 877 | for (i = 0; i < 4; i++) { |
878 | if (vals[i]) { | 878 | if (vals[i]) { |
879 | int sign = get_bits1(&s->gb) - 1; | 879 | int sign = get_bits1(&s->gb) - 1; |
880 | ci->coeffs[cur_coeff] = (sign == -1)? -vals[i]<<17 : vals[i]<<17; | 880 | ci->coeffs[cur_coeff] = (sign == -1)? -vals[i]<<WMAPRO_FRACT : vals[i]<<WMAPRO_FRACT; |
881 | num_zeros = 0; | 881 | num_zeros = 0; |
882 | } else { | 882 | } else { |
883 | ci->coeffs[cur_coeff] = 0; | 883 | ci->coeffs[cur_coeff] = 0; |
@@ -1035,7 +1035,7 @@ static void inverse_channel_transform(WMAProDecodeCtx *s) | |||
1035 | data_ptr = data; | 1035 | data_ptr = data; |
1036 | 1036 | ||
1037 | while (data_ptr < data_end) | 1037 | while (data_ptr < data_end) |
1038 | sum += fixmul16(*data_ptr++, *mat++); | 1038 | sum += fixmul16(*mat++, *data_ptr++); |
1039 | 1039 | ||
1040 | (*ch)[y] = sum; | 1040 | (*ch)[y] = sum; |
1041 | } | 1041 | } |
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 @@ | |||
1 | #include "codeclib.h" | 1 | #include "codeclib.h" |
2 | #include "wma.h" | ||
2 | #include "../libasf/asf.h" | 3 | #include "../libasf/asf.h" |
3 | 4 | ||
4 | #if (CONFIG_CPU == MCF5250) || defined(CPU_S5L870X) | 5 | #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) | |||
40 | int packetlength = 0; /* Logical packet size (minus the header size) */ | 40 | int packetlength = 0; /* Logical packet size (minus the header size) */ |
41 | int outlen = 0; /* Number of bytes written to the output buffer */ | 41 | int outlen = 0; /* Number of bytes written to the output buffer */ |
42 | int pktcnt = 0; /* Count of the packets played */ | 42 | int pktcnt = 0; /* Count of the packets played */ |
43 | uint8_t *data; /* Pointer to decoder input buffer */ | 43 | uint8_t *data; /* Pointer to decoder input buffer */ |
44 | int size; /* Size of the input frame to the decoder */ | 44 | int size; /* Size of the input frame to the decoder */ |
45 | 45 | ||
46 | /* Generic codec initialisation */ | 46 | /* Generic codec initialisation */ |
47 | ci->configure(DSP_SET_SAMPLE_DEPTH, 17); | 47 | ci->configure(DSP_SET_SAMPLE_DEPTH, WMAPRO_FRACT); |
48 | 48 | ||
49 | 49 | ||
50 | next_track: | 50 | next_track: |