summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2005-06-11 01:04:59 +0000
committerThom Johansen <thomj@rockbox.org>2005-06-11 01:04:59 +0000
commitc82518ce060d3da4800bcc08fffe910b37711f38 (patch)
treef754e46276771f964fa0f8ec242f89251cd1d63e /apps
parent197e3edce3c7c27b38eb2550d9eb4281ad2b4727 (diff)
downloadrockbox-c82518ce060d3da4800bcc08fffe910b37711f38.tar.gz
rockbox-c82518ce060d3da4800bcc08fffe910b37711f38.zip
Replaced critical loop with assembler. A bit closer to realtime now. This codec really needs all the 64 bit muls replaced with EMAC equivalents.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6667 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libmusepack/musepack.h1
-rw-r--r--apps/codecs/libmusepack/synth_filter.c38
2 files changed, 38 insertions, 1 deletions
diff --git a/apps/codecs/libmusepack/musepack.h b/apps/codecs/libmusepack/musepack.h
index 25c21f670c..e78d27205f 100644
--- a/apps/codecs/libmusepack/musepack.h
+++ b/apps/codecs/libmusepack/musepack.h
@@ -46,6 +46,7 @@ extern "C" {
46#include <stdlib.h> 46#include <stdlib.h>
47//#include <string.h> 47//#include <string.h>
48 48
49#include "../codec.h"
49#include "config_types.h" 50#include "config_types.h"
50#include "decoder.h" 51#include "decoder.h"
51#include "math.h" 52#include "math.h"
diff --git a/apps/codecs/libmusepack/synth_filter.c b/apps/codecs/libmusepack/synth_filter.c
index f8a2921932..78cf4d1765 100644
--- a/apps/codecs/libmusepack/synth_filter.c
+++ b/apps/codecs/libmusepack/synth_filter.c
@@ -54,7 +54,7 @@ typedef mpc_int32_t ptrdiff_t;
54#endif 54#endif
55 55
56 56
57static const MPC_SAMPLE_FORMAT Di_opt [32] [16] = { 57static const MPC_SAMPLE_FORMAT Di_opt [32] [16] IDATA_ATTR = {
58 { _( 0), _( -29), _( 213), _( -459), _( 2037), _(-5153), _( 6574), _(-37489), _(75038), _(37489), _(6574), _( 5153), _(2037), _( 459), _(213), _(29) }, 58 { _( 0), _( -29), _( 213), _( -459), _( 2037), _(-5153), _( 6574), _(-37489), _(75038), _(37489), _(6574), _( 5153), _(2037), _( 459), _(213), _(29) },
59 { _( -1), _( -31), _( 218), _( -519), _( 2000), _(-5517), _( 5959), _(-39336), _(74992), _(35640), _(7134), _( 4788), _(2063), _( 401), _(208), _(26) }, 59 { _( -1), _( -31), _( 218), _( -519), _( 2000), _(-5517), _( 5959), _(-39336), _(74992), _(35640), _(7134), _( 4788), _(2063), _( 401), _(208), _(26) },
60 { _( -1), _( -35), _( 222), _( -581), _( 1952), _(-5879), _( 5288), _(-41176), _(74856), _(33791), _(7640), _( 4425), _(2080), _( 347), _(202), _(24) }, 60 { _( -1), _( -35), _( 222), _( -581), _( 1952), _(-5879), _( 5288), _(-41176), _(74856), _(33791), _(7640), _( 4425), _(2080), _( 347), _(202), _(24) },
@@ -334,6 +334,10 @@ static void Calculate_New_V ( const MPC_SAMPLE_FORMAT * Sample, MPC_SAMPLE_FORMA
334static void Synthese_Filter_float_internal(MPC_SAMPLE_FORMAT * OutData,MPC_SAMPLE_FORMAT * V,const MPC_SAMPLE_FORMAT * Y) 334static void Synthese_Filter_float_internal(MPC_SAMPLE_FORMAT * OutData,MPC_SAMPLE_FORMAT * V,const MPC_SAMPLE_FORMAT * Y)
335{ 335{
336 mpc_uint32_t n; 336 mpc_uint32_t n;
337
338 #if CONFIG_CPU==MCF5249 && !defined(SIMULATOR)
339 asm volatile ("move.l #0x20, %macsr"); /* fractional emac mode */
340 #endif
337 for ( n = 0; n < 36; n++, Y += 32 ) { 341 for ( n = 0; n < 36; n++, Y += 32 ) {
338 V -= 64; 342 V -= 64;
339 Calculate_New_V ( Y, V ); 343 Calculate_New_V ( Y, V );
@@ -346,6 +350,37 @@ static void Synthese_Filter_float_internal(MPC_SAMPLE_FORMAT * OutData,MPC_SAMPL
346 350
347 351
348 for ( k = 0; k < 32; k++, D += 16, V++ ) { 352 for ( k = 0; k < 32; k++, D += 16, V++ ) {
353 #if CONFIG_CPU==MCF5249 && !defined(SIMULATOR)
354 asm volatile (
355 "movem.l (%[D]), %%d0-%%d3\n\t"
356 "move.l (%[V]), %%a5\n\t"
357 "mac.l %%d0, %%a5, (96*4, %[V]), %%a5, %%acc0\n\t"
358 "mac.l %%d1, %%a5, (128*4, %[V]), %%a5, %%acc0\n\t"
359 "mac.l %%d2, %%a5, (224*4, %[V]), %%a5, %%acc0\n\t"
360 "mac.l %%d3, %%a5, (256*4, %[V]), %%a5, %%acc0\n\t"
361 "movem.l (4*4, %[D]), %%d0-%%d3\n\t"
362 "mac.l %%d0, %%a5, (352*4, %[V]), %%a5, %%acc0\n\t"
363 "mac.l %%d1, %%a5, (384*4, %[V]), %%a5, %%acc0\n\t"
364 "mac.l %%d2, %%a5, (480*4, %[V]), %%a5, %%acc0\n\t"
365 "mac.l %%d3, %%a5, (512*4, %[V]), %%a5, %%acc0\n\t"
366 "movem.l (8*4, %[D]), %%d0-%%d3\n\t"
367 "mac.l %%d0, %%a5, (608*4, %[V]), %%a5, %%acc0\n\t"
368 "mac.l %%d1, %%a5, (640*4, %[V]), %%a5, %%acc0\n\t"
369 "mac.l %%d2, %%a5, (736*4, %[V]), %%a5, %%acc0\n\t"
370 "mac.l %%d3, %%a5, (768*4, %[V]), %%a5, %%acc0\n\t"
371 "movem.l (12*4, %[D]), %%d0-%%d3\n\t"
372 "mac.l %%d0, %%a5, (864*4, %[V]), %%a5, %%acc0\n\t"
373 "mac.l %%d1, %%a5, (896*4, %[V]), %%a5, %%acc0\n\t"
374 "mac.l %%d2, %%a5, (992*4, %[V]), %%a5, %%acc0\n\t"
375 "mac.l %%d3, %%a5, %%acc0\n\t"
376 "movclr.l %%acc0, %%d0\n\t"
377 "asl.l #1, %%d0\n\t"
378 "move.l %%d0, (%[Data])\n\t"
379 "addq.l #8, %[Data]"
380 : [Data] "+a" (Data)
381 : [V] "a" (V), [D] "a" (D)
382 : "d0", "d1", "d2", "d3", "a5");
383 #else
349 *Data = MPC_SHL( 384 *Data = MPC_SHL(
350 MPC_MULTIPLY_FRACT(V[ 0],D[ 0]) + MPC_MULTIPLY_FRACT(V[ 96],D[ 1]) + MPC_MULTIPLY_FRACT(V[128],D[ 2]) + MPC_MULTIPLY_FRACT(V[224],D[ 3]) 385 MPC_MULTIPLY_FRACT(V[ 0],D[ 0]) + MPC_MULTIPLY_FRACT(V[ 96],D[ 1]) + MPC_MULTIPLY_FRACT(V[128],D[ 2]) + MPC_MULTIPLY_FRACT(V[224],D[ 3])
351 + MPC_MULTIPLY_FRACT(V[256],D[ 4]) + MPC_MULTIPLY_FRACT(V[352],D[ 5]) + MPC_MULTIPLY_FRACT(V[384],D[ 6]) + MPC_MULTIPLY_FRACT(V[480],D[ 7]) 386 + MPC_MULTIPLY_FRACT(V[256],D[ 4]) + MPC_MULTIPLY_FRACT(V[352],D[ 5]) + MPC_MULTIPLY_FRACT(V[384],D[ 6]) + MPC_MULTIPLY_FRACT(V[480],D[ 7])
@@ -354,6 +389,7 @@ static void Synthese_Filter_float_internal(MPC_SAMPLE_FORMAT * OutData,MPC_SAMPL
354 , 2); 389 , 2);
355 390
356 Data += 2; 391 Data += 2;
392 #endif
357 } 393 }
358 V -= 32;//bleh 394 V -= 32;//bleh
359 OutData+=64; 395 OutData+=64;