Some people have asked why ffmpeg packs 18/20/24 bit audio in 32 bit samples and why it would be useful to have such sample formats for <some sound servers>.
To start with, C has no 24 bit integers, and casting the pointer to 32 bits and ANDing the top bits would be a spec violation as you move the pointer by 3 bytes, making it unaligned. So you need a bitstream reader/writer, which means copies.

Follow

No SIMD ISA anywhere mainstream does ops on 24 bits, so you'll have to do everything in 32 bits and then write a not-very-fast packing code which will slow down decoding.
And then, the sound server will have to unpack it anyway, probably in non-SIMD code, to do anything useful with it like resample and mix, unless can directly copy it to the device for playback.
And not many devices really use a 24 bit sample format for all the reasons I've given.

Sign in to participate in the conversation
Parsee

A Mastodon instance for people interested in multimedia, codecs, assembly, SIMD, and the occasional weeb stuff.