mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 22:00:25 +08:00
More intendation fixes
This commit is contained in:
parent
06df383675
commit
d2b4ee1e9b
@ -77,7 +77,7 @@ __kernel void bilateral(__global const uchar * src, int src_step, int src_offset
|
|||||||
int_t val = convert_int_t(loadpix(src + src_index + space_ofs[k]));
|
int_t val = convert_int_t(loadpix(src + src_index + space_ofs[k]));
|
||||||
uint diff = (uint)SUM(abs(val - val0));
|
uint diff = (uint)SUM(abs(val - val0));
|
||||||
float w = space_weight[k] * native_exp((float)(diff * diff * as_float(gauss_color_coeff)));
|
float w = space_weight[k] * native_exp((float)(diff * diff * as_float(gauss_color_coeff)));
|
||||||
sum += convert_float_t(val) * (float_t)(w);
|
sum += convert_float_t(val) * (float_t)(w);
|
||||||
wsum += w;
|
wsum += w;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ __kernel void bilateral_float(__global const uchar * src, int src_step, int src_
|
|||||||
float_t val = convert_float_t(loadpix(src + src_index + space_ofs[k]));
|
float_t val = convert_float_t(loadpix(src + src_index + space_ofs[k]));
|
||||||
float i = SUM(fabs(val - val0));
|
float i = SUM(fabs(val - val0));
|
||||||
float w = space_weight[k] * native_exp(i * i * as_float(gauss_color_coeff));
|
float w = space_weight[k] * native_exp(i * i * as_float(gauss_color_coeff));
|
||||||
sum += val * w;
|
sum += val * w;
|
||||||
wsum += w;
|
wsum += w;
|
||||||
}
|
}
|
||||||
storepix(convert_uchar_t(sum / (float_t)(wsum)), dst + dst_index);
|
storepix(convert_uchar_t(sum / (float_t)(wsum)), dst + dst_index);
|
||||||
|
@ -2343,11 +2343,10 @@ static bool ocl_bilateralFilter_8u(InputArray _src, OutputArray _dst, int d,
|
|||||||
copyMakeBorder(src, temp, radius, radius, radius, radius, borderType);
|
copyMakeBorder(src, temp, radius, radius, radius, radius, borderType);
|
||||||
std::vector<float> _space_weight(d * d);
|
std::vector<float> _space_weight(d * d);
|
||||||
std::vector<int> _space_ofs(d * d);
|
std::vector<int> _space_ofs(d * d);
|
||||||
|
|
||||||
float * const space_weight = &_space_weight[0];
|
float * const space_weight = &_space_weight[0];
|
||||||
int * const space_ofs = &_space_ofs[0];
|
int * const space_ofs = &_space_ofs[0];
|
||||||
|
|
||||||
// initialize space-related bilateral filter coefficients
|
// initialize space-related bilateral filter coefficients
|
||||||
for( i = -radius, maxk = 0; i <= radius; i++ )
|
for( i = -radius, maxk = 0; i <= radius; i++ )
|
||||||
for( j = -radius; j <= radius; j++ )
|
for( j = -radius; j <= radius; j++ )
|
||||||
{
|
{
|
||||||
@ -2358,13 +2357,13 @@ static bool ocl_bilateralFilter_8u(InputArray _src, OutputArray _dst, int d,
|
|||||||
space_ofs[maxk++] = (int)(i * temp.step + j * cn);
|
space_ofs[maxk++] = (int)(i * temp.step + j * cn);
|
||||||
}
|
}
|
||||||
|
|
||||||
char cvt[3][40];
|
char cvt[3][40];
|
||||||
String cnstr = cn > 1 ? format("%d", cn) : "";
|
String cnstr = cn > 1 ? format("%d", cn) : "";
|
||||||
String kernelName("bilateral");
|
String kernelName("bilateral");
|
||||||
size_t sizeDiv = 1;
|
size_t sizeDiv = 1;
|
||||||
if ((ocl::Device::getDefault().isIntel()) &&
|
if ((ocl::Device::getDefault().isIntel()) &&
|
||||||
(ocl::Device::getDefault().type() == ocl::Device::TYPE_GPU))
|
(ocl::Device::getDefault().type() == ocl::Device::TYPE_GPU))
|
||||||
{
|
{
|
||||||
//Intel GPU
|
//Intel GPU
|
||||||
if (dst.cols % 4 == 0 && cn == 1) // For single channel x4 sized images.
|
if (dst.cols % 4 == 0 && cn == 1) // For single channel x4 sized images.
|
||||||
{
|
{
|
||||||
@ -2376,12 +2375,12 @@ static bool ocl_bilateralFilter_8u(InputArray _src, OutputArray _dst, int d,
|
|||||||
kernelName = "bilateral_float";
|
kernelName = "bilateral_float";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ocl::Kernel k(kernelName.c_str(), ocl::imgproc::bilateral_oclsrc,
|
ocl::Kernel k(kernelName.c_str(), ocl::imgproc::bilateral_oclsrc,
|
||||||
format("-D radius=%d -D maxk=%d -D cn=%d -D int_t=%s -D uint_t=uint%s -D convert_int_t=%s"
|
format("-D radius=%d -D maxk=%d -D cn=%d -D int_t=%s -D uint_t=uint%s -D convert_int_t=%s"
|
||||||
" -D uchar_t=%s -D float_t=%s -D convert_float_t=%s -D convert_uchar_t=%s -D gauss_color_coeff=%f",
|
" -D uchar_t=%s -D float_t=%s -D convert_float_t=%s -D convert_uchar_t=%s -D gauss_color_coeff=%f",
|
||||||
radius, maxk, cn, ocl::typeToStr(CV_32SC(cn)), cnstr.c_str(),
|
radius, maxk, cn, ocl::typeToStr(CV_32SC(cn)), cnstr.c_str(),
|
||||||
ocl::convertTypeStr(CV_8U, CV_32S, cn, cvt[0]),
|
ocl::convertTypeStr(CV_8U, CV_32S, cn, cvt[0]),
|
||||||
ocl::typeToStr(type), ocl::typeToStr(CV_32FC(cn)),
|
ocl::typeToStr(type), ocl::typeToStr(CV_32FC(cn)),
|
||||||
ocl::convertTypeStr(CV_32S, CV_32F, cn, cvt[1]),
|
ocl::convertTypeStr(CV_32S, CV_32F, cn, cvt[1]),
|
||||||
ocl::convertTypeStr(CV_32F, CV_8U, cn, cvt[2]), gauss_color_coeff));
|
ocl::convertTypeStr(CV_32F, CV_8U, cn, cvt[2]), gauss_color_coeff));
|
||||||
if (k.empty())
|
if (k.empty())
|
||||||
|
Loading…
Reference in New Issue
Block a user