diff options
Diffstat (limited to 'apps/codecs/flac.c')
-rw-r--r-- | apps/codecs/flac.c | 27 |
1 files changed, 17 insertions, 10 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; |