Also, templatize the functions for 16-bit and 32-bit sample range. This will be used for 24-bit FLAC encoding.