The 24 bit implementation is mostly copy'n'paste of the 16 bit version, except that the data type is int32_t instead of int16_t.
Separate code from pcm_utils.c to keep it small and simple.