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

Method transformInputRois

Engine/EffectInstance.cpp:2048–2092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2046} // EffectInstance::allocateImagePlane
2047
2048void
2049EffectInstance::transformInputRois(const EffectInstance* self,
2050 const InputMatrixMapPtr & inputTransforms,
2051 double par,
2052 const RenderScale & scale,
2053 RoIMap* inputsRoi,
2054 std::map<int, EffectInstancePtr>* reroutesMap)
2055{
2056 if (!inputTransforms) {
2057 return;
2058 }
2059 //Transform the RoIs by the inverse of the transform matrix (which is in pixel coordinates)
2060 for (InputMatrixMap::const_iterator it = inputTransforms->begin(); it != inputTransforms->end(); ++it) {
2061 RectD transformedRenderWindow;
2062 EffectInstancePtr effectInTransformInput = self->getInput(it->first);
2063 assert(effectInTransformInput);
2064
2065
2066 RoIMap::iterator foundRoI = inputsRoi->find(effectInTransformInput);
2067 if ( foundRoI == inputsRoi->end() ) {
2068 //There might be no RoI because it was null
2069 continue;
2070 }
2071
2072 // invert it
2073 Transform::Matrix3x3 invertTransform;
2074 double det = Transform::matDeterminant(*it->second.cat);
2075 if (det != 0.) {
2076 invertTransform = Transform::matInverse(*it->second.cat, det);
2077 }
2078
2079 Transform::Matrix3x3 canonicalToPixel = Transform::matCanonicalToPixel(par, scale.x,
2080 scale.y, false);
2081 Transform::Matrix3x3 pixelToCanonical = Transform::matPixelToCanonical(par, scale.x,
2082 scale.y, false);
2083
2084 invertTransform = Transform::matMul(Transform::matMul(pixelToCanonical, invertTransform), canonicalToPixel);
2085 Transform::transformRegionFromRoD(foundRoI->second, invertTransform, transformedRenderWindow);
2086
2087 //Replace the original RoI by the transformed RoI
2088 inputsRoi->erase(foundRoI);
2089 inputsRoi->insert( std::make_pair(it->second.newInputEffect->getInput(it->second.newInputNbToFetchFrom), transformedRenderWindow) );
2090 reroutesMap->insert( std::make_pair(it->first, it->second.newInputEffect) );
2091 }
2092}
2093
2094EffectInstance::RenderRoIRetCode
2095EffectInstance::renderInputImagesForRoI(const FrameViewRequest* request,

Callers

nothing calls this directly

Calls 12

getInputMethod · 0.95
matDeterminantFunction · 0.85
matInverseFunction · 0.85
matCanonicalToPixelFunction · 0.85
matPixelToCanonicalFunction · 0.85
matMulFunction · 0.85
transformRegionFromRoDFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45
eraseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected