29#ifndef H264SWDEC_UTIL_H
30#define H264SWDEC_UTIL_H
48#if defined(_RANGE_CHECK) || defined(_DEBUG_PRINT) || defined(_ERROR_PRINT)
59#define HANTRO_TRUE (1)
60#define HANTRO_FALSE (0)
66#define MEMORY_ALLOCATION_ERROR 0xFFFF
67#define PARAM_SET_ERROR 0xFFF0
70#define END_OF_STREAM 0xFFFFFFFFU
72#define EMPTY_RESIDUAL_INDICATOR 0xFFFFFF
75#define MARK_RESIDUAL_EMPTY(residual) ((residual)[0] = EMPTY_RESIDUAL_INDICATOR)
77#define IS_RESIDUAL_EMPTY(residual) ((residual)[0] == EMPTY_RESIDUAL_INDICATOR)
81#define ASSERT(expr) assert(expr)
89#define RANGE_CHECK(value, minBound, maxBound) \
91 if ((value) < (minBound) || (value) > (maxBound)) \
92 fprintf(stderr, "Warning: Value exceeds given limit(s)!\n"); \
95#define RANGE_CHECK(value, minBound, maxBound)
101#define RANGE_CHECK_ARRAY(array, minBound, maxBound, length) \
104 for (i = 0; i < (length); i++) \
105 if ((array)[i] < (minBound) || (array)[i] > (maxBound)) \
106 fprintf(stderr,"Warning: Value [%d] exceeds given limit(s)!\n",i); \
109#define RANGE_CHECK_ARRAY(array, minBound, maxBound, length)
115#define DEBUG(args) printf args
123#define EPRINT(msg) fprintf(stderr,"ERROR: %s\n",msg)
129#define MIN(a, b) (((a) < (b)) ? (a) : (b))
132#define MAX(a, b) (((a) > (b)) ? (a) : (b))
135#define ABS(a) (((a) < 0) ? -(a) : (a))
138#define CLIP3(x,y,z) (((z) < (x)) ? (x) : (((z) > (y)) ? (y) : (z)))
141#define CLIP1(z) (((z) < 0) ? 0 : (((z) > 255) ? 255 : (z)))
144#define ALLOCATE(ptr, count, type) \
146 (ptr) = malloc((count) * sizeof(type)); \
152 free((ptr)); (ptr) = NULL; \
155#define ALIGN(ptr, bytePos) \
156 (ptr + ( ((bytePos - (uintptr_t)ptr) & (bytePos - 1)) / sizeof(*ptr) ))
#define abs(x)
Definition math.h:146
size_t a
Definition main.cpp:156
signed int i32
Definition basetype.h:34
u32 h264bsdMoreRbspData(strmData_t *strmData)
Definition h264bsd_util.c:172
const u32 h264bsdQpC[52]
Definition h264bsd_util.c:53
void h264bsdSetCurrImageMbPointers(image_t *image, u32 mbNum)
Definition h264bsd_util.c:265
i32 clip(i32 x, i32 y, i32 z)
u32 h264bsdNextMbAddress(u32 *pSliceGroupMap, u32 picSizeInMbs, u32 currMbAddr)
Definition h264bsd_util.c:219
u32 h264bsdRbspTrailingBits(strmData_t *strmData)
Definition h264bsd_util.c:124
u32 h264bsdCountLeadingZeros(u32 value, u32 length)
Definition h264bsd_util.c:81
__u64 image
Definition i915_drm.h:14
uint32_t u32
Definition kernel.h:16
Definition h264bsd_image.h:47
Definition h264bsd_stream.h:47