[FFmpeg-devel] [PATCH]Decode gray8a pam images
Carl Eugen Hoyos
cehoyos at ag.or.at
Mon Jan 16 15:01:54 CET 2012
Hi!
Attached patch implements gray8a pam decoding.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index fa43c8d..1defbc2 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -118,6 +118,9 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
} else {
avctx->pix_fmt = PIX_FMT_GRAY16BE;
}
+ } else if (depth == 2) {
+ if (maxval == 255)
+ avctx->pix_fmt = PIX_FMT_GRAY8A;
} else if (depth == 3) {
if (maxval < 256) {
avctx->pix_fmt = PIX_FMT_RGB24;
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index dc64f9b..ee15126 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -75,6 +75,11 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
if (s->maxval < 255)
upgrade = 1;
goto do_read;
+ case PIX_FMT_GRAY8A:
+ n = avctx->width * 2;
+ components=2;
+ sample_len=8;
+ goto do_read;
case PIX_FMT_GRAY16BE:
case PIX_FMT_GRAY16LE:
n = avctx->width * 2;
More information about the ffmpeg-devel
mailing list