1/* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 * express or implied.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
17 */
18/*
19------------------------------------------------------------------------------
20   PacketVideo Corp.
21   MP3 Decoder Library
22
23   Pathname: ./cpp/include/pv_mp3dec_fxd_op_msc_evc.h
24
25     Date: 08/20/2007
26
27------------------------------------------------------------------------------
28 REVISION HISTORY
29
30 Description:
31------------------------------------------------------------------------------
32 INCLUDE DESCRIPTION
33
34 This file select the associated fixed point functions with the OS/ARCH.
35
36
37------------------------------------------------------------------------------
38*/
39
40#ifndef PV_MP3DEC_FXD_OP_MSC_EVC_H
41#define PV_MP3DEC_FXD_OP_MSC_EVC_H
42
43
44#ifdef __cplusplus
45extern "C"
46{
47#endif
48
49#include "pvmp3_audio_type_defs.h"
50
51
52#if (defined(PV_ARM_MSC_EVC_V5)||defined(PV_ARM_MSC_EVC_V4))
53#include "armintr.h"
54#include "cmnintrin.h"
55
56
57    __inline int32 fxp_mul32_Q30(const int32 a, const int32 b)
58    {
59        return (int32)(((int64)(a) * b) >> 30);
60    }
61
62
63    __inline int32 fxp_mac32_Q30(const int32 a, const int32 b, int32 L_add)
64    {
65        return (L_add + (int32)(((int64)(a) * b) >> 30));
66    }
67
68
69#define Qfmt_31(a)   (int32)(a*0x7FFFFFFF + (a>=0?0.5F:-0.5F))
70
71#define Qfmt15(x)   (Int16)(x*((int32)1<<15) + (x>=0?0.5F:-0.5F))
72
73#define fxp_mul32_Q32( a,  b)   _MulHigh( b, a)
74
75
76
77    __inline int32 fxp_mul32_Q28(const int32 a, const int32 b)
78    {
79        return (int32)(((int64)(a) * b) >> 28);
80    }
81
82
83    __inline int32 fxp_mul32_Q27(const int32 a, const int32 b)
84    {
85        return (int32)(((int64)(a) * b) >> 27);
86    }
87
88
89
90    __inline int32 fxp_mul32_Q26(const int32 a, const int32 b)
91    {
92        return (int32)(((int64)(a) * b) >> 26);
93    }
94
95
96    __inline int32 fxp_mac32_Q32(int32 L_add, const int32 a, const int32 b)
97    {
98        return (L_add + _MulHigh(b, a));
99    }
100
101
102    __inline int32 fxp_msb32_Q32(int32 L_sub, const int32 a, const int32 b)
103    {
104        return (L_sub - _MulHigh(b, a));
105    }
106
107
108
109    __inline int32 fxp_mul32_Q29(const int32 a, const int32 b)
110    {
111        return (int32)(((int64)(a) * b) >> 29);
112    }
113
114
115
116    __inline int32 pv_abs(int32 a)
117    {
118        int32 b = (a < 0) ? -a : a;
119        return b;
120    }
121
122
123
124#endif
125
126#ifdef __cplusplus
127}
128#endif
129
130
131#endif   /*  PV_MP3DEC_FXD_OP_MSC_EVC_H  */
132
133