c
<   for (s = 0; s < spp; s++)
---
>   spp = MIN(spp, MAX_SAMPLES);
>   for (s = 0; s < spp; s++)
