[Ffmpeg-devel] Re: [PATCH] lpcm 20 and 24 bit support in MPEG PS
Tue Mar 27 21:17:17 CEST 2007
> > Ok, it will finally end this thread, may I suggest a CODEC_ID_DVD_LPCM
> > then ? And decoder which take bits_per_sample into account ?
Imho, it shouldn't even remove the LPCM header, and behave as AC3/DTS. Then a
parser wich get's bits per sample, bitrate and such and a decoder wich decodes
to 16bit (wich seems default for audiocodecs for now) should be created.
Also, I finally figured out how the channels are stored in LPCM. Pretty smart
actually, mainly putting it here so it's documented somewhere :).
LPCM stores the 16msb's of the first two samples for each channel first, then
appended to the end of this is the 8 (or 4)lsb for each of the previous channels.
eg: (4 channel 24bit) :
16msb of L1, R1, SL1, SR1, L2, R2, SL2, SR2. ( 2 * 4 * 16/8 = 16 bytes )
8lsb of L1, R1, SL1, SR1, L2, R2, SL2, SR2. ( 2 * 4 * 8/8 = 8 bytes )
eg: (3 channel, 20bit) :
16msb of L1, R1, C1, L2, R2, C2. ( 2 * 3 * 16/8 = 12 bytes )
4lsb of L1, R1, C1, L2, R2, C2. ( 2 * 3 * 4/8 = 3 bytes )
A player wich only can handle 16bit, can then easily just ditch all of the lsb
data and use the 16msb bits that comes first wich, has been noticed before, is
in bigendian byteorder.
More information about the ffmpeg-devel