mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #25197 from invarrow:invbranch-cleanup
Remove OpenVX #25197 resolves https://github.com/opencv/opencv/issues/24995 OpenCV cleanup https://github.com/opencv/opencv/issues/25007
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
#include "convert.hpp"
|
||||
#include "opencv2/core/openvx/ovx_defs.hpp"
|
||||
|
||||
/****************************************************************************************\
|
||||
* LUT Transform *
|
||||
@@ -100,39 +99,6 @@ static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENVX
|
||||
static bool openvx_LUT(Mat src, Mat dst, Mat _lut)
|
||||
{
|
||||
if (src.type() != CV_8UC1 || dst.type() != src.type() || _lut.type() != src.type() || !_lut.isContinuous())
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
ivx::Context ctx = ovx::getOpenVXContext();
|
||||
|
||||
ivx::Image
|
||||
ia = ivx::Image::createFromHandle(ctx, VX_DF_IMAGE_U8,
|
||||
ivx::Image::createAddressing(src.cols, src.rows, 1, (vx_int32)(src.step)), src.data),
|
||||
ib = ivx::Image::createFromHandle(ctx, VX_DF_IMAGE_U8,
|
||||
ivx::Image::createAddressing(dst.cols, dst.rows, 1, (vx_int32)(dst.step)), dst.data);
|
||||
|
||||
ivx::LUT lut = ivx::LUT::create(ctx);
|
||||
lut.copyFrom(_lut);
|
||||
ivx::IVX_CHECK_STATUS(vxuTableLookup(ctx, ia, lut, ib));
|
||||
}
|
||||
catch (const ivx::RuntimeError& e)
|
||||
{
|
||||
VX_DbgThrow(e.what());
|
||||
}
|
||||
catch (const ivx::WrapperError& e)
|
||||
{
|
||||
VX_DbgThrow(e.what());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_IPP)
|
||||
#if !IPP_DISABLE_PERF_LUT // there are no performance benefits (PR #2653)
|
||||
namespace ipp {
|
||||
@@ -374,8 +340,6 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
|
||||
_dst.createSameSize(_src, CV_MAKETYPE(_lut.depth(), cn));
|
||||
Mat dst = _dst.getMat();
|
||||
|
||||
CV_OVX_RUN(!ovx::skipSmallImages<VX_KERNEL_TABLE_LOOKUP>(src.cols, src.rows),
|
||||
openvx_LUT(src, dst, lut))
|
||||
|
||||
#if !IPP_DISABLE_PERF_LUT
|
||||
CV_IPP_RUN(_src.dims() <= 2, ipp_lut(src, lut, dst));
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
#include "opencv2/core/openvx/ovx_defs.hpp"
|
||||
#include "stat.hpp"
|
||||
|
||||
#ifndef OPENCV_IPP_MEAN
|
||||
@@ -319,69 +318,6 @@ static bool ocl_meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENVX
|
||||
static bool openvx_meanStdDev(Mat& src, OutputArray _mean, OutputArray _sdv, Mat& mask)
|
||||
{
|
||||
size_t total_size = src.total();
|
||||
int rows = src.size[0], cols = rows ? (int)(total_size / rows) : 0;
|
||||
if (src.type() != CV_8UC1|| !mask.empty() ||
|
||||
(src.dims != 2 && !(src.isContinuous() && cols > 0 && (size_t)rows*cols == total_size))
|
||||
)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
ivx::Context ctx = ovx::getOpenVXContext();
|
||||
#ifndef VX_VERSION_1_1
|
||||
if (ctx.vendorID() == VX_ID_KHRONOS)
|
||||
return false; // Do not use OpenVX meanStdDev estimation for sample 1.0.1 implementation due to lack of accuracy
|
||||
#endif
|
||||
|
||||
ivx::Image
|
||||
ia = ivx::Image::createFromHandle(ctx, VX_DF_IMAGE_U8,
|
||||
ivx::Image::createAddressing(cols, rows, 1, (vx_int32)(src.step[0])), src.ptr());
|
||||
|
||||
vx_float32 mean_temp, stddev_temp;
|
||||
ivx::IVX_CHECK_STATUS(vxuMeanStdDev(ctx, ia, &mean_temp, &stddev_temp));
|
||||
|
||||
if (_mean.needed())
|
||||
{
|
||||
if (!_mean.fixedSize())
|
||||
_mean.create(1, 1, CV_64F, -1, true);
|
||||
Mat mean = _mean.getMat();
|
||||
CV_Assert(mean.type() == CV_64F && mean.isContinuous() &&
|
||||
(mean.cols == 1 || mean.rows == 1) && mean.total() >= 1);
|
||||
double *pmean = mean.ptr<double>();
|
||||
pmean[0] = mean_temp;
|
||||
for (int c = 1; c < (int)mean.total(); c++)
|
||||
pmean[c] = 0;
|
||||
}
|
||||
|
||||
if (_sdv.needed())
|
||||
{
|
||||
if (!_sdv.fixedSize())
|
||||
_sdv.create(1, 1, CV_64F, -1, true);
|
||||
Mat stddev = _sdv.getMat();
|
||||
CV_Assert(stddev.type() == CV_64F && stddev.isContinuous() &&
|
||||
(stddev.cols == 1 || stddev.rows == 1) && stddev.total() >= 1);
|
||||
double *pstddev = stddev.ptr<double>();
|
||||
pstddev[0] = stddev_temp;
|
||||
for (int c = 1; c < (int)stddev.total(); c++)
|
||||
pstddev[c] = 0;
|
||||
}
|
||||
}
|
||||
catch (const ivx::RuntimeError & e)
|
||||
{
|
||||
VX_DbgThrow(e.what());
|
||||
}
|
||||
catch (const ivx::WrapperError & e)
|
||||
{
|
||||
VX_DbgThrow(e.what());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IPP
|
||||
static bool ipp_meanStdDev(Mat& src, OutputArray _mean, OutputArray _sdv, Mat& mask)
|
||||
@@ -532,9 +468,6 @@ void meanStdDev(InputArray _src, OutputArray _mean, OutputArray _sdv, InputArray
|
||||
|
||||
Mat src = _src.getMat(), mask = _mask.getMat();
|
||||
|
||||
CV_OVX_RUN(!ovx::skipSmallImages<VX_KERNEL_MEAN_STDDEV>(src.cols, src.rows),
|
||||
openvx_meanStdDev(src, _mean, _sdv, mask))
|
||||
|
||||
CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_meanStdDev(src, _mean, _sdv, mask));
|
||||
|
||||
int k, cn = src.channels(), depth = src.depth();
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencl_kernels_core.hpp"
|
||||
#include "opencv2/core/openvx/ovx_defs.hpp"
|
||||
#include "stat.hpp"
|
||||
#include "opencv2/core/detail/dispatch_helper.impl.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
// 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) 2016, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
// OpenVX related functions
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencv2/core/utils/tls.hpp"
|
||||
#include "opencv2/core/ovx.hpp"
|
||||
#include "opencv2/core/openvx/ovx_defs.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
namespace ovx
|
||||
{
|
||||
#ifdef HAVE_OPENVX
|
||||
|
||||
// Simple TLSData<ivx::Context> doesn't work, because default constructor doesn't create any OpenVX context.
|
||||
struct OpenVXTLSData
|
||||
{
|
||||
OpenVXTLSData() : ctx(ivx::Context::create()) {}
|
||||
ivx::Context ctx;
|
||||
};
|
||||
|
||||
static TLSData<OpenVXTLSData>& getOpenVXTLSData()
|
||||
{
|
||||
CV_SINGLETON_LAZY_INIT_REF(TLSData<OpenVXTLSData>, new TLSData<OpenVXTLSData>())
|
||||
}
|
||||
|
||||
struct OpenVXCleanupFunctor
|
||||
{
|
||||
~OpenVXCleanupFunctor() { getOpenVXTLSData().cleanup(); }
|
||||
};
|
||||
static OpenVXCleanupFunctor g_openvx_cleanup_functor;
|
||||
|
||||
ivx::Context& getOpenVXContext()
|
||||
{
|
||||
return getOpenVXTLSData().get()->ctx;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
bool haveOpenVX()
|
||||
{
|
||||
#ifdef HAVE_OPENVX
|
||||
static int g_haveOpenVX = -1;
|
||||
if(g_haveOpenVX < 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
ivx::Context context = ovx::getOpenVXContext();
|
||||
vx_uint16 vComp = ivx::compiledWithVersion();
|
||||
vx_uint16 vCurr = context.version();
|
||||
g_haveOpenVX =
|
||||
VX_VERSION_MAJOR(vComp) == VX_VERSION_MAJOR(vCurr) &&
|
||||
VX_VERSION_MINOR(vComp) == VX_VERSION_MINOR(vCurr)
|
||||
? 1 : 0;
|
||||
}
|
||||
catch(const ivx::WrapperError&)
|
||||
{ g_haveOpenVX = 0; }
|
||||
catch(const ivx::RuntimeError&)
|
||||
{ g_haveOpenVX = 0; }
|
||||
}
|
||||
return g_haveOpenVX == 1;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool useOpenVX()
|
||||
{
|
||||
#ifdef HAVE_OPENVX
|
||||
CoreTLSData& data = getCoreTlsData();
|
||||
if (data.useOpenVX < 0)
|
||||
{
|
||||
// enabled (if available) by default
|
||||
data.useOpenVX = haveOpenVX() ? 1 : 0;
|
||||
}
|
||||
return data.useOpenVX > 0;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void setUseOpenVX(bool flag)
|
||||
{
|
||||
#ifdef HAVE_OPENVX
|
||||
if( haveOpenVX() )
|
||||
{
|
||||
CoreTLSData& data = getCoreTlsData();
|
||||
data.useOpenVX = flag ? 1 : 0;
|
||||
}
|
||||
#else
|
||||
CV_Assert(!flag && "OpenVX support isn't enabled at compile time");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace cv
|
||||
@@ -353,9 +353,6 @@ struct CoreTLSData
|
||||
//#endif
|
||||
useIPP(-1),
|
||||
useIPP_NE(-1)
|
||||
#ifdef HAVE_OPENVX
|
||||
,useOpenVX(-1)
|
||||
#endif
|
||||
{}
|
||||
|
||||
RNG rng;
|
||||
@@ -366,9 +363,6 @@ struct CoreTLSData
|
||||
//#endif
|
||||
int useIPP; // 1 - use, 0 - do not use, -1 - auto/not initialized
|
||||
int useIPP_NE; // 1 - use, 0 - do not use, -1 - auto/not initialized
|
||||
#ifdef HAVE_OPENVX
|
||||
int useOpenVX; // 1 - use, 0 - do not use, -1 - auto/not initialized
|
||||
#endif
|
||||
};
|
||||
|
||||
CoreTLSData& getCoreTlsData();
|
||||
|
||||
@@ -171,10 +171,6 @@ public:
|
||||
#ifdef HAVE_OPENCL
|
||||
if (result.durationImplOpenCL)
|
||||
ok &= this->printf(",tOCL=%lld", (long long int)result.durationImplOpenCL);
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
if (result.durationImplOpenVX)
|
||||
ok &= this->printf(",tOVX=%lld", (long long int)result.durationImplOpenVX);
|
||||
#endif
|
||||
ok &= this->printf("\n");
|
||||
return ok;
|
||||
@@ -359,10 +355,6 @@ void Region::Impl::leaveRegion(TraceManagerThreadLocal& ctx)
|
||||
#ifdef HAVE_OPENCL
|
||||
if (result.durationImplOpenCL)
|
||||
__itt_metadata_add(domain, itt_id, __itt_string_handle_create("tOpenCL"), __itt_metadata_u64, 1, &result.durationImplOpenCL);
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
if (result.durationImplOpenVX)
|
||||
__itt_metadata_add(domain, itt_id, __itt_string_handle_create("tOpenVX"), __itt_metadata_u64, 1, &result.durationImplOpenVX);
|
||||
#endif
|
||||
__itt_task_end(domain);
|
||||
}
|
||||
@@ -492,12 +484,6 @@ Region::Region(const LocationStaticStorage& location) :
|
||||
if (!ctx.stat_status.ignoreDepthImplOpenCL)
|
||||
ctx.stat_status.ignoreDepthImplOpenCL = currentDepth;
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
case REGION_FLAG_IMPL_OPENVX:
|
||||
if (!ctx.stat_status.ignoreDepthImplOpenVX)
|
||||
ctx.stat_status.ignoreDepthImplOpenVX = currentDepth;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
@@ -615,11 +601,6 @@ void Region::destroy()
|
||||
cv::ocl::finish();
|
||||
myCodePath = Impl::CODE_PATH_OPENCL;
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
case REGION_FLAG_IMPL_OPENVX:
|
||||
myCodePath = Impl::CODE_PATH_OPENVX;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
@@ -665,19 +646,6 @@ void Region::destroy()
|
||||
ctx.stat.durationImplOpenCL = duration;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
case Impl::CODE_PATH_OPENVX:
|
||||
if (ctx.stat_status.ignoreDepthImplOpenVX == currentDepth)
|
||||
{
|
||||
ctx.stat.durationImplOpenVX += duration;
|
||||
ctx.stat_status.ignoreDepthImplOpenVX = 0;
|
||||
}
|
||||
else if (active)
|
||||
{
|
||||
ctx.stat.durationImplOpenVX = duration;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user