| 2046 | } // EffectInstance::allocateImagePlane |
| 2047 | |
| 2048 | void |
| 2049 | EffectInstance::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 | |
| 2094 | EffectInstance::RenderRoIRetCode |
| 2095 | EffectInstance::renderInputImagesForRoI(const FrameViewRequest* request, |
nothing calls this directly
no test coverage detected