OSDN Git Service

lavc/pnm: Support decoding ya16.
authorCarl Eugen Hoyos <cehoyos@ag.or.at>
Thu, 22 Jan 2015 00:49:04 +0000 (01:49 +0100)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Thu, 22 Jan 2015 00:49:04 +0000 (01:49 +0100)
libavcodec/pnm.c
libavcodec/pnmdec.c

index 502e550..1675959 100644 (file)
@@ -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;
index c84b6eb..e634500 100644 (file)
@@ -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;