]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pictordec.c
vda: cosmetic.
[ffmpeg] / libavcodec / pictordec.c
index ca3e791f9a86b7fc44589f5f66ab6057ea7b9986..b3b5f7ef4fd06901ea91cc814f814a37bffefa74 100644 (file)
@@ -130,7 +130,7 @@ static int decode_frame(AVCodecContext *avctx,
         return AVERROR_INVALIDDATA;
     }
 
-    if (*buf == 0xFF) {
+    if (*buf == 0xFF || bpp == 8) {
         buf += 2;
         etype  = bytestream_get_le16(&buf);
         esize  = bytestream_get_le16(&buf);
@@ -198,10 +198,10 @@ static int decode_frame(AVCodecContext *avctx,
     buf += esize;
 
 
-    x = 0;
     y = s->height - 1;
-    plane = 0;
     if (bytestream_get_le16(&buf)) {
+        x = 0;
+        plane = 0;
         while (y >= 0 && buf_end - buf >= 6) {
             const uint8_t *buf_pend = buf + FFMIN(AV_RL16(buf), buf_end - buf);
             //ignore uncompressed block size reported at buf[2]
@@ -228,8 +228,11 @@ static int decode_frame(AVCodecContext *avctx,
             }
         }
     } else {
-        av_log_ask_for_sample(avctx, "uncompressed image\n");
-        return buf_size;
+        while (y >= 0 && buf < buf_end) {
+            memcpy(s->frame.data[0] + y * s->frame.linesize[0], buf, FFMIN(avctx->width, buf_end - buf));
+            buf += avctx->width;
+            y--;
+        }
     }
 
     *data_size = sizeof(AVFrame);
@@ -250,7 +253,7 @@ AVCodec ff_pictor_decoder = {
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_PICTOR,
     .priv_data_size = sizeof(PicContext),
-    decode_init,
+    .init           = decode_init,
     .close          = decode_end,
     .decode         = decode_frame,
     .capabilities   = CODEC_CAP_DR1,