summaryrefslogtreecommitdiff
path: root/apps/plugins/mp3_encoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/mp3_encoder.c')
-rw-r--r--apps/plugins/mp3_encoder.c134
1 files changed, 67 insertions, 67 deletions
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c
index f4f6b56f22..e5b7cc8f6e 100644
--- a/apps/plugins/mp3_encoder.c
+++ b/apps/plugins/mp3_encoder.c
@@ -1,15 +1,15 @@
1// Shine is an MP3 encoder 1/* Shine is an MP3 encoder
2// Copyright (C) 1999-2000 Gabriel Bouvigne 2 * Copyright (C) 1999-2000 Gabriel Bouvigne
3// 3 *
4// This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6// License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7// version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8// 8 *
9// This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Library General Public License for more details. 12 * Library General Public License for more details. */
13 13
14#define samp_per_frame 1152 14#define samp_per_frame 1152
15#define samp_per_frame2 576 15#define samp_per_frame2 576
@@ -112,55 +112,55 @@ struct huffcodetab {
112}; 112};
113 113
114/* !!!!!!!! start of IRAM area: do not insert before x_int1 array !!!!!!!!!!!!! */ 114/* !!!!!!!! start of IRAM area: do not insert before x_int1 array !!!!!!!!!!!!! */
115short x_int0 [HAN_SIZE] IBSS_ATTR; // 1024 Bytes 115short x_int0 [HAN_SIZE] IBSS_ATTR; /* 1024 Bytes */
116int mdct_freq [2][2][samp_per_frame2] IBSS_ATTR; // 9216 Bytes 116int mdct_freq [2][2][samp_per_frame2] IBSS_ATTR; /* 9216 Bytes */
117short x_int1 [HAN_SIZE] IBSS_ATTR; // 1024 Bytes 117short x_int1 [HAN_SIZE] IBSS_ATTR; /* 1024 Bytes */
118/* !!!!!!!!!!!!!!!!!!!!! here you may insert other data !!!!!!!!!!!!!!!!!!!!!!! */ 118/* !!!!!!!!!!!!!!!!!!!!! here you may insert other data !!!!!!!!!!!!!!!!!!!!!!! */
119uint8 int2idx [4096] IBSS_ATTR; // 4096 Bytes 119uint8 int2idx [4096] IBSS_ATTR; /* 4096 Bytes */
120enct8 enc_data [2][2][samp_per_frame2] IBSS_ATTR; // 4608 Bytes 120enct8 enc_data [2][2][samp_per_frame2] IBSS_ATTR; /* 4608 Bytes */
121short y_int [64] IBSS_ATTR; // 256 Bytes 121short y_int [64] IBSS_ATTR; /* 256 Bytes */
122int off [2] IBSS_ATTR; // 16 Bytes 122int off [2] IBSS_ATTR; /* 16 Bytes */
123int scalefac_long[23] IBSS_ATTR; // 96 Bytes 123int scalefac_long[23] IBSS_ATTR; /* 96 Bytes */
124int mdct_in [36] IBSS_ATTR; // 144 Bytes 124int mdct_in [36] IBSS_ATTR; /* 144 Bytes */
125int sb_sample [2][3][18][SBLIMIT] IBSS_ATTR; // 13824 Bytes 125int sb_sample [2][3][18][SBLIMIT] IBSS_ATTR; /* 13824 Bytes */
126BF_Data CodedData IBSS_ATTR; // 1040 Bytes 126BF_Data CodedData IBSS_ATTR; /* 1040 Bytes */
127int ca_int [8] IBSS_ATTR; // 32 Bytes 127int ca_int [8] IBSS_ATTR; /* 32 Bytes */
128int cs_int [8] IBSS_ATTR; // 32 Bytes 128int cs_int [8] IBSS_ATTR; /* 32 Bytes */
129int win_int [18][36] IBSS_ATTR; // 2592 Bytes 129int win_int [18][36] IBSS_ATTR; /* 2592 Bytes */
130short filter_int [SBLIMIT][64] IBSS_ATTR; // 8192 Bytes 130short filter_int [SBLIMIT][64] IBSS_ATTR; /* 8192 Bytes */
131short enwindow_int[512] IBSS_ATTR; // 1024 Bytes 131short enwindow_int[512] IBSS_ATTR; /* 1024 Bytes */
132uint8 ht_count1 [2][2][16] IBSS_ATTR; // 64 Bytes 132uint8 ht_count1 [2][2][16] IBSS_ATTR; /* 64 Bytes */
133uint16 t1HB [ 4] IBSS_ATTR; // Bytes 133uint16 t1HB [ 4] IBSS_ATTR; /* Bytes */
134uint16 t2HB [ 9] IBSS_ATTR; // Bytes 134uint16 t2HB [ 9] IBSS_ATTR; /* Bytes */
135uint16 t3HB [ 9] IBSS_ATTR; // Bytes 135uint16 t3HB [ 9] IBSS_ATTR; /* Bytes */
136uint16 t5HB [ 16] IBSS_ATTR; // Bytes 136uint16 t5HB [ 16] IBSS_ATTR; /* Bytes */
137uint16 t6HB [ 16] IBSS_ATTR; // Bytes 137uint16 t6HB [ 16] IBSS_ATTR; /* Bytes */
138uint16 t7HB [ 36] IBSS_ATTR; // Bytes 138uint16 t7HB [ 36] IBSS_ATTR; /* Bytes */
139uint16 t8HB [ 36] IBSS_ATTR; // Bytes 139uint16 t8HB [ 36] IBSS_ATTR; /* Bytes */
140uint16 t9HB [ 36] IBSS_ATTR; // Bytes 140uint16 t9HB [ 36] IBSS_ATTR; /* Bytes */
141uint16 t10HB [ 64] IBSS_ATTR; // Bytes 141uint16 t10HB [ 64] IBSS_ATTR; /* Bytes */
142uint16 t11HB [ 64] IBSS_ATTR; // Bytes 142uint16 t11HB [ 64] IBSS_ATTR; /* Bytes */
143uint16 t12HB [ 64] IBSS_ATTR; // Bytes 143uint16 t12HB [ 64] IBSS_ATTR; /* Bytes */
144uint16 t13HB [256] IBSS_ATTR; // Bytes 144uint16 t13HB [256] IBSS_ATTR; /* Bytes */
145uint16 t15HB [256] IBSS_ATTR; // Bytes 145uint16 t15HB [256] IBSS_ATTR; /* Bytes */
146uint16 t16HB [256] IBSS_ATTR; // Bytes 146uint16 t16HB [256] IBSS_ATTR; /* Bytes */
147uint16 t24HB [256] IBSS_ATTR; // Bytes 147uint16 t24HB [256] IBSS_ATTR; /* Bytes */
148uint8 t1l [ 4] IBSS_ATTR; // Bytes 148uint8 t1l [ 4] IBSS_ATTR; /* Bytes */
149uint8 t2l [ 9] IBSS_ATTR; // Bytes 149uint8 t2l [ 9] IBSS_ATTR; /* Bytes */
150uint8 t3l [ 9] IBSS_ATTR; // Bytes 150uint8 t3l [ 9] IBSS_ATTR; /* Bytes */
151uint8 t5l [ 16] IBSS_ATTR; // Bytes 151uint8 t5l [ 16] IBSS_ATTR; /* Bytes */
152uint8 t6l [ 16] IBSS_ATTR; // Bytes 152uint8 t6l [ 16] IBSS_ATTR; /* Bytes */
153uint8 t7l [ 36] IBSS_ATTR; // Bytes 153uint8 t7l [ 36] IBSS_ATTR; /* Bytes */
154uint8 t8l [ 36] IBSS_ATTR; // Bytes 154uint8 t8l [ 36] IBSS_ATTR; /* Bytes */
155uint8 t9l [ 36] IBSS_ATTR; // Bytes 155uint8 t9l [ 36] IBSS_ATTR; /* Bytes */
156uint8 t10l [ 64] IBSS_ATTR; // Bytes 156uint8 t10l [ 64] IBSS_ATTR; /* Bytes */
157uint8 t11l [ 64] IBSS_ATTR; // Bytes 157uint8 t11l [ 64] IBSS_ATTR; /* Bytes */
158uint8 t12l [ 64] IBSS_ATTR; // Bytes 158uint8 t12l [ 64] IBSS_ATTR; /* Bytes */
159uint8 t13l [256] IBSS_ATTR; // Bytes 159uint8 t13l [256] IBSS_ATTR; /* Bytes */
160uint8 t15l [256] IBSS_ATTR; // Bytes 160uint8 t15l [256] IBSS_ATTR; /* Bytes */
161uint8 t16l [256] IBSS_ATTR; // Bytes 161uint8 t16l [256] IBSS_ATTR; /* Bytes */
162uint8 t24l [256] IBSS_ATTR; // Bytes 162uint8 t24l [256] IBSS_ATTR; /* Bytes */
163struct huffcodetab ht [HTN] IBSS_ATTR; // Bytes 163struct huffcodetab ht [HTN] IBSS_ATTR; /* Bytes */
164 164
165static const uint8 ht_count1_const[2][2][16] = 165static const uint8 ht_count1_const[2][2][16] =
166{ { { 1, 5, 4, 5, 6, 5, 4, 4, 7, 3, 6, 0, 7, 2, 3, 1 }, /* table0 */ 166{ { { 1, 5, 4, 5, 6, 5, 4, 4, 7, 3, 6, 0, 7, 2, 3, 1 }, /* table0 */
@@ -240,7 +240,7 @@ const struct huffcodetab ht_const[HTN] =
240{ 2, 2, 0, 0, t1HB, t1l}, 240{ 2, 2, 0, 0, t1HB, t1l},
241{ 3, 3, 0, 0, t2HB, t2l}, 241{ 3, 3, 0, 0, t2HB, t2l},
242{ 3, 3, 0, 0, t3HB, t3l}, 242{ 3, 3, 0, 0, t3HB, t3l},
243{ 0, 0, 0, 0, NULL, NULL},// Apparently not used 243{ 0, 0, 0, 0, NULL, NULL},/* Apparently not used */
244{ 4, 4, 0, 0, t5HB, t5l}, 244{ 4, 4, 0, 0, t5HB, t5l},
245{ 4, 4, 0, 0, t6HB, t6l}, 245{ 4, 4, 0, 0, t6HB, t6l},
246{ 6, 6, 0, 0, t7HB, t7l}, 246{ 6, 6, 0, 0, t7HB, t7l},
@@ -250,7 +250,7 @@ const struct huffcodetab ht_const[HTN] =
250{ 8, 8, 0, 0,t11HB, t11l}, 250{ 8, 8, 0, 0,t11HB, t11l},
251{ 8, 8, 0, 0,t12HB, t12l}, 251{ 8, 8, 0, 0,t12HB, t12l},
252{16,16, 0, 0,t13HB, t13l}, 252{16,16, 0, 0,t13HB, t13l},
253{ 0, 0, 0, 0, NULL, NULL},// Apparently not used 253{ 0, 0, 0, 0, NULL, NULL},/* Apparently not used */
254{16,16, 0, 0,t15HB, t15l}, 254{16,16, 0, 0,t15HB, t15l},
255{16,16, 1, 1,t16HB, t16l}, 255{16,16, 1, 1,t16HB, t16l},
256{16,16, 2, 3,t16HB, t16l}, 256{16,16, 2, 3,t16HB, t16l},
@@ -1025,7 +1025,7 @@ int count_bit(enct8 ix[samp_per_frame2], unsigned int start, unsigned int end, u
1025 ylen = h->ylen; 1025 ylen = h->ylen;
1026 1026
1027 if(table > 15) 1027 if(table > 15)
1028 { // ESC-table is used 1028 { /* ESC-table is used */
1029 linbits = h->linbits; 1029 linbits = h->linbits;
1030 for(i=start; i<end; i+=2) 1030 for(i=start; i<end; i+=2)
1031 { 1031 {
@@ -1532,7 +1532,7 @@ void filter_subband(short *buffer, int s[SBLIMIT], int k)
1532#endif 1532#endif
1533 1533
1534 /* 147456=72*2048 */ 1534 /* 147456=72*2048 */
1535 for(i=SBLIMIT; i--; ) // SBLIMIT: 32 1535 for(i=SBLIMIT; i--; ) /* SBLIMIT: 32 */
1536 { 1536 {
1537 short *filt = filter_int[i]; 1537 short *filt = filter_int[i];
1538 1538
@@ -1691,11 +1691,11 @@ void compress(void)
1691 memcpy(ht , ht_const , sizeof(ht )); 1691 memcpy(ht , ht_const , sizeof(ht ));
1692 1692
1693 /* I don't know, wether this is really necessary */ 1693 /* I don't know, wether this is really necessary */
1694 ht[ 0].table = NULL; ht[ 0].hlen = NULL;// Apparently not used 1694 ht[ 0].table = NULL; ht[ 0].hlen = NULL;/* Apparently not used */
1695 ht[ 1].table = t1HB; ht[ 1].hlen = t1l; 1695 ht[ 1].table = t1HB; ht[ 1].hlen = t1l;
1696 ht[ 2].table = t2HB; ht[ 2].hlen = t2l; 1696 ht[ 2].table = t2HB; ht[ 2].hlen = t2l;
1697 ht[ 3].table = t3HB; ht[ 3].hlen = t3l; 1697 ht[ 3].table = t3HB; ht[ 3].hlen = t3l;
1698 ht[ 4].table = NULL; ht[ 4].hlen = NULL;// Apparently not used 1698 ht[ 4].table = NULL; ht[ 4].hlen = NULL;/* Apparently not used */
1699 ht[ 5].table = t5HB; ht[ 5].hlen = t5l; 1699 ht[ 5].table = t5HB; ht[ 5].hlen = t5l;
1700 ht[ 6].table = t6HB; ht[ 6].hlen = t6l; 1700 ht[ 6].table = t6HB; ht[ 6].hlen = t6l;
1701 ht[ 7].table = t7HB; ht[ 7].hlen = t7l; 1701 ht[ 7].table = t7HB; ht[ 7].hlen = t7l;
@@ -1705,7 +1705,7 @@ void compress(void)
1705 ht[11].table = t11HB; ht[11].hlen = t11l; 1705 ht[11].table = t11HB; ht[11].hlen = t11l;
1706 ht[12].table = t12HB; ht[12].hlen = t12l; 1706 ht[12].table = t12HB; ht[12].hlen = t12l;
1707 ht[13].table = t13HB; ht[13].hlen = t13l; 1707 ht[13].table = t13HB; ht[13].hlen = t13l;
1708 ht[14].table = NULL; ht[14].hlen = NULL;// Apparently not used 1708 ht[14].table = NULL; ht[14].hlen = NULL;/* Apparently not used */
1709 ht[15].table = t15HB; ht[15].hlen = t15l; 1709 ht[15].table = t15HB; ht[15].hlen = t15l;
1710 ht[16].table = t16HB; ht[16].hlen = t16l; 1710 ht[16].table = t16HB; ht[16].hlen = t16l;
1711 ht[17].table = t16HB; ht[17].hlen = t16l; 1711 ht[17].table = t16HB; ht[17].hlen = t16l;