• 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 = (u4_temp1 << 24) |               \
25                                                            ((u4_temp1 & 0xff00) << 8) |     \
26                                                            ((u4_temp1 & 0xff0000) >> 8) |   \
27                                                            (u4_temp1 >> 24);
CLZ(UWORD32 u4_word)28 static __inline UWORD32 CLZ(UWORD32 u4_word)
29 {
30     if(u4_word)
31         return (__builtin_clz(u4_word));
32     else
33         return 32;
34 }
35 
36 
37 #define CLIP_U8(x) ((x) > 255) ? (255) : (((x) < 0) ? (0) : (x))
38 #define CLIP_S8(x) ((x) > 127) ? (127) : (((x) < -128) ? (-128) : (x))
39 
40 #define CLIP_U12(x) ((x) > 4095) ? (4095) : (((x) < 0) ? (0) : (x))
41 #define CLIP_S12(x) ((x) > 2047) ? (2047) : (((x) < -2048) ? (-2048) : (x))
42 
43 #define CLIP_U16(x) ((x) > 65535) ? (65535) : (((x) < 0) ? (0) : (x))
44 #define CLIP_S16(x) ((x) > 32767) ? (32767) : (((x) < -32768) ? (-32768) : (x))
45 #define PLD(x)
46 
47 #define INLINE
48 
49 #endif /* __IMPEG2_PLATFORM_MACROS_H__ */
50