[FFmpeg-cvslog] [PATCH] IFF Amiga Continuous Bitmap (ACBM)decoder

ami_stuff git at videolan.org
Mon Nov 21 23:45:39 CET 2011


ffmpeg | branch: master | ami_stuff <ami_stuff at o2.pl> | Mon Nov 21 20:31:47 2011 +0100| [cf14c822275301209c307fb35351d5c9833b7a3b] | committer: Michael Niedermayer

[PATCH] IFF Amiga Continuous Bitmap (ACBM)decoder

Some sample IFF ACBM files can be found here:

http://aminet.net/package/dev/basic/ABdemos

Thanks to Peter Ross for his help with this patch.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 Changelog         |    1 +
 libavcodec/iff.c  |   13 ++++++++++++-
 libavformat/iff.c |    5 ++++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 19472d4..b781f33 100644
--- a/Changelog
+++ b/Changelog
@@ -123,6 +123,7 @@ easier to use. The changes are:
 - OS X Video Decoder Acceleration (VDA) support
 - compact and csv output in ffprobe
 - pan audio filter
+- IFF Amiga Continuous Bitmap (ACBM) decoder
 
 
 version 0.8:
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 39fa732..c4c614e 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -440,7 +440,18 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
     }
     s->init = 1;
 
-    if (avctx->codec_tag == MKTAG('I','L','B','M')) { // interleaved
+    if (avctx->codec_tag == MKTAG('A','C','B','M')) {
+        if (avctx->pix_fmt == PIX_FMT_PAL8 || avctx->pix_fmt == PIX_FMT_GRAY8) {
+            memset(s->frame.data[0], 0, avctx->height * s->frame.linesize[0]);
+            for (plane = 0; plane < s->bpp; plane++) {
+                for(y = 0; y < avctx->height && buf < buf_end; y++ ) {
+                    uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
+                    decodeplane8(row, buf, FFMIN(s->planesize, buf_end - buf), plane);
+                    buf += s->planesize;
+                }
+            }
+        }
+    } else if (avctx->codec_tag == MKTAG('I','L','B','M')) { // interleaved
         if (avctx->pix_fmt == PIX_FMT_PAL8 || avctx->pix_fmt == PIX_FMT_GRAY8) {
             for(y = 0; y < avctx->height; y++ ) {
                 uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
diff --git a/libavformat/iff.c b/libavformat/iff.c
index 7601d6d..a816af5 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -43,6 +43,7 @@
 #define ID_BMHD       MKTAG('B','M','H','D')
 #define ID_CAMG       MKTAG('C','A','M','G')
 #define ID_CMAP       MKTAG('C','M','A','P')
+#define ID_ACBM       MKTAG('A','C','B','M')
 
 #define ID_FORM       MKTAG('F','O','R','M')
 #define ID_ANNO       MKTAG('A','N','N','O')
@@ -53,6 +54,7 @@
 #define ID_FVER       MKTAG('F','V','E','R')
 #define ID_NAME       MKTAG('N','A','M','E')
 #define ID_TEXT       MKTAG('T','E','X','T')
+#define ID_ABIT       MKTAG('A','B','I','T')
 #define ID_BODY       MKTAG('B','O','D','Y')
 #define ID_ANNO       MKTAG('A','N','N','O')
 
@@ -118,7 +120,7 @@ static int iff_probe(AVProbeData *p)
     const uint8_t *d = p->buf;
 
     if ( AV_RL32(d)   == ID_FORM &&
-         (AV_RL32(d+8) == ID_8SVX || AV_RL32(d+8) == ID_PBM || AV_RL32(d+8) == ID_ILBM) )
+         (AV_RL32(d+8) == ID_8SVX || AV_RL32(d+8) == ID_PBM || AV_RL32(d+8) == ID_ILBM || AV_RL32(d+8) == ID_ACBM) )
         return AVPROBE_SCORE_MAX;
     return 0;
 }
@@ -166,6 +168,7 @@ static int iff_read_header(AVFormatContext *s,
             }
             break;
 
+        case ID_ABIT:
         case ID_BODY:
             iff->body_pos = avio_tell(pb);
             iff->body_size = data_size;



More information about the ffmpeg-cvslog mailing list