[FFmpeg-devel] [PATCH] Fixed CamStudio decoder picture corruptions

Reimar Döffinger Reimar.Doeffinger
Thu Sep 9 22:22:20 CEST 2010

On Fri, Aug 20, 2010 at 09:23:09PM +0200, Laurent Aimar wrote:
>  The attached patch fixes picture corruptions on some samples (for example
> the one attached to http://trac.videolan.org/vlc/ticket/3778).

Sorry I completely missed this patch.
Please bug me if that happens.

>  I haven't tested the big endian code (I don't have any hardware to test on).

Your changes should not at all depend on endianness, so I don't
think it's necessary to test.

> @@ -30,31 +30,32 @@
>  typedef struct {
>      AVFrame pic;
> -    int linelen, height, bpp;
> +    int linelen, linepitch, height, bpp;

Using the term "stride" as we do in all other code would be better.

> @@ -229,8 +234,9 @@
>      c->bpp = avctx->bits_per_coded_sample;
>      c->pic.data[0] = NULL;
>      c->linelen = avctx->width * avctx->bits_per_coded_sample / 8;
> +    c->linepitch = (avctx->width * avctx->bits_per_coded_sample + 31) / 32 * 4;

I am almost certain that this codec just compresses a Windows bitmap 1:1
and thus this code is wrong.
For Windows bitmaps, alignment is only done for the RGB24 format,
but not e.g. for the RGB555 format.
If you have samples that prove one way or the other (i.e. if anyone has
RGB555 samples with odd width) that would be helpful.
Attached patch should be better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cscdstride.diff
Type: text/x-diff
Size: 3360 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100909/f0c55f79/attachment.diff>

More information about the ffmpeg-devel mailing list