Smart Remote 3 nRF52 v1.2
sbc_dct.h
1 /******************************************************************************
2  *
3  * Copyright (C) 1999-2012 Broadcom Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  * Definitions for the fast DCT.
22  *
23  ******************************************************************************/
24 
25 #ifndef SBC_DCT_H
26 #define SBC_DCT_H
27 
28 #if (SBC_ARM_ASM_OPT==TRUE)
29 #define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1, s32OutLow) \
30 { \
31  __asm \
32 { \
33  MUL s32OutLow,(SINT32)s16In2, (s32In1>>15) \
34 } \
35 }
36 #else
37 #if (SBC_DSP_OPT==TRUE)
38 #define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) s32OutLow = SBC_Multiply_32_16_Simplified((SINT32)s16In2,s32In1);
39 #else
40 #if (SBC_IPAQ_OPT==TRUE)
41 /*#define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) s32OutLow=(SINT32)((SINT32)(s16In2)*(SINT32)(s32In1>>15)); */
42 #define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) s32OutLow=(SINT32)(((SINT64)s16In2*(SINT64)s32In1)>>15);
43 #if (SBC_IS_64_MULT_IN_IDCT == TRUE)
44 #define SBC_MULT_32_32(s32In2, s32In1, s32OutLow) \
45 { \
46  s64Temp = ((SINT64) s32In2) * ((SINT64) s32In1)>>31; \
47  s32OutLow = (SINT32) s64Temp; \
48 }
49 #endif
50 #else
51 #define SBC_MULT_32_16_SIMPLIFIED(s16In2, s32In1 , s32OutLow) \
52 { \
53  s32In1Temp = s32In1; \
54  s32In2Temp = (SINT32)s16In2; \
55  \
56  /* Multiply one +ve and the other -ve number */ \
57  if (s32In1Temp < 0) \
58  { \
59  s32In1Temp ^= 0xFFFFFFFF; \
60  s32In1Temp++; \
61  s32OutLow = (s32In2Temp * (s32In1Temp >> 16)); \
62  s32OutLow += (( s32In2Temp * (s32In1Temp & 0xFFFF)) >> 16); \
63  s32OutLow ^= 0xFFFFFFFF; \
64  s32OutLow++; \
65  } \
66  else \
67  { \
68  s32OutLow = (s32In2Temp * (s32In1Temp >> 16)); \
69  s32OutLow += (( s32In2Temp * (s32In1Temp & 0xFFFF)) >> 16); \
70  } \
71  s32OutLow <<= 1; \
72 }
73 #if (SBC_IS_64_MULT_IN_IDCT == TRUE)
74 #define SBC_MULT_64(s32In1, s32In2, s32OutLow, s32OutHi) \
75 {\
76  s32OutLow=(SINT32)(((SINT64)s32In1*(SINT64)s32In2)& 0x00000000FFFFFFFF);\
77  s32OutHi=(SINT32)(((SINT64)s32In1*(SINT64)s32In2)>>32);\
78 }
79 #define SBC_MULT_32_32(s32In2, s32In1, s32OutLow) \
80 { \
81  s32HiTemp = 0; \
82  SBC_MULT_64(s32In2,s32In1 , s32OutLow, s32HiTemp); \
83  s32OutLow = (((s32OutLow>>15)&0x1FFFF) | (s32HiTemp << 17)); \
84 }
85 #endif
86 
87 #endif
88 #endif
89 #endif
90 
91 #endif

Documentation feedback | Developer Zone | Subscribe | Updated