fixed failure in Tonemap test

This commit is contained in:
Vadim Pisarevsky 2013-11-19 19:20:24 -05:00
parent d0b3c7a518
commit 677c7f27cb
7 changed files with 17 additions and 13 deletions

View File

@ -47,6 +47,7 @@
// */
#include "precomp.hpp"
#include "opencl_kernels.hpp"
namespace cv
{

View File

@ -3038,7 +3038,7 @@ const char* typeToStr(int t)
"?", "?", "?", "?"
};
int cn = CV_MAT_CN(t);
return cn >= 4 ? "?" : tab[CV_MAT_DEPTH(t)*4 + cn-1];
return cn > 4 ? "?" : tab[CV_MAT_DEPTH(t)*4 + cn-1];
}
const char* memopTypeToStr(int t)
@ -3055,7 +3055,7 @@ const char* memopTypeToStr(int t)
"?", "?", "?", "?"
};
int cn = CV_MAT_CN(t);
return cn >= 4 ? "?" : tab[CV_MAT_DEPTH(t)*4 + cn-1];
return cn > 4 ? "?" : tab[CV_MAT_DEPTH(t)*4 + cn-1];
}
const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf)

View File

@ -67,8 +67,6 @@
#define GET_OPTIMIZED(func) (func)
#endif
#include "opencl_kernels.hpp"
namespace cv
{

View File

@ -41,6 +41,7 @@
//M*/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
///////////////////////////////// UMat implementation ///////////////////////////////

View File

@ -90,6 +90,7 @@
\**********************************************************************************/
#include "precomp.hpp"
#include "opencl_kernels.hpp"
#include <limits>
#define CV_DESCALE(x,n) (((x) + (1 << ((n)-1))) >> (n))

View File

@ -47,6 +47,7 @@
// */
#include "precomp.hpp"
#include "opencl_kernels.hpp"
#include <iostream>
#include <vector>
@ -1901,7 +1902,7 @@ private:
};
#endif
static bool ocl_resize( InputArray _src, OutputArray _dst,
static bool ocl_resize( InputArray _src, OutputArray _dst, Size dsize,
double fx, double fy, int interpolation)
{
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
@ -1909,7 +1910,9 @@ static bool ocl_resize( InputArray _src, OutputArray _dst,
(interpolation == INTER_NEAREST ||
(interpolation == INTER_LINEAR && (depth == CV_8U || depth == CV_32F)))) )
return false;
UMat src = _src.getUMat(), dst = _dst.getUMat();
UMat src = _src.getUMat();
_dst.create(dsize, type);
UMat dst = _dst.getUMat();
ocl::Kernel k;
if (interpolation == INTER_LINEAR)
@ -2051,25 +2054,26 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
Size ssize = _src.size();
CV_Assert( ssize.area() > 0 );
CV_Assert( dsize.area() || (inv_scale_x > 0 && inv_scale_y > 0) );
if( !dsize.area() )
CV_Assert( dsize.area() > 0 || (inv_scale_x > 0 && inv_scale_y > 0) );
if( dsize.area() == 0 )
{
dsize = Size(saturate_cast<int>(ssize.width*inv_scale_x),
saturate_cast<int>(ssize.height*inv_scale_y));
CV_Assert( dsize.area() );
CV_Assert( dsize.area() > 0 );
}
else
{
inv_scale_x = (double)dsize.width/ssize.width;
inv_scale_y = (double)dsize.height/ssize.height;
}
_dst.create(dsize, _src.type());
if( ocl::useOpenCL() && _dst.kind() == _InputArray::UMAT &&
ocl_resize(_src, _dst, inv_scale_x, inv_scale_y, interpolation) )
ocl_resize(_src, _dst, dsize, inv_scale_x, inv_scale_y, interpolation) )
return;
Mat src = _src.getMat(), dst = _dst.getMat();
Mat src = _src.getMat();
_dst.create(dsize, src.type());
Mat dst = _dst.getMat();
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::resize(src, dst, (float)inv_scale_x, (float)inv_scale_y, interpolation))

View File

@ -49,7 +49,6 @@
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/core/private.hpp"
#include "opencv2/core/ocl.hpp"
#include "opencl_kernels.hpp"
#include <math.h>
#include <assert.h>