Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

FS#12141 by Sean Bartell

Some of these were found with http://www.samba.org/junkcode/#findstatic. Changes of note:
* The old MDCT has been removed.
* Makefile.test files that create test programs for libatrac, libcook, and libffmpegFLAC have been removed, as they don't work. My project will have a replacement that works with all codecs.
* I've tried not to remove anything useful. CLIP_TO_15 was removed from libtremor because there's another copy (also commented) in codeclib.



git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29945 a1c6a512-1295-4272-9138-f99709370657

+27 -1826
-1
apps/codecs/alac.c
··· 83 83 } 84 84 85 85 /* initialise the sound converter */ 86 - create_alac(demux_res.sound_sample_size, demux_res.num_channels,&alac); 87 86 alac_set_info(&alac, demux_res.codecdata); 88 87 89 88 /* Set i for first frame, seek to desired sample position for resuming. */
-1
apps/codecs/demac/libdemac/SOURCES
··· 1 - crc.c 2 1 predictor.c 3 2 #ifdef CPU_ARM 4 3 predictor-arm.S
-5
apps/codecs/lib/SOURCES
··· 3 3 fixedpoint.c 4 4 ffmpeg_bitstream.c 5 5 6 - /* OLD MDCT */ 7 - /* (when all other codecs are remediated this can be remoed) */ 8 - mdct2.c 9 6 mdct_lookup.c 10 - 11 7 fft-ffmpeg.c 12 8 mdct.c 13 9 14 10 #ifdef CPU_ARM 15 - mdct_arm.S 16 11 ../../../firmware/target/arm/support-arm.S 17 12 #endif 18 13
-513
apps/codecs/lib/mdct2.c
··· 1 - /******************************************************************** 2 - * * 3 - * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 - * * 5 - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 - * * 9 - * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 - * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 - * * 12 - ******************************************************************** 13 - 14 - function: normalized modified discrete cosine transform 15 - power of two length transform only [64 <= n ] 16 - 17 - 18 - Original algorithm adapted long ago from _The use of multirate filter 19 - banks for coding of high quality digital audio_, by T. Sporer, 20 - K. Brandenburg and B. Edler, collection of the European Signal 21 - Processing Conference (EUSIPCO), Amsterdam, June 1992, Vol.1, pp 22 - 211-214 23 - 24 - The below code implements an algorithm that no longer looks much like 25 - that presented in the paper, but the basic structure remains if you 26 - dig deep enough to see it. 27 - 28 - This module DOES NOT INCLUDE code to generate/apply the window 29 - function. Everybody has their own weird favorite including me... I 30 - happen to like the properties of y=sin(.5PI*sin^2(x)), but others may 31 - vehemently disagree. 32 - 33 - ********************************************************************/ 34 - 35 - /*Tremor IMDCT adapted for use with libwmai*/ 36 - 37 - 38 - #include "mdct2.h" 39 - #include "mdct_lookup.h" 40 - #ifdef ROCKBOX 41 - #include <codecs/lib/codeclib.h> 42 - #endif /* ROCKBOX */ 43 - 44 - #if defined(CPU_ARM) 45 - 46 - extern void mdct_butterfly_32(int32_t *x); 47 - extern void mdct_butterfly_generic_loop(int32_t *x1, int32_t *x2, 48 - const int32_t *T0, int step, 49 - const int32_t *Ttop); 50 - 51 - static inline void mdct_butterfly_generic(int32_t *x,int points, int step){ 52 - mdct_butterfly_generic_loop(x + points, x + (points>>1), sincos_lookup0, step, sincos_lookup0+1024); 53 - } 54 - 55 - #else 56 - 57 - /* 8 point butterfly (in place) */ 58 - static inline void mdct_butterfly_8(int32_t *x){ 59 - register int32_t r0 = x[4] + x[0]; 60 - register int32_t r1 = x[4] - x[0]; 61 - register int32_t r2 = x[5] + x[1]; 62 - register int32_t r3 = x[5] - x[1]; 63 - register int32_t r4 = x[6] + x[2]; 64 - register int32_t r5 = x[6] - x[2]; 65 - register int32_t r6 = x[7] + x[3]; 66 - register int32_t r7 = x[7] - x[3]; 67 - 68 - x[0] = r5 + r3; 69 - x[1] = r7 - r1; 70 - x[2] = r5 - r3; 71 - x[3] = r7 + r1; 72 - x[4] = r4 - r0; 73 - x[5] = r6 - r2; 74 - x[6] = r4 + r0; 75 - x[7] = r6 + r2; 76 - } 77 - 78 - /* 16 point butterfly (in place, 4 register) */ 79 - static inline void mdct_butterfly_16(int32_t *x){ 80 - 81 - register int32_t r0, r1; 82 - 83 - r0 = x[ 0] - x[ 8]; x[ 8] += x[ 0]; 84 - r1 = x[ 1] - x[ 9]; x[ 9] += x[ 1]; 85 - x[ 0] = MULT31((r0 + r1) , cPI2_8); 86 - x[ 1] = MULT31((r1 - r0) , cPI2_8); 87 - 88 - r0 = x[10] - x[ 2]; x[10] += x[ 2]; 89 - r1 = x[ 3] - x[11]; x[11] += x[ 3]; 90 - x[ 2] = r1; x[ 3] = r0; 91 - 92 - r0 = x[12] - x[ 4]; x[12] += x[ 4]; 93 - r1 = x[13] - x[ 5]; x[13] += x[ 5]; 94 - x[ 4] = MULT31((r0 - r1) , cPI2_8); 95 - x[ 5] = MULT31((r0 + r1) , cPI2_8); 96 - 97 - r0 = x[14] - x[ 6]; x[14] += x[ 6]; 98 - r1 = x[15] - x[ 7]; x[15] += x[ 7]; 99 - x[ 6] = r0; x[ 7] = r1; 100 - 101 - mdct_butterfly_8(x); 102 - mdct_butterfly_8(x+8); 103 - } 104 - 105 - /* 32 point butterfly (in place, 4 register) */ 106 - static inline void mdct_butterfly_32(int32_t *x){ 107 - 108 - register int32_t r0, r1; 109 - 110 - r0 = x[30] - x[14]; x[30] += x[14]; 111 - r1 = x[31] - x[15]; x[31] += x[15]; 112 - x[14] = r0; x[15] = r1; 113 - 114 - r0 = x[28] - x[12]; x[28] += x[12]; 115 - r1 = x[29] - x[13]; x[29] += x[13]; 116 - XNPROD31( r0, r1, cPI1_8, cPI3_8, &x[12], &x[13] ); 117 - 118 - r0 = x[26] - x[10]; x[26] += x[10]; 119 - r1 = x[27] - x[11]; x[27] += x[11]; 120 - x[10] = MULT31((r0 - r1) , cPI2_8); 121 - x[11] = MULT31((r0 + r1) , cPI2_8); 122 - 123 - r0 = x[24] - x[ 8]; x[24] += x[ 8]; 124 - r1 = x[25] - x[ 9]; x[25] += x[ 9]; 125 - XNPROD31( r0, r1, cPI3_8, cPI1_8, &x[ 8], &x[ 9] ); 126 - 127 - r0 = x[22] - x[ 6]; x[22] += x[ 6]; 128 - r1 = x[ 7] - x[23]; x[23] += x[ 7]; 129 - x[ 6] = r1; x[ 7] = r0; 130 - 131 - r0 = x[ 4] - x[20]; x[20] += x[ 4]; 132 - r1 = x[ 5] - x[21]; x[21] += x[ 5]; 133 - XPROD31 ( r0, r1, cPI3_8, cPI1_8, &x[ 4], &x[ 5] ); 134 - 135 - r0 = x[ 2] - x[18]; x[18] += x[ 2]; 136 - r1 = x[ 3] - x[19]; x[19] += x[ 3]; 137 - x[ 2] = MULT31((r1 + r0) , cPI2_8); 138 - x[ 3] = MULT31((r1 - r0) , cPI2_8); 139 - 140 - r0 = x[ 0] - x[16]; x[16] += x[ 0]; 141 - r1 = x[ 1] - x[17]; x[17] += x[ 1]; 142 - XPROD31 ( r0, r1, cPI1_8, cPI3_8, &x[ 0], &x[ 1] ); 143 - 144 - mdct_butterfly_16(x); 145 - mdct_butterfly_16(x+16); 146 - } 147 - 148 - /* N/stage point generic N stage butterfly (in place, 4 register) */ 149 - void mdct_butterfly_generic(int32_t *x,int points, int step) 150 - ICODE_ATTR_TREMOR_MDCT; 151 - void mdct_butterfly_generic(int32_t *x,int points, int step){ 152 - const int32_t *T = sincos_lookup0; 153 - int32_t *x1 = x + points - 8; 154 - int32_t *x2 = x + (points>>1) - 8; 155 - register int32_t r0; 156 - register int32_t r1; 157 - register int32_t r2; 158 - register int32_t r3; 159 - 160 - do{ 161 - r0 = x1[6] - x2[6]; x1[6] += x2[6]; 162 - r1 = x2[7] - x1[7]; x1[7] += x2[7]; 163 - r2 = x1[4] - x2[4]; x1[4] += x2[4]; 164 - r3 = x2[5] - x1[5]; x1[5] += x2[5]; 165 - XPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T+=step; 166 - XPROD31( r3, r2, T[0], T[1], &x2[4], &x2[5] ); T+=step; 167 - 168 - r0 = x1[2] - x2[2]; x1[2] += x2[2]; 169 - r1 = x2[3] - x1[3]; x1[3] += x2[3]; 170 - r2 = x1[0] - x2[0]; x1[0] += x2[0]; 171 - r3 = x2[1] - x1[1]; x1[1] += x2[1]; 172 - XPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T+=step; 173 - XPROD31( r3, r2, T[0], T[1], &x2[0], &x2[1] ); T+=step; 174 - 175 - x1-=8; x2-=8; 176 - }while(T<sincos_lookup0+1024); 177 - do{ 178 - r0 = x1[6] - x2[6]; x1[6] += x2[6]; 179 - r1 = x1[7] - x2[7]; x1[7] += x2[7]; 180 - r2 = x1[4] - x2[4]; x1[4] += x2[4]; 181 - r3 = x1[5] - x2[5]; x1[5] += x2[5]; 182 - XNPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T-=step; 183 - XNPROD31( r2, r3, T[0], T[1], &x2[4], &x2[5] ); T-=step; 184 - 185 - r0 = x1[2] - x2[2]; x1[2] += x2[2]; 186 - r1 = x1[3] - x2[3]; x1[3] += x2[3]; 187 - r2 = x1[0] - x2[0]; x1[0] += x2[0]; 188 - r3 = x1[1] - x2[1]; x1[1] += x2[1]; 189 - XNPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T-=step; 190 - XNPROD31( r2, r3, T[0], T[1], &x2[0], &x2[1] ); T-=step; 191 - 192 - x1-=8; x2-=8; 193 - }while(T>sincos_lookup0); 194 - do{ 195 - r0 = x2[6] - x1[6]; x1[6] += x2[6]; 196 - r1 = x2[7] - x1[7]; x1[7] += x2[7]; 197 - r2 = x2[4] - x1[4]; x1[4] += x2[4]; 198 - r3 = x2[5] - x1[5]; x1[5] += x2[5]; 199 - XPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T+=step; 200 - XPROD31( r2, r3, T[0], T[1], &x2[4], &x2[5] ); T+=step; 201 - 202 - r0 = x2[2] - x1[2]; x1[2] += x2[2]; 203 - r1 = x2[3] - x1[3]; x1[3] += x2[3]; 204 - r2 = x2[0] - x1[0]; x1[0] += x2[0]; 205 - r3 = x2[1] - x1[1]; x1[1] += x2[1]; 206 - XPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T+=step; 207 - XPROD31( r2, r3, T[0], T[1], &x2[0], &x2[1] ); T+=step; 208 - 209 - x1-=8; x2-=8; 210 - }while(T<sincos_lookup0+1024); 211 - do{ 212 - r0 = x1[6] - x2[6]; x1[6] += x2[6]; 213 - r1 = x2[7] - x1[7]; x1[7] += x2[7]; 214 - r2 = x1[4] - x2[4]; x1[4] += x2[4]; 215 - r3 = x2[5] - x1[5]; x1[5] += x2[5]; 216 - XNPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T-=step; 217 - XNPROD31( r3, r2, T[0], T[1], &x2[4], &x2[5] ); T-=step; 218 - 219 - r0 = x1[2] - x2[2]; x1[2] += x2[2]; 220 - r1 = x2[3] - x1[3]; x1[3] += x2[3]; 221 - r2 = x1[0] - x2[0]; x1[0] += x2[0]; 222 - r3 = x2[1] - x1[1]; x1[1] += x2[1]; 223 - XNPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T-=step; 224 - XNPROD31( r3, r2, T[0], T[1], &x2[0], &x2[1] ); T-=step; 225 - 226 - x1-=8; x2-=8; 227 - }while(T>sincos_lookup0); 228 - } 229 - 230 - #endif /* CPU_ARM */ 231 - 232 - static inline void mdct_butterflies(int32_t *x,int points,int shift) { 233 - 234 - int stages=8-shift; 235 - int i,j; 236 - 237 - for(i=0;--stages>0;i++){ 238 - for(j=0;j<(1<<i);j++) 239 - mdct_butterfly_generic(x+(points>>i)*j,points>>i,4<<(i+shift)); 240 - } 241 - 242 - for(j=0;j<points;j+=32) 243 - mdct_butterfly_32(x+j); 244 - } 245 - 246 - static const unsigned char bitrev[] ICONST_ATTR = 247 - { 248 - 0, 32, 16, 48, 8, 40, 24, 56, 4, 36, 20, 52, 12, 44, 28, 60, 249 - 2, 34, 18, 50, 10, 42, 26, 58, 6, 38, 22, 54, 14, 46, 30, 62, 250 - 1, 33, 17, 49, 9, 41, 25, 57, 5, 37, 21, 53, 13, 45, 29, 61, 251 - 3, 35, 19, 51, 11, 43, 27, 59, 7, 39, 23, 55, 15, 47, 31, 63 252 - }; 253 - 254 - static inline int bitrev12(int x){ 255 - return bitrev[x>>6]|((bitrev[x&0x03f])<<6); 256 - } 257 - 258 - static inline void mdct_bitreverse(int32_t *x,int n,int step,int shift) { 259 - 260 - int bit = 0; 261 - int32_t *w0 = x; 262 - int32_t *w1 = x = w0+(n>>1); 263 - const int32_t *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1; 264 - const int32_t *Ttop = T+1024; 265 - register int32_t r2; 266 - 267 - do{ 268 - register int32_t r3 = bitrev12(bit++); 269 - int32_t *x0 = x + ((r3 ^ 0xfff)>>shift) -1; 270 - int32_t *x1 = x + (r3>>shift); 271 - 272 - register int32_t r0 = x0[0] + x1[0]; 273 - register int32_t r1 = x1[1] - x0[1]; 274 - 275 - XPROD32( r0, r1, T[1], T[0], r2, r3 ); T+=step; 276 - 277 - w1 -= 4; 278 - 279 - r0 = (x0[1] + x1[1])>>1; 280 - r1 = (x0[0] - x1[0])>>1; 281 - w0[0] = r0 + r2; 282 - w0[1] = r1 + r3; 283 - w1[2] = r0 - r2; 284 - w1[3] = r3 - r1; 285 - 286 - r3 = bitrev12(bit++); 287 - x0 = x + ((r3 ^ 0xfff)>>shift) -1; 288 - x1 = x + (r3>>shift); 289 - 290 - r0 = x0[0] + x1[0]; 291 - r1 = x1[1] - x0[1]; 292 - 293 - XPROD32( r0, r1, T[1], T[0], r2, r3 ); T+=step; 294 - 295 - r0 = (x0[1] + x1[1])>>1; 296 - r1 = (x0[0] - x1[0])>>1; 297 - w0[2] = r0 + r2; 298 - w0[3] = r1 + r3; 299 - w1[0] = r0 - r2; 300 - w1[1] = r3 - r1; 301 - 302 - w0 += 4; 303 - }while(T<Ttop); 304 - do{ 305 - register int32_t r3 = bitrev12(bit++); 306 - int32_t *x0 = x + ((r3 ^ 0xfff)>>shift) -1; 307 - int32_t *x1 = x + (r3>>shift); 308 - 309 - register int32_t r0 = x0[0] + x1[0]; 310 - register int32_t r1 = x1[1] - x0[1]; 311 - 312 - T-=step; XPROD32( r0, r1, T[0], T[1], r2, r3 ); 313 - 314 - w1 -= 4; 315 - 316 - r0 = (x0[1] + x1[1])>>1; 317 - r1 = (x0[0] - x1[0])>>1; 318 - w0[0] = r0 + r2; 319 - w0[1] = r1 + r3; 320 - w1[2] = r0 - r2; 321 - w1[3] = r3 - r1; 322 - 323 - r3 = bitrev12(bit++); 324 - x0 = x + ((r3 ^ 0xfff)>>shift) -1; 325 - x1 = x + (r3>>shift); 326 - 327 - r0 = x0[0] + x1[0]; 328 - r1 = x1[1] - x0[1]; 329 - 330 - T-=step; XPROD32( r0, r1, T[0], T[1], r2, r3 ); 331 - 332 - r0 = (x0[1] + x1[1])>>1; 333 - r1 = (x0[0] - x1[0])>>1; 334 - w0[2] = r0 + r2; 335 - w0[3] = r1 + r3; 336 - w1[0] = r0 - r2; 337 - w1[1] = r3 - r1; 338 - 339 - w0 += 4; 340 - }while(w0<w1); 341 - } 342 - 343 - 344 - void mdct_backward(int n, int32_t *in, int32_t *out) 345 - ICODE_ATTR_TREMOR_MDCT; 346 - void mdct_backward(int n, int32_t *in, int32_t *out) { 347 - int n2=n>>1; 348 - int n4=n>>2; 349 - int32_t *iX; 350 - int32_t *oX; 351 - const int32_t *T; 352 - const int32_t *V; 353 - int shift; 354 - int step; 355 - for (shift=6;!(n&(1<<shift));shift++); 356 - shift=13-shift; 357 - step=2<<shift; 358 - 359 - /* rotate */ 360 - 361 - iX = in+n2-7; 362 - oX = out+n2+n4; 363 - T = sincos_lookup0; 364 - 365 - do{ 366 - oX-=4; 367 - XPROD31( iX[4], iX[6], T[0], T[1], &oX[2], &oX[3] ); T+=step; 368 - XPROD31( iX[0], iX[2], T[0], T[1], &oX[0], &oX[1] ); T+=step; 369 - iX-=8; 370 - }while(iX>=in+n4); 371 - do{ 372 - oX-=4; 373 - XPROD31( iX[4], iX[6], T[1], T[0], &oX[2], &oX[3] ); T-=step; 374 - XPROD31( iX[0], iX[2], T[1], T[0], &oX[0], &oX[1] ); T-=step; 375 - iX-=8; 376 - }while(iX>=in); 377 - 378 - iX = in+n2-8; 379 - oX = out+n2+n4; 380 - T = sincos_lookup0; 381 - 382 - do{ 383 - T+=step; XNPROD31( iX[6], iX[4], T[0], T[1], &oX[0], &oX[1] ); 384 - T+=step; XNPROD31( iX[2], iX[0], T[0], T[1], &oX[2], &oX[3] ); 385 - iX-=8; 386 - oX+=4; 387 - }while(iX>=in+n4); 388 - do{ 389 - T-=step; XNPROD31( iX[6], iX[4], T[1], T[0], &oX[0], &oX[1] ); 390 - T-=step; XNPROD31( iX[2], iX[0], T[1], T[0], &oX[2], &oX[3] ); 391 - iX-=8; 392 - oX+=4; 393 - }while(iX>=in); 394 - 395 - mdct_butterflies(out+n2,n2,shift); 396 - mdct_bitreverse(out,n,step,shift); 397 - /* rotate + window */ 398 - 399 - step>>=2; 400 - { 401 - int32_t *oX1=out+n2+n4; 402 - int32_t *oX2=out+n2+n4; 403 - int32_t *iX =out; 404 - 405 - switch(step) { 406 - default: { 407 - T=(step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1; 408 - do{ 409 - oX1-=4; 410 - XPROD31( iX[0], -iX[1], T[0], T[1], &oX1[3], &oX2[0] ); T+=step; 411 - XPROD31( iX[2], -iX[3], T[0], T[1], &oX1[2], &oX2[1] ); T+=step; 412 - XPROD31( iX[4], -iX[5], T[0], T[1], &oX1[1], &oX2[2] ); T+=step; 413 - XPROD31( iX[6], -iX[7], T[0], T[1], &oX1[0], &oX2[3] ); T+=step; 414 - oX2+=4; 415 - iX+=8; 416 - }while(iX<oX1); 417 - break; 418 - } 419 - 420 - case 1: { 421 - /* linear interpolation between table values: offset=0.5, step=1 */ 422 - register int32_t t0,t1,v0,v1; 423 - T = sincos_lookup0; 424 - V = sincos_lookup1; 425 - t0 = (*T++)>>1; 426 - t1 = (*T++)>>1; 427 - do{ 428 - oX1-=4; 429 - 430 - t0 += (v0 = (*V++)>>1); 431 - t1 += (v1 = (*V++)>>1); 432 - XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] ); 433 - v0 += (t0 = (*T++)>>1); 434 - v1 += (t1 = (*T++)>>1); 435 - XPROD31( iX[2], -iX[3], v0, v1, &oX1[2], &oX2[1] ); 436 - t0 += (v0 = (*V++)>>1); 437 - t1 += (v1 = (*V++)>>1); 438 - XPROD31( iX[4], -iX[5], t0, t1, &oX1[1], &oX2[2] ); 439 - v0 += (t0 = (*T++)>>1); 440 - v1 += (t1 = (*T++)>>1); 441 - XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] ); 442 - 443 - oX2+=4; 444 - iX+=8; 445 - }while(iX<oX1); 446 - break; 447 - } 448 - 449 - case 0: { 450 - /* linear interpolation between table values: offset=0.25, step=0.5 */ 451 - register int32_t t0,t1,v0,v1,q0,q1; 452 - T = sincos_lookup0; 453 - V = sincos_lookup1; 454 - t0 = *T++; 455 - t1 = *T++; 456 - do{ 457 - oX1-=4; 458 - 459 - v0 = *V++; 460 - v1 = *V++; 461 - t0 += (q0 = (v0-t0)>>2); 462 - t1 += (q1 = (v1-t1)>>2); 463 - XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] ); 464 - t0 = v0-q0; 465 - t1 = v1-q1; 466 - XPROD31( iX[2], -iX[3], t0, t1, &oX1[2], &oX2[1] ); 467 - 468 - t0 = *T++; 469 - t1 = *T++; 470 - v0 += (q0 = (t0-v0)>>2); 471 - v1 += (q1 = (t1-v1)>>2); 472 - XPROD31( iX[4], -iX[5], v0, v1, &oX1[1], &oX2[2] ); 473 - v0 = t0-q0; 474 - v1 = t1-q1; 475 - XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] ); 476 - 477 - oX2+=4; 478 - iX+=8; 479 - }while(iX<oX1); 480 - break; 481 - } 482 - } 483 - 484 - iX=out+n2+n4; 485 - oX1=out+n4; 486 - oX2=oX1; 487 - 488 - do{ 489 - oX1-=4; 490 - iX-=4; 491 - 492 - oX2[0] = -(oX1[3] = iX[3]); 493 - oX2[1] = -(oX1[2] = iX[2]); 494 - oX2[2] = -(oX1[1] = iX[1]); 495 - oX2[3] = -(oX1[0] = iX[0]); 496 - 497 - oX2+=4; 498 - }while(oX2<iX); 499 - 500 - iX=out+n2+n4; 501 - oX1=out+n2+n4; 502 - oX2=out+n2; 503 - 504 - do{ 505 - oX1-=4; 506 - oX1[0]= iX[3]; 507 - oX1[1]= iX[2]; 508 - oX1[2]= iX[1]; 509 - oX1[3]= iX[0]; 510 - iX+=4; 511 - }while(oX1>oX2); 512 - } 513 - }
-76
apps/codecs/lib/mdct2.h
··· 1 - /******************************************************************** 2 - * * 3 - * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 - * * 5 - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 - * * 9 - * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 - * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 - * * 12 - ******************************************************************** 13 - 14 - function: modified discrete cosine transform prototypes 15 - 16 - ********************************************************************/ 17 - 18 - #ifndef _OGG_mdct_H_ 19 - #define _OGG_mdct_H_ 20 - 21 - 22 - 23 - #ifdef _LOW_ACCURACY_ 24 - # define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9)) 25 - # //define LOOKUP_T const unsigned char 26 - #else 27 - # define X(n) (n) 28 - # //define LOOKUP_T const ogg_int32_t 29 - #endif 30 - 31 - #ifdef ROCKBOX 32 - #include <codecs.h> 33 - #endif /* ROCKBOX */ 34 - 35 - #include "codeclib_misc.h" 36 - 37 - #ifndef ICONST_ATTR_TREMOR_WINDOW 38 - #define ICONST_ATTR_TREMOR_WINDOW ICONST_ATTR 39 - #endif 40 - 41 - #ifndef ICODE_ATTR_TREMOR_MDCT 42 - #define ICODE_ATTR_TREMOR_MDCT ICODE_ATTR 43 - #endif 44 - 45 - #ifndef ICODE_ATTR_TREMOR_NOT_MDCT 46 - #define ICODE_ATTR_TREMOR_NOT_MDCT ICODE_ATTR 47 - #endif 48 - 49 - 50 - 51 - #ifdef _LOW_ACCURACY_ 52 - #define cPI3_8 (0x0062) 53 - #define cPI2_8 (0x00b5) 54 - #define cPI1_8 (0x00ed) 55 - #else 56 - #define cPI3_8 (0x30fbc54d) 57 - #define cPI2_8 (0x5a82799a) 58 - #define cPI1_8 (0x7641af3d) 59 - #endif 60 - 61 - 62 - extern void mdct_backward(int n, int32_t *in, int32_t *out); 63 - 64 - #endif 65 - 66 - 67 - 68 - 69 - 70 - 71 - 72 - 73 - 74 - 75 - 76 -
-437
apps/codecs/lib/mdct_arm.S
··· 1 - /*************************************************************************** 2 - * __________ __ ___. 3 - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 - * \/ \/ \/ \/ \/ 8 - * $Id$ 9 - * 10 - * Copyright (C) 2007 by Tomasz Malesinski 11 - * 12 - * This program is free software; you can redistribute it and/or 13 - * modify it under the terms of the GNU General Public License 14 - * as published by the Free Software Foundation; either version 2 15 - * of the License, or (at your option) any later version. 16 - * 17 - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 - * KIND, either express or implied. 19 - * 20 - ****************************************************************************/ 21 - 22 - #include "config.h" 23 - /* Codecs should not normally do this, but we need to check a macro, and 24 - * codecs.h would confuse the assembler. */ 25 - 26 - #define cPI3_8 (0x30fbc54d) 27 - #define cPI2_8 (0x5a82799a) 28 - #define cPI1_8 (0x7641af3d) 29 - 30 - #ifdef USE_IRAM 31 - .section .icode,"ax",%progbits 32 - #else 33 - .text 34 - #endif 35 - .align 36 - 37 - .global mdct_butterfly_32 38 - .global mdct_butterfly_generic_loop 39 - 40 - mdct_butterfly_8: 41 - @ inputs: r0,r1,r2,r3,r4,r5,r6,r10,r11 &lr 42 - @ uses: r8,r9,r12(scratch) 43 - @ modifies: r0,r1,r2,r3,r4,r5,r6,r10,r11. increments r0 by #8*4 44 - add r9, r5, r1 @ x4 + x0 45 - sub r5, r5, r1 @ x4 - x0 46 - add r7, r6, r2 @ x5 + x1 47 - sub r6, r6, r2 @ x5 - x1 48 - add r8, r10, r3 @ x6 + x2 49 - sub r10, r10, r3 @ x6 - x2 50 - add r12, r11, r4 @ x7 + x3 51 - sub r11, r11, r4 @ x7 - x3 52 - 53 - add r1, r10, r6 @ y0 = (x6 - x2) + (x5 - x1) 54 - sub r2, r11, r5 @ y1 = (x7 - x3) - (x4 - x0) 55 - sub r3, r10, r6 @ y2 = (x6 - x2) - (x5 - x1) 56 - add r4, r11, r5 @ y3 = (x7 - x3) + (x4 - x0) 57 - sub r5, r8, r9 @ y4 = (x6 + x2) - (x4 + x0) 58 - sub r6, r12, r7 @ y5 = (x7 + x3) - (x5 + x1) 59 - add r10, r8, r9 @ y6 = (x6 + x2) + (x4 + x0) 60 - add r11, r12, r7 @ y7 = (x7 + x3) + (x5 + x1) 61 - stmia r0!, {r1, r2, r3, r4, r5, r6, r10, r11} 62 - 63 - bx lr 64 - 65 - mdct_butterfly_16: 66 - @ inputs: r0,r1 &lr 67 - @ uses: r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12 68 - @ modifies: r0. increments r0 by #16*4 69 - @ calls mdct_butterfly_8 via bl so need to stack lr for return address 70 - str lr, [sp, #-4]! 71 - add r1, r0, #8*4 72 - 73 - ldmia r0, {r2, r3, r4, r5} 74 - ldmia r1, {r6, r7, r8, r9} 75 - add r6, r6, r2 @ y8 = x8 + x0 76 - rsb r2, r6, r2, asl #1 @ x0 - x8 77 - add r7, r7, r3 @ y9 = x9 + x1 78 - rsb r3, r7, r3, asl #1 @ x1 - x9 79 - add r8, r8, r4 @ y10 = x10 + x2 80 - sub r11, r8, r4, asl #1 @ x10 - x2 81 - add r9, r9, r5 @ y11 = x11 + x3 82 - rsb r10, r9, r5, asl #1 @ x3 - x11 83 - 84 - stmia r1!, {r6, r7, r8, r9} 85 - 86 - add r2, r2, r3 @ (x0 - x8) + (x1 - x9) 87 - rsb r3, r2, r3, asl #1 @ (x1 - x9) - (x0 - x8) 88 - 89 - ldr r12, =cPI2_8 90 - smull r8, r5, r12, r2 91 - smull r8, r6, r12, r3 92 - mov r5, r5, asl #1 93 - mov r6, r6, asl #1 94 - 95 - stmia r0!, {r5, r6, r10, r11} 96 - 97 - ldmia r0, {r2, r3, r4, r5} 98 - ldmia r1, {r6, r7, r8, r9} 99 - add r6, r6, r2 @ y12 = x12 + x4 100 - sub r2, r6, r2, asl #1 @ x12 - x4 101 - add r7, r7, r3 @ y13 = x13 + x5 102 - sub r3, r7, r3, asl #1 @ x13 - x5 103 - add r8, r8, r4 @ y10 = x14 + x6 104 - sub r10, r8, r4, asl #1 @ x14 - x6 105 - add r9, r9, r5 @ y11 = x15 + x7 106 - sub r11, r9, r5, asl #1 @ x15 - x7 107 - 108 - stmia r1, {r6, r7, r8, r9} 109 - 110 - sub r2, r2, r3 @ (x12 - x4) - (x13 - x5) 111 - add r3, r2, r3, asl #1 @ (x12 - x4) + (x13 - x5) 112 - 113 - smull r8, r5, r12, r2 114 - smull r8, r6, r12, r3 115 - mov r5, r5, asl #1 116 - mov r6, r6, asl #1 117 - @ no stmia here, r5, r6, r10, r11 are passed to mdct_butterfly_8 118 - 119 - sub r0, r0, #4*4 120 - ldmia r0, {r1, r2, r3, r4} 121 - bl mdct_butterfly_8 122 - 123 - @ mdct_butterfly_8 will have incremented r0 by #8*4 already 124 - ldmia r0, {r1, r2, r3, r4, r5, r6, r10, r11} 125 - 126 - bl mdct_butterfly_8 127 - @ mdct_butterfly_8 increments r0 by another #8*4 here 128 - @ at end, r0 has been incremented by #16*4 129 - 130 - ldrpc 131 - 132 - mdct_butterfly_32: 133 - stmdb sp!, {r4-r11, lr} 134 - 135 - add r1, r0, #16*4 136 - 137 - ldmia r0, {r2, r3, r4, r5} 138 - ldmia r1, {r6, r7, r8, r9} 139 - add r6, r6, r2 @ y16 = x16 + x0 140 - rsb r2, r6, r2, asl #1 @ x0 - x16 141 - add r7, r7, r3 @ y17 = x17 + x1 142 - rsb r3, r7, r3, asl #1 @ x1 - x17 143 - add r8, r8, r4 @ y18 = x18 + x2 144 - rsb r4, r8, r4, asl #1 @ x2 - x18 145 - add r9, r9, r5 @ y19 = x19 + x3 146 - rsb r5, r9, r5, asl #1 @ x3 - x19 147 - 148 - stmia r1!, {r6, r7, r8, r9} 149 - 150 - ldr r12, =cPI1_8 151 - ldr lr, =cPI3_8 152 - smull r10, r6, r12, r2 153 - rsb r2, r2, #0 154 - smlal r10, r6, lr, r3 155 - smull r10, r7, r12, r3 156 - smlal r10, r7, lr, r2 157 - mov r6, r6, asl #1 158 - mov r7, r7, asl #1 159 - 160 - add r4, r4, r5 @ (x3 - x19) + (x2 - x18) 161 - rsb r5, r4, r5, asl #1 @ (x3 - x19) - (x2 - x18) 162 - 163 - ldr r11, =cPI2_8 164 - smull r10, r8, r4, r11 165 - smull r10, r9, r5, r11 166 - mov r8, r8, asl #1 167 - mov r9, r9, asl #1 168 - 169 - stmia r0!, {r6, r7, r8, r9} 170 - 171 - ldmia r0, {r2, r3, r4, r5} 172 - ldmia r1, {r6, r7, r8, r9} 173 - add r6, r6, r2 @ y20 = x20 + x4 174 - rsb r2, r6, r2, asl #1 @ x4 - x20 175 - add r7, r7, r3 @ y21 = x21 + x5 176 - rsb r3, r7, r3, asl #1 @ x5 - x21 177 - add r8, r8, r4 @ y22 = x22 + x6 178 - sub r11, r8, r4, asl #1 @ x22 - x6 179 - add r9, r9, r5 @ y23 = x23 + x7 180 - rsb r10, r9, r5, asl #1 @ x7 - x23 181 - stmia r1!, {r6, r7, r8, r9} 182 - 183 - @r4,r5,r6,r7,r8,r9 now free 184 - @ we don't use r5, r8, r9 below 185 - 186 - smull r4, r6, lr, r2 187 - rsb r2, r2, #0 188 - smlal r4, r6, r12, r3 189 - smull r4, r7, lr, r3 190 - smlal r4, r7, r12, r2 191 - mov r6, r6, asl #1 192 - mov r7, r7, asl #1 193 - 194 - stmia r0!, {r6, r7, r10, r11} 195 - 196 - ldmia r0, {r2, r3, r4, r5} 197 - ldmia r1, {r6, r7, r8, r9} 198 - add r6, r6, r2 @ y24 = x24 + x8 199 - sub r2, r6, r2, asl #1 @ x24 - x8 200 - add r7, r7, r3 @ y25 = x25 + x9 201 - sub r3, r7, r3, asl #1 @ x25 - x9 202 - add r8, r8, r4 @ y26 = x26 + x10 203 - sub r4, r8, r4, asl #1 @ x26 - x10 204 - add r9, r9, r5 @ y27 = x27 + x11 205 - sub r5, r9, r5, asl #1 @ x27 - x11 206 - 207 - stmia r1!, {r6, r7, r8, r9} 208 - 209 - smull r10, r7, lr, r3 210 - rsb r3, r3, #0 211 - smlal r10, r7, r12, r2 212 - smull r10, r6, r12, r3 213 - smlal r10, r6, lr, r2 214 - mov r6, r6, asl #1 215 - mov r7, r7, asl #1 216 - 217 - sub r4, r4, r5 @ (x26 - x10) - (x27 - x11) 218 - add r5, r4, r5, asl #1 @ (x26 - x10) + (x27 - x11) 219 - 220 - ldr r11, =cPI2_8 221 - smull r10, r8, r11, r4 222 - smull r10, r9, r11, r5 223 - mov r8, r8, asl #1 224 - mov r9, r9, asl #1 225 - 226 - stmia r0!, {r6, r7, r8, r9} 227 - 228 - ldmia r0, {r2, r3, r4, r5} 229 - ldmia r1, {r6, r7, r8, r9} 230 - add r6, r6, r2 @ y28 = x28 + x12 231 - sub r2, r6, r2, asl #1 @ x28 - x12 232 - add r7, r7, r3 @ y29 = x29 + x13 233 - sub r3, r7, r3, asl #1 @ x29 - x13 234 - add r8, r8, r4 @ y30 = x30 + x14 235 - sub r10, r8, r4, asl #1 @ x30 - x14 236 - add r9, r9, r5 @ y31 = x31 + x15 237 - sub r11, r9, r5, asl #1 @ x31 - x15 238 - stmia r1, {r6, r7, r8, r9} 239 - 240 - @ r4,r5,r6,r7,r8,r9 now free 241 - @ we don't use r5,r8,r9 below 242 - 243 - smull r4, r7, r12, r3 244 - rsb r3, r3, #0 245 - smlal r4, r7, lr, r2 246 - smull r4, r6, lr, r3 247 - smlal r4, r6, r12, r2 248 - mov r6, r6, asl #1 249 - mov r7, r7, asl #1 250 - 251 - stmia r0, {r6, r7, r10, r11} 252 - 253 - sub r0, r0, #12*4 254 - bl mdct_butterfly_16 255 - 256 - @ we know mdct_butterfly_16 increments r0 by #16*4 257 - @ and we wanted to advance by #16*4 anyway, so just call again 258 - bl mdct_butterfly_16 259 - 260 - ldmpc regs=r4-r11 261 - 262 - @ mdct_butterfly_generic_loop(x1, x2, T0, step, Ttop) 263 - mdct_butterfly_generic_loop: 264 - stmdb sp!, {r4-r11, lr} 265 - str r2, [sp, #-4] 266 - ldr r4, [sp, #36] 267 - 1: 268 - ldmdb r0, {r6, r7, r8, r9} 269 - ldmdb r1, {r10, r11, r12, r14} 270 - 271 - add r6, r6, r10 272 - sub r10, r6, r10, asl #1 273 - add r7, r7, r11 274 - rsb r11, r7, r11, asl #1 275 - add r8, r8, r12 276 - sub r12, r8, r12, asl #1 277 - add r9, r9, r14 278 - rsb r14, r9, r14, asl #1 279 - 280 - stmdb r0!, {r6, r7, r8, r9} 281 - 282 - ldmia r2, {r6, r7} 283 - smull r5, r8, r6, r14 284 - rsb r14, r14, #0 285 - smlal r5, r8, r7, r12 286 - smull r5, r9, r6, r12 287 - smlal r5, r9, r7, r14 288 - 289 - mov r8, r8, asl #1 290 - mov r9, r9, asl #1 291 - add r2, r2, r3, asl #2 292 - 293 - ldmia r2, {r12, r14} 294 - smull r5, r6, r12, r11 295 - rsb r11, r11, #0 296 - smlal r5, r6, r14, r10 297 - smull r5, r7, r12, r10 298 - smlal r5, r7, r14, r11 299 - 300 - mov r6, r6, asl #1 301 - mov r7, r7, asl #1 302 - stmdb r1!, {r6, r7, r8, r9} 303 - add r2, r2, r3, asl #2 304 - 305 - cmp r2, r4 306 - blo 1b 307 - 308 - ldr r4, [sp, #-4] 309 - 1: 310 - ldmdb r0, {r6, r7, r8, r9} 311 - ldmdb r1, {r10, r11, r12, r14} 312 - 313 - add r6, r6, r10 314 - sub r10, r6, r10, asl #1 315 - add r7, r7, r11 316 - sub r11, r7, r11, asl #1 317 - add r8, r8, r12 318 - sub r12, r8, r12, asl #1 319 - add r9, r9, r14 320 - sub r14, r9, r14, asl #1 321 - 322 - stmdb r0!, {r6, r7, r8, r9} 323 - 324 - ldmia r2, {r6, r7} 325 - smull r5, r9, r6, r14 326 - rsb r14, r14, #0 327 - smlal r5, r9, r7, r12 328 - smull r5, r8, r6, r12 329 - smlal r5, r8, r7, r14 330 - 331 - mov r8, r8, asl #1 332 - mov r9, r9, asl #1 333 - 334 - sub r2, r2, r3, asl #2 335 - 336 - ldmia r2, {r12, r14} 337 - smull r5, r7, r12, r11 338 - rsb r11, r11, #0 339 - smlal r5, r7, r14, r10 340 - smull r5, r6, r12, r10 341 - smlal r5, r6, r14, r11 342 - 343 - mov r6, r6, asl #1 344 - mov r7, r7, asl #1 345 - stmdb r1!, {r6, r7, r8, r9} 346 - sub r2, r2, r3, asl #2 347 - 348 - cmp r2, r4 349 - bhi 1b 350 - 351 - ldr r4, [sp, #36] 352 - 1: 353 - ldmdb r0, {r6, r7, r8, r9} 354 - ldmdb r1, {r10, r11, r12, r14} 355 - 356 - add r6, r6, r10 357 - rsb r10, r6, r10, asl #1 358 - add r7, r7, r11 359 - rsb r11, r7, r11, asl #1 360 - add r8, r8, r12 361 - rsb r12, r8, r12, asl #1 362 - add r9, r9, r14 363 - rsb r14, r9, r14, asl #1 364 - 365 - stmdb r0!, {r6, r7, r8, r9} 366 - 367 - ldmia r2, {r6, r7} 368 - smull r5, r8, r6, r12 369 - rsb r12, r12, #0 370 - smlal r5, r8, r7, r14 371 - smull r5, r9, r6, r14 372 - smlal r5, r9, r7, r12 373 - 374 - mov r8, r8, asl #1 375 - mov r9, r9, asl #1 376 - 377 - add r2, r2, r3, asl #2 378 - 379 - ldmia r2, {r12, r14} 380 - smull r5, r6, r12, r10 381 - rsb r10, r10, #0 382 - smlal r5, r6, r14, r11 383 - smull r5, r7, r12, r11 384 - smlal r5, r7, r14, r10 385 - 386 - mov r6, r6, asl #1 387 - mov r7, r7, asl #1 388 - stmdb r1!, {r6, r7, r8, r9} 389 - add r2, r2, r3, asl #2 390 - 391 - cmp r2, r4 392 - blo 1b 393 - 394 - ldr r4, [sp, #-4] 395 - 1: 396 - ldmdb r0, {r6, r7, r8, r9} 397 - ldmdb r1, {r10, r11, r12, r14} 398 - 399 - add r6, r6, r10 400 - sub r10, r6, r10, asl #1 401 - add r7, r7, r11 402 - rsb r11, r7, r11, asl #1 403 - add r8, r8, r12 404 - sub r12, r8, r12, asl #1 405 - add r9, r9, r14 406 - rsb r14, r9, r14, asl #1 407 - 408 - stmdb r0!, {r6, r7, r8, r9} 409 - 410 - ldmia r2, {r6, r7} 411 - smull r5, r9, r6, r12 412 - smlal r5, r9, r7, r14 413 - rsb r12, r12, #0 414 - smull r5, r8, r6, r14 415 - smlal r5, r8, r7, r12 416 - 417 - mov r8, r8, asl #1 418 - mov r9, r9, asl #1 419 - sub r2, r2, r3, asl #2 420 - 421 - ldmia r2, {r12, r14} 422 - smull r5, r7, r12, r10 423 - rsb r10, r10, #0 424 - smlal r5, r7, r14, r11 425 - smull r5, r6, r12, r11 426 - smlal r5, r6, r14, r10 427 - 428 - mov r6, r6, asl #1 429 - mov r7, r7, asl #1 430 - stmdb r1!, {r6, r7, r8, r9} 431 - sub r2, r2, r3, asl #2 432 - 433 - cmp r2, r4 434 - bhi 1b 435 - 436 - ldmpc regs=r4-r11 437 -
+2 -1
apps/codecs/libalac/alac.c
··· 1139 1139 return outputsamples; 1140 1140 } 1141 1141 1142 + /* rockbox: not used 1142 1143 void create_alac(int samplesize, int numchannels, alac_file* alac) 1143 1144 { 1144 1145 alac->samplesize = samplesize; 1145 1146 alac->numchannels = numchannels; 1146 1147 alac->bytespersample = (samplesize / 8) * numchannels; 1147 - } 1148 + } */
+7 -2
apps/codecs/libalac/decomp.h
··· 17 17 unsigned char *input_buffer; 18 18 int input_buffer_bitaccumulator; /* used so we can do arbitary 19 19 bit reads */ 20 + 21 + /* rockbox: not used 20 22 int samplesize; 21 23 int numchannels; 22 - int bytespersample; 24 + int bytespersample; */ 25 + 23 26 int bytes_consumed; 24 27 25 28 /* stuff from setinfo */ ··· 37 40 /* end setinfo stuff */ 38 41 } alac_file; 39 42 43 + /* rockbox: not used 40 44 void create_alac(int samplesize, int numchannels, alac_file* alac) 41 - ICODE_ATTR_ALAC; 45 + ICODE_ATTR_ALAC; */ 46 + 42 47 int alac_decode_frame(alac_file *alac, 43 48 unsigned char *inbuffer, 44 49 int32_t outputbuffer[ALAC_MAX_CHANNELS][ALAC_BLOCKSIZE],
-11
apps/codecs/libatrac/Makefile.test
··· 1 - CFLAGS = -Wall -O3 -I../lib -DTEST -D"DEBUGF=printf" -D"ROCKBOX_LITTLE_ENDIAN=1" -D"ICONST_ATTR=" -D"ICODE_ATTR=" -D"IBSS_ATTR=" 2 - OBJS = atrac3.o ../lib/ffmpeg_bitstream.o ../librm/rm.o fixp_math.o ../lib/mdct2.o ../lib/mdct_lookup.o main.o 3 - 4 - atractest: $(OBJS) 5 - gcc -o atractest $(OBJS) 6 - 7 - .c.o : 8 - $(CC) $(CFLAGS) -c -o $@ $< 9 - 10 - clean: 11 - rm -f atractest $(OBJS) *~ output.wav
-168
apps/codecs/libatrac/main.c
··· 1 - #include <stdio.h> 2 - #include <stdint.h> 3 - #include <inttypes.h> 4 - #include <sys/stat.h> 5 - #include <fcntl.h> 6 - #include <unistd.h> 7 - #include <string.h> 8 - 9 - #include "atrac3.h" 10 - #include "../librm/rm.h" 11 - 12 - ATRAC3Context q IBSS_ATTR; 13 - 14 - static unsigned char wav_header[44]={ 15 - 'R','I','F','F',// 0 - ChunkID 16 - 0,0,0,0, // 4 - ChunkSize (filesize-8) 17 - 'W','A','V','E',// 8 - Format 18 - 'f','m','t',' ',// 12 - SubChunkID 19 - 16,0,0,0, // 16 - SubChunk1ID // 16 for PCM 20 - 1,0, // 20 - AudioFormat (1=Uncompressed) 21 - 2,0, // 22 - NumChannels 22 - 0,0,0,0, // 24 - SampleRate in Hz 23 - 0,0,0,0, // 28 - Byte Rate (SampleRate*NumChannels*(BitsPerSample/8) 24 - 4,0, // 32 - BlockAlign (== NumChannels * BitsPerSample/8) 25 - 16,0, // 34 - BitsPerSample 26 - 'd','a','t','a',// 36 - Subchunk2ID 27 - 0,0,0,0 // 40 - Subchunk2Size 28 - }; 29 - 30 - int open_wav(char* filename) { 31 - int fd,res; 32 - 33 - fd=open(filename,O_CREAT|O_WRONLY|O_TRUNC,S_IRUSR|S_IWUSR); 34 - if (fd >= 0) { 35 - res = write(fd,wav_header,sizeof(wav_header)); 36 - } 37 - 38 - return(fd); 39 - } 40 - 41 - void close_wav(int fd, RMContext *rmctx, ATRAC3Context *q) { 42 - int x,res; 43 - int filesize; 44 - int bytes_per_sample = 2; 45 - int samples_per_frame = q->samples_per_frame; 46 - int nb_channels = rmctx->nb_channels; 47 - int sample_rate = rmctx->sample_rate; 48 - int nb_frames = rmctx->audio_framesize/rmctx->block_align * rmctx->nb_packets - 2; // first 2 frames have no valid audio; skipped in output 49 - 50 - filesize= samples_per_frame*bytes_per_sample*nb_frames +44; 51 - printf("Filesize = %d\n",filesize); 52 - 53 - // ChunkSize 54 - x=filesize-8; 55 - wav_header[4]=(x&0xff); 56 - wav_header[5]=(x&0xff00)>>8; 57 - wav_header[6]=(x&0xff0000)>>16; 58 - wav_header[7]=(x&0xff000000)>>24; 59 - 60 - // Number of channels 61 - wav_header[22]=nb_channels; 62 - 63 - // Samplerate 64 - wav_header[24]=sample_rate&0xff; 65 - wav_header[25]=(sample_rate&0xff00)>>8; 66 - wav_header[26]=(sample_rate&0xff0000)>>16; 67 - wav_header[27]=(sample_rate&0xff000000)>>24; 68 - 69 - // ByteRate 70 - x=sample_rate*bytes_per_sample*nb_channels; 71 - wav_header[28]=(x&0xff); 72 - wav_header[29]=(x&0xff00)>>8; 73 - wav_header[30]=(x&0xff0000)>>16; 74 - wav_header[31]=(x&0xff000000)>>24; 75 - 76 - // BlockAlign 77 - wav_header[32]=rmctx->block_align;//2*rmctx->nb_channels; 78 - 79 - // Bits per sample 80 - wav_header[34]=16; 81 - 82 - // Subchunk2Size 83 - x=filesize-44; 84 - wav_header[40]=(x&0xff); 85 - wav_header[41]=(x&0xff00)>>8; 86 - wav_header[42]=(x&0xff0000)>>16; 87 - wav_header[43]=(x&0xff000000)>>24; 88 - 89 - lseek(fd,0,SEEK_SET); 90 - res = write(fd,wav_header,sizeof(wav_header)); 91 - close(fd); 92 - } 93 - 94 - int main(int argc, char *argv[]) 95 - { 96 - int fd, fd_dec; 97 - int res, i, datasize = 0; 98 - 99 - #ifdef DUMP_RAW_FRAMES 100 - char filename[15]; 101 - int fd_out; 102 - #endif 103 - int16_t outbuf[2048]; 104 - uint16_t fs,sps,h; 105 - uint32_t packet_count; 106 - RMContext rmctx; 107 - RMPacket pkt; 108 - 109 - memset(&q,0,sizeof(ATRAC3Context)); 110 - memset(&rmctx,0,sizeof(RMContext)); 111 - memset(&pkt,0,sizeof(RMPacket)); 112 - 113 - if (argc != 2) { 114 - DEBUGF("Incorrect number of arguments\n"); 115 - return -1; 116 - } 117 - 118 - fd = open(argv[1],O_RDONLY); 119 - if (fd < 0) { 120 - DEBUGF("Error opening file %s\n", argv[1]); 121 - return -1; 122 - } 123 - 124 - /* copy the input rm file to a memory buffer */ 125 - uint8_t * filebuf = (uint8_t *)calloc((int)filesize(fd),sizeof(uint8_t)); 126 - res = read(fd,filebuf,filesize(fd)); 127 - 128 - fd_dec = open_wav("output.wav"); 129 - if (fd_dec < 0) { 130 - DEBUGF("Error creating output file\n"); 131 - return -1; 132 - } 133 - res = real_parse_header(fd, &rmctx); 134 - packet_count = rmctx.nb_packets; 135 - rmctx.audio_framesize = rmctx.block_align; 136 - rmctx.block_align = rmctx.sub_packet_size; 137 - fs = rmctx.audio_framesize; 138 - sps= rmctx.block_align; 139 - h = rmctx.sub_packet_h; 140 - atrac3_decode_init(&q,&rmctx); 141 - 142 - /* change the buffer pointer to point at the first audio frame */ 143 - advance_buffer(&filebuf, rmctx.data_offset + DATA_HEADER_SIZE); 144 - while(packet_count) 145 - { 146 - rm_get_packet(&filebuf, &rmctx, &pkt); 147 - for(i = 0; i < rmctx.audio_pkt_cnt*(fs/sps) ; i++) 148 - { 149 - /* output raw audio frames that are sent to the decoder into separate files */ 150 - #ifdef DUMP_RAW_FRAMES 151 - snprintf(filename,sizeof(filename),"dump%d.raw",++x); 152 - fd_out = open(filename,O_WRONLY|O_CREAT|O_APPEND, 0666); 153 - write(fd_out,pkt.frames[i],sps); 154 - close(fd_out); 155 - #endif 156 - if(pkt.length > 0) 157 - res = atrac3_decode_frame(&rmctx,&q, outbuf, &datasize, pkt.frames[i] , rmctx.block_align); 158 - rmctx.frame_number++; 159 - res = write(fd_dec,outbuf,datasize); 160 - } 161 - packet_count -= rmctx.audio_pkt_cnt; 162 - rmctx.audio_pkt_cnt = 0; 163 - } 164 - close_wav(fd_dec, &rmctx, &q); 165 - close(fd); 166 - 167 - return 0; 168 - }
-10
apps/codecs/libcook/Makefile.test
··· 1 - CFLAGS = -Wall -O3 -I../lib -DTEST -D"DEBUGF=printf" -D"ROCKBOX_LITTLE_ENDIAN=1" -D"ICONST_ATTR=" -D"ICODE_ATTR=" 2 - OBJS = main.o ../lib/ffmpeg_bitstream.o cook.o ../librm/rm.o ../lib/mdct2.o ../lib/mdct_lookup.o 3 - cooktest: $(OBJS) 4 - gcc -o cooktest $(OBJS) 5 - 6 - .c.o : 7 - $(CC) $(CFLAGS) -c -o $@ $< 8 - 9 - clean: 10 - rm -f cooktest $(OBJS) *~ output.wav
-190
apps/codecs/libcook/main.c
··· 1 - /*************************************************************************** 2 - * __________ __ ___. 3 - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 - * \/ \/ \/ \/ \/ 8 - * $Id$ 9 - * 10 - * Copyright (C) 2009 Mohamed Tarek 11 - * 12 - * This program is free software; you can redistribute it and/or 13 - * modify it under the terms of the GNU General Public License 14 - * as published by the Free Software Foundation; either version 2 15 - * of the License, or (at your option) any later version. 16 - * 17 - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 - * KIND, either express or implied. 19 - * 20 - ****************************************************************************/ 21 - #include <stdint.h> 22 - #include <inttypes.h> 23 - #include <sys/stat.h> 24 - #include <fcntl.h> 25 - #include <unistd.h> 26 - #include <string.h> 27 - 28 - #include "../librm/rm.h" 29 - #include "cook.h" 30 - 31 - //#define DUMP_RAW_FRAMES 32 - 33 - #define DATA_HEADER_SIZE 18 /* size of DATA chunk header in a rm file */ 34 - static unsigned char wav_header[44]={ 35 - 'R','I','F','F',// 0 - ChunkID 36 - 0,0,0,0, // 4 - ChunkSize (filesize-8) 37 - 'W','A','V','E',// 8 - Format 38 - 'f','m','t',' ',// 12 - SubChunkID 39 - 16,0,0,0, // 16 - SubChunk1ID // 16 for PCM 40 - 1,0, // 20 - AudioFormat (1=Uncompressed) 41 - 2,0, // 22 - NumChannels 42 - 0,0,0,0, // 24 - SampleRate in Hz 43 - 0,0,0,0, // 28 - Byte Rate (SampleRate*NumChannels*(BitsPerSample/8) 44 - 4,0, // 32 - BlockAlign (== NumChannels * BitsPerSample/8) 45 - 16,0, // 34 - BitsPerSample 46 - 'd','a','t','a',// 36 - Subchunk2ID 47 - 0,0,0,0 // 40 - Subchunk2Size 48 - }; 49 - 50 - int open_wav(char* filename) { 51 - int fd,res; 52 - 53 - fd=open(filename,O_CREAT|O_WRONLY|O_TRUNC,S_IRUSR|S_IWUSR); 54 - if (fd >= 0) { 55 - res = write(fd,wav_header,sizeof(wav_header)); 56 - } 57 - 58 - return(fd); 59 - } 60 - 61 - void close_wav(int fd, RMContext *rmctx, COOKContext *q) { 62 - int x,res; 63 - int filesize; 64 - int bytes_per_sample = 2; 65 - int samples_per_frame = q->samples_per_frame; 66 - int nb_channels = rmctx->nb_channels; 67 - int sample_rate = rmctx->sample_rate; 68 - int nb_frames = rmctx->audio_framesize/rmctx->block_align * rmctx->nb_packets - 2; // first 2 frames have no valid audio; skipped in output 69 - 70 - filesize= samples_per_frame*bytes_per_sample*nb_frames +44; 71 - printf("Filesize = %d\n",filesize); 72 - 73 - // ChunkSize 74 - x=filesize-8; 75 - wav_header[4]=(x&0xff); 76 - wav_header[5]=(x&0xff00)>>8; 77 - wav_header[6]=(x&0xff0000)>>16; 78 - wav_header[7]=(x&0xff000000)>>24; 79 - 80 - // Number of channels 81 - wav_header[22]=nb_channels; 82 - 83 - // Samplerate 84 - wav_header[24]=sample_rate&0xff; 85 - wav_header[25]=(sample_rate&0xff00)>>8; 86 - wav_header[26]=(sample_rate&0xff0000)>>16; 87 - wav_header[27]=(sample_rate&0xff000000)>>24; 88 - 89 - // ByteRate 90 - x=sample_rate*bytes_per_sample*nb_channels; 91 - wav_header[28]=(x&0xff); 92 - wav_header[29]=(x&0xff00)>>8; 93 - wav_header[30]=(x&0xff0000)>>16; 94 - wav_header[31]=(x&0xff000000)>>24; 95 - 96 - // BlockAlign 97 - wav_header[32]=rmctx->block_align;//2*rmctx->nb_channels; 98 - 99 - // Bits per sample 100 - wav_header[34]=16; 101 - 102 - // Subchunk2Size 103 - x=filesize-44; 104 - wav_header[40]=(x&0xff); 105 - wav_header[41]=(x&0xff00)>>8; 106 - wav_header[42]=(x&0xff0000)>>16; 107 - wav_header[43]=(x&0xff000000)>>24; 108 - 109 - lseek(fd,0,SEEK_SET); 110 - res = write(fd,wav_header,sizeof(wav_header)); 111 - close(fd); 112 - } 113 - 114 - int main(int argc, char *argv[]) 115 - { 116 - int fd, fd_dec; 117 - int res, datasize,i; 118 - int nb_frames = 0; 119 - #ifdef DUMP_RAW_FRAMES 120 - char filename[15]; 121 - int fd_out; 122 - #endif 123 - int32_t outbuf[2048]; 124 - uint16_t fs,sps,h; 125 - uint32_t packet_count; 126 - COOKContext q; 127 - RMContext rmctx; 128 - RMPacket pkt; 129 - 130 - memset(&q,0,sizeof(COOKContext)); 131 - memset(&rmctx,0,sizeof(RMContext)); 132 - memset(&pkt,0,sizeof(RMPacket)); 133 - 134 - if (argc != 2) { 135 - DEBUGF("Incorrect number of arguments\n"); 136 - return -1; 137 - } 138 - 139 - fd = open(argv[1],O_RDONLY); 140 - if (fd < 0) { 141 - DEBUGF("Error opening file %s\n", argv[1]); 142 - return -1; 143 - } 144 - 145 - /* copy the input rm file to a memory buffer */ 146 - uint8_t * filebuf = (uint8_t *)calloc((int)filesize(fd),sizeof(uint8_t)); 147 - res = read(fd,filebuf,filesize(fd)); 148 - 149 - fd_dec = open_wav("output.wav"); 150 - if (fd_dec < 0) { 151 - DEBUGF("Error creating output file\n"); 152 - return -1; 153 - } 154 - res = real_parse_header(fd, &rmctx); 155 - packet_count = rmctx.nb_packets; 156 - rmctx.audio_framesize = rmctx.block_align; 157 - rmctx.block_align = rmctx.sub_packet_size; 158 - fs = rmctx.audio_framesize; 159 - sps= rmctx.block_align; 160 - h = rmctx.sub_packet_h; 161 - cook_decode_init(&rmctx,&q); 162 - 163 - /* change the buffer pointer to point at the first audio frame */ 164 - advance_buffer(&filebuf, rmctx.data_offset+ DATA_HEADER_SIZE); 165 - while(packet_count) 166 - { 167 - rm_get_packet(&filebuf, &rmctx, &pkt); 168 - //DEBUGF("total frames = %d packet count = %d output counter = %d \n",rmctx.audio_pkt_cnt*(fs/sps), packet_count,rmctx.audio_pkt_cnt); 169 - for(i = 0; i < rmctx.audio_pkt_cnt*(fs/sps) ; i++) 170 - { 171 - /* output raw audio frames that are sent to the decoder into separate files */ 172 - #ifdef DUMP_RAW_FRAMES 173 - snprintf(filename,sizeof(filename),"dump%d.raw",++x); 174 - fd_out = open(filename,O_WRONLY|O_CREAT|O_APPEND, 0666); 175 - write(fd_out,pkt.frames[i],sps); 176 - close(fd_out); 177 - #endif 178 - nb_frames = cook_decode_frame(&rmctx,&q, outbuf, &datasize, pkt.frames[i] , rmctx.block_align); 179 - rmctx.frame_number++; 180 - res = write(fd_dec,outbuf,datasize); 181 - } 182 - packet_count -= rmctx.audio_pkt_cnt; 183 - rmctx.audio_pkt_cnt = 0; 184 - } 185 - close_wav(fd_dec, &rmctx, &q); 186 - close(fd); 187 - 188 - 189 - return 0; 190 - }
+3
apps/codecs/libfaad/decoder.c
··· 88 88 return err_msg[errcode]; 89 89 } 90 90 91 + /* rockbox: not used */ 92 + #if 0 91 93 uint32_t NEAACDECAPI NeAACDecGetCapabilities(void) 92 94 { 93 95 uint32_t cap = 0; ··· 113 115 114 116 return cap; 115 117 } 118 + #endif 116 119 117 120 NeAACDecHandle NEAACDECAPI NeAACDecOpen(void) 118 121 {
+2 -1
apps/codecs/libfaad/mp4.c
··· 119 119 }; 120 120 121 121 /* Table 1.6.1 */ 122 + /* rockbox: not used 122 123 int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer, 123 124 uint32_t buffer_size, 124 125 mp4AudioSpecificConfig *mp4ASC) 125 126 { 126 127 return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL); 127 - } 128 + }*/ 128 129 129 130 int8_t AudioSpecificConfig2(uint8_t *pBuffer, 130 131 uint32_t buffer_size,
+2
apps/codecs/libfaad/mp4.h
··· 34 34 35 35 #include "decoder.h" 36 36 37 + /* rockbox: not used 37 38 int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer, 38 39 uint32_t buffer_size, 39 40 mp4AudioSpecificConfig *mp4ASC); 41 + */ 40 42 41 43 int8_t AudioSpecificConfig2(uint8_t *pBuffer, 42 44 uint32_t buffer_size,
+6
apps/codecs/libfaad/tns.c
··· 37 37 uint8_t *coef, real_t *a); 38 38 static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, 39 39 int8_t order); 40 + #ifdef LTP_DEC 40 41 static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, 41 42 int8_t order); 43 + #endif 42 44 43 45 44 46 #ifdef _MSC_VER ··· 129 131 } 130 132 } 131 133 134 + #ifdef LTP_DEC 132 135 /* TNS encoding for one channel and frame */ 133 136 void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, 134 137 uint8_t object_type, real_t *spec, uint16_t frame_len) ··· 182 185 } 183 186 } 184 187 } 188 + #endif 185 189 186 190 /* Decoder transmitted coefficients for one TNS filter */ 187 191 static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, ··· 268 272 } 269 273 } 270 274 275 + #ifdef LTP_DEC 271 276 static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, 272 277 int8_t order) 273 278 { ··· 304 309 spectrum += inc; 305 310 } 306 311 } 312 + #endif
-21
apps/codecs/libffmpegFLAC/Makefile.test
··· 1 - # Simple Makefile for standalone testing of decoder 2 - 3 - OBJS=main.o decoder.o bitstream.o tables.o 4 - CFLAGS=-O2 -Wall -DBUILD_STANDALONE 5 - CC=gcc 6 - 7 - # Uncomment the next line to build on a big-endian target: 8 - 9 - #CFLAGS += -DBUILD_BIGENDIAN 10 - 11 - all: test 12 - 13 - main.o: main.c decoder.h 14 - decoder.o: decoder.c bitstream.h golomb.h decoder.h 15 - bitstream.o: bitstream.c 16 - 17 - test: $(OBJS) 18 - gcc -o test $(OBJS) 19 - 20 - clean: 21 - rm -f test $(OBJS) *~
-322
apps/codecs/libffmpegFLAC/main.c
··· 1 - /*************************************************************************** 2 - * __________ __ ___. 3 - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 - * \/ \/ \/ \/ \/ 8 - * $Id$ 9 - * 10 - * Copyright (C) 2005 Dave Chapman 11 - * 12 - * This program is free software; you can redistribute it and/or 13 - * modify it under the terms of the GNU General Public License 14 - * as published by the Free Software Foundation; either version 2 15 - * of the License, or (at your option) any later version. 16 - * 17 - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 - * KIND, either express or implied. 19 - * 20 - ****************************************************************************/ 21 - 22 - /* A test program for the Rockbox version of the ffmpeg FLAC decoder. 23 - 24 - Compile using Makefile.test - run it as "./test file.flac" to decode the 25 - FLAC file to the file "test.wav" in the current directory 26 - 27 - This test program should support 16-bit and 24-bit mono and stereo files. 28 - 29 - The resulting "test.wav" should have the same md5sum as a WAV file created 30 - by the official FLAC decoder (it produces the same 44-byte canonical WAV 31 - header. 32 - */ 33 - 34 - #include <stdio.h> 35 - #include <string.h> 36 - #include <stdlib.h> 37 - #include <inttypes.h> 38 - #include <stdbool.h> 39 - #include <fcntl.h> 40 - #include <unistd.h> 41 - #include <sys/types.h> 42 - #include <sys/stat.h> 43 - 44 - #include "decoder.h" 45 - 46 - static unsigned char wav_header[44]={ 47 - 'R','I','F','F',// 0 - ChunkID 48 - 0,0,0,0, // 4 - ChunkSize (filesize-8) 49 - 'W','A','V','E',// 8 - Format 50 - 'f','m','t',' ',// 12 - SubChunkID 51 - 16,0,0,0, // 16 - SubChunk1ID // 16 for PCM 52 - 1,0, // 20 - AudioFormat (1=Uncompressed) 53 - 2,0, // 22 - NumChannels 54 - 0,0,0,0, // 24 - SampleRate in Hz 55 - 0,0,0,0, // 28 - Byte Rate (SampleRate*NumChannels*(BitsPerSample/8) 56 - 4,0, // 32 - BlockAlign (== NumChannels * BitsPerSample/8) 57 - 16,0, // 34 - BitsPerSample 58 - 'd','a','t','a',// 36 - Subchunk2ID 59 - 0,0,0,0 // 40 - Subchunk2Size 60 - }; 61 - 62 - int open_wav(char* filename) { 63 - int fd; 64 - 65 - fd=open(filename,O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR); 66 - if (fd >= 0) { 67 - if (write(fd,wav_header,sizeof(wav_header)) < sizeof(wav_header)) { 68 - fprintf(stderr,"[ERR} Failed to write wav header\n"); 69 - exit(1); 70 - } 71 - } 72 - return(fd); 73 - } 74 - 75 - void close_wav(int fd, FLACContext* fc) { 76 - int x; 77 - int filesize; 78 - int bytespersample; 79 - 80 - bytespersample=fc->bps/8; 81 - 82 - filesize=fc->totalsamples*bytespersample*fc->channels+44; 83 - 84 - // ChunkSize 85 - x=filesize-8; 86 - wav_header[4]=(x&0xff); 87 - wav_header[5]=(x&0xff00)>>8; 88 - wav_header[6]=(x&0xff0000)>>16; 89 - wav_header[7]=(x&0xff000000)>>24; 90 - 91 - // Number of channels 92 - wav_header[22]=fc->channels; 93 - 94 - // Samplerate 95 - wav_header[24]=fc->samplerate&0xff; 96 - wav_header[25]=(fc->samplerate&0xff00)>>8; 97 - wav_header[26]=(fc->samplerate&0xff0000)>>16; 98 - wav_header[27]=(fc->samplerate&0xff000000)>>24; 99 - 100 - // ByteRate 101 - x=fc->samplerate*(fc->bps/8)*fc->channels; 102 - wav_header[28]=(x&0xff); 103 - wav_header[29]=(x&0xff00)>>8; 104 - wav_header[30]=(x&0xff0000)>>16; 105 - wav_header[31]=(x&0xff000000)>>24; 106 - 107 - // BlockAlign 108 - wav_header[32]=(fc->bps/8)*fc->channels; 109 - 110 - // Bits per sample 111 - wav_header[34]=fc->bps; 112 - 113 - // Subchunk2Size 114 - x=filesize-44; 115 - wav_header[40]=(x&0xff); 116 - wav_header[41]=(x&0xff00)>>8; 117 - wav_header[42]=(x&0xff0000)>>16; 118 - wav_header[43]=(x&0xff000000)>>24; 119 - 120 - lseek(fd,0,SEEK_SET); 121 - if (write(fd,wav_header,sizeof(wav_header)) < sizeof(wav_header)) { 122 - fprintf(stderr,"[ERR} Failed to write wav header\n"); 123 - exit(1); 124 - } 125 - close(fd); 126 - } 127 - 128 - static void dump_headers(FLACContext *s) 129 - { 130 - fprintf(stderr," Blocksize: %d .. %d\n", s->min_blocksize, 131 - s->max_blocksize); 132 - fprintf(stderr," Framesize: %d .. %d\n", s->min_framesize, 133 - s->max_framesize); 134 - fprintf(stderr," Samplerate: %d\n", s->samplerate); 135 - fprintf(stderr," Channels: %d\n", s->channels); 136 - fprintf(stderr," Bits per sample: %d\n", s->bps); 137 - fprintf(stderr," Metadata length: %d\n", s->metadatalength); 138 - fprintf(stderr," Total Samples: %lu\n",s->totalsamples); 139 - fprintf(stderr," Duration: %d ms\n",s->length); 140 - fprintf(stderr," Bitrate: %d kbps\n",s->bitrate); 141 - } 142 - 143 - static bool flac_init(int fd, FLACContext* fc) 144 - { 145 - unsigned char buf[255]; 146 - struct stat statbuf; 147 - bool found_streaminfo=false; 148 - int endofmetadata=0; 149 - int blocklength; 150 - uint32_t* p; 151 - uint32_t seekpoint_lo,seekpoint_hi; 152 - uint32_t offset_lo,offset_hi; 153 - int n; 154 - 155 - if (lseek(fd, 0, SEEK_SET) < 0) 156 - { 157 - return false; 158 - } 159 - 160 - if (read(fd, buf, 4) < 4) 161 - { 162 - return false; 163 - } 164 - 165 - if (memcmp(buf,"fLaC",4) != 0) 166 - { 167 - return false; 168 - } 169 - fc->metadatalength = 4; 170 - 171 - while (!endofmetadata) { 172 - if (read(fd, buf, 4) < 4) 173 - { 174 - return false; 175 - } 176 - 177 - endofmetadata=(buf[0]&0x80); 178 - blocklength = (buf[1] << 16) | (buf[2] << 8) | buf[3]; 179 - fc->metadatalength+=blocklength+4; 180 - 181 - if ((buf[0] & 0x7f) == 0) /* 0 is the STREAMINFO block */ 182 - { 183 - /* FIXME: Don't trust the value of blocklength */ 184 - if (read(fd, buf, blocklength) < 0) 185 - { 186 - return false; 187 - } 188 - 189 - fstat(fd,&statbuf); 190 - fc->filesize = statbuf.st_size; 191 - fc->min_blocksize = (buf[0] << 8) | buf[1]; 192 - fc->max_blocksize = (buf[2] << 8) | buf[3]; 193 - fc->min_framesize = (buf[4] << 16) | (buf[5] << 8) | buf[6]; 194 - fc->max_framesize = (buf[7] << 16) | (buf[8] << 8) | buf[9]; 195 - fc->samplerate = (buf[10] << 12) | (buf[11] << 4) 196 - | ((buf[12] & 0xf0) >> 4); 197 - fc->channels = ((buf[12]&0x0e)>>1) + 1; 198 - fc->bps = (((buf[12]&0x01) << 4) | ((buf[13]&0xf0)>>4) ) + 1; 199 - 200 - /* totalsamples is a 36-bit field, but we assume <= 32 bits are 201 - used */ 202 - fc->totalsamples = (buf[14] << 24) | (buf[15] << 16) 203 - | (buf[16] << 8) | buf[17]; 204 - 205 - /* Calculate track length (in ms) and estimate the bitrate 206 - (in kbit/s) */ 207 - fc->length = (fc->totalsamples / fc->samplerate) * 1000; 208 - 209 - found_streaminfo=true; 210 - } else if ((buf[0] & 0x7f) == 3) { /* 3 is the SEEKTABLE block */ 211 - fprintf(stderr,"Seektable length = %d bytes\n",blocklength); 212 - while (blocklength >= 18) { 213 - n=read(fd,buf,18); 214 - if (n < 18) return false; 215 - blocklength-=n; 216 - 217 - p=(uint32_t*)buf; 218 - seekpoint_hi=betoh32(*(p++)); 219 - seekpoint_lo=betoh32(*(p++)); 220 - offset_hi=betoh32(*(p++)); 221 - offset_lo=betoh32(*(p++)); 222 - 223 - if ((seekpoint_hi != 0xffffffff) && (seekpoint_lo != 0xffffffff)) { 224 - fprintf(stderr,"Seekpoint: %u, Offset=%u\n",seekpoint_lo,offset_lo); 225 - } 226 - } 227 - lseek(fd, blocklength, SEEK_CUR); 228 - } else { 229 - /* Skip to next metadata block */ 230 - if (lseek(fd, blocklength, SEEK_CUR) < 0) 231 - { 232 - return false; 233 - } 234 - } 235 - } 236 - 237 - if (found_streaminfo) { 238 - fc->bitrate = ((fc->filesize-fc->metadatalength) * 8) / fc->length; 239 - return true; 240 - } else { 241 - return false; 242 - } 243 - } 244 - 245 - /* Dummy function needed to pass to flac_decode_frame() */ 246 - void yield() { 247 - } 248 - 249 - int main(int argc, char* argv[]) { 250 - FLACContext fc; 251 - int fd,fdout; 252 - int n; 253 - int i; 254 - int bytesleft; 255 - int consumed; 256 - unsigned char buf[MAX_FRAMESIZE]; /* The input buffer */ 257 - /* The output buffers containing the decoded samples (channels 0 and 1) */ 258 - int32_t decoded0[MAX_BLOCKSIZE]; 259 - int32_t decoded1[MAX_BLOCKSIZE]; 260 - 261 - /* For testing */ 262 - int8_t wavbuf[MAX_CHANNELS*MAX_BLOCKSIZE*3]; 263 - int8_t* p; 264 - int scale; 265 - 266 - fd=open(argv[1],O_RDONLY); 267 - 268 - if (fd < 0) { 269 - fprintf(stderr,"Can not parse %s\n",argv[1]); 270 - return(1); 271 - } 272 - 273 - /* Read the metadata and position the file pointer at the start of the 274 - first audio frame */ 275 - flac_init(fd,&fc); 276 - 277 - dump_headers(&fc); 278 - 279 - fdout=open_wav("test.wav"); 280 - bytesleft=read(fd,buf,sizeof(buf)); 281 - while (bytesleft) { 282 - if(flac_decode_frame(&fc,decoded0,decoded1,buf,bytesleft,yield) < 0) { 283 - fprintf(stderr,"DECODE ERROR, ABORTING\n"); 284 - break; 285 - } 286 - consumed=fc.gb.index/8; 287 - 288 - scale=FLAC_OUTPUT_DEPTH-fc.bps; 289 - p=wavbuf; 290 - for (i=0;i<fc.blocksize;i++) { 291 - /* Left sample */ 292 - decoded0[i]=decoded0[i]>>scale; 293 - *(p++)=decoded0[i]&0xff; 294 - *(p++)=(decoded0[i]&0xff00)>>8; 295 - if (fc.bps==24) *(p++)=(decoded0[i]&0xff0000)>>16; 296 - 297 - if (fc.channels==2) { 298 - /* Right sample */ 299 - decoded1[i]=decoded1[i]>>scale; 300 - *(p++)=decoded1[i]&0xff; 301 - *(p++)=(decoded1[i]&0xff00)>>8; 302 - if (fc.bps==24) *(p++)=(decoded1[i]&0xff0000)>>16; 303 - } 304 - } 305 - n = fc.blocksize*fc.channels*(fc.bps/8); 306 - if (write(fdout,wavbuf,n) < n) { 307 - fprintf(stderr,"[ERR] Write failed\n"); 308 - exit(1); 309 - } 310 - 311 - memmove(buf,&buf[consumed],bytesleft-consumed); 312 - bytesleft-=consumed; 313 - 314 - n=read(fd,&buf[bytesleft],sizeof(buf)-bytesleft); 315 - if (n > 0) { 316 - bytesleft+=n; 317 - } 318 - } 319 - close_wav(fdout,&fc); 320 - close(fd); 321 - return(0); 322 - }
-17
apps/codecs/libm4a/m4a.c
··· 67 67 return v; 68 68 } 69 69 70 - int16_t stream_read_int16(stream_t *stream) 71 - { 72 - int16_t v; 73 - stream_read(stream, 2, &v); 74 - #ifdef ROCKBOX_LITTLE_ENDIAN 75 - _Swap16(v); 76 - #endif 77 - return v; 78 - } 79 - 80 70 uint16_t stream_read_uint16(stream_t *stream) 81 71 { 82 72 uint16_t v; ··· 84 74 #ifdef ROCKBOX_LITTLE_ENDIAN 85 75 _Swap16(v); 86 76 #endif 87 - return v; 88 - } 89 - 90 - int8_t stream_read_int8(stream_t *stream) 91 - { 92 - int8_t v; 93 - stream_read(stream, 1, &v); 94 77 return v; 95 78 } 96 79
-2
apps/codecs/libm4a/m4a.h
··· 117 117 int32_t stream_read_int32(stream_t *stream); 118 118 uint32_t stream_read_uint32(stream_t *stream); 119 119 120 - int16_t stream_read_int16(stream_t *stream); 121 120 uint16_t stream_read_uint16(stream_t *stream); 122 121 123 - int8_t stream_read_int8(stream_t *stream); 124 122 uint8_t stream_read_uint8(stream_t *stream); 125 123 126 124 void stream_skip(stream_t *stream, size_t skip);
+1 -1
apps/codecs/libspeex/bits.c
··· 45 45 #define MAX_CHARS_PER_FRAME (2000/BYTES_PER_CHAR) 46 46 #endif 47 47 48 - #ifndef ROCKBOX_VOICE_CODEC 48 + #ifdef ROCKBOX_VOICE_ENCODER 49 49 void speex_bits_init(SpeexBits *bits) 50 50 { 51 51 bits->chars = (char*)speex_alloc(MAX_CHARS_PER_FRAME);
-20
apps/codecs/libtremor/asm_arm.h
··· 216 216 #endif 217 217 218 218 #endif 219 - /* not used anymore */ 220 - /* 221 - #ifndef _V_CLIP_MATH 222 - #define _V_CLIP_MATH 223 - 224 - static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) { 225 - int tmp; 226 - asm volatile("subs %1, %0, #32768\n\t" 227 - "movpl %0, #0x7f00\n\t" 228 - "orrpl %0, %0, #0xff\n" 229 - "adds %1, %0, #32768\n\t" 230 - "movmi %0, #0x8000" 231 - : "+r"(x),"=r"(tmp) 232 - : 233 - : "cc"); 234 - return(x); 235 - } 236 - 237 - #endif 238 - */ 239 219 240 220 #ifndef _V_LSP_MATH_ASM 241 221 #define _V_LSP_MATH_ASM
-12
apps/codecs/libtremor/asm_mcf5249.h
··· 250 250 #endif 251 251 252 252 #endif 253 - /* not used anymore */ 254 - /* 255 - #ifndef _V_CLIP_MATH 256 - #define _V_CLIP_MATH 257 - 258 - static inline ogg_int32_t CLIP_TO_15(register ogg_int32_t x) { 259 - register ogg_int32_t hi=32767, lo=-32768; 260 - return (x>=hi ? hi : (x<=lo ? lo : x)); 261 - } 262 - 263 - #endif 264 - */ 265 253 #endif
-14
apps/codecs/libtremor/misc.h
··· 203 203 #endif 204 204 205 205 #endif 206 - /* not used anymore */ 207 - /* 208 - #ifndef _V_CLIP_MATH 209 - #define _V_CLIP_MATH 210 - 211 - static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) { 212 - int ret=x; 213 - ret-= ((x<=32767)-1)&(x-32767); 214 - ret-= ((x>=-32768)-1)&(x+32768); 215 - return(ret); 216 - } 217 - 218 - #endif 219 - */ 220 206 221 207 static inline ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap, 222 208 ogg_int32_t b,ogg_int32_t bp,
+2 -1
apps/codecs/libtta/ttadec.c
··· 227 227 228 228 /************************* decoder functions ****************************/ 229 229 230 + /* rockbox: not used 230 231 const char *get_error_str (int error) { 231 232 switch (error) { 232 233 case NO_ERROR: return "No errors found"; ··· 237 238 case MEMORY_ERROR: return "Insufficient memory available"; 238 239 default: return "Unknown error code"; 239 240 } 240 - } 241 + } */ 241 242 242 243 int set_tta_info (tta_info *info) 243 244 {
+2
apps/codecs/raac.c
··· 24 24 #include "libfaad/common.h" 25 25 #include "libfaad/structs.h" 26 26 #include "libfaad/decoder.h" 27 + /* rockbox: not used 27 28 #include "libfaad/output.h" 29 + */ 28 30 29 31 CODEC_HEADER 30 32