[FFmpeg-devel] [PATCH] rawdec: do not unnecessarily allocate full-frame buffer

Reimar Döffinger Reimar.Doeffinger
Wed Sep 22 08:14:58 CEST 2010

On Tue, Sep 21, 2010 at 09:52:24PM +0200, Michael Niedermayer wrote:
> On Tue, Sep 21, 2010 at 07:15:53PM +0100, Reimar D?ffinger wrote:
> > Hello,
> > attached patch makes rawdec.c only allocate a buffer if it will
> > actually be used (2 and 4 bpp formats), adding a separate palette
> > to the context for use in the general PAL8 case.
> > make test passes, and I don't think it should break anything,
> > though I'll probably suggest a few more changes in a few days.
> >  rawdec.c |   20 +++++++++++---------
> >  1 file changed, 11 insertions(+), 9 deletions(-)
> > bc1b224c82cf7e9e0b6b24d392a8faffcc827104  rawdec.diff
> this should be ok if it fixes the bug and has been tested

Sorry I was unclear: No, this does not fix the valgrind bug,
it just makes the patch for that simpler/less confusing.
To fix the bug, data[1] must be set to the new
context->palette for all non-PAL8 paletted formats and
it needs to be initialized with the right palette.
Changing this first just means I don't have to think about how
to make sure the buffer is large enough for the palette for that
case etc.

More information about the ffmpeg-devel mailing list