5
#ifndef OPENCV_CORE_PARALLEL_FOR_OPENMP_HPP
6
#define OPENCV_CORE_PARALLEL_FOR_OPENMP_HPP
8
#include "opencv2/core/parallel/parallel_backend.hpp"
10
#if !defined(_OPENMP) && !defined(OPENCV_SKIP_OPENMP_PRESENSE_CHECK)
11
#error "This file must be compiled with enabled OpenMP"
16
namespace
cv
{
namespace
parallel {
namespace
openmp {
32
numThreadsMax = omp_get_max_threads();
37
virtual
void
parallel_for(
int
tasks, FN_parallel_for_body_cb_t body_callback,
void* callback_data) CV_OVERRIDE
39
#pragma omp parallel for schedule(dynamic) num_threads(numThreads > 0 ? numThreads : numThreadsMax)
40
for
(
int
i = 0; i < tasks; ++i)
41
body_callback(i, i + 1, callback_data);
44
virtual
int
getThreadNum()
const
CV_OVERRIDE
46
return
omp_get_thread_num();
49
virtual
int
getNumThreads()
const
CV_OVERRIDE
56
virtual
int
setNumThreads(
int
nThreads) CV_OVERRIDE
58
int
oldNumThreads = numThreads;
59
numThreads = nThreads;
64
const
char* getName()
const
CV_OVERRIDE
Definition:
parallel_backend.hpp:57
Definition:
parallel_for.openmp.hpp:24
"black box" representation of the file storage associated with a file on disk.
Definition:
aruco.hpp:75