[FFmpeg-cvslog] pamenc: allocate the correct packetsize for mono.

Michael Niedermayer git at videolan.org
Sun Feb 19 04:47:13 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Feb 19 04:15:22 2012 +0100| [d3f81a67008b6418b9f22d865294898915fb3ad8] | committer: Michael Niedermayer

pamenc: allocate the correct packetsize for mono.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d3f81a67008b6418b9f22d865294898915fb3ad8
---

 libavcodec/pamenc.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/pamenc.c b/libavcodec/pamenc.c
index b2c6c3e..d1de7a0 100644
--- a/libavcodec/pamenc.c
+++ b/libavcodec/pamenc.c
@@ -37,7 +37,7 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     w = avctx->width;
     switch (avctx->pix_fmt) {
     case PIX_FMT_MONOBLACK:
-        n          = (w + 7) >> 3;
+        n          = w;
         depth      = 1;
         maxval     = 1;
         tuple_type = "BLACKANDWHITE";
@@ -88,9 +88,7 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         return -1;
     }
 
-    if ((ret = ff_alloc_packet(pkt, avpicture_get_size(avctx->pix_fmt,
-                                                       avctx->width,
-                                                       avctx->height) + 200)) < 0) {
+    if ((ret = ff_alloc_packet(pkt, n*h + 200)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
         return ret;
     }



More information about the ffmpeg-cvslog mailing list