|
__global__ void result(unsigned char *id, unsigned char *itempd , int* nMaxWidth, int* nMaxHeight, float* dMaxR)
{
long m,n;
//float R=0.0f;
unsigned char P=0;
unsigned char TempP=0;
float dSigmaST = 0.0f;
float dSigmaS = 0.0f;
__shared__ float R[16][9];
float nMaxWidth_ = x;
float nMaxHeight_ = y;
long y=blockDim.y*blockIdx.y+threadIdx.y;//高
long x=blockDim.x*blockIdx.x+threadIdx.x;//宽
if( y< (256-48)) && x< (256-48))
{
for(m=0;m<48;m++)
{
for(n=0;n<48;n++)
{
P=id[(y+m)*256+x+n];
TempP=itempd[m*48+n];
dSigmaS+=(float)(P*P);
dSigmaST+=(float)(Pixel*TempP);
}
}
R[threadIdx.y][threadIdx.x]=dSigmaST/(sqrt(dSigmaS)*sqrt(32621576));
}
if (threadIdx.x <8)
{
if (R[threadIdx.y][threadIdx.x] < R[threadIdx.y][threadIdx.x+8])
.............
部分代码,其他的自己补充了 |
|