aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorS Hamsalekha <hamsalekha.s@ittiam.com>2019-02-01 18:04:23 +0530
committerRay Essick <essick@google.com>2019-03-28 14:40:47 -0700
commit65477dcfb93b4a059ea4e527f4c02e2d301e64cf (patch)
tree73e2dd9a3d9d6eb098c04f6b55a84f50b51089de
parent34769a5b08624ff4f10add43e78d227d2a9d8559 (diff)
downloadlibavc-65477dcfb93b4a059ea4e527f4c02e2d301e64cf.tar.gz
Decoder: Replacing some numbers with equivalent macros.
Bug: 118445723 Test: vendor Change-Id: I2dbdf3bf289c34409db341d7c0502cd88a20bab5
-rw-r--r--common/arm/ih264_platform_macros.h13
-rw-r--r--common/armv8/ih264_platform_macros.h13
-rw-r--r--common/mips/ih264_platform_macros.h13
-rw-r--r--common/x86/ih264_platform_macros.h13
4 files changed, 31 insertions, 21 deletions
diff --git a/common/arm/ih264_platform_macros.h b/common/arm/ih264_platform_macros.h
index a4908ff..a4d7f3a 100644
--- a/common/arm/ih264_platform_macros.h
+++ b/common/arm/ih264_platform_macros.h
@@ -36,6 +36,8 @@
#ifndef _IH264_PLATFORM_MACROS_H_
#define _IH264_PLATFORM_MACROS_H_
+#include <stdint.h>
+
#ifndef ARMV8
static __inline WORD32 CLIP_U8(WORD32 x)
@@ -107,8 +109,8 @@ static __inline UWORD32 ITT_BIG_ENDIAN(UWORD32 x)
#else
-#define CLIP_U8(x) CLIP3(0, 255, (x))
-#define CLIP_S8(x) CLIP3(-128, 127, (x))
+#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
+#define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x))
#define CLIP_U10(x) CLIP3(0, 1023, (x))
#define CLIP_S10(x) CLIP3(-512, 511, (x))
@@ -119,8 +121,8 @@ static __inline UWORD32 ITT_BIG_ENDIAN(UWORD32 x)
#define CLIP_U12(x) CLIP3(0, 4095, (x))
#define CLIP_S12(x) CLIP3(-2048, 2047, (x))
-#define CLIP_U16(x) CLIP3(0, 65535, (x))
-#define CLIP_S16(x) CLIP3(-32768, 32767, (x))
+#define CLIP_U16(x) CLIP3(0, UINT16_MAX, (x))
+#define CLIP_S16(x) CLIP3(INT16_MIN, INT16_MAX, (x))
#define ITT_BIG_ENDIAN(x) __asm__("rev %0, %1" : "=r"(x) : "r"(x));
@@ -135,7 +137,8 @@ static __inline UWORD32 ITT_BIG_ENDIAN(UWORD32 x)
/*saturating instructions are not available for WORD64 in ARMv7, hence we cannot
* use inline assembly like other clips*/
-#define CLIP_S32(x) CLIP3(-4294967296, 4294967295, (x))
+#define CLIP_U32(x) CLIP3(0, UINT32_MAX, (x))
+#define CLIP_S32(x) CLIP3(INT32_MIN, INT32_MAX, (x))
#define DATA_SYNC() __sync_synchronize()
diff --git a/common/armv8/ih264_platform_macros.h b/common/armv8/ih264_platform_macros.h
index a4908ff..a4d7f3a 100644
--- a/common/armv8/ih264_platform_macros.h
+++ b/common/armv8/ih264_platform_macros.h
@@ -36,6 +36,8 @@
#ifndef _IH264_PLATFORM_MACROS_H_
#define _IH264_PLATFORM_MACROS_H_
+#include <stdint.h>
+
#ifndef ARMV8
static __inline WORD32 CLIP_U8(WORD32 x)
@@ -107,8 +109,8 @@ static __inline UWORD32 ITT_BIG_ENDIAN(UWORD32 x)
#else
-#define CLIP_U8(x) CLIP3(0, 255, (x))
-#define CLIP_S8(x) CLIP3(-128, 127, (x))
+#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
+#define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x))
#define CLIP_U10(x) CLIP3(0, 1023, (x))
#define CLIP_S10(x) CLIP3(-512, 511, (x))
@@ -119,8 +121,8 @@ static __inline UWORD32 ITT_BIG_ENDIAN(UWORD32 x)
#define CLIP_U12(x) CLIP3(0, 4095, (x))
#define CLIP_S12(x) CLIP3(-2048, 2047, (x))
-#define CLIP_U16(x) CLIP3(0, 65535, (x))
-#define CLIP_S16(x) CLIP3(-32768, 32767, (x))
+#define CLIP_U16(x) CLIP3(0, UINT16_MAX, (x))
+#define CLIP_S16(x) CLIP3(INT16_MIN, INT16_MAX, (x))
#define ITT_BIG_ENDIAN(x) __asm__("rev %0, %1" : "=r"(x) : "r"(x));
@@ -135,7 +137,8 @@ static __inline UWORD32 ITT_BIG_ENDIAN(UWORD32 x)
/*saturating instructions are not available for WORD64 in ARMv7, hence we cannot
* use inline assembly like other clips*/
-#define CLIP_S32(x) CLIP3(-4294967296, 4294967295, (x))
+#define CLIP_U32(x) CLIP3(0, UINT32_MAX, (x))
+#define CLIP_S32(x) CLIP3(INT32_MIN, INT32_MAX, (x))
#define DATA_SYNC() __sync_synchronize()
diff --git a/common/mips/ih264_platform_macros.h b/common/mips/ih264_platform_macros.h
index a4db20a..fa0ba61 100644
--- a/common/mips/ih264_platform_macros.h
+++ b/common/mips/ih264_platform_macros.h
@@ -38,8 +38,10 @@
#ifndef _IH264_PLATFORM_MACROS_H_
#define _IH264_PLATFORM_MACROS_H_
-#define CLIP_U8(x) CLIP3(0, 255, (x))
-#define CLIP_S8(x) CLIP3(-128, 127, (x))
+#include <stdint.h>
+
+#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
+#define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x))
#define CLIP_U10(x) CLIP3(0, 1023, (x))
#define CLIP_S10(x) CLIP3(-512, 511, (x))
@@ -50,10 +52,11 @@
#define CLIP_U12(x) CLIP3(0, 4095, (x))
#define CLIP_S12(x) CLIP3(-2048, 2047, (x))
-#define CLIP_U16(x) CLIP3(0, 65535, (x))
-#define CLIP_S16(x) CLIP3(-32768, 32767, (x))
+#define CLIP_U16(x) CLIP3(0, UINT16_MAX, (x))
+#define CLIP_S16(x) CLIP3(INT16_MIN, INT16_MAX, (x))
-#define CLIP_S32(x) CLIP3(-4294967296, 4294967295, (x))
+#define CLIP_U32(x) CLIP3(0, UINT32_MAX, (x))
+#define CLIP_S32(x) CLIP3(INT32_MIN, INT32_MAX, (x))
#define MEM_ALIGN16 __attribute__ ((aligned (16)))
diff --git a/common/x86/ih264_platform_macros.h b/common/x86/ih264_platform_macros.h
index e545114..54af325 100644
--- a/common/x86/ih264_platform_macros.h
+++ b/common/x86/ih264_platform_macros.h
@@ -38,11 +38,11 @@
#ifndef _IH264_PLATFORM_MACROS_H_
#define _IH264_PLATFORM_MACROS_H_
+#include <stdint.h>
#include <immintrin.h>
-
-#define CLIP_U8(x) CLIP3(0, 255, (x))
-#define CLIP_S8(x) CLIP3(-128, 127, (x))
+#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
+#define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x))
#define CLIP_U10(x) CLIP3(0, 1023, (x))
#define CLIP_S10(x) CLIP3(-512, 511, (x))
@@ -53,10 +53,11 @@
#define CLIP_U12(x) CLIP3(0, 4095, (x))
#define CLIP_S12(x) CLIP3(-2048, 2047, (x))
-#define CLIP_U16(x) CLIP3(0, 65535, (x))
-#define CLIP_S16(x) CLIP3(-32768, 32767, (x))
+#define CLIP_U16(x) CLIP3(0, UINT16_MAX, (x))
+#define CLIP_S16(x) CLIP3(INT16_MIN, INT16_MAX, (x))
-#define CLIP_S32(x) CLIP3(-4294967296, 4294967295, (x))
+#define CLIP_U32(x) CLIP3(0, UINT32_MAX, (x))
+#define CLIP_S32(x) CLIP3(INT32_MIN, INT32_MAX, (x))
#define MEM_ALIGN16 __attribute__ ((aligned (16)))