small fixes
This commit is contained in:
parent
8bf616e4c7
commit
c7857e8c13
@ -42,7 +42,7 @@ OCL_PERF_TEST(Photo, DenoisingColored)
|
||||
OCL_TEST_CYCLE()
|
||||
cv::fastNlMeansDenoisingColored(original, result, 10, 10);
|
||||
|
||||
SANITY_CHECK(result);
|
||||
SANITY_CHECK(result, 2);
|
||||
}
|
||||
|
||||
OCL_PERF_TEST(Photo, DISABLED_DenoisingGrayscaleMulti)
|
||||
|
@ -9,20 +9,20 @@
|
||||
#define __OPENCV_FAST_NLMEANS_DENOISING_OPENCL_HPP__
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#define CV_OPENCL_RUN_ASSERT
|
||||
#include "opencl_kernels.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cv {
|
||||
|
||||
enum
|
||||
{
|
||||
BLOCK_ROWS = 32,
|
||||
BLOCK_COLS = 128,
|
||||
BLOCK_COLS = 32,
|
||||
CTA_SIZE = 256
|
||||
};
|
||||
|
||||
static inline int getNearestPowerOf2(int value)
|
||||
static inline int getNearestPowerOf2OpenCL(int value)
|
||||
{
|
||||
int p = 0;
|
||||
while (1 << p < value)
|
||||
@ -51,7 +51,7 @@ static bool ocl_calcAlmostDist2Weight(UMat & almostDist2Weight, int searchWindow
|
||||
// additional optimization of precalced weights to replace division(averaging) by binary shift
|
||||
CV_Assert(templateWindowSize <= 46340); // sqrt(INT_MAX)
|
||||
int templateWindowSizeSq = templateWindowSize * templateWindowSize;
|
||||
almostTemplateWindowSizeSqBinShift = getNearestPowerOf2(templateWindowSizeSq);
|
||||
almostTemplateWindowSizeSqBinShift = getNearestPowerOf2OpenCL(templateWindowSizeSq);
|
||||
FT almostDist2ActualDistMultiplier = (FT)(1 << almostTemplateWindowSizeSqBinShift) / templateWindowSizeSq;
|
||||
|
||||
const FT WEIGHT_THRESHOLD = 1e-3f;
|
||||
@ -128,7 +128,7 @@ static bool ocl_fastNlMeansDenoising(InputArray _src, OutputArray _dst, float h,
|
||||
ocl::KernelArg::PtrReadOnly(almostDist2Weight),
|
||||
ocl::KernelArg::PtrReadOnly(buffer), almostTemplateWindowSizeSqBinShift);
|
||||
|
||||
size_t globalsize[2] = { nblocksx * BLOCK_COLS, nblocksy * BLOCK_ROWS }, localsize[2] = { CTA_SIZE, 1 };
|
||||
size_t globalsize[2] = { nblocksx * CTA_SIZE, nblocksy }, localsize[2] = { CTA_SIZE, 1 };
|
||||
return k.run(2, globalsize, localsize, false);
|
||||
}
|
||||
|
||||
@ -167,3 +167,4 @@ static bool ocl_fastNlMeansDenoisingColored( InputArray _src, OutputArray _dst,
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -115,8 +115,6 @@ inline void calcFirstElementInRow(__global const uchar * src, int src_step, int
|
||||
for (int j = 0; j < TEMPLATE_SIZE; ++j)
|
||||
col_dists_current[j] = col_dists_current_private[j];
|
||||
|
||||
// COND printf("%d %d\n", i, convert_int(dist));
|
||||
|
||||
dists[i] = dist;
|
||||
up_col_dists[0 + i] = col_dists[TEMPLATE_SIZE - 1];
|
||||
}
|
||||
|
@ -1,44 +1,9 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user