[FFmpeg-devel] [PATCH]Fix linesize for raw video

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Jun 30 00:44:46 CEST 2011


Hi!

Attached patch fixes decoding of several raw video streams I tested.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 04aa51e..f689f48 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -192,7 +192,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)


More information about the ffmpeg-devel mailing list