summaryrefslogtreecommitdiff
path: root/apps/codecs/demac/libdemac
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2010-03-03 21:20:13 +0000
committerJens Arnold <amiconn@rockbox.org>2010-03-03 21:20:13 +0000
commit5c80a838e4f6217970998df9d2bef44a9dddc795 (patch)
treeb357e7f9ded23d59f7a76655fa983efb4a088b57 /apps/codecs/demac/libdemac
parent0030ae28b551df94defe25c04c1859ba508e632e (diff)
libdemac: Separate filtering calls per channel in preparation for the dual-core split on PP. This also means less inlining, and hence speeds up decoding on single core slightly, due to better caching behaviour.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25005 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/demac/libdemac')
-rw-r--r--apps/codecs/demac/libdemac/decoder.c35
-rw-r--r--apps/codecs/demac/libdemac/filter.c24
-rw-r--r--apps/codecs/demac/libdemac/filter.h20
3 files changed, 40 insertions, 39 deletions
diff --git a/apps/codecs/demac/libdemac/decoder.c b/apps/codecs/demac/libdemac/decoder.c
index 09563e0112..c415db774a 100644
--- a/apps/codecs/demac/libdemac/decoder.c
+++ b/apps/codecs/demac/libdemac/decoder.c
@@ -118,22 +118,22 @@ int ICODE_ATTR_DEMAC decode_chunk(struct ape_ctx_t* ape_ctx,
switch (ape_ctx->compressiontype)
{
case 2000:
- apply_filter_16_11(ape_ctx->fileversion,decoded0,NULL,count);
+ apply_filter_16_11(ape_ctx->fileversion,0,decoded0,count);
break;
case 3000:
- apply_filter_64_11(ape_ctx->fileversion,decoded0,NULL,count);
+ apply_filter_64_11(ape_ctx->fileversion,0,decoded0,count);
break;
case 4000:
- apply_filter_32_10(ape_ctx->fileversion,decoded0,NULL,count);
- apply_filter_256_13(ape_ctx->fileversion,decoded0,NULL,count);
+ apply_filter_32_10(ape_ctx->fileversion,0,decoded0,count);
+ apply_filter_256_13(ape_ctx->fileversion,0,decoded0,count);
break;
case 5000:
- apply_filter_16_11(ape_ctx->fileversion,decoded0,NULL,count);
- apply_filter_256_13(ape_ctx->fileversion,decoded0,NULL,count);
- apply_filter_1280_15(ape_ctx->fileversion,decoded0,NULL,count);
+ apply_filter_16_11(ape_ctx->fileversion,0,decoded0,count);
+ apply_filter_256_13(ape_ctx->fileversion,0,decoded0,count);
+ apply_filter_1280_15(ape_ctx->fileversion,0,decoded0,count);
}
/* Now apply the predictor decoding */
@@ -171,22 +171,29 @@ int ICODE_ATTR_DEMAC decode_chunk(struct ape_ctx_t* ape_ctx,
switch (ape_ctx->compressiontype)
{
case 2000:
- apply_filter_16_11(ape_ctx->fileversion,decoded0,decoded1,count);
+ apply_filter_16_11(ape_ctx->fileversion,0,decoded0,count);
+ apply_filter_16_11(ape_ctx->fileversion,1,decoded1,count);
break;
case 3000:
- apply_filter_64_11(ape_ctx->fileversion,decoded0,decoded1,count);
+ apply_filter_64_11(ape_ctx->fileversion,0,decoded0,count);
+ apply_filter_64_11(ape_ctx->fileversion,1,decoded1,count);
break;
case 4000:
- apply_filter_32_10(ape_ctx->fileversion,decoded0,decoded1,count);
- apply_filter_256_13(ape_ctx->fileversion,decoded0,decoded1,count);
+ apply_filter_32_10(ape_ctx->fileversion,0,decoded0,count);
+ apply_filter_32_10(ape_ctx->fileversion,1,decoded1,count);
+ apply_filter_256_13(ape_ctx->fileversion,0,decoded0,count);
+ apply_filter_256_13(ape_ctx->fileversion,1,decoded1,count);
break;
case 5000:
- apply_filter_16_11(ape_ctx->fileversion,decoded0,decoded1,count);
- apply_filter_256_13(ape_ctx->fileversion,decoded0,decoded1,count);
- apply_filter_1280_15(ape_ctx->fileversion,decoded0,decoded1,count);
+ apply_filter_16_11(ape_ctx->fileversion,0,decoded0,count);
+ apply_filter_16_11(ape_ctx->fileversion,1,decoded1,count);
+ apply_filter_256_13(ape_ctx->fileversion,0,decoded0,count);
+ apply_filter_256_13(ape_ctx->fileversion,1,decoded1,count);
+ apply_filter_1280_15(ape_ctx->fileversion,0,decoded0,count);
+ apply_filter_1280_15(ape_ctx->fileversion,1,decoded1,count);
}
/* Now apply the predictor decoding */
diff --git a/apps/codecs/demac/libdemac/filter.c b/apps/codecs/demac/libdemac/filter.c
index 275f12f6ae..47a0aeb28e 100644
--- a/apps/codecs/demac/libdemac/filter.c
+++ b/apps/codecs/demac/libdemac/filter.c
@@ -260,8 +260,7 @@ static void ICODE_ATTR_DEMAC do_apply_filter_3970(struct filter_t* f,
}
}
-static struct filter_t filter0 IBSS_ATTR;
-static struct filter_t filter1 IBSS_ATTR;
+static struct filter_t filter[2] IBSS_ATTR;
static void do_init_filter(struct filter_t* f, filter_int* buf)
{
@@ -281,20 +280,15 @@ static void do_init_filter(struct filter_t* f, filter_int* buf)
void INIT_FILTER(filter_int* buf)
{
- do_init_filter(&filter0, buf);
- do_init_filter(&filter1, buf + ORDER*3 + FILTER_HISTORY_SIZE);
+ do_init_filter(&filter[0], buf);
+ do_init_filter(&filter[1], buf + ORDER*3 + FILTER_HISTORY_SIZE);
}
-void ICODE_ATTR_DEMAC APPLY_FILTER(int fileversion, int32_t* data0,
- int32_t* data1, int count)
+void ICODE_ATTR_DEMAC APPLY_FILTER(int fileversion, int channel,
+ int32_t* data, int count)
{
- if (fileversion >= 3980) {
- do_apply_filter_3980(&filter0, data0, count);
- if (data1 != NULL)
- do_apply_filter_3980(&filter1, data1, count);
- } else {
- do_apply_filter_3970(&filter0, data0, count);
- if (data1 != NULL)
- do_apply_filter_3970(&filter1, data1, count);
- }
+ if (fileversion >= 3980)
+ do_apply_filter_3980(&filter[channel], data, count);
+ else
+ do_apply_filter_3970(&filter[channel], data, count);
}
diff --git a/apps/codecs/demac/libdemac/filter.h b/apps/codecs/demac/libdemac/filter.h
index bfd0c552a6..609ea12496 100644
--- a/apps/codecs/demac/libdemac/filter.h
+++ b/apps/codecs/demac/libdemac/filter.h
@@ -28,23 +28,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
#include "demac_config.h"
void init_filter_16_11(filter_int* buf);
-void apply_filter_16_11(int fileversion, int32_t* decoded0,
- int32_t* decoded1, int count);
+void apply_filter_16_11(int fileversion, int channel,
+ int32_t* decoded, int count);
void init_filter_64_11(filter_int* buf);
-void apply_filter_64_11(int fileversion, int32_t* decoded0,
- int32_t* decoded1, int count);
+void apply_filter_64_11(int fileversion, int channel,
+ int32_t* decoded, int count);
void init_filter_32_10(filter_int* buf);
-void apply_filter_32_10(int fileversion, int32_t* decoded0,
- int32_t* decoded1, int count);
+void apply_filter_32_10(int fileversion, int channel,
+ int32_t* decoded, int count);
void init_filter_256_13(filter_int* buf);
-void apply_filter_256_13(int fileversion, int32_t* decoded0,
- int32_t* decoded1, int count);
+void apply_filter_256_13(int fileversion, int channel,
+ int32_t* decoded, int count);
void init_filter_1280_15(filter_int* buf);
-void apply_filter_1280_15(int fileversion, int32_t* decoded0,
- int32_t* decoded1, int count);
+void apply_filter_1280_15(int fileversion, int channel,
+ int32_t* decoded, int count);
#endif