MLT/PSSMLT: better logic for selecting the 'luminanceSamples' parameter
parent
cf98273c7c
commit
5dc9f571e7
|
@ -269,12 +269,19 @@ public:
|
||||||
if (m_config.workUnits <= 0) {
|
if (m_config.workUnits <= 0) {
|
||||||
const size_t desiredMutationsPerWorkUnit = 200000;
|
const size_t desiredMutationsPerWorkUnit = 200000;
|
||||||
const size_t cropArea = (size_t) cropSize.x * cropSize.y;
|
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;
|
(cropArea * sampleCount)) / desiredMutationsPerWorkUnit;
|
||||||
Assert(workUnits <= (size_t) std::numeric_limits<int>::max());
|
Assert(workUnits <= (size_t) std::numeric_limits<int>::max());
|
||||||
m_config.workUnits = (int) std::max(workUnits, (size_t) 1);
|
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 *
|
m_config.nMutations = (cropSize.x * cropSize.y *
|
||||||
sampleCount) / m_config.workUnits;
|
sampleCount) / m_config.workUnits;
|
||||||
|
|
||||||
|
@ -295,7 +302,7 @@ public:
|
||||||
ref<MLTProcess> process = new MLTProcess(job, queue,
|
ref<MLTProcess> process = new MLTProcess(job, queue,
|
||||||
m_config, directImage, pathSeeds);
|
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);
|
m_config.workUnits, true, m_config.importanceMap, pathSeeds);
|
||||||
|
|
||||||
if (!nested)
|
if (!nested)
|
||||||
|
|
|
@ -328,6 +328,13 @@ public:
|
||||||
m_config.workUnits = (int) std::max(workUnits, (size_t) 1);
|
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 *
|
m_config.nMutations = (cropSize.x * cropSize.y *
|
||||||
sampleCount) / m_config.workUnits;
|
sampleCount) / m_config.workUnits;
|
||||||
|
|
||||||
|
@ -348,7 +355,7 @@ public:
|
||||||
ref<PSSMLTProcess> process = new PSSMLTProcess(job, queue,
|
ref<PSSMLTProcess> process = new PSSMLTProcess(job, queue,
|
||||||
m_config, directImage, pathSeeds);
|
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);
|
m_config.workUnits, false, m_config.importanceMap, pathSeeds);
|
||||||
|
|
||||||
if (!nested)
|
if (!nested)
|
||||||
|
|
Loading…
Reference in New Issue