[FFmpeg-devel] [patch] 24bit lpcm in mpeg (vob)

Lars Täuber lars.taeuber
Sat Apr 12 19:38:24 CEST 2008


On Sat, 12 Apr 2008 19:42:32 +0200 Michael Niedermayer <michaelni at gmx.at> wrote:
> use 4 space indention please. Also do we have a sample on mphq?

OK, indention changed.
This patch is actually a potential solution for issue 31
yes there is a sample: http://samples.mplayerhq.hu/A-codecs/pcm24/

I could sent another one when requested.

> 
> 
> [...]
> please split changes to code maintained by mans out into a seperate patch.

OK. But where do I get to know he is the maintainer?

> [...]
> > diff -pur ffmpeg/libavcodec/pcm.c ffmpeg.2/libavcodec/pcm.c
> > --- ffmpeg/libavcodec/pcm.c	2008-03-21 13:17:05.000000000 +0100
> > +++ ffmpeg.2/libavcodec/pcm.c	2008-04-12 15:19:41.000000000 +0200
> > @@ -383,15 +383,15 @@ static int pcm_decode_frame(AVCodecConte
> >      samples = data;
> >      src = buf;
> >  
> > -    n= av_get_bits_per_sample(avctx->codec_id)/8;
> > -    if(n && buf_size % n){
> > -        av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
> > -        return -1;
> > -    }
> >      if(avctx->channels <= 0 || avctx->channels > MAX_CHANNELS){
> >          av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
> >          return -1;
> >      }
> > +    n= av_get_bits_per_sample(avctx->codec_id)/8 * avctx->channels;
> > +    if(n && buf_size % n){
> > +        av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
> > +        return -1;
> > +    }
> >  
> >      buf_size= FFMIN(buf_size, *data_size/2);
> >      *data_size=0;
> 
> What is this good for?

I thought a valid PCM packet has one sample for each channel at a given time.
But I could drop this.
A check for a complete packet for 24bit DVD-LPCM is somewhat more complex, because some bytes  are interleaved.
see http://wiki.multimedia.cx/index.php?title=PCM#DVD_24-Bit_PCM (to be corrected!)

> > +    case CODEC_ID_PCM_S24DVD:
> > +        return 48;  /** 2 samples are interleaved per block */
> 
> This is wrong, its 24 bit per sample.

removed already.

still the configure/Makefile adaptation is missing

Regards
Lars
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 24pcm_dvd.patch1
Type: application/octet-stream
Size: 2945 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080412/711df5d2/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 24pcm_dvd.patch2
Type: application/octet-stream
Size: 838 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080412/711df5d2/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: better_sanity_check.patch
Type: text/x-diff
Size: 1014 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080412/711df5d2/attachment.patch>



More information about the ffmpeg-devel mailing list