我有两个图像块存储为1D数组,并在它们的元素之间执行以下按位AND操作.
int compare(unsigned char *a, int a_pitch,
unsigned char *b, int b_pitch, int a_lenx, int a_leny)
{
int overlap =0 ;
for(int y=0; y<a_leny; y++)
for(int x=0; x<a_lenx; x++)
{
if(a[x + y * a_pitch] & b[x+y*b_pitch])
overlap++ ;
}
return overlap ;
}
Run Code Online (Sandbox Code Playgroud)
实际上,我必须做大约220,000次这个工作,所以它在iphone设备上变得非常慢.
我怎么能在iPhone上加速这项工作?
我听说NEON可能有用,但我并不熟悉它.此外,似乎NEON没有按位AND ...