[FFmpeg-cvslog] lavc/pnm: Support decoding ya16.

Carl Eugen Hoyos git at videolan.org
Thu Jan 22 04:44:28 CET 2015


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Thu Jan 22 01:49:04 2015 +0100| [6c559a0a9d3e8eb10e2b92b6793e11038ab86fcf] | committer: Carl Eugen Hoyos

lavc/pnm: Support decoding ya16.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c559a0a9d3e8eb10e2b92b6793e11038ab86fcf
---

 libavcodec/pnm.c    |    5 ++++-
 libavcodec/pnmdec.c |    7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 502e550..1675959 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -122,8 +122,11 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
                 avctx->pix_fmt = AV_PIX_FMT_GRAY16;
             }
         } else if (depth == 2) {
-            if (maxval == 255)
+            if (maxval < 256) {
                 avctx->pix_fmt = AV_PIX_FMT_GRAY8A;
+            } else {
+                avctx->pix_fmt = AV_PIX_FMT_YA16;
+            }
         } else if (depth == 3) {
             if (maxval < 256) {
                 avctx->pix_fmt = AV_PIX_FMT_RGB24;
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index c84b6eb..e634500 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -108,6 +108,13 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
         if (s->maxval < 65535)
             upgrade = 2;
         goto do_read;
+    case AV_PIX_FMT_YA16:
+        n =  avctx->width * 4;
+        components=2;
+        sample_len=16;
+        if (s->maxval < 65535)
+            upgrade = 2;
+        goto do_read;
     case AV_PIX_FMT_MONOWHITE:
     case AV_PIX_FMT_MONOBLACK:
         n = (avctx->width + 7) >> 3;



More information about the ffmpeg-cvslog mailing list