ref: 2b038fa73b2b9ff2abef1e45f7e4db741835cf6e
parent: e9b8d927ca34e2333a9d17e0e03344faeef658a8
parent: 263833b3bfdf936bd2d5596c62ee5e636a796075
author: zhilwang <[email protected]>
date: Mon Jun 30 06:09:05 EDT 2014
Merge pull request #1037 from mstorsjo/unify-align-macros Unify macros for alignment
--- a/codec/common/inc/macros.h
+++ b/codec/common/inc/macros.h
@@ -73,20 +73,10 @@
#endif
#define ALIGNED_DECLARE( type, var, n ) __declspec(align(n)) type var
-#define __align16(t,v) __declspec(align(16)) t v
-#define ALIGNED_DECLARE_MATRIX_1D(name,size,type,alignment) \
- __declspec(align(alignment)) type name[(size)]
-#define ALIGNED_DECLARE_MATRIX_2D(name,sizex,sizey,type,alignment) \
-__declspec(align(alignment)) type name[(sizex)*(sizey)]
#elif defined(__GNUC__)
#define ALIGNED_DECLARE( type, var, n ) type var __attribute__((aligned(n)))
-#define __align16(t,v) t v __attribute__ ((aligned (16)))
-#define ALIGNED_DECLARE_MATRIX_1D(name,size,type,alignment) \
- type name[size] __attribute__((aligned(alignment)))
-#define ALIGNED_DECLARE_MATRIX_2D(name,sizex,sizey,type,alignment) \
- type name[(sizex)*(sizey)] __attribute__((aligned(alignment)))
#endif//_MSC_VER
--- a/codec/decoder/core/inc/wels_common_basis.h
+++ b/codec/decoder/core/inc/wels_common_basis.h
@@ -47,7 +47,7 @@
extern const uint8_t g_kuiScan8[24];
extern const uint8_t g_kuiLumaDcZigzagScan[16];
extern const uint8_t g_kuiChromaDcScan[4];
-extern __align16 (const uint16_t, g_kuiDequantCoeff[52][8]);
+extern ALIGNED_DECLARE (const uint16_t, g_kuiDequantCoeff[52][8], 16);
/* Profile IDC */
typedef uint8_t ProfileIdc;
enum {
--- a/codec/decoder/core/src/decoder_data_tables.cpp
+++ b/codec/decoder/core/src/decoder_data_tables.cpp
@@ -155,7 +155,7 @@
0, 16, 32, 48
};
-__align16 (const uint16_t, g_kuiDequantCoeff[52][8]) = {
+ALIGNED_DECLARE (const uint16_t, g_kuiDequantCoeff[52][8], 16) = {
/* 0*/{ 10, 13, 10, 13, 13, 16, 13, 16 }, /* 1*/{ 11, 14, 11, 14, 14, 18, 14, 18 },
/* 2*/{ 13, 16, 13, 16, 16, 20, 16, 20 }, /* 3*/{ 14, 18, 14, 18, 18, 23, 18, 23 },
/* 4*/{ 16, 20, 16, 20, 20, 25, 20, 25 }, /* 5*/{ 18, 23, 18, 23, 23, 29, 23, 29 },
--- a/codec/encoder/core/inc/encode_mb_aux.h
+++ b/codec/encoder/core/inc/encode_mb_aux.h
@@ -126,8 +126,8 @@
}
#endif//__cplusplus
-__align16 (extern const int16_t, g_kiQuantInterFF[58][8]);
+ALIGNED_DECLARE (extern const int16_t, g_kiQuantInterFF[58][8], 16);
#define g_iQuantIntraFF (g_kiQuantInterFF +6 )
-__align16 (extern const int16_t, g_kiQuantMF[52][8]) ;
+ALIGNED_DECLARE (extern const int16_t, g_kiQuantMF[52][8], 16);
}
#endif//ENCODE_MB_AUX_H
--- a/codec/encoder/core/inc/mb_cache.h
+++ b/codec/encoder/core/inc/mb_cache.h
@@ -77,9 +77,9 @@
//the followed pData now is promised aligned to 16 bytes
ALIGNED_DECLARE (SMVComponentUnit, sMvComponents, 16);
-ALIGNED_DECLARE_MATRIX_1D (iNonZeroCoeffCount, 48, int8_t, 16); // Cache line size
+ALIGNED_DECLARE (int8_t, iNonZeroCoeffCount[48], 16); // Cache line size
// int8_t iNonZeroCoeffCount[6 * 8]; // Right luma, Chroma(Left Top Cb, Left btm Cr); must follow by iIntraPredMode!
-ALIGNED_DECLARE_MATRIX_1D (iIntraPredMode, 48, int8_t, 16);
+ALIGNED_DECLARE (int8_t, iIntraPredMode[48], 16);
// must follow with iNonZeroCoeffCount!
int32_t iSadCost[4]; //avail 1; unavail 0
--- a/codec/encoder/core/src/encode_mb_aux.cpp
+++ b/codec/encoder/core/src/encode_mb_aux.cpp
@@ -36,7 +36,7 @@
#include "cpu_core.h"
namespace WelsSVCEnc {
-__align16 (const int16_t, g_kiQuantInterFF[58][8]) = {
+ALIGNED_DECLARE (const int16_t, g_kiQuantInterFF[58][8], 16) = {
/* 0*/ { 0, 1, 0, 1, 1, 1, 1, 1 },
/* 1*/ { 0, 1, 0, 1, 1, 1, 1, 1 },
/* 2*/ { 1, 1, 1, 1, 1, 1, 1, 1 },
@@ -100,7 +100,7 @@
-__align16 (const int16_t, g_kiQuantMF[52][8]) = {
+ALIGNED_DECLARE (const int16_t, g_kiQuantMF[52][8], 16) = {
/* 0*/ {26214, 16132, 26214, 16132, 16132, 10486, 16132, 10486 },
/* 1*/ {23832, 14980, 23832, 14980, 14980, 9320, 14980, 9320 },
/* 2*/ {20164, 13108, 20164, 13108, 13108, 8388, 13108, 8388 },
--- a/codec/encoder/core/src/encoder_data_tables.cpp
+++ b/codec/encoder/core/src/encoder_data_tables.cpp
@@ -132,7 +132,7 @@
{ NON_VCL, NON_VCL } // 31: NAL_UNIT_UNSPEC_31
};
-__align16 (const uint16_t, g_kuiDequantCoeff[52][8]) = {
+ALIGNED_DECLARE (const uint16_t, g_kuiDequantCoeff[52][8], 16) = {
/* 0*/{ 10, 13, 10, 13, 13, 16, 13, 16 }, /* 1*/{ 11, 14, 11, 14, 14, 18, 14, 18 },
/* 2*/{ 13, 16, 13, 16, 16, 20, 16, 20 }, /* 3*/{ 14, 18, 14, 18, 18, 23, 18, 23 },
/* 4*/{ 16, 20, 16, 20, 20, 25, 20, 25 }, /* 5*/{ 18, 23, 18, 23, 23, 29, 23, 29 },
--- a/codec/encoder/core/src/svc_base_layer_md.cpp
+++ b/codec/encoder/core/src/svc_base_layer_md.cpp
@@ -239,7 +239,7 @@
{ 15, 15, 15, 7, 15, 15, 15, 7, 15, 15, 15, 7, 15, 7, 15, 7},
};
-__align16 (const int8_t, g_kiMapModeI4x4[14]) = {
+ALIGNED_DECLARE (const int8_t, g_kiMapModeI4x4[14], 16) = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 2, 2, 2, 3, 7
};
--- a/test/encoder/EncUT_EncoderMb.cpp
+++ b/test/encoder/EncUT_EncoderMb.cpp
@@ -6,7 +6,7 @@
using namespace WelsSVCEnc;
#include "encode_mb_aux.h"
-__align16 (const int16_t, g_kiQuantInterFFCompare[104][8]) = {
+ALIGNED_DECLARE (const int16_t, g_kiQuantInterFFCompare[104][8], 16) = {
/* 0*/ { 0, 1, 0, 1, 1, 1, 1, 1 },
/* 1*/ { 0, 1, 0, 1, 1, 1, 1, 1 },
/* 2*/ { 1, 1, 1, 1, 1, 1, 1, 1 },