
>       uint16 max_s = (spp < MAX_SAMPLES) ? spp : MAX_SAMPLES;
<       for (s = 0; s < spp; s++)
---
>       for (s = 0; s < max_s; s++)
