mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Fix mono* pam encoding.
This commit is contained in:
parent
0098e79f8a
commit
f69a766d11
@ -50,7 +50,7 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
|
|||||||
h = avctx->height;
|
h = avctx->height;
|
||||||
w = avctx->width;
|
w = avctx->width;
|
||||||
switch (avctx->pix_fmt) {
|
switch (avctx->pix_fmt) {
|
||||||
case PIX_FMT_MONOWHITE:
|
case PIX_FMT_MONOBLACK:
|
||||||
n = (w + 7) >> 3;
|
n = (w + 7) >> 3;
|
||||||
depth = 1;
|
depth = 1;
|
||||||
maxval = 1;
|
maxval = 1;
|
||||||
@ -97,6 +97,13 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
|
|||||||
}
|
}
|
||||||
ptr += linesize;
|
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 {
|
} else {
|
||||||
for (i = 0; i < h; i++) {
|
for (i = 0; i < h; i++) {
|
||||||
memcpy(s->bytestream, ptr, n);
|
memcpy(s->bytestream, ptr, n);
|
||||||
@ -115,6 +122,6 @@ AVCodec ff_pam_encoder = {
|
|||||||
.priv_data_size = sizeof(PNMContext),
|
.priv_data_size = sizeof(PNMContext),
|
||||||
.init = ff_pnm_init,
|
.init = ff_pnm_init,
|
||||||
.encode = pam_encode_frame,
|
.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"),
|
.long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user