Index: apps/codecs/libatrac/SOURCES =================================================================== --- apps/codecs/libatrac/SOURCES (revision 22519) +++ apps/codecs/libatrac/SOURCES (working copy) @@ -1,2 +1,5 @@ atrac3.c +#if defined(CPU_ARM) +atrac3_arm.S +#endif ../lib/ffmpeg_bitstream.c Index: apps/codecs/libatrac/fixp_math.h =================================================================== --- apps/codecs/libatrac/fixp_math.h (revision 22519) +++ apps/codecs/libatrac/fixp_math.h (working copy) @@ -10,28 +10,78 @@ /* Fixed point math routines for use in atrac3.c */ -static inline int32_t fixmul16(int32_t x, int32_t y) -{ - int64_t temp; - temp = x; - temp *= y; +#if defined(CPU_ARM) + #define fixmul16(X,Y) \ + ({ \ + int32_t low; \ + int32_t high; \ + asm volatile ( /* calculates: result = (X*Y)>>16 */ \ + "smull %0,%1,%2,%3 \n\t" /* 64 = 32x32 multiply */ \ + "mov %0, %0, lsr #16 \n\t" /* %0 = %0 >> 16 */ \ + "orr %0, %0, %1, lsl #16 \n\t"/* result = %0 OR (%1 << 16) */ \ + : "=&r"(low), "=&r" (high) \ + : "r"(X),"r"(Y)); \ + low; \ + }) + + #define fixmul31(X,Y) \ + ({ \ + int32_t low; \ + int32_t high; \ + asm volatile ( /* calculates: result = (X*Y)>>31 */ \ + "smull %0,%1,%2,%3 \n\t" /* 64 = 32x32 multiply */ \ + "mov %0, %0, lsr #31 \n\t" /* %0 = %0 >> 31 */ \ + "orr %0, %0, %1, lsl #1 \n\t" /* result = %0 OR (%1 << 1) */ \ + : "=&r"(low), "=&r" (high) \ + : "r"(X),"r"(Y)); \ + low; \ + }) + + #define fixmul32(X,Y) \ + ({ \ + int32_t low; \ + int32_t high; \ + asm volatile ( /* calculates: result = (X*Y)>>32 */ \ + "smull %0,%1,%2,%3 \n\t" /* 64 = 32x32 multiply */ \ + : "=&r"(low), "=&r" (high) \ + : "r"(X),"r"(Y)); \ + high; \ + }) +#else + static inline int32_t fixmul16(int32_t x, int32_t y) + { + int64_t temp; + temp = x; + temp *= y; + + temp >>= 16; + + return (int32_t)temp; + } + + static inline int32_t fixmul31(int32_t x, int32_t y) + { + int64_t temp; + temp = x; + temp *= y; + + temp >>= 31; //16+31-16 = 31 bits + + return (int32_t)temp; + } + + static inline int32_t fixmul32(int32_t x, int32_t y) + { + int64_t temp; + temp = x; + temp *= y; + + temp >>= 32; //16+31-16 = 31 bits + + return (int32_t)temp; + } +#endif - temp >>= 16; - - return (int32_t)temp; -} - -static inline int32_t fixmul31(int32_t x, int32_t y) -{ - int64_t temp; - temp = x; - temp *= y; - - temp >>= 31; //16+31-16 = 31 bits - - return (int32_t)temp; -} - static inline int32_t fixdiv16(int32_t x, int32_t y) { int64_t temp; Index: apps/codecs/libatrac/atrac3_arm.S =================================================================== --- apps/codecs/libatrac/atrac3_arm.S (revision 0) +++ apps/codecs/libatrac/atrac3_arm.S (revision 0) @@ -0,0 +1,137 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: + * + * Copyright (C) 2009 by Andree Buschmann + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + + .section .text, "ax", %progbits + +/**************************************************************************** + * void atrac3_iqmf_matrixing(int32_t *dest, + * int32_t *inlo, + * int32_t *inhi, + * unsigned int count); + * + * Matrixing step within iqmf of atrac3 synthesis. Reference implementation: + * + * for(i=0; i>31 || hi<<1 */ + mov r12, r12, lsr #31 + orr r9 , r12, r9 , lsl #1 /* s2 = low>>31 || hi<<1 */ + + stmia r0!, {r9, r10} /* store result out[0]=s2, out[1]=s1 */ + sub r1, r1, #184 /* roll back 64 entries = 184 bytes */ + sub r2, r2, #192 /* roll back 48 entries = 192 bytes = win[0] */ + + subs r3, r3, #1 /* outer loop -= 1 */ + bgt .iqmf_dewindow_outer_loop + + ldmfd sp!, {r4-r10, pc} /* restore registers */ + +.atrac3_iqmf_dewindowing_end: + .size atrac3_iqmf_dewindowing,.atrac3_iqmf_dewindowing_end-atrac3_iqmf_dewindowing Property changes on: apps/codecs/libatrac/atrac3_arm.S ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + Author Date Id Revision Index: apps/codecs/libatrac/atrac3.c =================================================================== --- apps/codecs/libatrac/atrac3.c (revision 22519) +++ apps/codecs/libatrac/atrac3.c (working copy) @@ -67,7 +67,83 @@ static int32_t qmf_window[48] IBSS_ATTR; static VLC spectral_coeff_tab[7]; static channel_unit channel_units[2]; + /** + * Matrixing within quadrature mirror synthesis filter. + * + * @param p3 output buffer + * @param inlo lower part of spectrum + * @param inhi higher part of spectrum + * @param nIn size of spectrum buffer + */ + +#if defined(CPU_ARM) + extern void + atrac3_iqmf_matrixing(int32_t *p3, + int32_t *inlo, + int32_t *inhi, + unsigned int nIn); +#else + static inline void + atrac3_iqmf_matrixing(int32_t *p3, + int32_t *inlo, + int32_t *inhi, + unsigned int nIn) + { + for(i=0; i