Skip to content

Commit

Permalink
FIX : Resample : Fix a particularly terrible name
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldresser-ie committed Jan 27, 2024
1 parent ec0f2dc commit 2d7024c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/GafferImage/Resample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,12 @@ int linearCombineSampledPixels(
return 0;
}

// The index of sampled depth we have currently covered up to for each source
std::vector<int> sourceIndex( numSources, -1 );
std::vector<int> sourceSourceIndex( numSources, 0 );

// The original index of the segment in the source pixel which the current sample came from for each source.
// Because of interpolated samples, there may be many samples per original segment.
std::vector<int> sourceOrigIndex( numSources, 0 );
double totalAccumAlpha = 0;
double prevTotalAccumAlpha = 0;

Expand Down Expand Up @@ -746,10 +750,10 @@ int linearCombineSampledPixels(
contributionCount++;
float skippedContribution = curSamples[curIndex-1].linearContribution / ( 1.0 - prevTotalAccumAlpha );
contributionElements->push_back( ContributionElement {
(int)i, sourceSourceIndex[i], weights[i] * skippedContribution
(int)i, sourceOrigIndex[i], weights[i] * skippedContribution
} );

sourceSourceIndex[i]++;
sourceOrigIndex[i]++;
}
contributionCount++;

Expand All @@ -769,14 +773,14 @@ int linearCombineSampledPixels(
assert( linearContribution >= 0.0f );

contributionElements->push_back( ContributionElement {
(int)i, sourceSourceIndex[i], weights[i] * linearContribution
(int)i, sourceOrigIndex[i], weights[i] * linearContribution
} );

if( curSamples[curIndex].type < DepthSampleInterpolated )
{
// We must track the index of the source segment we are adding contributions from. This
// goes up for every sample we output, unless it's an interpolated sample.
sourceSourceIndex[i]++;
sourceOrigIndex[i]++;
}
}
}
Expand Down Expand Up @@ -930,10 +934,10 @@ int linearCombineSampledPixels(
// Add to the list of contributions
contributionCount++;
contributionElements->push_back( ContributionElement {
(int)i, sourceSourceIndex[i], weights[i] * linearContribution
(int)i, sourceOrigIndex[i], weights[i] * linearContribution
} );

sourceSourceIndex[i]++;
sourceOrigIndex[i]++;
firstSegment = false;
}
}
Expand Down

0 comments on commit 2d7024c

Please sign in to comment.