Browse Source

pamenc: allocate the correct packetsize for mono.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n0.11
Michael Niedermayer 13 years ago
parent
commit
d3f81a6700
1 changed files with 2 additions and 4 deletions
  1. +2
    -4
      libavcodec/pamenc.c

+ 2
- 4
libavcodec/pamenc.c View File

@@ -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;
}


Loading…
Cancel
Save