@@ -198,12 +198,12 @@ If threads == 0, OpenCV will disable threading optimizations and run all it's fu
198
198
sequentially. Passing threads \< 0 will reset threads number to system default. This function must
199
199
be called outside of parallel region.
200
200
201
- OpenCV will try to run it's functions with specified threads number, but some behaviour differs from
201
+ OpenCV will try to run its functions with specified threads number, but some behaviour differs from
202
202
framework:
203
203
- `TBB` - User-defined parallel constructions will run with the same threads number, if
204
- another does not specified. If later on user creates own scheduler, OpenCV will use it.
204
+ another is not specified. If later on user creates his own scheduler, OpenCV will use it.
205
205
- `OpenMP` - No special defined behaviour.
206
- - `Concurrency` - If threads == 1, OpenCV will disable threading optimizations and run it's
206
+ - `Concurrency` - If threads == 1, OpenCV will disable threading optimizations and run its
207
207
functions sequentially.
208
208
- `GCD` - Supports only values \<= 0.
209
209
- `C=` - No special defined behaviour.
@@ -233,7 +233,7 @@ CV_EXPORTS_W int getNumThreads();
233
233
/* * @brief Returns the index of the currently executed thread within the current parallel region. Always
234
234
returns 0 if called outside of parallel region.
235
235
236
- The exact meaning of return value depends on the threading framework used by OpenCV library:
236
+ The exact meaning of the return value depends on the threading framework used by OpenCV library:
237
237
- `TBB` - Unsupported with current 4.1 TBB release. Maybe will be supported in future.
238
238
- `OpenMP` - The thread number, within the current team, of the calling thread.
239
239
- `Concurrency` - An ID for the virtual processor that the current context is executing on (0
@@ -285,6 +285,19 @@ tm.start();
285
285
tm.stop();
286
286
std::cout << tm.getTimeSec();
287
287
@endcode
288
+
289
+ It is also possible to compute the average time over multiple runs:
290
+ @code
291
+ TickMeter tm;
292
+ for (int i = 0; i < 100; i++)
293
+ {
294
+ tm.start();
295
+ // do something ...
296
+ tm.stop();
297
+ }
298
+ double average_time = tm.getTimeSec() / tm.getCounter();
299
+ std::cout << "Average time in second per iteration is: " << average_time << std::endl;
300
+ @endcode
288
301
@sa getTickCount, getTickFrequency
289
302
*/
290
303
@@ -428,12 +441,13 @@ The function returns the aligned pointer of the same type as the input pointer:
428
441
*/
429
442
template <typename _Tp> static inline _Tp* alignPtr (_Tp* ptr, int n=(int )sizeof(_Tp))
430
443
{
444
+ CV_DbgAssert ((n & (n - 1 )) == 0 ); // n is a power of 2
431
445
return (_Tp*)(((size_t )ptr + n-1 ) & -n);
432
446
}
433
447
434
448
/* * @brief Aligns a buffer size to the specified number of bytes.
435
449
436
- The function returns the minimum number that is greater or equal to sz and is divisible by n :
450
+ The function returns the minimum number that is greater than or equal to sz and is divisible by n :
437
451
\f[\texttt{(sz + n-1) & -n}\f]
438
452
@param sz Buffer size to align.
439
453
@param n Alignment size that must be a power of two.
@@ -482,7 +496,7 @@ The function returns true if the optimized code is enabled. Otherwise, it return
482
496
*/
483
497
CV_EXPORTS_W bool useOptimized ();
484
498
485
- static inline size_t getElemSize (int type) { return CV_ELEM_SIZE (type); }
499
+ static inline size_t getElemSize (int type) { return ( size_t ) CV_ELEM_SIZE (type); }
486
500
487
501
// ///////////////////////////// Parallel Primitives //////////////////////////////////
488
502
@@ -526,10 +540,10 @@ template<typename _Tp, typename Functor> inline
526
540
void Mat::forEach_impl (const Functor& operation) {
527
541
if (false ) {
528
542
operation (*reinterpret_cast <_Tp*>(0 ), reinterpret_cast <int *>(0 ));
529
- // If your compiler fail in this line.
543
+ // If your compiler fails in this line.
530
544
// Please check that your functor signature is
531
- // (_Tp&, const int*) <- multidimential
532
- // or (_Tp&, void*) <- in case of you don't need current idx.
545
+ // (_Tp&, const int*) <- multi-dimensional
546
+ // or (_Tp&, void*) <- in case you don't need current idx.
533
547
}
534
548
535
549
CV_Assert (this ->total () / this ->size [this ->dims - 1 ] <= INT_MAX);
0 commit comments