]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pnmdec.c
avutil/frame: Remove deprecated AVFrame.pkt_pts field
[ffmpeg] / libavcodec / pnmdec.c
index 9add5cfc845f834d06574be4517989ecb2e65b3d..4d5ce0bcb5376e70a1cd442fc72561a9d2e6cbb7 100644 (file)
@@ -297,6 +297,30 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
             }
         }
         break;
+    case AV_PIX_FMT_GRAYF32:
+        if (avctx->width * avctx->height * 4 > s->bytestream_end - s->bytestream)
+            return AVERROR_INVALIDDATA;
+        scale = 1.f / s->scale;
+        if (s->endian) {
+            float *g = (float *)p->data[0];
+            for (int i = 0; i < avctx->height; i++) {
+                for (int j = 0; j < avctx->width; j++) {
+                    g[j] = av_int2float(AV_RL32(s->bytestream)) * scale;
+                    s->bytestream += 4;
+                }
+                g += p->linesize[0] / 4;
+            }
+        } else {
+            float *g = (float *)p->data[0];
+            for (int i = 0; i < avctx->height; i++) {
+                for (int j = 0; j < avctx->width; j++) {
+                    g[j] = av_int2float(AV_RB32(s->bytestream)) * scale;
+                    s->bytestream += 4;
+                }
+                g += p->linesize[0] / 4;
+            }
+        }
+        break;
     }
     *got_frame = 1;