• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright (C) 2015 The Android Open Source Project
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  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 #ifndef __IMPEG2_PLATFORM_MACROS_H__
21 #define __IMPEG2_PLATFORM_MACROS_H__
22 
23 
24 #define CONV_LE_TO_BE(u4_temp2,u4_temp1) u4_temp2 =                            \
25                                          (u4_temp1 << 24) |                    \
26                                          ((u4_temp1 & 0xff00) << 8) |          \
27                                          ((u4_temp1 & 0xff0000) >> 8) |        \
28                                          (u4_temp1 >> 24);
29 
CLZ(UWORD32 u4_word)30 static __inline  UWORD32 CLZ(UWORD32 u4_word)
31 {
32     if(u4_word)
33         return (__builtin_clz(u4_word));
34     else
35         return 32;
36 }
CLIP_U8(WORD32 x)37 static __inline WORD32 CLIP_U8(WORD32 x)
38 {
39     asm("usat %0, #8, %1" : "=r"(x) : "r"(x));
40     return x;
41 }
42 
CLIP_S8(WORD32 x)43 static __inline WORD32 CLIP_S8(WORD32 x)
44 {
45     asm("ssat %0, #8, %1" : "=r"(x) : "r"(x));
46     return x;
47 }
48 
CLIP_U12(WORD32 x)49 static __inline WORD32 CLIP_U12(WORD32 x)
50 {
51     asm("usat %0, #12, %1" : "=r"(x) : "r"(x));
52     return x;
53 }
54 
CLIP_S12(WORD32 x)55 static __inline WORD32 CLIP_S12(WORD32 x)
56 {
57     asm("ssat %0, #12, %1" : "=r"(x) : "r"(x));
58     return x;
59 }
60 
CLIP_U16(WORD32 x)61 static __inline WORD32 CLIP_U16(WORD32 x)
62 {
63     asm("usat %0, #16, %1" : "=r"(x) : "r"(x));
64     return x;
65 }
CLIP_S16(WORD32 x)66 static __inline WORD32 CLIP_S16(WORD32 x)
67 {
68     asm("ssat %0, #16, %1" : "=r"(x) : "r"(x));
69     return x;
70 }
71 
72 #define INLINE
73 #define PLD(x) __pld(x)
74 
75 #endif /* __IMPEG2_PLATFORM_MACROS_H__ */
76