Average and largest sample count
32-bit in partThe two numbers the render dialog states after an adaptive render.
avg = round(10 × Σ nᵢ ÷ (w × h)) ÷ 10; max = largest nᵢ
Each nᵢ is read from the 32-bit float accumulation buffer (channel 4 of each pixel); as whole numbers below 16,777,216 they are exact there. They are added in order into a 64-bit sum, and the average is rounded to one decimal with Math.round before it is returned.
let sum = 0, mx = 0;
for (let i = 0; i < w * h; i++) { const n = layers.accum[i * 4 + 3]; sum += n; if (n > mx) mx = n; }
out.adaptive = { converged: !!r.converged, avg: Math.round((sum / (w * h)) * 10) / 10, max: mx };