545 files changed, 230976 insertions, 0 deletions
diff --git a/audio_codec/libcook/assembly.h b/audio_codec/libcook/assembly.h new file mode 100644 index 0000000..aceb886 --- a/dev/null +++ b/audio_codec/libcook/assembly.h @@ -0,0 +1,119 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Source last modified: $Id: assembly.h,v 1.13 2005/04/27 19:20:50 hubbe Exp $ + * + * REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM + * Portions Copyright (c) 1995-2002 RealNetworks, Inc. + * All Rights Reserved. + * + * The contents of this file, and the files included with this file, + * are subject to the current version of the Real Format Source Code + * Porting and Optimization License, available at + * https://helixcommunity.org/2005/license/realformatsource (unless + * RealNetworks otherwise expressly agrees in writing that you are + * subject to a different license). You may also obtain the license + * terms directly from RealNetworks. You may not use this file except + * in compliance with the Real Format Source Code Porting and + * Optimization License. There are no redistribution rights for the + * source code of this file. Please see the Real Format Source Code + * Porting and Optimization License for the rights, obligations and + * limitations governing use of the contents of the file. + * + * RealNetworks is the developer of the Original Code and owns the + * copyrights in the portions it created. + * + * This file, and the files included with this file, is distributed and + * made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL + * SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT + * OR NON-INFRINGEMENT. + * + * Technology Compatibility Kit Test Suite(s) Location: + * https://rarvcode-tck.helixcommunity.org + * + * Contributor(s): + * + * ***** END LICENSE BLOCK ***** */ + +/************************************************************************************** + * Fixed-point RealAudio 8 decoder + * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com) + * October 2003 + * + * assembly.h - inline assembly language functions and prototypes + * + * MULSHIFT32(x, y) signed multiply of two 32-bit integers (x and y), + * returns top 32-bits of 64-bit result + * CLIPTOSHORT(x) convert 32-bit integer to 16-bit short, + * clipping to [-32768, 32767] + * FASTABS(x) branchless absolute value of signed integer x + * CLZ(x) count leading zeros on signed integer x + **************************************************************************************/ + +#ifndef _ASSEMBLY_H +#define _ASSEMBLY_H + +#include "coder.h" + +/* toolchain: ARM gcc + * target architecture: ARM v.4 and above (requires 'M' type processor for 32x32->64 multiplier) + */ + +#if defined(__aarch64__) +static __inline__ int MULSHIFT32(int x, int y) +{ + long c; + c = (long)x * y; + return (int)c; +} +#else +static __inline__ int MULSHIFT32(int x, int y) +{ + int zlow; + __asm__ volatile("smull %0,%1,%2,%3" : "=&r"(zlow), "=r"(y) : "r"(x), "1"(y)); + return y; +} +#endif +static __inline short CLIPTOSHORT(int x) +{ + int sign; + + /* clip to [-32768, 32767] */ + sign = x >> 31; + if (sign != (x >> 15)) { + x = sign ^((1 << 15) - 1); + } + + return (short)x; +} + +static __inline int FASTABS(int x) +{ + int sign; + + sign = x >> (sizeof(int) * 8 - 1); + x ^= sign; + x -= sign; + + return x; +} + +static __inline int CLZ(int x) +{ + int numZeros; + + if (!x) { + return (sizeof(int) * 8); + } + + numZeros = 0; + while (!(x & 0x80000000)) { + numZeros++; + x <<= 1; + } + + return numZeros; +} + + +#endif /* _ASSEMBLY_H */ |