minor
authorVladislav Vinogradov <no@email>
Wed, 23 Nov 2011 13:26:24 +0000 (13:26 +0000)
committerVladislav Vinogradov <no@email>
Wed, 23 Nov 2011 13:26:24 +0000 (13:26 +0000)
modules/core/src/gpumat.cpp

index 87b7f60..f06772c 100644 (file)
@@ -52,7 +52,7 @@
 \r
 #ifdef HAVE_OPENGL\r
     #include <GL/gl.h>\r
-    #include <Gl/glu.h>\r
+    #include <GL/glu.h>\r
 \r
     #ifdef HAVE_CUDA\r
         #include <cuda_gl_interop.h>\r
@@ -66,15 +66,15 @@ using namespace cv::gpu;
 ////////////////////////////////////////////////////////////////////////\r
 // GpuMat\r
 \r
-cv::gpu::GpuMat::GpuMat(const GpuMat& m) \r
+cv::gpu::GpuMat::GpuMat(const GpuMat& m)\r
     : flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data), refcount(m.refcount), datastart(m.datastart), dataend(m.dataend)\r
 {\r
     if (refcount)\r
         CV_XADD(refcount, 1);\r
 }\r
 \r
-cv::gpu::GpuMat::GpuMat(int rows_, int cols_, int type_, void* data_, size_t step_) : \r
-    flags(Mat::MAGIC_VAL + (type_ & TYPE_MASK)), rows(rows_), cols(cols_), \r
+cv::gpu::GpuMat::GpuMat(int rows_, int cols_, int type_, void* data_, size_t step_) :\r
+    flags(Mat::MAGIC_VAL + (type_ & TYPE_MASK)), rows(rows_), cols(cols_),\r
     step(step_), data((uchar*)data_), refcount(0),\r
     datastart((uchar*)data_), dataend((uchar*)data_)\r
 {\r
@@ -87,7 +87,7 @@ cv::gpu::GpuMat::GpuMat(int rows_, int cols_, int type_, void* data_, size_t ste
     }\r
     else\r
     {\r
-        if (rows == 1) \r
+        if (rows == 1)\r
             step = minstep;\r
 \r
         CV_DbgAssert(step >= minstep);\r
@@ -97,7 +97,7 @@ cv::gpu::GpuMat::GpuMat(int rows_, int cols_, int type_, void* data_, size_t ste
     dataend += step * (rows - 1) + minstep;\r
 }\r
 \r
-cv::gpu::GpuMat::GpuMat(Size size_, int type_, void* data_, size_t step_) : \r
+cv::gpu::GpuMat::GpuMat(Size size_, int type_, void* data_, size_t step_) :\r
     flags(Mat::MAGIC_VAL + (type_ & TYPE_MASK)), rows(size_.height), cols(size_.width),\r
     step(step_), data((uchar*)data_), refcount(0),\r
     datastart((uchar*)data_), dataend((uchar*)data_)\r
@@ -111,7 +111,7 @@ cv::gpu::GpuMat::GpuMat(Size size_, int type_, void* data_, size_t step_) :
     }\r
     else\r
     {\r
-        if (rows == 1) \r
+        if (rows == 1)\r
             step = minstep;\r
 \r
         CV_DbgAssert(step >= minstep);\r
@@ -158,7 +158,7 @@ cv::gpu::GpuMat::GpuMat(const GpuMat& m, Range rowRange, Range colRange)
         rows = cols = 0;\r
 }\r
 \r
-cv::gpu::GpuMat::GpuMat(const GpuMat& m, Rect roi) : \r
+cv::gpu::GpuMat::GpuMat(const GpuMat& m, Rect roi) :\r
     flags(m.flags), rows(roi.height), cols(roi.width),\r
     step(m.step), data(m.data + roi.y*step), refcount(m.refcount),\r
     datastart(m.datastart), dataend(m.dataend)\r
@@ -175,10 +175,10 @@ cv::gpu::GpuMat::GpuMat(const GpuMat& m, Rect roi) :
         rows = cols = 0;\r
 }\r
 \r
