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