[FFmpeg-devel] [RFC][PATCH] Fix decoding of QT WRAW file from ticket #108

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon May 16 01:30:31 CEST 2011


On date Thursday 2011-05-12 18:36:27 +0200, ami_stuff encoded:
> Hi,
> 
> The attached patch fixes decoding of file from ticket #108 (and flips the video).
> 
> The problem is that it seems the correct color mode for this file should be PIX_FMT_BGR24
> (the colors looks more or less the same like with QT player), but with my patch PIX_FMT_RGB24
> color mode is selected... or maybe this is problem with endianness (I test on big-endian)?
> 
> Also when I manually assign
> 
> avctx->pix_fmt = PIX_FMT_BGR24;
> 
> some distortion is visible at the top of the video.
> 
> So the question is should I leave the patch as it is now or modify it to assign color mode to BGR24
> when the file is encoded with WRAW codec and have 24bpp?
> 
> BTW. I have only this one WRAW file for test.
> 
> Regards

> diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
> index bd9312c..4add8c3 100644
> --- a/libavcodec/rawdec.c
> +++ b/libavcodec/rawdec.c
> @@ -76,7 +76,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
>  {
>      RawVideoContext *context = avctx->priv_data;
>  
> -    if (avctx->codec_tag == MKTAG('r','a','w',' '))
> +    if (avctx->codec_tag == MKTAG('r','a','w',' ') || avctx->codec_tag == MKTAG('W','R','A','W'))
>          avctx->pix_fmt = ff_find_pix_fmt(pix_fmt_bps_mov, avctx->bits_per_coded_sample);
>      else if (avctx->codec_tag)
>          avctx->pix_fmt = ff_find_pix_fmt(ff_raw_pix_fmt_tags, avctx->codec_tag);
> @@ -98,7 +98,8 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
>      avctx->coded_frame= &context->pic;
>  
>      if((avctx->extradata_size >= 9 && !memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp", 9)) ||
> -       avctx->codec_tag == MKTAG( 3 ,  0 ,  0 ,  0 ))
> +       avctx->codec_tag == MKTAG( 3 ,  0 ,  0 ,  0 ) ||
> +       avctx->codec_tag == MKTAG('W','R','A','W'))
>          context->flip=1;

Not sure this is right. WRAW in AVI is used for paletted video, this
may force the flip of files which are currently decoded correctly.

Or in other words, can you show some docs which document what's the
assumed meaning of that tag in MOV?
-- 
FFmpeg = Fast and Friendly Most Powerful Elfic Gnome


More information about the ffmpeg-devel mailing list