[FFmpeg-devel] [PATCH] make pcm_dvd use the full bit depth

Michael Niedermayer michaelni
Tue Aug 12 20:31:04 CEST 2008


On Tue, Aug 12, 2008 at 07:26:35PM +0200, Lars T?uber wrote:
> for review
> 
> Best regards.
> Lars

> Index: libavcodec/pcm.c
> ===================================================================
> --- libavcodec/pcm.c	(Revision 14707)
> +++ libavcodec/pcm.c	(Arbeitskopie)
> @@ -428,18 +428,33 @@
>          }
>          break;
>      case CODEC_ID_PCM_DVD:
> -        if(avctx->bits_per_sample != 20 && avctx->bits_per_sample != 24) {
> -            av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
> -            return -1;
> -        } else {
> -            int jump = avctx->channels * (avctx->bits_per_sample-16) / 4;
> -            n = buf_size / (avctx->channels * 2 * avctx->bits_per_sample / 8);
> +        dst_int32_t = data;
> +        n = buf_size / (avctx->channels * 2 * avctx->bits_per_sample / 8);
> +        switch (avctx->bits_per_sample) {
> +        case 20:
>              while (n--) {

>                  for (c=0; c < 2*avctx->channels; c++)
> +                    dst_int32_t[c] = bytestream_get_be16(&src);
> +                for (c=0; c < avctx->channels; c++) {
> +                    *dst_int32_t++ = (*src   &0xf0) << 8;
> +                    *dst_int32_t++ = (*src++ &0x0f) << 12;
> +                }
>              }

for (c=0; c < 2*avctx->channels; c=2) {
    dst_int32_t[c  ] = (bytestream_get_be16(&src16)<<16) + ((*src   &0xf0)<<8);
    dst_int32_t[c+1] = (bytestream_get_be16(&src16)<<16) + ((*src++ &0x0f)<<12);
}



> +            break;
> +        case 24:
> +            while (n--) {
> +                for (c=0; c < 2*avctx->channels; c++)
> +                    dst_int32_t[c] = bytestream_get_be16(&src);
> +                for (c=0; c < 2*avctx->channels; c++)
> +                    *dst_int32_t++ = (*src++) << 8;

for (c=0; c < 2*avctx->channels; c++) 
    dst_int32_t[c] = (bytestream_get_be16(&src16)<<16) + (src[c]<<8);

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080812/5732dde6/attachment.pgp>



More information about the ffmpeg-devel mailing list