[Ffmpeg-devel] Re: [PATCH] lpcm 20 and 24 bit support in MPEG PS

elupus elupus
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 ?
> 
> ok
> 

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 )
then 
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 )
then 
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.


Joakim






More information about the ffmpeg-devel mailing list