MLT/PSSMLT: better logic for selecting the 'luminanceSamples' parameter

metadata
Wenzel Jakob 2014-04-02 14:40:15 +02:00
parent cf98273c7c
commit 5dc9f571e7
2 changed files with 17 additions and 3 deletions

View File

@ -269,12 +269,19 @@ public:
if (m_config.workUnits <= 0) {
const size_t desiredMutationsPerWorkUnit = 200000;
const size_t cropArea = (size_t) cropSize.x * cropSize.y;
const size_t workUnits = ((desiredMutationsPerWorkUnit - 1) +
const size_t workUnits = ((desiredMutationsPerWorkUnit - 1) +
(cropArea * sampleCount)) / desiredMutationsPerWorkUnit;
Assert(workUnits <= (size_t) std::numeric_limits<int>::max());
m_config.workUnits = (int) std::max(workUnits, (size_t) 1);
}
size_t luminanceSamples = m_config.luminanceSamples;
if (luminanceSamples < (size_t) m_config.workUnits * 10) {
luminanceSamples = (size_t) m_config.workUnits * 10;
Log(EWarn, "Warning: increasing number of luminance samples to " SIZE_T_FMT,
luminanceSamples);
}
m_config.nMutations = (cropSize.x * cropSize.y *
sampleCount) / m_config.workUnits;
@ -295,7 +302,7 @@ public:
ref<MLTProcess> process = new MLTProcess(job, queue,
m_config, directImage, pathSeeds);
m_config.luminance = pathSampler->generateSeeds(m_config.luminanceSamples,
m_config.luminance = pathSampler->generateSeeds(luminanceSamples,
m_config.workUnits, true, m_config.importanceMap, pathSeeds);
if (!nested)

View File

@ -328,6 +328,13 @@ public:
m_config.workUnits = (int) std::max(workUnits, (size_t) 1);
}
size_t luminanceSamples = m_config.luminanceSamples;
if (luminanceSamples < (size_t) m_config.workUnits * 10) {
luminanceSamples = (size_t) m_config.workUnits * 10;
Log(EWarn, "Warning: increasing number of luminance samples to " SIZE_T_FMT,
luminanceSamples);
}
m_config.nMutations = (cropSize.x * cropSize.y *
sampleCount) / m_config.workUnits;
@ -348,7 +355,7 @@ public:
ref<PSSMLTProcess> process = new PSSMLTProcess(job, queue,
m_config, directImage, pathSeeds);
m_config.luminance = pathSampler->generateSeeds(m_config.luminanceSamples,
m_config.luminance = pathSampler->generateSeeds(luminanceSamples,
m_config.workUnits, false, m_config.importanceMap, pathSeeds);
if (!nested)