summaryrefslogtreecommitdiff
path: root/apps/codecs/raac.c
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-04-24 20:19:05 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-04-24 20:19:05 +0000
commita602f46d69d9d18756b7f317470f654f695faa80 (patch)
treef111cc29197def94d5404d15c7febfd06efed9f7 /apps/codecs/raac.c
parent69580a96eb816d9b811c542d38181126243d8563 (diff)
downloadrockbox-a602f46d69d9d18756b7f317470f654f695faa80.tar.gz
rockbox-a602f46d69d9d18756b7f317470f654f695faa80.zip
Rework of libfaad in several areas. Allow removal of malloc with a new define FAAD_STATIC_ALLOC (in common.h). For now malloc is not fully removed but used by a few arrays needed for AAC-HE SBR+PS only. Reason to keep malloc is to have this amount of memory available for AAC-LC files which might require large m4a tables. The changes make the allocation routines much smaller, better centralized and allow to move duplicated code from aac.c/raa.c to libfaad. The rework includes removal of (now and former) unused code as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29778 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/raac.c')
-rw-r--r--apps/codecs/raac.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/apps/codecs/raac.c b/apps/codecs/raac.c
index e3ad2b5dd8..b322ae7df3 100644
--- a/apps/codecs/raac.c
+++ b/apps/codecs/raac.c
@@ -28,13 +28,6 @@
28 28
29CODEC_HEADER 29CODEC_HEADER
30 30
31/* Global buffers to be used in the mdct synthesis. This way the arrays can
32 * be moved to IRAM for some targets */
33#define GB_BUF_SIZE 1024
34static ALIGN real_t gb_time_buffer[2][GB_BUF_SIZE] IBSS_ATTR_FAAD_LARGE_IRAM;
35static ALIGN real_t gb_fb_intermed[2][GB_BUF_SIZE] IBSS_ATTR_FAAD_LARGE_IRAM;
36
37
38static void init_rm(RMContext *rmctx) 31static void init_rm(RMContext *rmctx)
39{ 32{
40 memcpy(rmctx, (void*)(( (intptr_t)ci->id3->id3v2buf + 3 ) &~ 3), sizeof(RMContext)); 33 memcpy(rmctx, (void*)(( (intptr_t)ci->id3->id3v2buf + 3 ) &~ 3), sizeof(RMContext));
@@ -49,7 +42,6 @@ enum codec_status codec_main(void)
49 NeAACDecHandle decoder; 42 NeAACDecHandle decoder;
50 size_t n; 43 size_t n;
51 void *ret; 44 void *ret;
52 int needed_bufsize;
53 unsigned int i; 45 unsigned int i;
54 unsigned char* buffer; 46 unsigned char* buffer;
55 int err, consumed, pkt_offset, skipped = 0; 47 int err, consumed, pkt_offset, skipped = 0;
@@ -103,34 +95,6 @@ next_track:
103 goto done; 95 goto done;
104 } 96 }
105 97
106 /* Set pointer to be able to use IRAM an to avoid alloc in decoder. Must
107 * be called after NeAACDecOpen(). */
108 /* A buffer of framelength or 2*frameLenght size must be allocated for
109 * time_out. If frameLength is too big or SBR/forceUpSampling is active,
110 * we do not use the IRAM buffer and keep faad's internal allocation (see
111 * specrec.c). */
112 needed_bufsize = decoder->frameLength;
113#ifdef SBR_DEC
114 if ((decoder->sbr_present_flag == 1) || (decoder->forceUpSampling == 1))
115 {
116 needed_bufsize *= 2;
117 }
118#endif
119 if (needed_bufsize <= GB_BUF_SIZE)
120 {
121 decoder->time_out[0] = &gb_time_buffer[0][0];
122 decoder->time_out[1] = &gb_time_buffer[1][0];
123 }
124 /* A buffer of with frameLength elements must be allocated for fb_intermed.
125 * If frameLength is too big, we do not use the IRAM buffer and keep faad's
126 * internal allocation (see specrec.c). */
127 needed_bufsize = decoder->frameLength;
128 if (needed_bufsize <= GB_BUF_SIZE)
129 {
130 decoder->fb_intermed[0] = &gb_fb_intermed[0][0];
131 decoder->fb_intermed[1] = &gb_fb_intermed[1][0];
132 }
133
134 /* check for a mid-track resume and force a seek time accordingly */ 98 /* check for a mid-track resume and force a seek time accordingly */
135 if(resume_offset > rmctx.data_offset + DATA_HEADER_SIZE) { 99 if(resume_offset > rmctx.data_offset + DATA_HEADER_SIZE) {
136 resume_offset -= rmctx.data_offset + DATA_HEADER_SIZE; 100 resume_offset -= rmctx.data_offset + DATA_HEADER_SIZE;