Use ENFORCE_STACK_ALIGN_1D instead of manually doing stack buffer alignment

This commit is contained in:
Martin Storsjö 2014-06-29 00:51:58 +03:00
parent d8e78fee09
commit 6e815e708d
2 changed files with 9 additions and 18 deletions

View File

@ -382,9 +382,8 @@ GENERATE_4x4_UT (WelsI4x4LumaPredHD_c, WelsI4x4LumaPredHD_ref, 0, 0)
TEST(DecoderIntraPredictionTest, pred) {\
const int32_t kiStride = 32; \
int iRunTimes = 1000; \
uint8_t _pRefBuffer[18 * kiStride + 64]; \
uint8_t _pPredBuffer[18 * kiStride + 64]; \
uint8_t *pRefBuffer, *pPredBuffer; \
ENFORCE_STACK_ALIGN_1D (uint8_t, pRefBuffer, 18 * kiStride, 16); \
ENFORCE_STACK_ALIGN_1D (uint8_t, pPredBuffer, 18 * kiStride, 16); \
if (ASM) { \
int32_t iTmp = 1; \
uint32_t uiCPUFlags = WelsCPUFeatureDetect(&iTmp); \
@ -392,8 +391,6 @@ if (ASM) { \
return; \
} \
} \
pRefBuffer = (uint8_t*)((((intptr_t)(&_pRefBuffer[31])) >> 4) << 4); \
pPredBuffer = (uint8_t*)((((intptr_t)(&_pPredBuffer[31])) >> 4) << 4); \
srand((unsigned int)time(NULL)); \
while(iRunTimes--) {\
for (int i = 0; i < 17; i ++) {\
@ -523,9 +520,8 @@ GENERATE_8x8_UT (WelsIChromaPredV_c, LumaI8x8PredV, 0, 0)
TEST(DecoderIntraPredictionTest, pred) {\
const int32_t kiStride = 32; \
int32_t iRunTimes = 1000; \
uint8_t _pRefBuffer[18 * kiStride + 64]; \
uint8_t _pPredBuffer[18 * kiStride + 64]; \
uint8_t *pRefBuffer, *pPredBuffer; \
ENFORCE_STACK_ALIGN_1D (uint8_t, pRefBuffer, 18 * kiStride, 16); \
ENFORCE_STACK_ALIGN_1D (uint8_t, pPredBuffer, 18 * kiStride, 16); \
if (ASM) { \
int32_t iTmp = 1; \
uint32_t uiCPUFlags = WelsCPUFeatureDetect( &iTmp); \
@ -533,8 +529,6 @@ if (ASM) { \
return ; \
} \
}\
pRefBuffer = (uint8_t*)((((intptr_t)(&_pRefBuffer[31])) >> 4) << 4); \
pPredBuffer = (uint8_t*)((((intptr_t)(&_pPredBuffer[31])) >> 4) << 4); \
srand((unsigned int)time(NULL)); \
while(iRunTimes--) {\
for (int i = 0; i < 17; i ++) {\

View File

@ -239,10 +239,9 @@ void copy (uint8_t* pDst, int32_t iDStride, uint8_t* pSrc, int32_t iSStride, int
TEST(EncodeMbAuxTest, function) { \
const int iSStride = 64; \
const int iDStride = 64; \
uint8_t _ref_src[64*64], _ref_dst[64*64], _dst[64*64]; \
uint8_t *ref_src = (uint8_t*)((((uintptr_t)(_ref_src + 15)) >> 4) << 4); \
uint8_t *ref_dst = (uint8_t*)((((uintptr_t)(_ref_dst + 15)) >> 4) << 4); \
uint8_t *dst = (uint8_t*)((((uintptr_t)(_dst + 15)) >> 4) << 4); \
ENFORCE_STACK_ALIGN_1D (uint8_t, ref_src, iSStride*height, 16); \
ENFORCE_STACK_ALIGN_1D (uint8_t, ref_dst, iDStride*height, 16); \
ENFORCE_STACK_ALIGN_1D (uint8_t, dst, iDStride*height, 16); \
srand((unsigned int)time(NULL)); \
for(int i = 0; i < height; i++) \
for(int j = 0; j < width; j++) \
@ -265,8 +264,7 @@ GENERATE_UT_FOR_COPY (16, 16, WelsCopy16x16NotAligned_sse2);
GENERATE_UT_FOR_COPY (16, 16, WelsCopy16x16_sse2);
#endif
TEST (EncodeMbAuxTest, WelsGetNoneZeroCount_c) {
int16_t _iLevel[32];
int16_t* pLevel = (int16_t*) (((((uintptr_t)_iLevel) + 15) >> 4) << 4);
ENFORCE_STACK_ALIGN_1D (int16_t, pLevel, 16, 16);
srand ((unsigned int)time (NULL));
int32_t result = 0;
for (int i = 0; i < 16; i++) {
@ -278,8 +276,7 @@ TEST (EncodeMbAuxTest, WelsGetNoneZeroCount_c) {
}
#ifdef X86_ASM
TEST (EncodeMbAuxTest, WelsGetNoneZeroCount_sse2) {
int16_t _iLevel[32];
int16_t* pLevel = (int16_t*) (((((uintptr_t)_iLevel) + 15) >> 4) << 4);
ENFORCE_STACK_ALIGN_1D (int16_t, pLevel, 16, 16);
srand ((unsigned int)time (NULL));
int32_t result = 0;
for (int i = 0; i < 16; i++) {