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

Method process

Log2Lin/Log2Lin.cpp:401–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

unusedFunction · 0.85
getPixelAddressMethod · 0.80

Tested by

no test coverage detected