718c41634f
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
// check sanity of vsx aligned ld/st
|
|
// https://github.com/opencv/opencv/issues/13211
|
|
|
|
#include <altivec.h>
|
|
#undef bool
|
|
|
|
#define vsx_ld vec_vsx_ld
|
|
#define vsx_st vec_vsx_st
|
|
|
|
template<typename T>
|
|
static void fill(T& d, int from = 0, int to = 16)
|
|
{
|
|
for (int i = from; i < to; i++)
|
|
d[i] = i;
|
|
}
|
|
|
|
template<typename T, typename Tvec>
|
|
static bool check_data(T& d, Tvec& v, int from = 0, int to = 16)
|
|
{
|
|
for (int i = from; i < to; i++)
|
|
{
|
|
if (d[i] != vec_extract(v, i))
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
unsigned char __attribute__ ((aligned (16))) rbuf[16];
|
|
unsigned char __attribute__ ((aligned (16))) wbuf[16];
|
|
__vector unsigned char a;
|
|
|
|
// 1- check aligned load and store
|
|
fill(rbuf);
|
|
a = vec_ld(0, rbuf);
|
|
if (!check_data(rbuf, a))
|
|
return 1;
|
|
vec_st(a, 0, wbuf);
|
|
if (!check_data(wbuf, a))
|
|
return 11;
|
|
|
|
// 2- check mixing aligned load and unaligned store
|
|
a = vec_ld(0, rbuf);
|
|
vsx_st(a, 0, wbuf);
|
|
if (!check_data(wbuf, a))
|
|
return 2;
|
|
|
|
// 3- check mixing unaligned load and aligned store
|
|
a = vsx_ld(0, rbuf);
|
|
vec_st(a, 0, wbuf);
|
|
if (!check_data(wbuf, a))
|
|
return 3;
|
|
|
|
return 0;
|
|
} |