mirror of https://git.ffmpeg.org/ffmpeg.git
Simplify 32bit RGB pam encoding.
Reviewed-by: Paul B Mahol
This commit is contained in:
parent
4cef928ef7
commit
7c10d3ca2e
|
@ -80,7 +80,7 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
|
||||||
maxval = 255;
|
maxval = 255;
|
||||||
tuple_type = "RGB";
|
tuple_type = "RGB";
|
||||||
break;
|
break;
|
||||||
case PIX_FMT_RGB32:
|
case PIX_FMT_RGBA:
|
||||||
n = w * 4;
|
n = w * 4;
|
||||||
depth = 4;
|
depth = 4;
|
||||||
maxval = 255;
|
maxval = 255;
|
||||||
|
@ -103,19 +103,7 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
|
||||||
ptr = p->data[0];
|
ptr = p->data[0];
|
||||||
linesize = p->linesize[0];
|
linesize = p->linesize[0];
|
||||||
|
|
||||||
if (avctx->pix_fmt == PIX_FMT_RGB32) {
|
if (avctx->pix_fmt == PIX_FMT_MONOBLACK){
|
||||||
int j;
|
|
||||||
unsigned int v;
|
|
||||||
|
|
||||||
for (i = 0; i < h; i++) {
|
|
||||||
for (j = 0; j < w; j++) {
|
|
||||||
v = ((uint32_t *)ptr)[j];
|
|
||||||
bytestream_put_be24(&s->bytestream, v);
|
|
||||||
*s->bytestream++ = v >> 24;
|
|
||||||
}
|
|
||||||
ptr += linesize;
|
|
||||||
}
|
|
||||||
} else if (avctx->pix_fmt == PIX_FMT_MONOBLACK){
|
|
||||||
int j;
|
int j;
|
||||||
for (i = 0; i < h; i++) {
|
for (i = 0; i < h; i++) {
|
||||||
for (j = 0; j < w; j++)
|
for (j = 0; j < w; j++)
|
||||||
|
@ -140,6 +128,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_RGB48BE, PIX_FMT_GRAY8, PIX_FMT_GRAY8A, PIX_FMT_GRAY16BE, PIX_FMT_MONOBLACK, PIX_FMT_NONE},
|
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGBA, PIX_FMT_RGB48BE, PIX_FMT_GRAY8, PIX_FMT_GRAY8A, PIX_FMT_GRAY16BE, 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"),
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_MAJOR 53
|
#define LIBAVCODEC_VERSION_MAJOR 53
|
||||||
#define LIBAVCODEC_VERSION_MINOR 55
|
#define LIBAVCODEC_VERSION_MINOR 55
|
||||||
#define LIBAVCODEC_VERSION_MICRO 100
|
#define LIBAVCODEC_VERSION_MICRO 101
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||||
LIBAVCODEC_VERSION_MINOR, \
|
LIBAVCODEC_VERSION_MINOR, \
|
||||||
|
|
Loading…
Reference in New Issue