summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libatrac/atrac3.c80
-rw-r--r--apps/codecs/libatrac/atrac3data.h11
-rw-r--r--apps/codecs/libatrac/main.c3
3 files changed, 78 insertions, 16 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c
index ac63925ce7..467f42f161 100644
--- a/apps/codecs/libatrac/atrac3.c
+++ b/apps/codecs/libatrac/atrac3.c
@@ -98,6 +98,20 @@ static channel_unit channel_units[2] IBSS_ATTR_LARGE_IRAM;
98 * @param in input buffer 98 * @param in input buffer
99 * @param win windowing coefficients 99 * @param win windowing coefficients
100 * @param nIn size of spectrum buffer 100 * @param nIn size of spectrum buffer
101 * Reference implementation:
102 *
103 * for (j = nIn; j != 0; j--) {
104 * s1 = fixmul32(in[0], win[0]);
105 * s2 = fixmul32(in[1], win[1]);
106 * for (i = 2; i < 48; i += 2) {
107 * s1 += fixmul31(in[i ], win[i ]);
108 * s2 += fixmul31(in[i+1], win[i+1]);
109 * }
110 * out[0] = s2;
111 * out[1] = s1;
112 * in += 2;
113 * out += 2;
114 * }
101 */ 115 */
102 116
103#if defined(CPU_ARM) 117#if defined(CPU_ARM)
@@ -116,16 +130,62 @@ static channel_unit channel_units[2] IBSS_ATTR_LARGE_IRAM;
116 int32_t i, j, s1, s2; 130 int32_t i, j, s1, s2;
117 131
118 for (j = nIn; j != 0; j--) { 132 for (j = nIn; j != 0; j--) {
119 /* i=0 */ 133 i = 0;
120 s1 = fixmul31(win[0], in[0]); 134 /* 0.. 7 */
121 s2 = fixmul31(win[1], in[1]); 135 s1 = fixmul31(win[i], in[i]); i++;
122 136 s2 = fixmul31(win[i], in[i]); i++;
123 /* i=2..46 */ 137 s1 += fixmul31(win[i], in[i]); i++;
124 for (i = 2; i < 48; i += 2) { 138 s2 += fixmul31(win[i], in[i]); i++;
125 s1 += fixmul31(win[i ], in[i ]); 139 s1 += fixmul31(win[i], in[i]); i++;
126 s2 += fixmul31(win[i+1], in[i+1]); 140 s2 += fixmul31(win[i], in[i]); i++;
127 } 141 s1 += fixmul31(win[i], in[i]); i++;
128 142 s2 += fixmul31(win[i], in[i]); i++;
143 /* 8..15 */
144 s1 += fixmul31(win[i], in[i]); i++;
145 s2 += fixmul31(win[i], in[i]); i++;
146 s1 += fixmul31(win[i], in[i]); i++;
147 s2 += fixmul31(win[i], in[i]); i++;
148 s1 += fixmul31(win[i], in[i]); i++;
149 s2 += fixmul31(win[i], in[i]); i++;
150 s1 += fixmul31(win[i], in[i]); i++;
151 s2 += fixmul31(win[i], in[i]); i++;
152 /* 16..23 */
153 s1 += fixmul31(win[i], in[i]); i++;
154 s2 += fixmul31(win[i], in[i]); i++;
155 s1 += fixmul31(win[i], in[i]); i++;
156 s2 += fixmul31(win[i], in[i]); i++;
157 s1 += fixmul31(win[i], in[i]); i++;
158 s2 += fixmul31(win[i], in[i]); i++;
159 s1 += fixmul31(win[i], in[i]); i++;
160 s2 += fixmul31(win[i], in[i]); i++;
161 /* 24..31 */
162 s1 += fixmul31(win[i], in[i]); i++;
163 s2 += fixmul31(win[i], in[i]); i++;
164 s1 += fixmul31(win[i], in[i]); i++;
165 s2 += fixmul31(win[i], in[i]); i++;
166 s1 += fixmul31(win[i], in[i]); i++;
167 s2 += fixmul31(win[i], in[i]); i++;
168 s1 += fixmul31(win[i], in[i]); i++;
169 s2 += fixmul31(win[i], in[i]); i++;
170 /* 32..39 */
171 s1 += fixmul31(win[i], in[i]); i++;
172 s2 += fixmul31(win[i], in[i]); i++;
173 s1 += fixmul31(win[i], in[i]); i++;
174 s2 += fixmul31(win[i], in[i]); i++;
175 s1 += fixmul31(win[i], in[i]); i++;
176 s2 += fixmul31(win[i], in[i]); i++;
177 s1 += fixmul31(win[i], in[i]); i++;
178 s2 += fixmul31(win[i], in[i]); i++;
179 /* 40..47 */
180 s1 += fixmul31(win[i], in[i]); i++;
181 s2 += fixmul31(win[i], in[i]); i++;
182 s1 += fixmul31(win[i], in[i]); i++;
183 s2 += fixmul31(win[i], in[i]); i++;
184 s1 += fixmul31(win[i], in[i]); i++;
185 s2 += fixmul31(win[i], in[i]); i++;
186 s1 += fixmul31(win[i], in[i]); i++;
187 s2 += fixmul31(win[i], in[i]);
188
129 out[0] = s2; 189 out[0] = s2;
130 out[1] = s1; 190 out[1] = s1;
131 191
diff --git a/apps/codecs/libatrac/atrac3data.h b/apps/codecs/libatrac/atrac3data.h
index 8e7fe97c32..0da9d9e758 100644
--- a/apps/codecs/libatrac/atrac3data.h
+++ b/apps/codecs/libatrac/atrac3data.h
@@ -117,18 +117,18 @@ static const int8_t decTable1[18] = {0,0, 0,1, 0,-1, 1,0, -1,0, 1,1, 1,-1, -1,1,
117 117
118 118
119/* tables for the scalefactor decoding */ 119/* tables for the scalefactor decoding */
120 120/* not needed anymore
121static const float iMaxQuant[8] = { 121static const float iMaxQuant[8] = {
122 0.0, 1.0/1.5, 1.0/2.5, 1.0/3.5, 1.0/4.5, 1.0/7.5, 1.0/15.5, 1.0/31.5 122 0.0, 1.0/1.5, 1.0/2.5, 1.0/3.5, 1.0/4.5, 1.0/7.5, 1.0/15.5, 1.0/31.5
123}; 123};
124 124*/
125static const uint16_t subbandTab[33] = { 125static const uint16_t subbandTab[33] = {
126 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 126 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224,
127 256, 288, 320, 352, 384, 416, 448, 480, 512, 576, 640, 704, 768, 896, 1024 127 256, 288, 320, 352, 384, 416, 448, 480, 512, 576, 640, 704, 768, 896, 1024
128}; 128};
129 129
130/* transform data */ 130/* transform data */
131 131/* not needed anymore
132static const float qmf_48tap_half[24] = { 132static const float qmf_48tap_half[24] = {
133 -0.00001461907, -0.00009205479, -0.000056157569, 0.00030117269, 133 -0.00001461907, -0.00009205479, -0.000056157569, 0.00030117269,
134 0.0002422519,-0.00085293897, -0.0005205574, 0.0020340169, 134 0.0002422519,-0.00085293897, -0.0005205574, 0.0020340169,
@@ -137,8 +137,9 @@ static const float qmf_48tap_half[24] = {
137 -0.007801671, -0.034090221, 0.01880949, 0.054326009, 137 -0.007801671, -0.034090221, 0.01880949, 0.054326009,
138 -0.043596379, -0.099384367, 0.13207909, 0.46424159 138 -0.043596379, -0.099384367, 0.13207909, 0.46424159
139}; 139};
140 140*/
141/* joint stereo related tables */ 141/* joint stereo related tables */
142/* not needed anymore
142static const float matrixCoeffs[8] = {0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0}; 143static const float matrixCoeffs[8] = {0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0};
143 144*/
144#endif /* AVCODEC_ATRAC3DATA_H */ 145#endif /* AVCODEC_ATRAC3DATA_H */
diff --git a/apps/codecs/libatrac/main.c b/apps/codecs/libatrac/main.c
index 826dacf819..e0a3f8507d 100644
--- a/apps/codecs/libatrac/main.c
+++ b/apps/codecs/libatrac/main.c
@@ -9,6 +9,8 @@
9#include "atrac3.h" 9#include "atrac3.h"
10#include "../librm/rm.h" 10#include "../librm/rm.h"
11 11
12ATRAC3Context q IBSS_ATTR;
13
12static unsigned char wav_header[44]={ 14static unsigned char wav_header[44]={
13 'R','I','F','F',// 0 - ChunkID 15 'R','I','F','F',// 0 - ChunkID
14 0,0,0,0, // 4 - ChunkSize (filesize-8) 16 0,0,0,0, // 4 - ChunkSize (filesize-8)
@@ -101,7 +103,6 @@ int main(int argc, char *argv[])
101 int16_t outbuf[2048]; 103 int16_t outbuf[2048];
102 uint16_t fs,sps,h; 104 uint16_t fs,sps,h;
103 uint32_t packet_count; 105 uint32_t packet_count;
104 ATRAC3Context q;
105 RMContext rmctx; 106 RMContext rmctx;
106 RMPacket pkt; 107 RMPacket pkt;
107 108