Skip to content

Commit

Permalink
enabled 3-channels support for cv::createSuperResolution_BTVL1
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Mar 20, 2014
1 parent 291458a commit 63d8a61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
15 changes: 6 additions & 9 deletions modules/imgproc/src/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3425,8 +3425,6 @@ static bool ocl_sepColFilter2D(const UMat & buf, UMat & dst, const Mat & kernelY
return k.run(2, globalsize, localsize, false);
}

#if 0

const int optimizedSepFilterLocalSize = 16;

static bool ocl_sepFilter2D_SinglePass(InputArray _src, OutputArray _dst,
Expand Down Expand Up @@ -3484,13 +3482,11 @@ static bool ocl_sepFilter2D_SinglePass(InputArray _src, OutputArray _dst,
return k.run(2, gt2, lt2, false);
}

#endif

static bool ocl_sepFilter2D( InputArray _src, OutputArray _dst, int ddepth,
InputArray _kernelX, InputArray _kernelY, Point anchor,
double delta, int borderType )
{
// Size imgSize = _src.size();
Size imgSize = _src.size();

if (abs(delta)> FLT_MIN)
return false;
Expand All @@ -3515,10 +3511,11 @@ static bool ocl_sepFilter2D( InputArray _src, OutputArray _dst, int ddepth,
if (ddepth < 0)
ddepth = sdepth;

// CV_OCL_RUN_(kernelY.rows <= 21 && kernelX.rows <= 21 &&
// imgSize.width > optimizedSepFilterLocalSize + (kernelX.rows >> 1) &&
// imgSize.height > optimizedSepFilterLocalSize + (kernelY.rows >> 1),
// ocl_sepFilter2D_SinglePass(_src, _dst, _kernelX, _kernelY, borderType, ddepth), true)
CV_OCL_RUN_(kernelY.rows <= 21 && kernelX.rows <= 21 &&
imgSize.width > optimizedSepFilterLocalSize + (kernelX.rows >> 1) &&
imgSize.height > optimizedSepFilterLocalSize + (kernelY.rows >> 1) &&
(borderType & BORDER_ISOLATED) != 0,
ocl_sepFilter2D_SinglePass(_src, _dst, _kernelX, _kernelY, borderType, ddepth), true)

UMat src = _src.getUMat();
Size srcWholeSize; Point srcOffset;
Expand Down
4 changes: 2 additions & 2 deletions modules/imgproc/test/ocl/test_sepfilter2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ PARAM_TEST_CASE(SepFilter2D, MatDepth, Channels, BorderType, bool, bool)
temp = randomMat(Size(1, ksize.height), CV_MAKE_TYPE(CV_32F, 1), -MAX_VALUE, MAX_VALUE);
cv::normalize(temp, kernelY, 1.0, 0.0, NORM_L1);

Size roiSize = randomSize(ksize.width + 16, MAX_VALUE, ksize.height + 20, MAX_VALUE);
Size roiSize = randomSize(ksize.width, MAX_VALUE, ksize.height, MAX_VALUE);
int rest = roiSize.width % 4;
if (rest != 0)
roiSize.width += (4 - rest);
Expand Down Expand Up @@ -115,7 +115,7 @@ PARAM_TEST_CASE(SepFilter2D, MatDepth, Channels, BorderType, bool, bool)

OCL_TEST_P(SepFilter2D, Mat)
{
for (int j = 0; j < test_loop_times; j++)
for (int j = 0; j < test_loop_times + 1; j++)
{
random_roi();

Expand Down
4 changes: 1 addition & 3 deletions modules/superres/src/btv_l1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,10 +1014,8 @@ namespace
return;

#ifdef HAVE_OPENCL
if (isUmat_ && curFrame_.channels() == 1)
if (isUmat_)
curFrame_.copyTo(ucurFrame_);
else
isUmat_ = false;
#endif
++storePos_;

Expand Down

0 comments on commit 63d8a61

Please sign in to comment.