On Wed, Dec 28, 2011 at 04:45:11PM +0000, Måns Rullgård wrote:
> Kostya Shishkov <[email protected]> writes:
> 
> > On Wed, Dec 28, 2011 at 12:50:29AM -0500, Derek Buitenhuis wrote:
> >> From: Carl Eugen Hoyos <[email protected]>
> >> 
> >> ---
> >>  libavcodec/rawdec.c |    8 +++++++-
> >>  1 files changed, 7 insertions(+), 1 deletions(-)
> >> 
> >> diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
> >> index ddd8583..340278b 100644
> >> --- a/libavcodec/rawdec.c
> >> +++ b/libavcodec/rawdec.c
> >> @@ -172,7 +172,13 @@ static int raw_decode(AVCodecContext *avctx,
> >>              frame->palette_has_changed = 1;
> >>          }
> >>      }
> >> -    if(avctx->pix_fmt==PIX_FMT_BGR24 && 
> >> ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size)
> >> +    if((avctx->pix_fmt==PIX_FMT_BGR24    ||
> >> +        avctx->pix_fmt==PIX_FMT_GRAY8    ||
> >> +        avctx->pix_fmt==PIX_FMT_RGB555LE ||
> >> +        avctx->pix_fmt==PIX_FMT_RGB555BE ||
> >> +        avctx->pix_fmt==PIX_FMT_RGB565LE ||
> >> +        avctx->pix_fmt==PIX_FMT_PAL8) &&
> >> +        ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size)
> >>          frame->linesize[0] = (frame->linesize[0]+3)&~3;
> >>  
> >>      if(context->flip)
> >> -- 
> >
> > looks stupid
> 
> Disgusting even.
> 
> > It obviously tries to say "if we can pad linesize to DWORD then do it" and
> > that's because M$ raw in AVI requires it. But it can be done in more generic
> > way and preferably with comment, like:
> >
> >  // M$ raw data in AVI is padded to 4 bytes
> >  if (isRGB(avctx->pix_fmt) && FFALIGN(linesize, 4) * height <= buf_size)
> >     linesize = FFALIGN(linesize, 4);
> 
> Why do "codecs" need to care about container quirks?  Something doesn't
> smell quite right.

Probably demuxer assumes that raw data is packed without any line padding
while it's not true for M$ DIB (BMP, AVI). I wonder how to deal with it but no
patch from me.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to