]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pnm.c
ARMv6 optimised pix_abs16_y2
[ffmpeg] / libavcodec / pnm.c
index 4fd9c61a24e69647a45dbcd004f714ca5d2505f8..cb6a7139f2c1ce693bc99e948af39024f2eced85 100644 (file)
@@ -59,16 +59,20 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
     int h, w, depth, maxval;
 
     pnm_get(s, buf1, sizeof(buf1));
-    if (!strcmp(buf1, "P4")) {
+    s->type= buf1[1]-'0';
+    if(buf1[0] != 'P')
+        return -1;
+
+    if (s->type==1 || s->type==4) {
         avctx->pix_fmt = PIX_FMT_MONOWHITE;
-    } else if (!strcmp(buf1, "P5")) {
+    } else if (s->type==2 || s->type==5) {
         if (avctx->codec_id == CODEC_ID_PGMYUV)
             avctx->pix_fmt = PIX_FMT_YUV420P;
         else
             avctx->pix_fmt = PIX_FMT_GRAY8;
-    } else if (!strcmp(buf1, "P6")) {
+    } else if (s->type==3 || s->type==6) {
         avctx->pix_fmt = PIX_FMT_RGB24;
-    } else if (!strcmp(buf1, "P7")) {
+    } else if (s->type==7) {
         w      = -1;
         h      = -1;
         maxval = -1;
@@ -149,7 +153,8 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
                 return -1;
             }
         }
-    }
+    }else
+        s->maxval=1;
     /* more check if YUV420 */
     if (avctx->pix_fmt == PIX_FMT_YUV420P) {
         if ((avctx->width & 1) != 0)