__device__ T warpScanInclusive(T data, volatile T* smem, uint tid) { #if CV_CUDEV_ARCH >= 300 CV_UNUSED(smem); CV_UNUSED(tid); const uint laneId = Warp::laneId(); // scan on shufl functions #pragma unroll for (int i = 1; i <= (WARP_SIZE / 2); i *= 2) { const T val = shfl_up(data, i); if (laneId >= i) data += val; } return data; #else uint pos = 2 * tid - (tid & (WARP_SIZE - 1)); smem[pos] = 0; pos += WARP_SIZE; smem[pos] = data; smem[pos] += smem[pos - 1]; smem[pos] += smem[pos - 2]; smem[pos] += smem[pos - 4]; smem[pos] += smem[pos - 8]; smem[pos] += smem[pos - 16]; return smem[pos]; #endif }
bool parseMovi(frame_list& in_frame_list) { //not implemented CV_UNUSED(in_frame_list); // FIXIT: in_frame_list.empty(); return true; }
PERF_TEST_P(Size_MatType, Mat_Clone_Roi, testing::Combine(testing::Values(TYPICAL_MAT_SIZES), testing::Values(TYPICAL_MAT_TYPES)) ) { Size size = get<0>(GetParam()); int type = get<1>(GetParam()); unsigned int width = size.width; unsigned int height = size.height; Mat source(height, width, type); Mat destination(size.height/2, size.width/2, type); declare.in(source, WARMUP_RNG).out(destination); Mat roi(source, Rect(width/4, height/4, 3*width/4, 3*height/4)); TEST_CYCLE() { Mat tmp = roi.clone(); CV_UNUSED(tmp); } destination = roi.clone(); SANITY_CHECK(destination, 1); }
double CxCore_MulSpectrumsTest::get_success_error_level( int test_case_idx, int i, int j ) { CV_UNUSED(test_case_idx); CV_Assert(i == OUTPUT); CV_Assert(j == 0); int elem_depth = CV_MAT_DEPTH(cvGetElemType(test_array[i][j])); CV_Assert(elem_depth == CV_32F || elem_depth == CV_64F); element_wise_relative_error = false; double maxInputValue = 1000; // ArrayTest::get_minmax_bounds double err = 8 * maxInputValue; // result = A*B + C*D return (elem_depth == CV_32F ? FLT_EPSILON : DBL_EPSILON) * err; }
void cv::imshow(const String& winname, const ogl::Texture2D& _tex) { CV_TRACE_FUNCTION(); #ifndef HAVE_OPENGL CV_UNUSED(winname); CV_UNUSED(_tex); CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support"); #else const double useGl = getWindowProperty(winname, WND_PROP_OPENGL); if (useGl <= 0) { CV_Error(cv::Error::OpenGlNotSupported, "The window was created without OpenGL context"); } else { const double autoSize = getWindowProperty(winname, WND_PROP_AUTOSIZE); if (autoSize > 0) { Size size = _tex.size(); resizeWindow(winname, size.width, size.height); } setOpenGlContext(winname); cv::ogl::Texture2D& tex = wndTexs[winname]; tex = _tex; tex.setAutoRelease(false); setOpenGlDrawCallback(winname, glDrawTextureCallback, &tex); updateWindow(winname); } #endif }
PERF_TEST_P(Size_MatType, Mat_Clone, testing::Combine(testing::Values(TYPICAL_MAT_SIZES), testing::Values(TYPICAL_MAT_TYPES)) ) { Size size = get<0>(GetParam()); int type = get<1>(GetParam()); Mat source(size.height, size.width, type); Mat destination(size.height, size.width, type); declare.in(source, WARMUP_RNG).out(destination); TEST_CYCLE() { Mat tmp = source.clone(); CV_UNUSED(tmp); } destination = source.clone(); SANITY_CHECK(destination, 1); }
static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) { CV_INSTRUMENT_REGION_IPP(); #if IPP_VERSION_X100 >= 700 size_t total_size = src.total(); int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0; if( (src.dims == 2 || (src.isContinuous() && mask.isContinuous())) && cols > 0 && (size_t)rows*cols == total_size ) { if( !mask.empty() ) { IppiSize sz = { cols, rows }; int type = src.type(); typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *); ippiMaskNormFuncC1 ippiNorm_C1MR = normType == NORM_INF ? (type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_8u_C1MR : type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_16u_C1MR : type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_32f_C1MR : 0) : normType == NORM_L1 ? (type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_8u_C1MR : type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_16u_C1MR : type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_L1_32f_C1MR : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? (type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_8u_C1MR : type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_16u_C1MR : type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_32f_C1MR : 0) : 0; if( ippiNorm_C1MR ) { Ipp64f norm; if( CV_INSTRUMENT_FUN_IPP(ippiNorm_C1MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 ) { result = (normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm); return true; } } typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *); ippiMaskNormFuncC3 ippiNorm_C3CMR = normType == NORM_INF ? (type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_8u_C3CMR : type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_16u_C3CMR : type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_32f_C3CMR : 0) : normType == NORM_L1 ? (type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_8u_C3CMR : type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_16u_C3CMR : type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_L1_32f_C3CMR : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? (type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_8u_C3CMR : type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_16u_C3CMR : type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_32f_C3CMR : 0) : 0; if( ippiNorm_C3CMR ) { Ipp64f norm1, norm2, norm3; if( CV_INSTRUMENT_FUN_IPP(ippiNorm_C3CMR, src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 1, &norm1) >= 0 && CV_INSTRUMENT_FUN_IPP(ippiNorm_C3CMR, src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 2, &norm2) >= 0 && CV_INSTRUMENT_FUN_IPP(ippiNorm_C3CMR, src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 3, &norm3) >= 0) { Ipp64f norm = normType == NORM_INF ? std::max(std::max(norm1, norm2), norm3) : normType == NORM_L1 ? norm1 + norm2 + norm3 : normType == NORM_L2 || normType == NORM_L2SQR ? std::sqrt(norm1 * norm1 + norm2 * norm2 + norm3 * norm3) : 0; result = (normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm); return true; } } } else { IppiSize sz = { cols*src.channels(), rows }; int type = src.depth(); typedef IppStatus (CV_STDCALL* ippiNormFuncHint)(const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); typedef IppStatus (CV_STDCALL* ippiNormFuncNoHint)(const void *, int, IppiSize, Ipp64f *); ippiNormFuncHint ippiNormHint = normType == NORM_L1 ? (type == CV_32FC1 ? (ippiNormFuncHint)ippiNorm_L1_32f_C1R : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? (type == CV_32FC1 ? (ippiNormFuncHint)ippiNorm_L2_32f_C1R : 0) : 0; ippiNormFuncNoHint ippiNorm = normType == NORM_INF ? (type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C1R : type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_16u_C1R : type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_16s_C1R : type == CV_32FC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_32f_C1R : 0) : normType == NORM_L1 ? (type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L1_8u_C1R : type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_L1_16u_C1R : type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_L1_16s_C1R : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? (type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C1R : type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C1R : type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C1R : 0) : 0; if( ippiNormHint || ippiNorm ) { Ipp64f norm; IppStatus ret = ippiNormHint ? CV_INSTRUMENT_FUN_IPP(ippiNormHint, src.ptr(), (int)src.step[0], sz, &norm, ippAlgHintAccurate) : CV_INSTRUMENT_FUN_IPP(ippiNorm, src.ptr(), (int)src.step[0], sz, &norm); if( ret >= 0 ) { result = (normType == NORM_L2SQR) ? norm * norm : norm; return true; } } } } #else CV_UNUSED(src); CV_UNUSED(normType); CV_UNUSED(mask); CV_UNUSED(result); #endif return false; }
static bool ipp_Deriv(InputArray _src, OutputArray _dst, int dx, int dy, int ksize, double scale, double delta, int borderType) { #ifdef HAVE_IPP_IW CV_INSTRUMENT_REGION_IPP() ::ipp::IwiSize size(_src.size().width, _src.size().height); IppDataType srcType = ippiGetDataType(_src.depth()); IppDataType dstType = ippiGetDataType(_dst.depth()); int channels = _src.channels(); bool useScale = false; bool useScharr = false; if(channels != _dst.channels() || channels > 1) return false; if(fabs(delta) > FLT_EPSILON || fabs(scale-1) > FLT_EPSILON) useScale = true; if(ksize <= 0) { ksize = 3; useScharr = true; } IppiMaskSize maskSize = ippiGetMaskSize(ksize, ksize); if((int)maskSize < 0) return false; #if IPP_VERSION_X100 <= 201703 // Bug with mirror wrap if(borderType == BORDER_REFLECT_101 && (ksize/2+1 > size.width || ksize/2+1 > size.height)) return false; #endif IwiDerivativeType derivType = ippiGetDerivType(dx, dy, (useScharr)?false:true); if((int)derivType < 0) return false; // Acquire data and begin processing try { Mat src = _src.getMat(); Mat dst = _dst.getMat(); ::ipp::IwiImage iwSrc = ippiGetImage(src); ::ipp::IwiImage iwDst = ippiGetImage(dst); ::ipp::IwiImage iwSrcProc = iwSrc; ::ipp::IwiImage iwDstProc = iwDst; ::ipp::IwiBorderSize borderSize(maskSize); ::ipp::IwiBorderType ippBorder(ippiGetBorder(iwSrc, borderType, borderSize)); if(!ippBorder) return false; if(srcType == ipp8u && dstType == ipp8u) { iwDstProc.Alloc(iwDst.m_size, ipp16s, channels); useScale = true; } else if(srcType == ipp8u && dstType == ipp32f) { iwSrc -= borderSize; iwSrcProc.Alloc(iwSrc.m_size, ipp32f, channels); CV_INSTRUMENT_FUN_IPP(::ipp::iwiScale, iwSrc, iwSrcProc, 1, 0, ::ipp::IwiScaleParams(ippAlgHintFast)); iwSrcProc += borderSize; } if(useScharr) CV_INSTRUMENT_FUN_IPP(::ipp::iwiFilterScharr, iwSrcProc, iwDstProc, derivType, maskSize, ::ipp::IwDefault(), ippBorder); else CV_INSTRUMENT_FUN_IPP(::ipp::iwiFilterSobel, iwSrcProc, iwDstProc, derivType, maskSize, ::ipp::IwDefault(), ippBorder); if(useScale) CV_INSTRUMENT_FUN_IPP(::ipp::iwiScale, iwDstProc, iwDst, scale, delta, ::ipp::IwiScaleParams(ippAlgHintFast)); } catch (::ipp::IwException) { return false; } return true; #else CV_UNUSED(_src); CV_UNUSED(_dst); CV_UNUSED(dx); CV_UNUSED(dy); CV_UNUSED(ksize); CV_UNUSED(scale); CV_UNUSED(delta); CV_UNUSED(borderType); return false; #endif }
CV_IMPL int cvStartLoop(int (*)(int argc, char *argv[]), int , char* argv[]) { CV_UNUSED(argv); CV_NO_GUI_ERROR("cvStartLoop"); }
} CV_CATCH (ExifParsingError, e) { CV_UNUSED(e); return false; }