diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-12-19 19:46:10 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-12-19 19:46:10 +0000 |
commit | 07405841c67ac29b2a75f20f8732b34064a28cff (patch) | |
tree | 2f0cff6eecb9c77c18ac411b2067610bf862e69a /apps | |
parent | 9b920734be1325ce60c46b6afaff5a23309be97a (diff) | |
download | rockbox-07405841c67ac29b2a75f20f8732b34064a28cff.tar.gz rockbox-07405841c67ac29b2a75f20f8732b34064a28cff.zip |
FS#12463: Improve performance for multichannel FLAC decoding. Speeds up decoding by 3 MHz on PP5022, 6-7 MHz on S5L870x and 11-12 MHz on MCF5250. 5.1-88kHz-files still do not decode in realtime on Coldfire and PP502x.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31367 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs/flac.c | 27 | ||||
-rw-r--r-- | apps/codecs/libffmpegFLAC/bitstream.h | 22 | ||||
-rw-r--r-- | apps/codecs/libffmpegFLAC/decoder.c | 1 |
3 files changed, 36 insertions, 14 deletions
diff --git a/apps/codecs/flac.c b/apps/codecs/flac.c index b9f6654f92..e10403819c 100644 --- a/apps/codecs/flac.c +++ b/apps/codecs/flac.c | |||
@@ -24,10 +24,15 @@ | |||
24 | 24 | ||
25 | CODEC_HEADER | 25 | CODEC_HEADER |
26 | 26 | ||
27 | static FLACContext fc IBSS_ATTR_FLAC; | ||
28 | |||
27 | /* The output buffers containing the decoded samples (channels 0 and 1) */ | 29 | /* The output buffers containing the decoded samples (channels 0 and 1) */ |
28 | static int32_t decoded0[MAX_BLOCKSIZE] IBSS_ATTR_FLAC_DECODED0; | 30 | static int32_t decoded0[MAX_BLOCKSIZE] IBSS_ATTR_FLAC; |
29 | static int32_t decoded1[MAX_BLOCKSIZE] IBSS_ATTR; | 31 | static int32_t decoded1[MAX_BLOCKSIZE] IBSS_ATTR_FLAC; |
30 | static int32_t dummydec[4][MAX_BLOCKSIZE]; | 32 | static int32_t decoded2[MAX_BLOCKSIZE] IBSS_ATTR_FLAC_LARGE_IRAM; |
33 | static int32_t decoded3[MAX_BLOCKSIZE] IBSS_ATTR_FLAC_LARGE_IRAM; | ||
34 | static int32_t decoded4[MAX_BLOCKSIZE] IBSS_ATTR_FLAC_XLARGE_IRAM; | ||
35 | static int32_t decoded5[MAX_BLOCKSIZE] IBSS_ATTR_FLAC_XLARGE_IRAM; | ||
31 | 36 | ||
32 | #define MAX_SUPPORTED_SEEKTABLE_SIZE 5000 | 37 | #define MAX_SUPPORTED_SEEKTABLE_SIZE 5000 |
33 | 38 | ||
@@ -81,7 +86,6 @@ static bool flac_init(FLACContext* fc, int first_frame_offset) | |||
81 | uint16_t blocksize; | 86 | uint16_t blocksize; |
82 | int endofmetadata=0; | 87 | int endofmetadata=0; |
83 | uint32_t blocklength; | 88 | uint32_t blocklength; |
84 | int ch; | ||
85 | 89 | ||
86 | ci->memset(fc,0,sizeof(FLACContext)); | 90 | ci->memset(fc,0,sizeof(FLACContext)); |
87 | nseekpoints=0; | 91 | nseekpoints=0; |
@@ -91,15 +95,19 @@ static bool flac_init(FLACContext* fc, int first_frame_offset) | |||
91 | /* Reset sample buffers */ | 95 | /* Reset sample buffers */ |
92 | memset(decoded0, 0, sizeof(decoded0)); | 96 | memset(decoded0, 0, sizeof(decoded0)); |
93 | memset(decoded1, 0, sizeof(decoded1)); | 97 | memset(decoded1, 0, sizeof(decoded1)); |
94 | memset(dummydec, 0, sizeof(dummydec)); | 98 | memset(decoded2, 0, sizeof(decoded2)); |
99 | memset(decoded3, 0, sizeof(decoded3)); | ||
100 | memset(decoded4, 0, sizeof(decoded4)); | ||
101 | memset(decoded5, 0, sizeof(decoded5)); | ||
95 | 102 | ||
96 | /* Set sample buffers in decoder structure */ | 103 | /* Set sample buffers in decoder structure */ |
97 | fc->decoded[0] = decoded0; | 104 | fc->decoded[0] = decoded0; |
98 | fc->decoded[1] = decoded1; | 105 | fc->decoded[1] = decoded1; |
99 | for (ch=2; ch<MAX_CHANNELS; ++ch) | 106 | fc->decoded[2] = decoded2; |
100 | { | 107 | fc->decoded[3] = decoded3; |
101 | fc->decoded[ch] = dummydec[ch-2]; | 108 | fc->decoded[4] = decoded4; |
102 | } | 109 | fc->decoded[5] = decoded5; |
110 | |||
103 | 111 | ||
104 | /* Skip any foreign tags at start of file */ | 112 | /* Skip any foreign tags at start of file */ |
105 | ci->seek_buffer(first_frame_offset); | 113 | ci->seek_buffer(first_frame_offset); |
@@ -447,7 +455,6 @@ enum codec_status codec_main(enum codec_entry_call_reason reason) | |||
447 | enum codec_status codec_run(void) | 455 | enum codec_status codec_run(void) |
448 | { | 456 | { |
449 | int8_t *buf; | 457 | int8_t *buf; |
450 | FLACContext fc; | ||
451 | uint32_t samplesdone; | 458 | uint32_t samplesdone; |
452 | uint32_t elapsedtime; | 459 | uint32_t elapsedtime; |
453 | size_t bytesleft; | 460 | size_t bytesleft; |
diff --git a/apps/codecs/libffmpegFLAC/bitstream.h b/apps/codecs/libffmpegFLAC/bitstream.h index 1333b9f4b8..5fc3460c8e 100644 --- a/apps/codecs/libffmpegFLAC/bitstream.h +++ b/apps/codecs/libffmpegFLAC/bitstream.h | |||
@@ -19,12 +19,26 @@ | |||
19 | #define ICODE_ATTR | 19 | #define ICODE_ATTR |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #ifndef ICODE_ATTR_FLAC | 22 | #if (CONFIG_CPU == MCF5250) || (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) |
23 | #define ICODE_ATTR_FLAC ICODE_ATTR | 23 | #define ICODE_ATTR_FLAC ICODE_ATTR |
24 | #endif | 24 | #define IBSS_ATTR_FLAC IBSS_ATTR |
25 | /* Enough IRAM to move additional data to it. */ | ||
26 | #define IBSS_ATTR_FLAC_LARGE_IRAM IBSS_ATTR | ||
27 | #define IBSS_ATTR_FLAC_XLARGE_IRAM | ||
28 | |||
29 | #elif defined(CPU_S5L870X) | ||
30 | #define ICODE_ATTR_FLAC ICODE_ATTR | ||
31 | #define IBSS_ATTR_FLAC IBSS_ATTR | ||
32 | /* Enough IRAM to move even more additional data to it. */ | ||
33 | #define IBSS_ATTR_FLAC_LARGE_IRAM IBSS_ATTR | ||
34 | #define IBSS_ATTR_FLAC_XLARGE_IRAM IBSS_ATTR | ||
25 | 35 | ||
26 | #ifndef IBSS_ATTR_FLAC_DECODED0 | 36 | #else |
27 | #define IBSS_ATTR_FLAC_DECODED0 IBSS_ATTR | 37 | #define ICODE_ATTR_FLAC ICODE_ATTR |
38 | #define IBSS_ATTR_FLAC IBSS_ATTR | ||
39 | /* Not enough IRAM available. */ | ||
40 | #define IBSS_ATTR_FLAC_LARGE_IRAM | ||
41 | #define IBSS_ATTR_FLAC_XLARGE_IRAM | ||
28 | #endif | 42 | #endif |
29 | 43 | ||
30 | /* Endian conversion routines for standalone compilation */ | 44 | /* Endian conversion routines for standalone compilation */ |
diff --git a/apps/codecs/libffmpegFLAC/decoder.c b/apps/codecs/libffmpegFLAC/decoder.c index 1be5fbb6ef..2e92c4b90d 100644 --- a/apps/codecs/libffmpegFLAC/decoder.c +++ b/apps/codecs/libffmpegFLAC/decoder.c | |||
@@ -488,6 +488,7 @@ static int decode_frame(FLACContext *s, | |||
488 | return 0; | 488 | return 0; |
489 | } | 489 | } |
490 | 490 | ||
491 | static int flac_downmix(FLACContext *s) ICODE_ATTR_FLAC; | ||
491 | static int flac_downmix(FLACContext *s) | 492 | static int flac_downmix(FLACContext *s) |
492 | { | 493 | { |
493 | int32_t *FL, *FR, *FC, *SB, *RL, *RR; | 494 | int32_t *FL, *FR, *FC, *SB, *RL, *RR; |