diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs/demac/libdemac/decoder.c | 21 | ||||
-rw-r--r-- | apps/codecs/demac/libdemac/demac_config.h | 4 | ||||
-rw-r--r-- | apps/codecs/demac/libdemac/filter.c | 21 | ||||
-rw-r--r-- | apps/codecs/demac/libdemac/filter_1280_15.c | 5 | ||||
-rw-r--r-- | apps/codecs/demac/libdemac/filter_256_13.c | 5 | ||||
-rw-r--r-- | apps/codecs/lib/udiv32_arm.S | 10 |
6 files changed, 55 insertions, 11 deletions
diff --git a/apps/codecs/demac/libdemac/decoder.c b/apps/codecs/demac/libdemac/decoder.c index 0763c11037..09563e0112 100644 --- a/apps/codecs/demac/libdemac/decoder.c +++ b/apps/codecs/demac/libdemac/decoder.c | |||
@@ -33,10 +33,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | |||
33 | 33 | ||
34 | /* Statically allocate the filter buffers */ | 34 | /* Statically allocate the filter buffers */ |
35 | 35 | ||
36 | #ifdef FILTER256_IRAM | ||
36 | static filter_int filterbuf32[(32*3 + FILTER_HISTORY_SIZE) * 2] | 37 | static filter_int filterbuf32[(32*3 + FILTER_HISTORY_SIZE) * 2] |
37 | IBSS_ATTR __attribute__((aligned(16))); /* 2432/4864 bytes */ | 38 | IBSS_ATTR __attribute__((aligned(16))); /* 2432/4864 bytes */ |
38 | static filter_int filterbuf256[(256*3 + FILTER_HISTORY_SIZE) * 2] | 39 | static filter_int filterbuf256[(256*3 + FILTER_HISTORY_SIZE) * 2] |
39 | IBSS_ATTR __attribute__((aligned(16))); /* 5120/10240 bytes */ | 40 | IBSS_ATTR __attribute__((aligned(16))); /* 5120/10240 bytes */ |
41 | #define FILTERBUF64 filterbuf256 | ||
42 | #define FILTERBUF32 filterbuf32 | ||
43 | #define FILTERBUF16 filterbuf32 | ||
44 | #else | ||
45 | static filter_int filterbuf64[(64*3 + FILTER_HISTORY_SIZE) * 2] | ||
46 | IBSS_ATTR __attribute__((aligned(16))); /* 2432/4864 bytes */ | ||
47 | static filter_int filterbuf256[(256*3 + FILTER_HISTORY_SIZE) * 2] | ||
48 | __attribute__((aligned(16))); /* 5120/10240 bytes */ | ||
49 | #define FILTERBUF64 filterbuf64 | ||
50 | #define FILTERBUF32 filterbuf64 | ||
51 | #define FILTERBUF16 filterbuf64 | ||
52 | #endif | ||
40 | 53 | ||
41 | /* This is only needed for "insane" files, and no current Rockbox targets | 54 | /* This is only needed for "insane" files, and no current Rockbox targets |
42 | can hope to decode them in realtime, although the Gigabeat S comes close. */ | 55 | can hope to decode them in realtime, although the Gigabeat S comes close. */ |
@@ -57,22 +70,22 @@ void init_frame_decoder(struct ape_ctx_t* ape_ctx, | |||
57 | switch (ape_ctx->compressiontype) | 70 | switch (ape_ctx->compressiontype) |
58 | { | 71 | { |
59 | case 2000: | 72 | case 2000: |
60 | init_filter_16_11(filterbuf32); | 73 | init_filter_16_11(FILTERBUF16); |
61 | break; | 74 | break; |
62 | 75 | ||
63 | case 3000: | 76 | case 3000: |
64 | init_filter_64_11(filterbuf256); | 77 | init_filter_64_11(FILTERBUF64); |
65 | break; | 78 | break; |
66 | 79 | ||
67 | case 4000: | 80 | case 4000: |
68 | init_filter_256_13(filterbuf256); | 81 | init_filter_256_13(filterbuf256); |
69 | init_filter_32_10(filterbuf32); | 82 | init_filter_32_10(FILTERBUF32); |
70 | break; | 83 | break; |
71 | 84 | ||
72 | case 5000: | 85 | case 5000: |
73 | init_filter_1280_15(filterbuf1280); | 86 | init_filter_1280_15(filterbuf1280); |
74 | init_filter_256_13(filterbuf256); | 87 | init_filter_256_13(filterbuf256); |
75 | init_filter_16_11(filterbuf32); | 88 | init_filter_16_11(FILTERBUF32); |
76 | } | 89 | } |
77 | } | 90 | } |
78 | 91 | ||
diff --git a/apps/codecs/demac/libdemac/demac_config.h b/apps/codecs/demac/libdemac/demac_config.h index 1beda2b9cd..13166f69ae 100644 --- a/apps/codecs/demac/libdemac/demac_config.h +++ b/apps/codecs/demac/libdemac/demac_config.h | |||
@@ -44,6 +44,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | |||
44 | #define FILTER_BITS 32 | 44 | #define FILTER_BITS 32 |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #if !defined(CPU_PP) && !defined(CPU_S5L870X) | ||
48 | #define FILTER256_IRAM | ||
49 | #endif | ||
50 | |||
47 | #if CONFIG_CPU == PP5002 | 51 | #if CONFIG_CPU == PP5002 |
48 | /* Code in IRAM for speed, not enough IRAM for the insane filter buffer. */ | 52 | /* Code in IRAM for speed, not enough IRAM for the insane filter buffer. */ |
49 | #define ICODE_SECTION_DEMAC_ARM .icode | 53 | #define ICODE_SECTION_DEMAC_ARM .icode |
diff --git a/apps/codecs/demac/libdemac/filter.c b/apps/codecs/demac/libdemac/filter.c index bab830a8bd..93edf39cb2 100644 --- a/apps/codecs/demac/libdemac/filter.c +++ b/apps/codecs/demac/libdemac/filter.c | |||
@@ -97,9 +97,26 @@ struct filter_t { | |||
97 | #define FP_HALF (1 << (FRACBITS - 1)) /* 0.5 in fixed-point format. */ | 97 | #define FP_HALF (1 << (FRACBITS - 1)) /* 0.5 in fixed-point format. */ |
98 | #define FP_TO_INT(x) ((x + FP_HALF) >> FRACBITS) /* round(x) */ | 98 | #define FP_TO_INT(x) ((x + FP_HALF) >> FRACBITS) /* round(x) */ |
99 | 99 | ||
100 | #if defined(CPU_ARM) && (ARM_ARCH >= 6) | 100 | #ifdef CPU_ARM |
101 | #if ARM_ARCH >= 6 | ||
101 | #define SATURATE(x) ({int __res; asm("ssat %0, #16, %1" : "=r"(__res) : "r"(x)); __res; }) | 102 | #define SATURATE(x) ({int __res; asm("ssat %0, #16, %1" : "=r"(__res) : "r"(x)); __res; }) |
102 | #else | 103 | #else /* ARM_ARCH < 6 */ |
104 | /* Keeping the asr #31 outside of the asm allows loads to be scheduled between | ||
105 | it and the rest of the block on ARM9E, with the load's result latency filled | ||
106 | by the other calculations. */ | ||
107 | #define SATURATE(x) ({ \ | ||
108 | int __res = (x) >> 31; \ | ||
109 | asm volatile ( \ | ||
110 | "teq %0, %1, asr #15\n\t" \ | ||
111 | "moveq %0, %1\n\t" \ | ||
112 | "eorne %0, %0, #0xff\n\t" \ | ||
113 | "eorne %0, %0, #0x7f00" \ | ||
114 | : "+r" (__res) : "r" (x) : "cc" \ | ||
115 | ); \ | ||
116 | __res; \ | ||
117 | }) | ||
118 | #endif /* ARM_ARCH */ | ||
119 | #else /* CPU_ARM */ | ||
103 | #define SATURATE(x) (LIKELY((x) == (int16_t)(x)) ? (x) : ((x) >> 31) ^ 0x7FFF) | 120 | #define SATURATE(x) (LIKELY((x) == (int16_t)(x)) ? (x) : ((x) >> 31) ^ 0x7FFF) |
104 | #endif | 121 | #endif |
105 | 122 | ||
diff --git a/apps/codecs/demac/libdemac/filter_1280_15.c b/apps/codecs/demac/libdemac/filter_1280_15.c index 7077e0ee8e..f2301fb02a 100644 --- a/apps/codecs/demac/libdemac/filter_1280_15.c +++ b/apps/codecs/demac/libdemac/filter_1280_15.c | |||
@@ -22,6 +22,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | |||
22 | 22 | ||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "demac_config.h" | ||
26 | #ifndef FILTER256_IRAM | ||
27 | #undef ICODE_ATTR_DEMAC | ||
28 | #define ICODE_ATTR_DEMAC | ||
29 | #endif | ||
25 | #define ORDER 1280 | 30 | #define ORDER 1280 |
26 | #define FRACBITS 15 | 31 | #define FRACBITS 15 |
27 | #include "filter.c" | 32 | #include "filter.c" |
diff --git a/apps/codecs/demac/libdemac/filter_256_13.c b/apps/codecs/demac/libdemac/filter_256_13.c index 69cf638903..9e4b9fcb13 100644 --- a/apps/codecs/demac/libdemac/filter_256_13.c +++ b/apps/codecs/demac/libdemac/filter_256_13.c | |||
@@ -22,6 +22,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | |||
22 | 22 | ||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "demac_config.h" | ||
26 | #ifndef FILTER256_IRAM | ||
27 | #undef ICODE_ATTR_DEMAC | ||
28 | #define ICODE_ATTR_DEMAC | ||
29 | #endif | ||
25 | #define ORDER 256 | 30 | #define ORDER 256 |
26 | #define FRACBITS 13 | 31 | #define FRACBITS 13 |
27 | #include "filter.c" | 32 | #include "filter.c" |
diff --git a/apps/codecs/lib/udiv32_arm.S b/apps/codecs/lib/udiv32_arm.S index 33ab7a43a5..8efc92c2e6 100644 --- a/apps/codecs/lib/udiv32_arm.S +++ b/apps/codecs/lib/udiv32_arm.S | |||
@@ -90,18 +90,18 @@ | |||
90 | 90 | ||
91 | #ifdef CPU_PP | 91 | #ifdef CPU_PP |
92 | #if CONFIG_CPU == PP5020 | 92 | #if CONFIG_CPU == PP5020 |
93 | .set recip_max, 5952 | 93 | .set recip_max, 8384 |
94 | #elif CONFIG_CPU == PP5002 | 94 | #elif CONFIG_CPU == PP5002 |
95 | .set recip_max, 1472 | 95 | .set recip_max, 4992 |
96 | #else | 96 | #else |
97 | .set recip_max, 14208 | 97 | .set recip_max, 16384 |
98 | #endif | 98 | #endif |
99 | #elif CONFIG_CPU == AS3525 | 99 | #elif CONFIG_CPU == AS3525 |
100 | .set recip_max, 42752 | 100 | .set recip_max, 42752 |
101 | #elif CONFIG_CPU == S5L8701 | 101 | #elif CONFIG_CPU == S5L8701 |
102 | .set recip_max, 9600 | 102 | .set recip_max, 13184 |
103 | #elif CONFIG_CPU == S5L8700 | 103 | #elif CONFIG_CPU == S5L8700 |
104 | .set recip_max, 5504 | 104 | .set recip_max, 9088 |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | udiv32_arm: | 107 | udiv32_arm: |