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