summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/mpegplayer/idct.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/plugins/mpegplayer/idct.c b/apps/plugins/mpegplayer/idct.c
index 8a0b56ea22..5f37d7688c 100644
--- a/apps/plugins/mpegplayer/idct.c
+++ b/apps/plugins/mpegplayer/idct.c
@@ -47,8 +47,34 @@ void (* mpeg2_idct_add) (int last, int16_t * block,
47 * to +-3826 - this is the worst case for a column IDCT where the 47 * to +-3826 - this is the worst case for a column IDCT where the
48 * column inputs are 16-bit values. 48 * column inputs are 16-bit values.
49 */ 49 */
50#ifdef CPU_COLDFIRE
51static inline unsigned CLIP(int value)
52{
53 asm ( /* Note: Uses knowledge that only the low byte of the result is used */
54 "cmp.l #255,%[v] \n" /* overflow? */
55 "bls.b 1f \n" /* no: return value */
56 "spl.b %[v] \n" /* yes: set low byte to appropriate boundary */
57 "1: \n"
58 : /* outputs */
59 [v]"+d"(value)
60 );
61 return value;
62}
63#elif defined CPU_ARM
64static inline unsigned CLIP(int value)
65{
66 asm ( /* Note: Uses knowledge that only the low byte of the result is used */
67 "cmp %[v], #255 \n"
68 "mvnhi %[v], %[v], asr #31 \n"
69 : /* outputs */
70 [v]"+r"(value)
71 );
72 return value;
73}
74#else
50uint8_t mpeg2_clip[3840 * 2 + 256] IBSS_ATTR; 75uint8_t mpeg2_clip[3840 * 2 + 256] IBSS_ATTR;
51#define CLIP(i) ((mpeg2_clip + 3840)[i]) 76#define CLIP(i) ((mpeg2_clip + 3840)[i])
77#endif
52 78
53#if 0 79#if 0
54#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \ 80#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \
@@ -275,8 +301,10 @@ void mpeg2_idct_init (uint32_t accel)
275 301
276 mpeg2_idct_copy = mpeg2_idct_copy_c; 302 mpeg2_idct_copy = mpeg2_idct_copy_c;
277 mpeg2_idct_add = mpeg2_idct_add_c; 303 mpeg2_idct_add = mpeg2_idct_add_c;
304#if !defined(CPU_COLDFIRE) && !defined(CPU_ARM)
278 for (i = -3840; i < 3840 + 256; i++) 305 for (i = -3840; i < 3840 + 256; i++)
279 CLIP(i) = (i < 0) ? 0 : ((i > 255) ? 255 : i); 306 CLIP(i) = (i < 0) ? 0 : ((i > 255) ? 255 : i);
307#endif
280 for (i = 0; i < 64; i++) { 308 for (i = 0; i < 64; i++) {
281 j = mpeg2_scan_norm[i]; 309 j = mpeg2_scan_norm[i];
282 mpeg2_scan_norm[i] = ((j & 0x36) >> 1) | ((j & 0x09) << 2); 310 mpeg2_scan_norm[i] = ((j & 0x36) >> 1) | ((j & 0x09) << 2);