From 75cf06e8b2cbf0273a35dec26508242af311b3bd Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Thu, 25 Oct 2012 02:25:28 -0400 Subject: [PATCH] fixing 2-stage MLT, part 2 --- setpath.sh | 0 src/libbidir/pathsampler.cpp | 24 +++++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) mode change 100644 => 100755 setpath.sh diff --git a/setpath.sh b/setpath.sh old mode 100644 new mode 100755 diff --git a/src/libbidir/pathsampler.cpp b/src/libbidir/pathsampler.cpp index 29ae9784..2c177d21 100644 --- a/src/libbidir/pathsampler.cpp +++ b/src/libbidir/pathsampler.cpp @@ -580,7 +580,9 @@ Float PathSampler::computeAverageLuminance(size_t sampleCount) { } static void seedCallback(std::vector &output, const Bitmap *importanceMap, - int s, int t, Float weight, Path &path) { + Float &accum, int s, int t, Float weight, Path &path) { + accum += weight; + if (importanceMap) { const Float *luminanceValues = importanceMap->getFloatData(); Vector2i size = importanceMap->getSize(); @@ -608,40 +610,40 @@ Float PathSampler::generateSeeds(size_t sampleCount, size_t seedCount, tempSeeds.reserve(sampleCount); SplatList splatList; + Float luminance; PathCallback callback = boost::bind(&seedCallback, - boost::ref(tempSeeds), importanceMap, _1, _2, _3, _4); + boost::ref(tempSeeds), importanceMap, boost::ref(luminance), + _1, _2, _3, _4); Float mean = 0.0f, variance = 0.0f; for (size_t i=0; igetSampleIndex(); - Float lum = 0.0f; + luminance = 0.0f; if (fineGrained) { samplePaths(Point2i(-1), callback); /* Fine seed granularity (e.g. for Veach-MLT). Set the correct the sample index value */ - for (size_t j = seedIndex; j