-cv::gpu::GpuMat::GpuMat(const Mat& m) : \r
-    flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0) \r
-{ \r
-    upload(m); \r
+cv::gpu::GpuMat::GpuMat(const Mat& m) :\r
+    flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0)\r
+{\r
+    upload(m);\r
 }\r
 \r
 GpuMat& cv::gpu::GpuMat::operator = (const GpuMat& m)\r
@@ -195,9 +195,9 @@ GpuMat& cv::gpu::GpuMat::operator = (const GpuMat& m)
 void cv::gpu::GpuMat::swap(GpuMat& b)\r
 {\r
     std::swap(flags, b.flags);\r
-    std::swap(rows, b.rows); \r
+    std::swap(rows, b.rows);\r
     std::swap(cols, b.cols);\r
-    std::swap(step, b.step); \r
+    std::swap(step, b.step);\r
     std::swap(data, b.data);\r
     std::swap(datastart, b.datastart);\r
     std::swap(dataend, b.dataend);\r
@@ -230,20 +230,20 @@ void cv::gpu::GpuMat::locateROI(Size& wholeSize, Point& ofs) const
 \r
 GpuMat& cv::gpu::GpuMat::adjustROI(int dtop, int dbottom, int dleft, int dright)\r
 {\r
-    Size wholeSize; \r
+    Size wholeSize;\r
     Point ofs;\r
     locateROI(wholeSize, ofs);\r
 \r
     size_t esz = elemSize();\r
 \r
-    int row1 = std::max(ofs.y - dtop, 0); \r
+    int row1 = std::max(ofs.y - dtop, 0);\r
     int row2 = std::min(ofs.y + rows + dbottom, wholeSize.height);\r
 \r
     int col1 = std::max(ofs.x - dleft, 0);\r
     int col2 = std::min(ofs.x + cols + dright, wholeSize.width);\r
 \r
     data += (row1 - ofs.y) * step + (col1 - ofs.x) * esz;\r
-    rows = row2 - row1; \r
+    rows = row2 - row1;\r
     cols = col2 - col1;\r
 \r
     if (esz * cols == step || rows == 1)\r
@@ -329,9 +329,9 @@ namespace
 \r
 namespace\r
 {\r
-    void throw_nogpu() \r
-    { \r
-        CV_Error(CV_GpuNotSupported, "The library is compiled without GPU support"); \r
+    void throw_nogpu()\r
+    {\r
+        CV_Error(CV_GpuNotSupported, "The library is compiled without GPU support");\r
     }\r
 \r
     class EmptyFuncTable : public GpuFuncTable\r
@@ -361,7 +361,7 @@ namespace
 \r
 #else // HAVE_CUDA\r
 \r
-namespace cv { namespace gpu { namespace device \r
+namespace cv { namespace gpu { namespace device\r
 {\r
     void copy_to_with_mask(DevMem2Db src, DevMem2Db dst, int depth, DevMem2Db mask, int channels, cudaStream_t stream);\r
 \r
@@ -418,15 +418,15 @@ namespace
 \r
 namespace cv { namespace gpu\r
 {\r
-    CV_EXPORTS void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask, cudaStream_t stream = 0) \r
-    { \r
+    CV_EXPORTS void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask, cudaStream_t stream = 0)\r
+    {\r
         ::cv::gpu::device::copy_to_with_mask(src, dst, src.depth(), mask, src.channels(), stream);\r
     }\r
 \r
     CV_EXPORTS void convertTo(const GpuMat& src, GpuMat& dst)\r
     {\r
         ::cv::gpu::device::convert_gpu(src.reshape(1), src.depth(), dst.reshape(1), dst.depth(), 1.0, 0.0, 0);\r
-    }  \r
+    }\r
 \r
     CV_EXPORTS void convertTo(const GpuMat& src, GpuMat& dst, double alpha, double beta, cudaStream_t stream = 0)\r
     {\r
@@ -437,7 +437,7 @@ namespace cv { namespace gpu
     {\r
         typedef void (*caller_t)(GpuMat& src, Scalar s, cudaStream_t stream);\r
 \r
-        static const caller_t callers[] = \r
+        static const caller_t callers[] =\r
         {\r
             kernelSetCaller<uchar>, kernelSetCaller<schar>, kernelSetCaller<ushort>, kernelSetCaller<short>, kernelSetCaller<int>,\r
             kernelSetCaller<float>, kernelSetCaller<double>\r
@@ -450,7 +450,7 @@ namespace cv { namespace gpu
     {\r
         typedef void (*caller_t)(GpuMat& src, Scalar s, const GpuMat& mask, cudaStream_t stream);\r
 \r
-        static const caller_t callers[] = \r
+        static const caller_t callers[] =\r
         {\r
             kernelSetCaller<uchar>, kernelSetCaller<schar>, kernelSetCaller<ushort>, kernelSetCaller<short>, kernelSetCaller<int>,\r
             kernelSetCaller<float>, kernelSetCaller<double>\r
@@ -524,11 +524,11 @@ namespace
 \r
             cudaSafeCall( cudaDeviceSynchronize() );\r
         }\r
-    };    \r
+    };\r
 \r
     //////////////////////////////////////////////////////////////////////////\r
     // Set\r
-    \r
+\r
     template<int SDEPTH, int SCN> struct NppSetFunc\r
     {\r
         typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;\r
@@ -575,7 +575,7 @@ namespace
 \r
             cudaSafeCall( cudaDeviceSynchronize() );\r
         }\r
-    };    \r
+    };\r
 \r
     template<int SDEPTH, int SCN> struct NppSetMaskFunc\r
     {\r
@@ -623,35 +623,35 @@ namespace
 \r
             cudaSafeCall( cudaDeviceSynchronize() );\r
         }\r
-    };    \r
+    };\r
 \r
     class CudaFuncTable : public GpuFuncTable\r
     {\r
     public:\r
-        void copy(const Mat& src, GpuMat& dst) const \r
-        { \r
+        void copy(const Mat& src, GpuMat& dst) const\r
+        {\r
             cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyHostToDevice) );\r
         }\r
         void copy(const GpuMat& src, Mat& dst) const\r
-        { \r
+        {\r
             cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyDeviceToHost) );\r
         }\r
         void copy(const GpuMat& src, GpuMat& dst) const\r
-        { \r
+        {\r
             cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyDeviceToDevice) );\r
         }\r
 \r
-        void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask) const \r
-        { \r
+        void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask) const\r
+        {\r
             ::cv::gpu::copyWithMask(src, dst, mask);\r
         }\r
 \r
-        void convert(const GpuMat& src, GpuMat& dst) const \r
-        { \r
+        void convert(const GpuMat& src, GpuMat& dst) const\r
+        {\r
             typedef void (*caller_t)(const GpuMat& src, GpuMat& dst);\r
             static const caller_t callers[7][7][7] =\r
             {\r
-                {                \r
+                {\r
                     /*  8U ->  8U */ {0, 0, 0, 0},\r
                     /*  8U ->  8S */ {::cv::gpu::convertTo, ::cv::gpu::convertTo, ::cv::gpu::convertTo, ::cv::gpu::convertTo},\r
                     /*  8U -> 16U */ {NppCvt<CV_8U, CV_16U, nppiConvert_8u16u_C1R>::cvt,::cv::gpu::convertTo,::cv::gpu::convertTo,NppCvt<CV_8U, CV_16U, nppiConvert_8u16u_C4R>::cvt},\r
@@ -722,8 +722,8 @@ namespace
             func(src, dst);\r
         }\r
 \r
-        void convert(const GpuMat& src, GpuMat& dst, double alpha, double beta) const \r
-        { \r
+        void convert(const GpuMat& src, GpuMat& dst, double alpha, double beta) const\r
+        {\r
             ::cv::gpu::convertTo(src, dst, alpha, beta);\r
         }\r
 \r
@@ -796,7 +796,7 @@ namespace
             cudaFree(devPtr);\r
         }\r
     };\r
-    \r
+\r
     const GpuFuncTable* gpuFuncTable()\r
     {\r
         static CudaFuncTable funcTable;\r
@@ -883,7 +883,7 @@ GpuMat& cv::gpu::GpuMat::setTo(Scalar s, const GpuMat& mask)
     CV_Assert(mask.empty() || mask.type() == CV_8UC1);\r
     CV_DbgAssert(!empty());\r
 \r
-    gpuFuncTable()->setTo(*this, s, mask);    \r
+    gpuFuncTable()->setTo(*this, s, mask);\r
 \r
     return *this;\r
 }\r
@@ -948,12 +948,12 @@ void cv::gpu::GpuMat::release()
 \r
 namespace\r
 {\r
-    void throw_nogl() \r
+    void throw_nogl()\r
     {\r
     #ifndef HAVE_OPENGL\r
-        CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support"); \r
+        CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");\r
     #else\r
-        CV_Error(CV_OpenGlNotSupported, "OpenGL context doesn't exist"); \r
+        CV_Error(CV_OpenGlNotSupported, "OpenGL context doesn't exist");\r
     #endif\r
     }\r
 \r
@@ -1012,7 +1012,7 @@ void cv::gpu::setGlFuncTab(const GlFuncTab* tab)
     #endif\r
 \r
     namespace\r
-    {    \r
+    {\r
         const GLenum gl_types[] = {GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE};\r
 \r
     #ifdef HAVE_CUDA\r
@@ -1034,7 +1034,7 @@ void cv::gpu::setGlDevice(int device)
         if (!glFuncTab()->isGlContextInitialized())\r
             throw_nogl();\r
 \r
-        cudaSafeCall( cudaGLSetGLDevice(device) ); \r
+        cudaSafeCall( cudaGLSetGLDevice(device) );\r
 \r
         g_isCudaGlDeviceInitialized = true;\r
     #endif\r
@@ -1064,17 +1064,17 @@ namespace
         cudaGraphicsResource_t resource_;\r
     };\r
 \r
-    inline CudaGlInterop::CudaGlInterop() : resource_(0) \r
+    inline CudaGlInterop::CudaGlInterop() : resource_(0)\r
     {\r
     }\r
 \r
-    CudaGlInterop::~CudaGlInterop() \r
-    { \r
+    CudaGlInterop::~CudaGlInterop()\r
+    {\r
         if (resource_)\r
         {\r
             cudaGraphicsUnregisterResource(resource_);\r
             resource_ = 0;\r
-        } \r
+        }\r
     }\r
 \r
     void CudaGlInterop::registerBuffer(unsigned int buffer)\r
@@ -1097,7 +1097,7 @@ namespace
         void* dst_ptr;\r
         size_t num_bytes;\r
         cudaSafeCall( cudaGraphicsResourceGetMappedPointer(&dst_ptr, &num_bytes, resource_) );\r
-        \r
+\r
         const void* src_ptr = mat.ptr();\r
         size_t widthBytes = mat.cols * mat.elemSize();\r
 \r
@@ -1177,20 +1177,21 @@ private:
 #endif\r
 };\r
 \r
-inline cv::gpu::GlBuffer::Impl::Impl() : buffer_(0) \r
+inline cv::gpu::GlBuffer::Impl::Impl() : buffer_(0)\r
 {\r
 }\r
 \r
-cv::gpu::GlBuffer::Impl::Impl(int rows, int cols, int type, unsigned int target) : buffer_(0) \r
-{ \r
+cv::gpu::GlBuffer::Impl::Impl(int rows, int cols, int type, unsigned int target) : buffer_(0)\r
+{\r
     if (!glFuncTab()->isGlContextInitialized())\r
         throw_nogl();\r
 \r
     CV_DbgAssert(rows > 0 && cols > 0);\r
     CV_DbgAssert(CV_MAT_DEPTH(type) >= 0 && CV_MAT_DEPTH(type) <= CV_64F);\r
-    \r
+\r
     glFuncTab()->genBuffers(1, &buffer_);\r
     CV_CheckGlError();\r
+    CV_Assert(buffer_ != 0);\r
 \r
     size_t size = rows * cols * CV_ELEM_SIZE(type);\r
 \r
@@ -1201,24 +1202,25 @@ cv::gpu::GlBuffer::Impl::Impl(int rows, int cols, int type, unsigned int target)
     CV_CheckGlError();\r
 \r
     glFuncTab()->bindBuffer(target, 0);\r
-    \r
+\r
 #ifdef HAVE_CUDA\r
     if (g_isCudaGlDeviceInitialized)\r
         cudaGlInterop_.registerBuffer(buffer_);\r
 #endif\r
 }\r
 \r
-cv::gpu::GlBuffer::Impl::Impl(const Mat& m, unsigned int target) : buffer_(0) \r
-{ \r
+cv::gpu::GlBuffer::Impl::Impl(const Mat& m, unsigned int target) : buffer_(0)\r
+{\r
     if (!glFuncTab()->isGlContextInitialized())\r
         throw_nogl();\r
 \r
     CV_DbgAssert(m.rows > 0 && m.cols > 0);\r
     CV_DbgAssert(m.depth() >= 0 && m.depth() <= CV_64F);\r
     CV_Assert(m.isContinuous());\r
\r
+\r
     glFuncTab()->genBuffers(1, &buffer_);\r
     CV_CheckGlError();\r
+    CV_Assert(buffer_ != 0);\r
 \r
     size_t size = m.rows * m.cols * m.elemSize();\r
 \r
@@ -1229,15 +1231,15 @@ cv::gpu::GlBuffer::Impl::Impl(const Mat& m, unsigned int target) : buffer_(0)
     CV_CheckGlError();\r
 \r
     glFuncTab()->bindBuffer(target, 0);\r
-    \r
+\r
 #ifdef HAVE_CUDA\r
     if (g_isCudaGlDeviceInitialized)\r
         cudaGlInterop_.registerBuffer(buffer_);\r
 #endif\r
 }\r
 \r
-cv::gpu::GlBuffer::Impl::~Impl() \r
-{ \r
+cv::gpu::GlBuffer::Impl::~Impl()\r
+{\r
     try\r
     {\r
         if (buffer_)\r
@@ -1272,7 +1274,7 @@ void cv::gpu::GlBuffer::Impl::copyFrom(const Mat& m, unsigned int target)
 \r
 #ifdef HAVE_CUDA\r
 \r
-void cv::gpu::GlBuffer::Impl::copyFrom(const GpuMat& mat, cudaStream_t stream) \r
+void cv::gpu::GlBuffer::Impl::copyFrom(const GpuMat& mat, cudaStream_t stream)\r
 {\r
     if (!g_isCudaGlDeviceInitialized)\r
         cvError(CV_GpuApiCallError, "copyFrom", "cuda GL device wasn't initialized, call setGlDevice", __FILE__, __LINE__);\r
@@ -1284,16 +1286,16 @@ void cv::gpu::GlBuffer::Impl::copyFrom(const GpuMat& mat, cudaStream_t stream)
 \r
 #endif // HAVE_CUDA\r
 \r
-inline void cv::gpu::GlBuffer::Impl::bind(unsigned int target) const \r
+inline void cv::gpu::GlBuffer::Impl::bind(unsigned int target) const\r
 {\r
     CV_Assert(buffer_ != 0);\r
 \r
-    glFuncTab()->bindBuffer(target, buffer_); \r
+    glFuncTab()->bindBuffer(target, buffer_);\r
     CV_CheckGlError();\r
 }\r
 \r
 inline void cv::gpu::GlBuffer::Impl::unbind(unsigned int target) const\r
-{ \r
+{\r
     glFuncTab()->bindBuffer(target, 0);\r
 }\r
 \r
@@ -1397,7 +1399,7 @@ cv::gpu::GlBuffer::GlBuffer(const GpuMat& d_mat, Usage usage) : rows(0), cols(0)
 #endif\r
 }\r
 \r
-cv::gpu::GlBuffer::GlBuffer(const GlBuffer& other) \r
+cv::gpu::GlBuffer::GlBuffer(const GlBuffer& other)\r
     : rows(other.rows), cols(other.cols), type_(other.type_), usage_(other.usage_), impl_(other.impl_)\r
 {\r
 }\r
@@ -1582,6 +1584,7 @@ cv::gpu::GlTexture::Impl::Impl(int rows, int cols, int type) : tex_(0)
 \r
     glGenTextures(1, &tex_);\r
     CV_CheckGlError();\r
+    CV_Assert(tex_ != 0);\r
 \r
     glBindTexture(GL_TEXTURE_2D, tex_);\r
     CV_CheckGlError();\r
@@ -1589,7 +1592,7 @@ cv::gpu::GlTexture::Impl::Impl(int rows, int cols, int type) : tex_(0)
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\r
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\r
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); \r
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
     CV_CheckGlError();\r
 \r
     GLenum format = cn == 1 ? GL_LUMINANCE : cn == 3 ? GL_BGR : GL_BGRA;\r
@@ -1616,6 +1619,7 @@ cv::gpu::GlTexture::Impl::Impl(const Mat& mat, bool bgra) : tex_(0)
 \r
     glGenTextures(1, &tex_);\r
     CV_CheckGlError();\r
+    CV_Assert(tex_ != 0);\r
 \r
     glBindTexture(GL_TEXTURE_2D, tex_);\r
     CV_CheckGlError();\r
@@ -1623,7 +1627,7 @@ cv::gpu::GlTexture::Impl::Impl(const Mat& mat, bool bgra) : tex_(0)
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\r
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\r
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); \r
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
     CV_CheckGlError();\r
 \r
     GLenum format = cn == 1 ? GL_LUMINANCE : (cn == 3 ? (bgra ? GL_BGR : GL_RGB) : (bgra ? GL_BGRA : GL_RGBA));\r
@@ -1643,13 +1647,14 @@ cv::gpu::GlTexture::Impl::Impl(const GlBuffer& buf, bool bgra) : tex_(0)
     int depth = buf.depth();\r
     int cn = buf.channels();\r
 \r
-    CV_DbgAssert(buf.rows() > 0 && buf.cols() > 0);\r
+    CV_DbgAssert(buf.rows > 0 && buf.cols > 0);\r
     CV_Assert(cn == 1 || cn == 3 || cn == 4);\r
     CV_Assert(depth >= 0 && depth <= CV_32F);\r
     CV_Assert(buf.usage() == GlBuffer::TEXTURE_BUFFER);\r
 \r
     glGenTextures(1, &tex_);\r
     CV_CheckGlError();\r
+    CV_Assert(tex_ != 0);\r
 \r
     glBindTexture(GL_TEXTURE_2D, tex_);\r
     CV_CheckGlError();\r
@@ -1657,7 +1662,7 @@ cv::gpu::GlTexture::Impl::Impl(const GlBuffer& buf, bool bgra) : tex_(0)
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\r
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\r
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); \r
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
     CV_CheckGlError();\r
 \r
     GLenum format = cn == 1 ? GL_LUMINANCE : (cn == 3 ? (bgra ? GL_BGR : GL_RGB) : (bgra ? GL_BGRA : GL_RGBA));\r
@@ -1790,7 +1795,7 @@ cv::gpu::GlTexture::GlTexture(const GlBuffer& buf, bool bgra) : rows(0), cols(0)
 #endif\r
 }\r
 \r
-cv::gpu::GlTexture::GlTexture(const GlTexture& other) \r
+cv::gpu::GlTexture::GlTexture(const GlTexture& other)\r
     : rows(other.rows), cols(other.cols), type_(other.type_), impl_(other.impl_)\r
 {\r
 }\r
@@ -1874,8 +1879,8 @@ void cv::gpu::GlTexture::unbind() const
 ////////////////////////////////////////////////////////////////////////\r
 // GlArrays\r
 \r
-void cv::gpu::GlArrays::setVertexArray(const GlBuffer& vertex) \r
-{ \r
+void cv::gpu::GlArrays::setVertexArray(const GlBuffer& vertex)\r
+{\r
     CV_Assert(vertex.usage() == GlBuffer::ARRAY_BUFFER);\r
 \r
     int cn = vertex.channels();\r
@@ -1884,65 +1889,65 @@ void cv::gpu::GlArrays::setVertexArray(const GlBuffer& vertex)
     CV_Assert(cn == 2 || cn == 3 || cn == 4);\r
     CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
 \r
-    vertex_ = vertex; \r
+    vertex_ = vertex;\r
 }\r
 \r
-void cv::gpu::GlArrays::setVertexArray(const GpuMat& vertex) \r
-{ \r
+void cv::gpu::GlArrays::setVertexArray(const GpuMat& vertex)\r
+{\r
     int cn = vertex.channels();\r
     int depth = vertex.depth();\r
 \r
     CV_Assert(cn == 2 || cn == 3 || cn == 4);\r
     CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
 \r
-    vertex_.copyFrom(vertex); \r
+    vertex_.copyFrom(vertex);\r
 }\r
 \r
-void cv::gpu::GlArrays::setVertexArray(InputArray vertex) \r
-{ \r
+void cv::gpu::GlArrays::setVertexArray(InputArray vertex)\r
+{\r
     int cn = vertex.channels();\r
     int depth = vertex.depth();\r
 \r
     CV_Assert(cn == 2 || cn == 3 || cn == 4);\r
     CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
 \r
-    vertex_.copyFrom(vertex); \r
+    vertex_.copyFrom(vertex);\r
 }\r
 \r
-void cv::gpu::GlArrays::setColorArray(const GlBuffer& color, bool bgra) \r
-{ \r
+void cv::gpu::GlArrays::setColorArray(const GlBuffer& color, bool bgra)\r
+{\r
     CV_Assert(color.usage() == GlBuffer::ARRAY_BUFFER);\r
 \r
     int cn = color.channels();\r
 \r
     CV_Assert((cn == 3 && !bgra) || cn == 4);\r
 \r
-    color_ = color; \r
-    bgra_ = bgra; \r
+    color_ = color;\r
+    bgra_ = bgra;\r
 }\r
 \r
-void cv::gpu::GlArrays::setColorArray(const GpuMat& color, bool bgra) \r
-{ \r
+void cv::gpu::GlArrays::setColorArray(const GpuMat& color, bool bgra)\r
+{\r
     int cn = color.channels();\r
 \r
     CV_Assert((cn == 3 && !bgra) || cn == 4);\r
 \r
-    color_.copyFrom(color); \r
-    bgra_ = bgra; \r
+    color_.copyFrom(color);\r
+    bgra_ = bgra;\r
 }\r
 \r
-void cv::gpu::GlArrays::setColorArray(InputArray color, bool bgra) \r
-{ \r
+void cv::gpu::GlArrays::setColorArray(InputArray color, bool bgra)\r
+{\r
     int cn = color.channels();\r
 \r
     CV_Assert((cn == 3 && !bgra) || cn == 4);\r
 \r
-    color_.copyFrom(color); \r
-    bgra_ = bgra; \r
+    color_.copyFrom(color);\r
+    bgra_ = bgra;\r
 }\r
 \r
-void cv::gpu::GlArrays::setNormalArray(const GlBuffer& normal) \r
-{ \r
+void cv::gpu::GlArrays::setNormalArray(const GlBuffer& normal)\r
+{\r
     CV_Assert(normal.usage() == GlBuffer::ARRAY_BUFFER);\r
 \r
     int cn = normal.channels();\r
@@ -1951,33 +1956,33 @@ void cv::gpu::GlArrays::setNormalArray(const GlBuffer& normal)
     CV_Assert(cn == 3);\r
     CV_Assert(depth == CV_8S || depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
 \r
-    normal_ = normal; \r
+    normal_ = normal;\r
 }\r
 \r
-void cv::gpu::GlArrays::setNormalArray(const GpuMat& normal) \r
-{ \r
+void cv::gpu::GlArrays::setNormalArray(const GpuMat& normal)\r
+{\r
     int cn = normal.channels();\r
     int depth = normal.depth();\r
 \r
     CV_Assert(cn == 3);\r
     CV_Assert(depth == CV_8S || depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
 \r
-    normal_.copyFrom(normal); \r
+    normal_.copyFrom(normal);\r
 }\r
 \r
-void cv::gpu::GlArrays::setNormalArray(InputArray normal) \r
-{ \r
+void cv::gpu::GlArrays::setNormalArray(InputArray normal)\r
+{\r
     int cn = normal.channels();\r
     int depth = normal.depth();\r
 \r
     CV_Assert(cn == 3);\r
     CV_Assert(depth == CV_8S || depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
 \r
-    normal_.copyFrom(normal); \r
+    normal_.copyFrom(normal);\r
 }\r
 \r
-void cv::gpu::GlArrays::setTexCoordArray(const GlBuffer& texCoord) \r
-{ \r
+void cv::gpu::GlArrays::setTexCoordArray(const GlBuffer& texCoord)\r
+{\r
     CV_Assert(texCoord.usage() == GlBuffer::ARRAY_BUFFER);\r
 \r
     int cn = texCoord.channels();\r
@@ -1986,29 +1991,29 @@ void cv::gpu::GlArrays::setTexCoordArray(const GlBuffer& texCoord)
     CV_Assert(cn >= 1 && cn <= 4);\r
     CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
 \r
-    texCoord_ = texCoord; \r
+    texCoord_ = texCoord;\r
 }\r
 \r
-void cv::gpu::GlArrays::setTexCoordArray(const GpuMat& texCoord) \r
-{ \r
+void cv::gpu::GlArrays::setTexCoordArray(const GpuMat& texCoord)\r
+{\r
     int cn = texCoord.channels();\r
     int depth = texCoord.depth();\r
 \r
     CV_Assert(cn >= 1 && cn <= 4);\r
     CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
 \r
-    texCoord_.copyFrom(texCoord); \r
+    texCoord_.copyFrom(texCoord);\r
 }\r
 \r
-void cv::gpu::GlArrays::setTexCoordArray(InputArray texCoord) \r
-{ \r
+void cv::gpu::GlArrays::setTexCoordArray(InputArray texCoord)\r
+{\r
     int cn = texCoord.channels();\r
     int depth = texCoord.depth();\r
 \r
     CV_Assert(cn >= 1 && cn <= 4);\r
     CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
 \r
-    texCoord_.copyFrom(texCoord); \r
+    texCoord_.copyFrom(texCoord);\r
 }\r
 \r
 void cv::gpu::GlArrays::bind() const\r
@@ -2054,7 +2059,7 @@ void cv::gpu::GlArrays::bind() const
         color_.bind();\r
 \r
         int cn = color_.channels();\r
-        int format = cn == 3 ? cn : (bgra_ ? GL_BGRA : 4); \r
+        int format = cn == 3 ? cn : (bgra_ ? GL_BGRA : 4);\r
 \r
         glColorPointer(format, gl_types[color_.depth()], 0, 0);\r
         CV_CheckGlError();\r
@@ -2125,13 +2130,13 @@ void cv::gpu::render(const GlTexture& tex, Rect_<double> wndRect, Rect_<double>
         glBegin(GL_QUADS);\r
             glTexCoord2d(texRect.x, texRect.y);\r
             glVertex2d(wndRect.x, wndRect.y);\r
-            \r
+\r
             glTexCoord2d(texRect.x, texRect.y + texRect.height);\r
             glVertex2d(wndRect.x, (wndRect.y + wndRect.height));\r
-            \r
+\r
             glTexCoord2d(texRect.x + texRect.width, texRect.y + texRect.height);\r
             glVertex2d(wndRect.x + wndRect.width, (wndRect.y + wndRect.height));\r
-            \r
+\r
             glTexCoord2d(texRect.x + texRect.width, texRect.y);\r
             glVertex2d(wndRect.x + wndRect.width, wndRect.y);\r
         glEnd();\r
@@ -2159,7 +2164,7 @@ void cv::gpu::render(const GlArrays& arr, int mode)
 ////////////////////////////////////////////////////////////////////////\r
 // GlCamera\r
 \r
-cv::gpu::GlCamera::GlCamera() : \r
+cv::gpu::GlCamera::GlCamera() :\r
     eye_(0.0, 0.0, -5.0), center_(0.0, 0.0, 0.0), up_(0.0, 1.0, 0.0),\r
     pos_(0.0, 0.0, -5.0), yaw_(0.0), pitch_(0.0), roll_(0.0),\r
     useLookAtParams_(false),\r
@@ -2288,13 +2293,13 @@ void cv::gpu::error(const char *error_string, const char *file, const int line,
 \r
     if (uncaught_exception())\r
     {\r
-        const char* errorStr = cvErrorStr(code);            \r
-        const char* function = func ? func : "unknown function";    \r
+        const char* errorStr = cvErrorStr(code);\r
+        const char* function = func ? func : "unknown function";\r
 \r
         cerr << "OpenCV Error: " << errorStr << "(" << error_string << ") in " << function << ", file " << file << ", line " << line;\r
-        cerr.flush();            \r
+        cerr.flush();\r
     }\r
-    else    \r
+    else\r
         cv::error( cv::Exception(code, error_string, func, file, line) );\r
 }\r
 \r