From 623c7da74708d85ee7f2f08d8171d093fa63a98b Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 17 Apr 2013 17:53:50 +0400 Subject: [PATCH] removed obsolete source files from gpu module --- modules/gpu/src/cuda/internal_shared.hpp | 58 -------- modules/gpu/src/cuda/safe_call.hpp | 50 ------- modules/gpu/src/cuda/texture_binder.hpp | 92 ------------- modules/gpu/src/error.cpp | 45 ------ modules/gpu/src/speckle_filtering.cpp | 168 ----------------------- 5 files changed, 413 deletions(-) delete mode 100644 modules/gpu/src/cuda/internal_shared.hpp delete mode 100644 modules/gpu/src/cuda/safe_call.hpp delete mode 100644 modules/gpu/src/cuda/texture_binder.hpp delete mode 100644 modules/gpu/src/error.cpp delete mode 100644 modules/gpu/src/speckle_filtering.cpp diff --git a/modules/gpu/src/cuda/internal_shared.hpp b/modules/gpu/src/cuda/internal_shared.hpp deleted file mode 100644 index ce2cfe465c..0000000000 --- a/modules/gpu/src/cuda/internal_shared.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/*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. -// 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*/ - -#ifndef __OPENCV_internal_shared_HPP__ -#define __OPENCV_internal_shared_HPP__ - -#include -#include - -#include "opencv2/core/cuda_devptrs.hpp" -#include "opencv2/core/cuda/common.hpp" -#include "opencv2/gpunvidia/private.hpp" - - -#include "safe_call.hpp" - - - -#endif /* __OPENCV_internal_shared_HPP__ */ diff --git a/modules/gpu/src/cuda/safe_call.hpp b/modules/gpu/src/cuda/safe_call.hpp deleted file mode 100644 index 35530bee36..0000000000 --- a/modules/gpu/src/cuda/safe_call.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/*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. -// 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*/ - -#ifndef __OPENCV_CUDA_SAFE_CALL_HPP__ -#define __OPENCV_CUDA_SAFE_CALL_HPP__ - -#include - - - -#endif /* __OPENCV_CUDA_SAFE_CALL_HPP__ */ diff --git a/modules/gpu/src/cuda/texture_binder.hpp b/modules/gpu/src/cuda/texture_binder.hpp deleted file mode 100644 index e9677460ff..0000000000 --- a/modules/gpu/src/cuda/texture_binder.hpp +++ /dev/null @@ -1,92 +0,0 @@ -/*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. -// 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*/ - -#ifndef OPENCV_GPU_TEXTURE_BINDER_HPP_ -#define OPENCV_GPU_TEXTURE_BINDER_HPP_ - -#include "opencv2/gpu/devmem2d.hpp" -#include - -namespace cv -{ - namespace gpu - { - class TextureBinder - { - public: - template - TextureBinder(const PtrStepSz& arr, const struct texture& tex) : texref(&tex) - { - cudaChannelFormatDesc desc = cudaCreateChannelDesc(); - cudaSafeCall( cudaBindTexture2D(0, tex, arr.data, desc, arr.cols, arr.rows, arr.step) ); - } - - template - TextureBinder(const PtrSz& arr, const struct texture &tex) : texref(&tex) - { - cudaChannelFormatDesc desc = cudaCreateChannelDesc(); - cudaSafeCall( cudaBindTexture(0, tex, arr.data, desc, arr.size * arr.elemSize()) ); - } - - template - TextureBinder(const A& arr, const struct texture& tex, const cudaChannelFormatDesc& desc) : texref(&tex) - { - cudaSafeCall( cudaBindTexture2D(0, tex, arr.data, desc, arr.cols, arr.rows, arr.step) ); - } - - - ~TextureBinder() - { - cudaSafeCall( cudaUnbindTexture(texref) ); - } - private: - const struct textureReference *texref; - }; - } - - namespace cuda - { - using cv::gpu::TextureBinder; - } -} - -#endif /* OPENCV_GPU_TEXTURE_BINDER_HPP_*/ diff --git a/modules/gpu/src/error.cpp b/modules/gpu/src/error.cpp deleted file mode 100644 index d0a621d79f..0000000000 --- a/modules/gpu/src/error.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/*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. -// 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 "precomp.hpp" - -using namespace cv; -using namespace cv::gpu; diff --git a/modules/gpu/src/speckle_filtering.cpp b/modules/gpu/src/speckle_filtering.cpp deleted file mode 100644 index 85b6c47c77..0000000000 --- a/modules/gpu/src/speckle_filtering.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/*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. -// 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 "precomp.hpp" - -using namespace cv; - -namespace cv { -// TODO: conflicts with calib3d.hpp : filterSpeckles, should be removed ? - -//! Speckle filtering - filters small connected components on diparity image. -//! It sets pixel (x,y) to newVal if it coresponds to small CC with size < maxSpeckleSize. -//! Threshold for border between CC is diffThreshold; - CV_EXPORTS void filterSpeckles(Mat& img, uchar newVal, int maxSpeckleSize, uchar diffThreshold, Mat& buf); -} - -typedef Point_ Point2s; - -void cv::filterSpeckles( Mat& img, uchar newVal, int maxSpeckleSize, uchar maxDiff, Mat& _buf) -{ - int MaxD = 1024; - int WinSz = 64; - - int bufSize0 = (MaxD + 2)*sizeof(int) + (img.rows+WinSz+2)*MaxD*sizeof(int) + - (img.rows + WinSz + 2)*sizeof(int) + - (img.rows+WinSz+2)*MaxD*(WinSz+1)*sizeof(uchar) + 256; - int bufSize1 = (img.cols + 9 + 2) * sizeof(int) + 256; - int bufSz = std::max(bufSize0 * 1, bufSize1 * 2); - - _buf.create(1, bufSz, CV_8U); - - CV_Assert( img.type() == CV_8U ); - - int width = img.cols, height = img.rows, npixels = width*height; - size_t bufSize = npixels*(int)(sizeof(Point2s) + sizeof(int) + sizeof(uchar)); - if( !_buf.isContinuous() || !_buf.data || _buf.cols*_buf.rows*_buf.elemSize() < bufSize ) - _buf.create(1, (int)bufSize, CV_8U); - - uchar* buf = _buf.data; - int i, j, dstep = (int)(img.step/sizeof(uchar)); - int* labels = (int*)buf; - buf += npixels*sizeof(labels[0]); - Point2s* wbuf = (Point2s*)buf; - buf += npixels*sizeof(wbuf[0]); - uchar* rtype = (uchar*)buf; - int curlabel = 0; - - // clear out label assignments - memset(labels, 0, npixels*sizeof(labels[0])); - - for( i = 0; i < height; i++ ) - { - uchar* ds = img.ptr(i); - int* ls = labels + width*i; - - for( j = 0; j < width; j++ ) - { - if( ds[j] != newVal ) // not a bad disparity - { - if( ls[j] ) // has a label, check for bad label - { - if( rtype[ls[j]] ) // small region, zero out disparity - ds[j] = (uchar)newVal; - } - // no label, assign and propagate - else - { - Point2s* ws = wbuf; // initialize wavefront - Point2s p((short)j, (short)i); // current pixel - curlabel++; // next label - int count = 0; // current region size - ls[j] = curlabel; - - // wavefront propagation - while( ws >= wbuf ) // wavefront not empty - { - count++; - // put neighbors onto wavefront - uchar* dpp = &img.at(p.y, p.x); - uchar dp = *dpp; - int* lpp = labels + width*p.y + p.x; - - if( p.x < width-1 && !lpp[+1] && dpp[+1] != newVal && std::abs(dp - dpp[+1]) <= maxDiff ) - { - lpp[+1] = curlabel; - *ws++ = Point2s(p.x+1, p.y); - } - - if( p.x > 0 && !lpp[-1] && dpp[-1] != newVal && std::abs(dp - dpp[-1]) <= maxDiff ) - { - lpp[-1] = curlabel; - *ws++ = Point2s(p.x-1, p.y); - } - - if( p.y < height-1 && !lpp[+width] && dpp[+dstep] != newVal && std::abs(dp - dpp[+dstep]) <= maxDiff ) - { - lpp[+width] = curlabel; - *ws++ = Point2s(p.x, p.y+1); - } - - if( p.y > 0 && !lpp[-width] && dpp[-dstep] != newVal && std::abs(dp - dpp[-dstep]) <= maxDiff ) - { - lpp[-width] = curlabel; - *ws++ = Point2s(p.x, p.y-1); - } - - // pop most recent and propagate - // NB: could try least recent, maybe better convergence - p = *--ws; - } - - // assign label type - if( count <= maxSpeckleSize ) // speckle region - { - //printf("count = %d\n", count); - rtype[ls[j]] = 1; // small region label - ds[j] = (uchar)newVal; - } - else - { - //printf("count = %d\n", count); - rtype[ls[j]] = 0; // large region label - } - } - } - } - } -} -