MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / run

Method run

Engine/HistogramCPU.cpp:382–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380} // computeHistogramStatic
381
382void
383HistogramCPU::run()
384{
385#ifdef DEBUG
386 boost_adaptbx::floating_point::exception_trapping trap(boost_adaptbx::floating_point::exception_trapping::division_by_zero |
387 boost_adaptbx::floating_point::exception_trapping::invalid |
388 boost_adaptbx::floating_point::exception_trapping::overflow);
389#endif
390 for (;; ) {
391 HistogramRequest request;
392 {
393 QMutexLocker l(&_imp->requestMutex);
394 while ( _imp->requests.empty() ) {
395 _imp->requestCond.wait(l.mutex());
396 }
397
398 ///get the last request
399 request = _imp->requests.back();
400 _imp->requests.pop_back();
401
402 ///ignore all other requests pending
403 _imp->requests.clear();
404 }
405
406 {
407 QMutexLocker l(&_imp->mustQuitMutex);
408 if (_imp->mustQuit) {
409 _imp->mustQuit = false;
410 _imp->mustQuitCond.wakeOne();
411
412 return;
413 }
414 }
415 FinishedHistogramPtr ret = std::make_shared<FinishedHistogram>();
416 ret->binsCount = request.binsCount;
417 ret->mode = request.mode;
418 ret->vmin = request.vmin;
419 ret->vmax = request.vmax;
420 ret->mipMapLevel = request.image->getMipMapLevel();
421
422
423 switch (request.mode) {
424 case 0: //< RGB
425 computeHistogramStatic(request, ret, 1);
426 computeHistogramStatic(request, ret, 2);
427 computeHistogramStatic(request, ret, 3);
428 break;
429 case 1:
430 case 2:
431 case 3:
432 case 4:
433 case 5:
434 computeHistogramStatic(request, ret, 1);
435 break;
436 default:
437 assert(false); //< unknown case.
438 break;
439 }

Callers

nothing calls this directly

Calls 6

computeHistogramStaticFunction · 0.85
emptyMethod · 0.80
pop_backMethod · 0.80
clearMethod · 0.45
getMipMapLevelMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected