diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2011-12-31 17:15:43 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2011-12-31 17:15:43 +0100 |
commit | f69a766d11e60cb11b45cee5a397db96bb8cf66e (patch) | |
tree | b4254419f38380f44010ac78b849f9c8a03b197c /libavcodec | |
parent | 0098e79f8a88a5ec8f710940c6fd7628c9dab110 (diff) | |
download | ffmpeg-f69a766d11e60cb11b45cee5a397db96bb8cf66e.tar.gz |
Fix mono* pam encoding.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/pamenc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/pamenc.c b/libavcodec/pamenc.c index 28fe7e13d7..c19ea0e117 100644 --- a/libavcodec/pamenc.c +++ b/libavcodec/pamenc.c @@ -50,7 +50,7 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, h = avctx->height; w = avctx->width; switch (avctx->pix_fmt) { - case PIX_FMT_MONOWHITE: + case PIX_FMT_MONOBLACK: n = (w + 7) >> 3; depth = 1; maxval = 1; @@ -97,6 +97,13 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, } ptr += linesize; } + } else if (avctx->pix_fmt == PIX_FMT_MONOBLACK){ + int j; + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) + *s->bytestream++ = ptr[j >> 3] >> (7 - j & 7) & 1; + ptr += linesize; + } } else { for (i = 0; i < h; i++) { memcpy(s->bytestream, ptr, n); @@ -115,6 +122,6 @@ AVCodec ff_pam_encoder = { .priv_data_size = sizeof(PNMContext), .init = ff_pnm_init, .encode = pam_encode_frame, - .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE}, + .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"), }; |