Convert char to uint8_t in nlmeans.c.
Remove unused macros.
Explicitly sanitize patch size and search range.
Fix Tim's nit.