Skip to content

Commit

Permalink
Resample : Minor simplify, actually gives 20% perf gain for disk filter
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldresser-ie committed Sep 5, 2023
1 parent c019138 commit 22171e1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/GafferImage/Resample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,16 +582,15 @@ IECore::ConstFloatVectorDataPtr Resample::computeChannelData( const std::string

float v = 0.0f;
float totalW = 0.0f;
V2f filterOrigin = filterCoordinateMult.x * ( iPF - V2f( 0.5f ) );
sampler.visitPixels( Imath::Box2i(
iPI - filterRadius,
iPI + filterRadius + Imath::V2i( 1 )
),
[&filter, &filterOrigin, &filterCoordinateMult, &iPI, &v, &totalW]( float cur, int x, int y )
[&filter, &filterCoordinateMult, &iP, &v, &totalW]( float cur, int x, int y )
{
const float w = (*filter)(
filterOrigin.x + filterCoordinateMult.x * ( x - iPI.x ),
filterOrigin.y + filterCoordinateMult.y * ( y - iPI.y )
filterCoordinateMult.x * ( float(x) + 0.5f - iP.x ),
filterCoordinateMult.y * ( float(y) + 0.5f - iP.y )
);

v += w * cur;
Expand Down

0 comments on commit 22171e1

Please sign in to comment.