[FFmpeg-devel] [RFC] LPCM 24 bits support

Lars Täuber lars.taeuber
Sun Apr 13 09:18:16 CEST 2008


Hallo Giuliano,

I overlooked your work sorry for that.

On Sun, 30 Mar 2008 18:56:17 +0000 Giuliano Pochini <pochini at shiny.it> wrote:
> diff -dupr ffmpeg__orig/libavcodec/pcm.c ffmpeg/libavcodec/pcm.c
> --- ffmpeg__orig/libavcodec/pcm.c	2008-02-06 12:37:37.000000000 +0000
> +++ ffmpeg/libavcodec/pcm.c	2008-03-30 18:41:30.000000000 +0000
> @@ -492,6 +492,43 @@ static int pcm_decode_frame(AVCodecConte
>              *samples++ = s->table[*src++];
>          }
>          break;
> +    case CODEC_ID_PCM_DVD20:
> +    {
> +        int audio24[8*2], *ap;
> +        const uint8_t *src_LSB;
> +
> +        for (n=buf_size/(avctx->channels * 5); n>0; n--) {
> +            ap = audio24;
> +            src_LSB = src + avctx->channels * 2 * 2;
> +            for (c=0; c<avctx->channels; c++, src+=4, src_LSB++) {
> +                *ap++ = (((const int8_t *)src)[0]<<16) + (src[1]<<8) + (*src_LSB & 0xf0);
> +                *ap++ = (((const int8_t *)src)[2]<<16) + (src[3]<<8) + ((*src_LSB << 4) & 0xff);

Does this work with an odd number of channels, or are only even number of channels possible?

> +            }
> +            src = src_LSB;
> +
> +            for (c=0; c<avctx->channels * 2; c++)
> +                *samples++ = audio24[c] >> 8;
> +        }
> +        break;
> +    }

I'm not sure, but the break; and the following { should be exchanged.!?


> +    case CODEC_ID_PCM_DVD24:
> +    {
> +        int audio24[8*2], *ap;
> +        const uint8_t *src_LSB;
> +
> +        for (n=buf_size/(avctx->channels * 2 * 3); n>0; n--) {
> +            ap = audio24;
> +            src_LSB = src + avctx->channels * 2 * 2;
> +            for (c=0; c<avctx->channels * 2; c++, src+=2, src_LSB++) {
> +                *ap++ = (((const int8_t *)src)[0]<<16) + (src[1]<<8) + *src_LSB;
> +            }
> +            src = src_LSB;
> +
> +            for (c=0; c<avctx->channels * 2; c++)
> +                *samples++ = audio24[c] >> 8;
> +        }
> +        break;
> +    }

break; <=> }    ??


Regards
Lars




More information about the ffmpeg-devel mailing list