www.pudn.com > iMagic_2006_0428_v098r23.rar > fixed.h
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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 program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: fixed.h,v 1.18 2004/01/28 19:17:25 menno Exp $
**/
#ifndef __FIXED_H__
#define __FIXED_H__
#ifdef __cplusplus
extern "C" {
#endif
#define COEF_BITS 28
#define COEF_PRECISION (1 << COEF_BITS)
#define REAL_BITS 14 // MAXIMUM OF 14 FOR FIXED POINT SBR
#define REAL_PRECISION (1 << REAL_BITS)
/* FRAC is the fractional only part of the fixed point number [0.0..1.0) */
#define FRAC_SIZE 32 /* frac is a 32 bit integer */
#define FRAC_BITS 31
#define FRAC_PRECISION ((uint32_t)(1 << FRAC_BITS))
#define FRAC_MAX 0x7FFFFFFF
typedef int32_t real_t;
#define REAL_CONST(A) (((A) >= 0) ? ((int32_t)((A)*(REAL_PRECISION)+0.5)) : ((int32_t)((A)*(REAL_PRECISION)-0.5)))
static INLINE int32_t MUL_FX2(int32_t A, int32_t B)
{
int64_t S;
int32_t BX;
BX = B << 16;
S = ((int64_t)A*(int64_t)BX) >> 32; //get hi register
S = S+S;
return (int32_t)S;
}
static INLINE int32_t MUL_FND2(int32_t A, int32_t B)
{
int64_t S;
int32_t BX;
BX = B << 16;
S = ((int64_t)A*(int64_t)BX) >> 32; //get hi register
return (int32_t)S;
}
static INLINE int32_t MLA_FX2(int32_t A, int32_t B, int32_t C)
{
int64_t S;
int32_t BX;
A = A+A;
BX = B << 16;
S = ((int64_t)A*(int64_t)BX) >> 32; //get hi register
S = S+C;
return (int32_t)S;
}
static INLINE int32_t MUL_DND2(int32_t A, int32_t B)
{
int64_t S;
int32_t BX;
A = A+A;
BX = B <<16;
S = ((int64_t)A*(int64_t)BX) >> 32; //get hi register
return (int32_t)S;
}
static INLINE int32_t MAD_FX_MUL2(int32_t A, int32_t B)
{
int64_t S;
int32_t BX;
BX = B << 16;
S = ((int64_t)A*(int64_t)BX) >> 32; //get hi register
S = S+S;
return (int32_t)S;
}
#ifdef __cplusplus
}
#endif
#endif