diff options
Diffstat (limited to 'apps/codecs')
-rw-r--r-- | apps/codecs/aac.c | 14 | ||||
-rw-r--r-- | apps/codecs/libfaad/bits.c | 7 | ||||
-rw-r--r-- | apps/codecs/libfaad/bits.h | 34 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_1.h | 4 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_10.h | 4 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_11.h | 4 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_2.h | 4 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_3.h | 2 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_4.h | 4 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_5.h | 2 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_6.h | 4 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_7.h | 2 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_8.h | 4 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_9.h | 2 | ||||
-rw-r--r-- | apps/codecs/libfaad/codebook/hcb_sf.h | 2 | ||||
-rw-r--r-- | apps/codecs/libfaad/common.h | 21 | ||||
-rw-r--r-- | apps/codecs/libfaad/huffman.c | 69 | ||||
-rw-r--r-- | apps/codecs/libfaad/huffman.h | 2 | ||||
-rw-r--r-- | apps/codecs/libfaad/specrec.c | 70 |
19 files changed, 121 insertions, 134 deletions
diff --git a/apps/codecs/aac.c b/apps/codecs/aac.c index 0f38ea1145..1daa7de11b 100644 --- a/apps/codecs/aac.c +++ b/apps/codecs/aac.c | |||
@@ -27,6 +27,11 @@ | |||
27 | 27 | ||
28 | CODEC_HEADER | 28 | CODEC_HEADER |
29 | 29 | ||
30 | /* Global buffers to be used in the mdct synthesis. This way the arrays can | ||
31 | * be moved to IRAM for some targets */ | ||
32 | ALIGN real_t gb_time_buffer[2][1024] IBSS_ATTR_FAAD_LARGE_IRAM; | ||
33 | ALIGN real_t gb_fb_intermed[2][1024] IBSS_ATTR_FAAD_LARGE_IRAM; | ||
34 | |||
30 | /* this is the codec entry point */ | 35 | /* this is the codec entry point */ |
31 | enum codec_status codec_main(void) | 36 | enum codec_status codec_main(void) |
32 | { | 37 | { |
@@ -105,7 +110,14 @@ next_track: | |||
105 | err = CODEC_ERROR; | 110 | err = CODEC_ERROR; |
106 | goto done; | 111 | goto done; |
107 | } | 112 | } |
108 | 113 | ||
114 | /* Set pointer to be able to use IRAM an to avoid alloc in decoder. Must | ||
115 | * be called after NeAACDecOpen(). */ | ||
116 | decoder->time_out[0] = &gb_time_buffer[0][0]; | ||
117 | decoder->time_out[1] = &gb_time_buffer[1][0]; | ||
118 | decoder->fb_intermed[0] = &gb_fb_intermed[0][0]; | ||
119 | decoder->fb_intermed[1] = &gb_fb_intermed[1][0]; | ||
120 | |||
109 | ci->id3->frequency = s; | 121 | ci->id3->frequency = s; |
110 | 122 | ||
111 | i = 0; | 123 | i = 0; |
diff --git a/apps/codecs/libfaad/bits.c b/apps/codecs/libfaad/bits.c index a010e830ed..f1a36235bd 100644 --- a/apps/codecs/libfaad/bits.c +++ b/apps/codecs/libfaad/bits.c | |||
@@ -33,9 +33,10 @@ | |||
33 | #include "bits.h" | 33 | #include "bits.h" |
34 | 34 | ||
35 | /* Need to be large enough to fit the largest compressed sample in a file. | 35 | /* Need to be large enough to fit the largest compressed sample in a file. |
36 | * Samples a little larger than 1 KB observed in a 256 kbps file. | 36 | * Samples were observed to need up to 1500 bytes (400 kbps nero aac). |
37 | */ | 37 | */ |
38 | uint8_t static_buffer[2048]; | 38 | #define BUFFER_SIZE 2048 |
39 | uint8_t static_buffer[BUFFER_SIZE] IBSS_ATTR; | ||
39 | 40 | ||
40 | /* initialize buffer, call once before first getbits or showbits */ | 41 | /* initialize buffer, call once before first getbits or showbits */ |
41 | void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) | 42 | void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) |
@@ -47,7 +48,7 @@ void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) | |||
47 | 48 | ||
48 | memset(ld, 0, sizeof(bitfile)); | 49 | memset(ld, 0, sizeof(bitfile)); |
49 | 50 | ||
50 | if (buffer_size == 0 || _buffer == NULL) | 51 | if (buffer_size == 0 || _buffer == NULL || (buffer_size+12)>BUFFER_SIZE) |
51 | { | 52 | { |
52 | ld->error = 1; | 53 | ld->error = 1; |
53 | ld->no_more_reading = 1; | 54 | ld->no_more_reading = 1; |
diff --git a/apps/codecs/libfaad/bits.h b/apps/codecs/libfaad/bits.h index 0ebe04b03f..815db59c68 100644 --- a/apps/codecs/libfaad/bits.h +++ b/apps/codecs/libfaad/bits.h | |||
@@ -55,15 +55,11 @@ typedef struct _bitfile | |||
55 | void *buffer; | 55 | void *buffer; |
56 | } bitfile; | 56 | } bitfile; |
57 | 57 | ||
58 | 58 | /* rockbox: use asm optimized swap32() | |
59 | #if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__) | ||
60 | #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax | ||
61 | #elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__) | ||
62 | #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) | ||
63 | #else | ||
64 | #define BSWAP(a) \ | 59 | #define BSWAP(a) \ |
65 | ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) | 60 | ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) |
66 | #endif | 61 | */ |
62 | #define BSWAP(a) swap32(a) | ||
67 | 63 | ||
68 | static uint32_t bitmask[] = { | 64 | static uint32_t bitmask[] = { |
69 | 0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, | 65 | 0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, |
@@ -81,7 +77,7 @@ void faad_initbits_rev(bitfile *ld, void *buffer, | |||
81 | uint32_t bits_in_buffer); | 77 | uint32_t bits_in_buffer); |
82 | uint8_t faad_byte_align(bitfile *ld); | 78 | uint8_t faad_byte_align(bitfile *ld); |
83 | uint32_t faad_get_processed_bits(bitfile *ld); | 79 | uint32_t faad_get_processed_bits(bitfile *ld); |
84 | void faad_flushbits_ex(bitfile *ld, uint32_t bits); | 80 | INLINE void faad_flushbits_ex(bitfile *ld, uint32_t bits); |
85 | void faad_rewindbits(bitfile *ld); | 81 | void faad_rewindbits(bitfile *ld); |
86 | uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits | 82 | uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits |
87 | DEBUGDEC); | 83 | DEBUGDEC); |
@@ -93,28 +89,10 @@ uint32_t faad_origbitbuffer_size(bitfile *ld); | |||
93 | /* circumvent memory alignment errors on ARM */ | 89 | /* circumvent memory alignment errors on ARM */ |
94 | static INLINE uint32_t getdword(void *mem) | 90 | static INLINE uint32_t getdword(void *mem) |
95 | { | 91 | { |
96 | #ifdef ARM | ||
97 | uint32_t tmp; | ||
98 | #ifndef ARCH_IS_BIG_ENDIAN | 92 | #ifndef ARCH_IS_BIG_ENDIAN |
99 | ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3]; | 93 | return BSWAP(*(uint32_t*)mem); |
100 | ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2]; | ||
101 | ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1]; | ||
102 | ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0]; | ||
103 | #else | ||
104 | ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0]; | ||
105 | ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1]; | ||
106 | ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2]; | ||
107 | ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3]; | ||
108 | #endif | ||
109 | |||
110 | return tmp; | ||
111 | #else | 94 | #else |
112 | uint32_t tmp; | 95 | return *(uint32_t*)mem; |
113 | tmp = *(uint32_t*)mem; | ||
114 | #ifndef ARCH_IS_BIG_ENDIAN | ||
115 | BSWAP(tmp); | ||
116 | #endif | ||
117 | return tmp; | ||
118 | #endif | 96 | #endif |
119 | } | 97 | } |
120 | 98 | ||
diff --git a/apps/codecs/libfaad/codebook/hcb_1.h b/apps/codecs/libfaad/codebook/hcb_1.h index 610e578efb..88c04b6012 100644 --- a/apps/codecs/libfaad/codebook/hcb_1.h +++ b/apps/codecs/libfaad/codebook/hcb_1.h | |||
@@ -33,7 +33,7 @@ | |||
33 | * | 33 | * |
34 | * Used to find offset into 2nd step table and number of extra bits to get | 34 | * Used to find offset into 2nd step table and number of extra bits to get |
35 | */ | 35 | */ |
36 | static hcb hcb1_1[] = { | 36 | static hcb hcb1_1[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
37 | { /* 00000 */ 0, 0 }, | 37 | { /* 00000 */ 0, 0 }, |
38 | { /* */ 0, 0 }, | 38 | { /* */ 0, 0 }, |
39 | { /* */ 0, 0 }, | 39 | { /* */ 0, 0 }, |
@@ -78,7 +78,7 @@ static hcb hcb1_1[] = { | |||
78 | * | 78 | * |
79 | * Gives size of codeword and actual data (x,y,v,w) | 79 | * Gives size of codeword and actual data (x,y,v,w) |
80 | */ | 80 | */ |
81 | static hcb_2_quad hcb1_2[] = { | 81 | static hcb_2_quad hcb1_2[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
82 | /* 1 bit codeword */ | 82 | /* 1 bit codeword */ |
83 | { 1, 0, 0, 0, 0 }, | 83 | { 1, 0, 0, 0, 0 }, |
84 | 84 | ||
diff --git a/apps/codecs/libfaad/codebook/hcb_10.h b/apps/codecs/libfaad/codebook/hcb_10.h index 7f1b6a4d7e..971d06aaf0 100644 --- a/apps/codecs/libfaad/codebook/hcb_10.h +++ b/apps/codecs/libfaad/codebook/hcb_10.h | |||
@@ -33,7 +33,7 @@ | |||
33 | * | 33 | * |
34 | * Used to find offset into 2nd step table and number of extra bits to get | 34 | * Used to find offset into 2nd step table and number of extra bits to get |
35 | */ | 35 | */ |
36 | static hcb hcb10_1[] = { | 36 | static hcb hcb10_1[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
37 | /* 4 bit codewords */ | 37 | /* 4 bit codewords */ |
38 | { /* 000000 */ 0, 0 }, | 38 | { /* 000000 */ 0, 0 }, |
39 | { /* */ 0, 0 }, | 39 | { /* */ 0, 0 }, |
@@ -115,7 +115,7 @@ static hcb hcb10_1[] = { | |||
115 | * | 115 | * |
116 | * Gives size of codeword and actual data (x,y,v,w) | 116 | * Gives size of codeword and actual data (x,y,v,w) |
117 | */ | 117 | */ |
118 | static hcb_2_pair hcb10_2[] = { | 118 | static hcb_2_pair hcb10_2[] ICONST_ATTR = { |
119 | /* 4 bit codewords */ | 119 | /* 4 bit codewords */ |
120 | { 4, 1, 1 }, | 120 | { 4, 1, 1 }, |
121 | { 4, 1, 2 }, | 121 | { 4, 1, 2 }, |
diff --git a/apps/codecs/libfaad/codebook/hcb_11.h b/apps/codecs/libfaad/codebook/hcb_11.h index c5137215f9..49e97af23f 100644 --- a/apps/codecs/libfaad/codebook/hcb_11.h +++ b/apps/codecs/libfaad/codebook/hcb_11.h | |||
@@ -33,7 +33,7 @@ | |||
33 | * | 33 | * |
34 | * Used to find offset into 2nd step table and number of extra bits to get | 34 | * Used to find offset into 2nd step table and number of extra bits to get |
35 | */ | 35 | */ |
36 | static hcb hcb11_1[] = { | 36 | static hcb hcb11_1[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
37 | /* 4 bits */ | 37 | /* 4 bits */ |
38 | { /* 00000 */ 0, 0 }, | 38 | { /* 00000 */ 0, 0 }, |
39 | { /* */ 0, 0 }, | 39 | { /* */ 0, 0 }, |
@@ -95,7 +95,7 @@ static hcb hcb11_1[] = { | |||
95 | * | 95 | * |
96 | * Gives size of codeword and actual data (x,y,v,w) | 96 | * Gives size of codeword and actual data (x,y,v,w) |
97 | */ | 97 | */ |
98 | static hcb_2_pair hcb11_2[] = { | 98 | static hcb_2_pair hcb11_2[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
99 | /* 4 */ | 99 | /* 4 */ |
100 | { 4, 0, 0 }, | 100 | { 4, 0, 0 }, |
101 | { 4, 1, 1 }, | 101 | { 4, 1, 1 }, |
diff --git a/apps/codecs/libfaad/codebook/hcb_2.h b/apps/codecs/libfaad/codebook/hcb_2.h index bcc8857c15..15e7d57084 100644 --- a/apps/codecs/libfaad/codebook/hcb_2.h +++ b/apps/codecs/libfaad/codebook/hcb_2.h | |||
@@ -33,7 +33,7 @@ | |||
33 | * | 33 | * |
34 | * Used to find offset into 2nd step table and number of extra bits to get | 34 | * Used to find offset into 2nd step table and number of extra bits to get |
35 | */ | 35 | */ |
36 | static hcb hcb2_1[] = { | 36 | static hcb hcb2_1[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
37 | { /* 00000 */ 0, 0 }, | 37 | { /* 00000 */ 0, 0 }, |
38 | { /* */ 0, 0 }, | 38 | { /* */ 0, 0 }, |
39 | { /* */ 0, 0 }, | 39 | { /* */ 0, 0 }, |
@@ -82,7 +82,7 @@ static hcb hcb2_1[] = { | |||
82 | * | 82 | * |
83 | * Gives size of codeword and actual data (x,y,v,w) | 83 | * Gives size of codeword and actual data (x,y,v,w) |
84 | */ | 84 | */ |
85 | static hcb_2_quad hcb2_2[] = { | 85 | static hcb_2_quad hcb2_2[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
86 | /* 3 bit codeword */ | 86 | /* 3 bit codeword */ |
87 | { 3, 0, 0, 0, 0 }, | 87 | { 3, 0, 0, 0, 0 }, |
88 | 88 | ||
diff --git a/apps/codecs/libfaad/codebook/hcb_3.h b/apps/codecs/libfaad/codebook/hcb_3.h index 2672de0a47..3b12fdff60 100644 --- a/apps/codecs/libfaad/codebook/hcb_3.h +++ b/apps/codecs/libfaad/codebook/hcb_3.h | |||
@@ -28,7 +28,7 @@ | |||
28 | /* Binary search huffman table HCB_3 */ | 28 | /* Binary search huffman table HCB_3 */ |
29 | 29 | ||
30 | 30 | ||
31 | static hcb_bin_quad hcb3[] = { | 31 | static hcb_bin_quad hcb3[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
32 | { /* 0 */ 0, { 1, 2, 0, 0 } }, | 32 | { /* 0 */ 0, { 1, 2, 0, 0 } }, |
33 | { /* 1 */ 1, { 0, 0, 0, 0 } }, /* 0 */ | 33 | { /* 1 */ 1, { 0, 0, 0, 0 } }, /* 0 */ |
34 | { /* 2 */ 0, { 1, 2, 0, 0 } }, | 34 | { /* 2 */ 0, { 1, 2, 0, 0 } }, |
diff --git a/apps/codecs/libfaad/codebook/hcb_4.h b/apps/codecs/libfaad/codebook/hcb_4.h index 1dc90404f6..67397e1fb0 100644 --- a/apps/codecs/libfaad/codebook/hcb_4.h +++ b/apps/codecs/libfaad/codebook/hcb_4.h | |||
@@ -33,7 +33,7 @@ | |||
33 | * | 33 | * |
34 | * Used to find offset into 2nd step table and number of extra bits to get | 34 | * Used to find offset into 2nd step table and number of extra bits to get |
35 | */ | 35 | */ |
36 | static hcb hcb4_1[] = { | 36 | static hcb hcb4_1[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
37 | /* 4 bit codewords */ | 37 | /* 4 bit codewords */ |
38 | { /* 00000 */ 0, 0 }, | 38 | { /* 00000 */ 0, 0 }, |
39 | { /* */ 0, 0 }, | 39 | { /* */ 0, 0 }, |
@@ -85,7 +85,7 @@ static hcb hcb4_1[] = { | |||
85 | * | 85 | * |
86 | * Gives size of codeword and actual data (x,y,v,w) | 86 | * Gives size of codeword and actual data (x,y,v,w) |
87 | */ | 87 | */ |
88 | static hcb_2_quad hcb4_2[] = { | 88 | static hcb_2_quad hcb4_2[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
89 | /* 4 bit codewords */ | 89 | /* 4 bit codewords */ |
90 | { 4, 1, 1, 1, 1 }, | 90 | { 4, 1, 1, 1, 1 }, |
91 | { 4, 0, 1, 1, 1 }, | 91 | { 4, 0, 1, 1, 1 }, |
diff --git a/apps/codecs/libfaad/codebook/hcb_5.h b/apps/codecs/libfaad/codebook/hcb_5.h index d094a6b1c2..0143482901 100644 --- a/apps/codecs/libfaad/codebook/hcb_5.h +++ b/apps/codecs/libfaad/codebook/hcb_5.h | |||
@@ -28,7 +28,7 @@ | |||
28 | /* Binary search huffman table HCB_5 */ | 28 | /* Binary search huffman table HCB_5 */ |
29 | 29 | ||
30 | 30 | ||
31 | static hcb_bin_pair hcb5[] = { | 31 | static hcb_bin_pair hcb5[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
32 | { /* 0 */ 0, { 1, 2 } }, | 32 | { /* 0 */ 0, { 1, 2 } }, |
33 | { /* 1 */ 1, { 0, 0 } }, /* 0 */ | 33 | { /* 1 */ 1, { 0, 0 } }, /* 0 */ |
34 | { /* 2 */ 0, { 1, 2 } }, | 34 | { /* 2 */ 0, { 1, 2 } }, |
diff --git a/apps/codecs/libfaad/codebook/hcb_6.h b/apps/codecs/libfaad/codebook/hcb_6.h index 4df2380ad2..9988133552 100644 --- a/apps/codecs/libfaad/codebook/hcb_6.h +++ b/apps/codecs/libfaad/codebook/hcb_6.h | |||
@@ -33,7 +33,7 @@ | |||
33 | * | 33 | * |
34 | * Used to find offset into 2nd step table and number of extra bits to get | 34 | * Used to find offset into 2nd step table and number of extra bits to get |
35 | */ | 35 | */ |
36 | static hcb hcb6_1[] = { | 36 | static hcb hcb6_1[] ICONST_ATTR = { |
37 | /* 4 bit codewords */ | 37 | /* 4 bit codewords */ |
38 | { /* 00000 */ 0, 0 }, | 38 | { /* 00000 */ 0, 0 }, |
39 | { /* */ 0, 0 }, | 39 | { /* */ 0, 0 }, |
@@ -83,7 +83,7 @@ static hcb hcb6_1[] = { | |||
83 | * | 83 | * |
84 | * Gives size of codeword and actual data (x,y,v,w) | 84 | * Gives size of codeword and actual data (x,y,v,w) |
85 | */ | 85 | */ |
86 | static hcb_2_pair hcb6_2[] = { | 86 | static hcb_2_pair hcb6_2[] ICONST_ATTR = { |
87 | /* 4 bit codewords */ | 87 | /* 4 bit codewords */ |
88 | { 4, 0, 0 }, | 88 | { 4, 0, 0 }, |
89 | { 4, 1, 0 }, | 89 | { 4, 1, 0 }, |
diff --git a/apps/codecs/libfaad/codebook/hcb_7.h b/apps/codecs/libfaad/codebook/hcb_7.h index c26a1a328f..3b378dc5cd 100644 --- a/apps/codecs/libfaad/codebook/hcb_7.h +++ b/apps/codecs/libfaad/codebook/hcb_7.h | |||
@@ -28,7 +28,7 @@ | |||
28 | /* Binary search huffman table HCB_7 */ | 28 | /* Binary search huffman table HCB_7 */ |
29 | 29 | ||
30 | 30 | ||
31 | static hcb_bin_pair hcb7[] = { | 31 | static hcb_bin_pair hcb7[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
32 | { /* 0 */ 0, { 1, 2 } }, | 32 | { /* 0 */ 0, { 1, 2 } }, |
33 | { /* 1 */ 1, { 0, 0 } }, | 33 | { /* 1 */ 1, { 0, 0 } }, |
34 | { /* 2 */ 0, { 1, 2 } }, | 34 | { /* 2 */ 0, { 1, 2 } }, |
diff --git a/apps/codecs/libfaad/codebook/hcb_8.h b/apps/codecs/libfaad/codebook/hcb_8.h index d75da9030e..b76eb8f667 100644 --- a/apps/codecs/libfaad/codebook/hcb_8.h +++ b/apps/codecs/libfaad/codebook/hcb_8.h | |||
@@ -33,7 +33,7 @@ | |||
33 | * | 33 | * |
34 | * Used to find offset into 2nd step table and number of extra bits to get | 34 | * Used to find offset into 2nd step table and number of extra bits to get |
35 | */ | 35 | */ |
36 | static hcb hcb8_1[] = { | 36 | static hcb hcb8_1[] ICONST_ATTR = { |
37 | /* 3 bit codeword */ | 37 | /* 3 bit codeword */ |
38 | { /* 00000 */ 0, 0 }, | 38 | { /* 00000 */ 0, 0 }, |
39 | { /* */ 0, 0 }, | 39 | { /* */ 0, 0 }, |
@@ -87,7 +87,7 @@ static hcb hcb8_1[] = { | |||
87 | * | 87 | * |
88 | * Gives size of codeword and actual data (x,y,v,w) | 88 | * Gives size of codeword and actual data (x,y,v,w) |
89 | */ | 89 | */ |
90 | static hcb_2_pair hcb8_2[] = { | 90 | static hcb_2_pair hcb8_2[] ICONST_ATTR = { |
91 | /* 3 bit codeword */ | 91 | /* 3 bit codeword */ |
92 | { 3, 1, 1 }, | 92 | { 3, 1, 1 }, |
93 | 93 | ||
diff --git a/apps/codecs/libfaad/codebook/hcb_9.h b/apps/codecs/libfaad/codebook/hcb_9.h index 740a6c324e..2932001294 100644 --- a/apps/codecs/libfaad/codebook/hcb_9.h +++ b/apps/codecs/libfaad/codebook/hcb_9.h | |||
@@ -28,7 +28,7 @@ | |||
28 | /* Binary search huffman table HCB_9 */ | 28 | /* Binary search huffman table HCB_9 */ |
29 | 29 | ||
30 | 30 | ||
31 | static hcb_bin_pair hcb9[] = { | 31 | static hcb_bin_pair hcb9[] ICONST_ATTR_FAAD_LARGE_IRAM = { |
32 | { /* 0 */ 0, { 1, 2 } }, | 32 | { /* 0 */ 0, { 1, 2 } }, |
33 | { /* 1 */ 1, { 0, 0 } }, | 33 | { /* 1 */ 1, { 0, 0 } }, |
34 | { /* 2 */ 0, { 1, 2 } }, | 34 | { /* 2 */ 0, { 1, 2 } }, |
diff --git a/apps/codecs/libfaad/codebook/hcb_sf.h b/apps/codecs/libfaad/codebook/hcb_sf.h index aa5ccdbfcf..66762e2fce 100644 --- a/apps/codecs/libfaad/codebook/hcb_sf.h +++ b/apps/codecs/libfaad/codebook/hcb_sf.h | |||
@@ -28,7 +28,7 @@ | |||
28 | /* Binary search huffman table HCB_SF */ | 28 | /* Binary search huffman table HCB_SF */ |
29 | 29 | ||
30 | 30 | ||
31 | static uint8_t hcb_sf[][2] = { | 31 | static uint8_t hcb_sf[][2] ICONST_ATTR_FAAD_LARGE_IRAM = { |
32 | { /* 0 */ 1, 2 }, | 32 | { /* 0 */ 1, 2 }, |
33 | { /* 1 */ 60, 0 }, | 33 | { /* 1 */ 60, 0 }, |
34 | { /* 2 */ 1, 2 }, | 34 | { /* 2 */ 1, 2 }, |
diff --git a/apps/codecs/libfaad/common.h b/apps/codecs/libfaad/common.h index 01164e3746..59ce806e91 100644 --- a/apps/codecs/libfaad/common.h +++ b/apps/codecs/libfaad/common.h | |||
@@ -51,6 +51,25 @@ extern struct codec_api* ci; | |||
51 | #define LOGF(...) | 51 | #define LOGF(...) |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #if (CONFIG_CPU == MCF5250) || defined(CPU_S5L870X) | ||
55 | /* Enough IRAM but performance suffers with ICODE_ATTR. */ | ||
56 | #define IBSS_ATTR_FAAD_LARGE_IRAM IBSS_ATTR | ||
57 | #define ICODE_ATTR_FAAD_LARGE_IRAM | ||
58 | #define ICONST_ATTR_FAAD_LARGE_IRAM ICONST_ATTR | ||
59 | |||
60 | #elif (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) | ||
61 | /* Enough IRAM to move additional data and code to it. */ | ||
62 | #define IBSS_ATTR_FAAD_LARGE_IRAM IBSS_ATTR | ||
63 | #define ICODE_ATTR_FAAD_LARGE_IRAM ICODE_ATTR | ||
64 | #define ICONST_ATTR_FAAD_LARGE_IRAM ICONST_ATTR | ||
65 | |||
66 | #else | ||
67 | /* Not enough IRAM available. */ | ||
68 | #define IBSS_ATTR_FAAD_LARGE_IRAM | ||
69 | #define ICODE_ATTR_FAAD_LARGE_IRAM | ||
70 | #define ICONST_ATTR_FAAD_LARGE_IRAM | ||
71 | #endif | ||
72 | |||
54 | #define INLINE __inline | 73 | #define INLINE __inline |
55 | #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) | 74 | #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) |
56 | #define ALIGN __declspec(align(16)) | 75 | #define ALIGN __declspec(align(16)) |
@@ -71,7 +90,7 @@ extern struct codec_api* ci; | |||
71 | /* #define USE_DOUBLE_PRECISION */ | 90 | /* #define USE_DOUBLE_PRECISION */ |
72 | /* use fixed point reals */ | 91 | /* use fixed point reals */ |
73 | #define FIXED_POINT | 92 | #define FIXED_POINT |
74 | //#define BIG_IQ_TABLE | 93 | #define BIG_IQ_TABLE /* BIG_IQ_TABLE results in faster requantization */ |
75 | 94 | ||
76 | /* Use if target platform has address generators with autoincrement */ | 95 | /* Use if target platform has address generators with autoincrement */ |
77 | //#define PREFER_POINTERS | 96 | //#define PREFER_POINTERS |
diff --git a/apps/codecs/libfaad/huffman.c b/apps/codecs/libfaad/huffman.c index c142ad7ac7..bea0dd7bf2 100644 --- a/apps/codecs/libfaad/huffman.c +++ b/apps/codecs/libfaad/huffman.c | |||
@@ -39,17 +39,18 @@ | |||
39 | 39 | ||
40 | 40 | ||
41 | /* static function declarations */ | 41 | /* static function declarations */ |
42 | static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len); | 42 | static INLINE void huffman_sign_bits_pair(bitfile *ld, int16_t *sp); |
43 | static INLINE void huffman_sign_bits_quad(bitfile *ld, int16_t *sp); | ||
43 | static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp); | 44 | static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp); |
44 | static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp); | 45 | static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp); |
45 | static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp); | 46 | static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp); |
46 | static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp); | 47 | static INLINE uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp); |
47 | static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp); | 48 | static INLINE uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp); |
48 | static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp); | 49 | static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp); |
49 | static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp); | 50 | static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp); |
50 | static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp); | 51 | static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp); |
51 | static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp); | 52 | static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp); |
52 | static int16_t huffman_codebook(uint8_t i); | 53 | static int16_t huffman_codebook(uint8_t i) ICODE_ATTR_FAAD_LARGE_IRAM; |
53 | #ifdef ERROR_RESILIENCE | 54 | #ifdef ERROR_RESILIENCE |
54 | static void vcb11_check_LAV(uint8_t cb, int16_t *sp); | 55 | static void vcb11_check_LAV(uint8_t cb, int16_t *sp); |
55 | #endif | 56 | #endif |
@@ -75,49 +76,51 @@ int8_t huffman_scale_factor(bitfile *ld) | |||
75 | } | 76 | } |
76 | 77 | ||
77 | 78 | ||
78 | hcb *hcb_table[] = { | 79 | hcb *hcb_table[] ICONST_ATTR = { |
79 | 0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1 | 80 | 0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1 |
80 | }; | 81 | }; |
81 | 82 | ||
82 | hcb_2_quad *hcb_2_quad_table[] = { | 83 | hcb_2_quad *hcb_2_quad_table[] ICONST_ATTR = { |
83 | 0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0 | 84 | 0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0 |
84 | }; | 85 | }; |
85 | 86 | ||
86 | hcb_2_pair *hcb_2_pair_table[] = { | 87 | hcb_2_pair *hcb_2_pair_table[] ICONST_ATTR = { |
87 | 0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2 | 88 | 0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2 |
88 | }; | 89 | }; |
89 | 90 | ||
90 | hcb_bin_pair *hcb_bin_table[] = { | 91 | hcb_bin_pair *hcb_bin_table[] ICONST_ATTR = { |
91 | 0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0 | 92 | 0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0 |
92 | }; | 93 | }; |
93 | 94 | ||
94 | uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 }; | 95 | uint8_t hcbN[] ICONST_ATTR = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 }; |
95 | 96 | ||
96 | /* defines whether a huffman codebook is unsigned or not */ | 97 | /* defines whether a huffman codebook is unsigned or not */ |
97 | /* Table 4.6.2 */ | 98 | /* Table 4.6.2 */ |
98 | uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, | 99 | uint8_t unsigned_cb[] ICONST_ATTR = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, |
99 | /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 | 100 | /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 |
100 | }; | 101 | }; |
101 | 102 | ||
102 | int hcb_2_quad_table_size[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 }; | 103 | int hcb_2_quad_table_size[] ICONST_ATTR = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 }; |
103 | int hcb_2_pair_table_size[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 }; | 104 | int hcb_2_pair_table_size[] ICONST_ATTR = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 }; |
104 | int hcb_bin_table_size[] = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 }; | 105 | int hcb_bin_table_size[] ICONST_ATTR = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 }; |
105 | 106 | ||
106 | static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len) | 107 | #define FAAD_GET_SIGN(idx) \ |
108 | if (sp[idx]) \ | ||
109 | if (faad_get1bit(ld)&1) \ | ||
110 | sp[idx] = -sp[idx]; \ | ||
111 | |||
112 | static INLINE void huffman_sign_bits_pair(bitfile *ld, int16_t *sp) | ||
107 | { | 113 | { |
108 | uint8_t i; | 114 | FAAD_GET_SIGN(0) |
115 | FAAD_GET_SIGN(1) | ||
116 | } | ||
109 | 117 | ||
110 | for (i = 0; i < len; i++) | 118 | static INLINE void huffman_sign_bits_quad(bitfile *ld, int16_t *sp) |
111 | { | 119 | { |
112 | if(sp[i]) | 120 | FAAD_GET_SIGN(0) |
113 | { | 121 | FAAD_GET_SIGN(1) |
114 | if(faad_get1bit(ld | 122 | FAAD_GET_SIGN(2) |
115 | DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1) | 123 | FAAD_GET_SIGN(3) |
116 | { | ||
117 | sp[i] = -sp[i]; | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | } | 124 | } |
122 | 125 | ||
123 | static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp) | 126 | static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp) |
@@ -194,12 +197,12 @@ static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp) | |||
194 | static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) | 197 | static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) |
195 | { | 198 | { |
196 | uint8_t err = huffman_2step_quad(cb, ld, sp); | 199 | uint8_t err = huffman_2step_quad(cb, ld, sp); |
197 | huffman_sign_bits(ld, sp, QUAD_LEN); | 200 | huffman_sign_bits_quad(ld, sp); |
198 | 201 | ||
199 | return err; | 202 | return err; |
200 | } | 203 | } |
201 | 204 | ||
202 | static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp) | 205 | static INLINE uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp) |
203 | { | 206 | { |
204 | uint32_t cw; | 207 | uint32_t cw; |
205 | uint16_t offset = 0; | 208 | uint16_t offset = 0; |
@@ -232,10 +235,10 @@ static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp) | |||
232 | return 0; | 235 | return 0; |
233 | } | 236 | } |
234 | 237 | ||
235 | static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) | 238 | static INLINE uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) |
236 | { | 239 | { |
237 | uint8_t err = huffman_2step_pair(cb, ld, sp); | 240 | uint8_t err = huffman_2step_pair(cb, ld, sp); |
238 | huffman_sign_bits(ld, sp, PAIR_LEN); | 241 | huffman_sign_bits_pair(ld, sp); |
239 | 242 | ||
240 | return err; | 243 | return err; |
241 | } | 244 | } |
@@ -269,7 +272,7 @@ static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp) | |||
269 | static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) | 272 | static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) |
270 | { | 273 | { |
271 | uint8_t err = huffman_binary_quad(cb, ld, sp); | 274 | uint8_t err = huffman_binary_quad(cb, ld, sp); |
272 | huffman_sign_bits(ld, sp, QUAD_LEN); | 275 | huffman_sign_bits_quad(ld, sp); |
273 | 276 | ||
274 | return err; | 277 | return err; |
275 | } | 278 | } |
@@ -301,7 +304,7 @@ static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp) | |||
301 | static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) | 304 | static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) |
302 | { | 305 | { |
303 | uint8_t err = huffman_binary_pair(cb, ld, sp); | 306 | uint8_t err = huffman_binary_pair(cb, ld, sp); |
304 | huffman_sign_bits(ld, sp, PAIR_LEN); | 307 | huffman_sign_bits_pair(ld, sp); |
305 | 308 | ||
306 | return err; | 309 | return err; |
307 | } | 310 | } |
diff --git a/apps/codecs/libfaad/huffman.h b/apps/codecs/libfaad/huffman.h index 683689002d..214d3a220f 100644 --- a/apps/codecs/libfaad/huffman.h +++ b/apps/codecs/libfaad/huffman.h | |||
@@ -33,7 +33,7 @@ extern "C" { | |||
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | int8_t huffman_scale_factor(bitfile *ld); | 35 | int8_t huffman_scale_factor(bitfile *ld); |
36 | uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp); | 36 | uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp) ICODE_ATTR_FAAD_LARGE_IRAM; |
37 | #ifdef ERROR_RESILIENCE | 37 | #ifdef ERROR_RESILIENCE |
38 | int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp); | 38 | int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp); |
39 | #endif | 39 | #endif |
diff --git a/apps/codecs/libfaad/specrec.c b/apps/codecs/libfaad/specrec.c index 4998828eff..74bf1f36f6 100644 --- a/apps/codecs/libfaad/specrec.c +++ b/apps/codecs/libfaad/specrec.c | |||
@@ -414,19 +414,18 @@ uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics) | |||
414 | /**/ | 414 | /**/ |
415 | static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) | 415 | static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) |
416 | { | 416 | { |
417 | #ifdef FIXED_POINT | 417 | #ifndef BIG_IQ_TABLE |
418 | /* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */ | 418 | /* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */ |
419 | /* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not | 419 | /* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not |
420 | * defined a 1026 value table and interpolation will be used | 420 | * defined a 1026 value table and interpolation will be used |
421 | */ | 421 | */ |
422 | #ifndef BIG_IQ_TABLE | ||
423 | static const real_t errcorr[] = { | 422 | static const real_t errcorr[] = { |
424 | REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0), | 423 | REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0), |
425 | REAL_CONST(4.0/8.0), REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0), | 424 | REAL_CONST(4.0/8.0), REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0), |
426 | REAL_CONST(0) | 425 | REAL_CONST(0) |
427 | }; | 426 | }; |
428 | real_t x1, x2; | 427 | real_t x1, x2; |
429 | #endif | 428 | |
430 | int16_t sgn = 1; | 429 | int16_t sgn = 1; |
431 | 430 | ||
432 | if (q < 0) | 431 | if (q < 0) |
@@ -445,7 +444,6 @@ static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) | |||
445 | return sgn * tab[q]; | 444 | return sgn * tab[q]; |
446 | } | 445 | } |
447 | 446 | ||
448 | #ifndef BIG_IQ_TABLE | ||
449 | if (q >= 8192) | 447 | if (q >= 8192) |
450 | { | 448 | { |
451 | *error = 17; | 449 | *error = 17; |
@@ -456,12 +454,7 @@ static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) | |||
456 | x1 = tab[q>>3]; | 454 | x1 = tab[q>>3]; |
457 | x2 = tab[(q>>3) + 1]; | 455 | x2 = tab[(q>>3) + 1]; |
458 | return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1); | 456 | return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1); |
459 | #else | 457 | #else /* #ifndef BIG_IQ_TABLE */ |
460 | *error = 17; | ||
461 | return 0; | ||
462 | #endif | ||
463 | |||
464 | #else | ||
465 | if (q < 0) | 458 | if (q < 0) |
466 | { | 459 | { |
467 | /* tab contains a value for all possible q [0,8192] */ | 460 | /* tab contains a value for all possible q [0,8192] */ |
@@ -547,9 +540,7 @@ static uint8_t quant_to_spec(NeAACDecHandle hDecoder, | |||
547 | uint8_t g, sfb, win; | 540 | uint8_t g, sfb, win; |
548 | uint16_t width, bin, k, gindex, wa, wb; | 541 | uint16_t width, bin, k, gindex, wa, wb; |
549 | uint8_t error = 0; /* Init error flag */ | 542 | uint8_t error = 0; /* Init error flag */ |
550 | #ifndef FIXED_POINT | ||
551 | real_t scf; | 543 | real_t scf; |
552 | #endif | ||
553 | 544 | ||
554 | k = 0; | 545 | k = 0; |
555 | gindex = 0; | 546 | gindex = 0; |
@@ -597,6 +588,8 @@ static uint8_t quant_to_spec(NeAACDecHandle hDecoder, | |||
597 | 588 | ||
598 | #ifndef FIXED_POINT | 589 | #ifndef FIXED_POINT |
599 | scf = pow2sf_tab[exp/*+25*/] * pow2_table[frac]; | 590 | scf = pow2sf_tab[exp/*+25*/] * pow2_table[frac]; |
591 | #else | ||
592 | scf = pow2_table[frac]; | ||
600 | #endif | 593 | #endif |
601 | 594 | ||
602 | for (win = 0; win < ics->window_group_length[g]; win++) | 595 | for (win = 0; win < ics->window_group_length[g]; win++) |
@@ -612,32 +605,12 @@ static uint8_t quant_to_spec(NeAACDecHandle hDecoder, | |||
612 | spec_data[wb+3] = iquant(quant_data[k+3], tab, &error) * scf; | 605 | spec_data[wb+3] = iquant(quant_data[k+3], tab, &error) * scf; |
613 | 606 | ||
614 | #else | 607 | #else |
615 | real_t iq0 = iquant(quant_data[k+0], tab, &error); | ||
616 | real_t iq1 = iquant(quant_data[k+1], tab, &error); | ||
617 | real_t iq2 = iquant(quant_data[k+2], tab, &error); | ||
618 | real_t iq3 = iquant(quant_data[k+3], tab, &error); | ||
619 | |||
620 | wb = wa + bin; | 608 | wb = wa + bin; |
621 | 609 | ||
622 | if (exp < 0) | 610 | spec_data[wb+0] = MUL_C((iquant(quant_data[k+0], tab, &error)<<exp), scf); |
623 | { | 611 | spec_data[wb+1] = MUL_C((iquant(quant_data[k+1], tab, &error)<<exp), scf); |
624 | spec_data[wb+0] = iq0 >>= -exp; | 612 | spec_data[wb+2] = MUL_C((iquant(quant_data[k+2], tab, &error)<<exp), scf); |
625 | spec_data[wb+1] = iq1 >>= -exp; | 613 | spec_data[wb+3] = MUL_C((iquant(quant_data[k+3], tab, &error)<<exp), scf); |
626 | spec_data[wb+2] = iq2 >>= -exp; | ||
627 | spec_data[wb+3] = iq3 >>= -exp; | ||
628 | } else { | ||
629 | spec_data[wb+0] = iq0 <<= exp; | ||
630 | spec_data[wb+1] = iq1 <<= exp; | ||
631 | spec_data[wb+2] = iq2 <<= exp; | ||
632 | spec_data[wb+3] = iq3 <<= exp; | ||
633 | } | ||
634 | if (frac != 0) | ||
635 | { | ||
636 | spec_data[wb+0] = MUL_C(spec_data[wb+0],pow2_table[frac]); | ||
637 | spec_data[wb+1] = MUL_C(spec_data[wb+1],pow2_table[frac]); | ||
638 | spec_data[wb+2] = MUL_C(spec_data[wb+2],pow2_table[frac]); | ||
639 | spec_data[wb+3] = MUL_C(spec_data[wb+3],pow2_table[frac]); | ||
640 | } | ||
641 | 614 | ||
642 | //#define SCFS_PRINT | 615 | //#define SCFS_PRINT |
643 | #ifdef SCFS_PRINT | 616 | #ifdef SCFS_PRINT |
@@ -855,11 +828,14 @@ static uint8_t allocate_channel_pair(NeAACDecHandle hDecoder, | |||
855 | return 0; | 828 | return 0; |
856 | } | 829 | } |
857 | 830 | ||
831 | /* used by reconstruct_single_channel() and reconstruct_channel_pair() */ | ||
832 | ALIGN static real_t spec_coef1[1024] IBSS_ATTR; | ||
833 | ALIGN static real_t spec_coef2[1024] IBSS_ATTR; | ||
834 | |||
858 | uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, | 835 | uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, |
859 | element *sce, int16_t *spec_data) | 836 | element *sce, int16_t *spec_data) |
860 | { | 837 | { |
861 | uint8_t retval, output_channels; | 838 | uint8_t retval, output_channels; |
862 | ALIGN static real_t spec_coef[1024]; | ||
863 | 839 | ||
864 | #ifdef PROFILE | 840 | #ifdef PROFILE |
865 | int64_t count = faad_get_ts(); | 841 | int64_t count = faad_get_ts(); |
@@ -893,7 +869,7 @@ uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, | |||
893 | 869 | ||
894 | 870 | ||
895 | /* dequantisation and scaling */ | 871 | /* dequantisation and scaling */ |
896 | retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength); | 872 | retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef1, hDecoder->frameLength); |
897 | if (retval > 0) | 873 | if (retval > 0) |
898 | return retval; | 874 | return retval; |
899 | 875 | ||
@@ -904,14 +880,14 @@ uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, | |||
904 | 880 | ||
905 | 881 | ||
906 | /* pns decoding */ | 882 | /* pns decoding */ |
907 | pns_decode(ics, NULL, spec_coef, NULL, hDecoder->frameLength, 0, hDecoder->object_type); | 883 | pns_decode(ics, NULL, spec_coef1, NULL, hDecoder->frameLength, 0, hDecoder->object_type); |
908 | 884 | ||
909 | #ifdef MAIN_DEC | 885 | #ifdef MAIN_DEC |
910 | /* MAIN object type prediction */ | 886 | /* MAIN object type prediction */ |
911 | if (hDecoder->object_type == MAIN) | 887 | if (hDecoder->object_type == MAIN) |
912 | { | 888 | { |
913 | /* intra channel prediction */ | 889 | /* intra channel prediction */ |
914 | ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength, | 890 | ic_prediction(ics, spec_coef1, hDecoder->pred_stat[sce->channel], hDecoder->frameLength, |
915 | hDecoder->sf_index); | 891 | hDecoder->sf_index); |
916 | 892 | ||
917 | /* In addition, for scalefactor bands coded by perceptual | 893 | /* In addition, for scalefactor bands coded by perceptual |
@@ -938,7 +914,7 @@ uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, | |||
938 | #endif | 914 | #endif |
939 | 915 | ||
940 | /* long term prediction */ | 916 | /* long term prediction */ |
941 | lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb, | 917 | lt_prediction(ics, &(ics->ltp), spec_coef1, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb, |
942 | ics->window_shape, hDecoder->window_shape_prev[sce->channel], | 918 | ics->window_shape, hDecoder->window_shape_prev[sce->channel], |
943 | hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); | 919 | hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); |
944 | } | 920 | } |
@@ -946,13 +922,13 @@ uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, | |||
946 | 922 | ||
947 | /* tns decoding */ | 923 | /* tns decoding */ |
948 | tns_decode_frame(ics, &(ics->tns), hDecoder->sf_index, hDecoder->object_type, | 924 | tns_decode_frame(ics, &(ics->tns), hDecoder->sf_index, hDecoder->object_type, |
949 | spec_coef, hDecoder->frameLength); | 925 | spec_coef1, hDecoder->frameLength); |
950 | 926 | ||
951 | /* drc decoding */ | 927 | /* drc decoding */ |
952 | if (hDecoder->drc->present) | 928 | if (hDecoder->drc->present) |
953 | { | 929 | { |
954 | if (!hDecoder->drc->exclude_mask[sce->channel] || !hDecoder->drc->excluded_chns_present) | 930 | if (!hDecoder->drc->exclude_mask[sce->channel] || !hDecoder->drc->excluded_chns_present) |
955 | drc_decode(hDecoder->drc, spec_coef); | 931 | drc_decode(hDecoder->drc, spec_coef1); |
956 | } | 932 | } |
957 | 933 | ||
958 | /* filter bank */ | 934 | /* filter bank */ |
@@ -961,13 +937,13 @@ uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, | |||
961 | { | 937 | { |
962 | #endif | 938 | #endif |
963 | ifilter_bank(ics->window_sequence,ics->window_shape, | 939 | ifilter_bank(ics->window_sequence,ics->window_shape, |
964 | hDecoder->window_shape_prev[sce->channel],spec_coef, | 940 | hDecoder->window_shape_prev[sce->channel],spec_coef1, |
965 | hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel], | 941 | hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel], |
966 | hDecoder->object_type, hDecoder->frameLength); | 942 | hDecoder->object_type, hDecoder->frameLength); |
967 | #ifdef SSR_DEC | 943 | #ifdef SSR_DEC |
968 | } else { | 944 | } else { |
969 | ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape, | 945 | ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape, |
970 | hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], | 946 | hDecoder->window_shape_prev[sce->channel], spec_coef1, hDecoder->time_out[sce->channel], |
971 | hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel], | 947 | hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel], |
972 | hDecoder->frameLength); | 948 | hDecoder->frameLength); |
973 | } | 949 | } |
@@ -1051,8 +1027,6 @@ uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_st | |||
1051 | element *cpe, int16_t *spec_data1, int16_t *spec_data2) | 1027 | element *cpe, int16_t *spec_data1, int16_t *spec_data2) |
1052 | { | 1028 | { |
1053 | uint8_t retval; | 1029 | uint8_t retval; |
1054 | ALIGN static real_t spec_coef1[1024] IBSS_ATTR; | ||
1055 | ALIGN static real_t spec_coef2[1024] IBSS_ATTR; | ||
1056 | 1030 | ||
1057 | #ifdef PROFILE | 1031 | #ifdef PROFILE |
1058 | int64_t count = faad_get_ts(); | 1032 | int64_t count = faad_get_ts(); |