MCPcopy Create free account
hub / github.com/NatronGitHub/openfx-misc / process

Method process

PLogLin/PLogLin.cpp:405–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403
404 template<bool processR, bool processG, bool processB>
405 void process(const OfxRectI& procWindow, const OfxPointD& rs)
406 {
407 unused(rs);
408 assert( (!processR && !processG && !processB) || (nComponents == 3 || nComponents == 4) );
409 assert(nComponents == 3 || nComponents == 4);
410 float unpPix[4] = {0.f, 0.f, 0.f, 0.f};
411 float tmpPix[4] = {0.f, 0.f, 0.f, 0.f};
412 for (int y = procWindow.y1; y < procWindow.y2; y++) {
413 if ( _effect.abort() ) {
414 break;
415 }
416
417 PIX *dstPix = (PIX *) _dstImg->getPixelAddress(procWindow.x1, y);
418 for (int x = procWindow.x1; x < procWindow.x2; x++) {
419 const PIX *srcPix = (const PIX *) (_srcImg ? _srcImg->getPixelAddress(x, y) : 0);
420 ofxsUnPremult<PIX, nComponents, maxValue>(srcPix, unpPix, _premult, _premultChannel);
421
422 // process the pixel (the actual computation goes here)
423 for (int c = 0; c < 3; ++c) {
424 tmpPix[c] = lin2log(unpPix[c], c);
425 }
426 tmpPix[3] = unpPix[3];
427 ofxsPremultMaskMixPix<PIX, nComponents, maxValue, true>(tmpPix, _premult, _premultChannel, x, y, srcPix, _doMasking, _maskImg, (float)_mix, _maskInvert, dstPix);
428 // copy back original values from unprocessed channels
429 if (!processR) {
430 dstPix[0] = srcPix ? srcPix[0] : PIX();
431 }
432 if (!processG) {
433 dstPix[1] = srcPix ? srcPix[1] : PIX();
434 }
435 if (!processB) {
436 dstPix[2] = srcPix ? srcPix[2] : PIX();
437 }
438 if (nComponents == 4) {
439 dstPix[3] = srcPix ? srcPix[3] : PIX();
440 }
441 // increment the dst pixel
442 dstPix += nComponents;
443 }
444 }
445 }
446};
447
448////////////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 2

unusedFunction · 0.85
getPixelAddressMethod · 0.80

Tested by

no test coverage detected