Browse code

[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@gmx.at>

ami_stuff authored on 2011/11/22 04:31:47
Showing 3 changed files
... ...
@@ -123,6 +123,7 @@ easier to use. The changes are:
123 123
 - OS X Video Decoder Acceleration (VDA) support
124 124
 - compact and csv output in ffprobe
125 125
 - pan audio filter
126
+- IFF Amiga Continuous Bitmap (ACBM) decoder
126 127
 
127 128
 
128 129
 version 0.8:
... ...
@@ -440,7 +440,18 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
440 440
     }
441 441
     s->init = 1;
442 442
 
443
-    if (avctx->codec_tag == MKTAG('I','L','B','M')) { // interleaved
443
+    if (avctx->codec_tag == MKTAG('A','C','B','M')) {
444
+        if (avctx->pix_fmt == PIX_FMT_PAL8 || avctx->pix_fmt == PIX_FMT_GRAY8) {
445
+            memset(s->frame.data[0], 0, avctx->height * s->frame.linesize[0]);
446
+            for (plane = 0; plane < s->bpp; plane++) {
447
+                for(y = 0; y < avctx->height && buf < buf_end; y++ ) {
448
+                    uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
449
+                    decodeplane8(row, buf, FFMIN(s->planesize, buf_end - buf), plane);
450
+                    buf += s->planesize;
451
+                }
452
+            }
453
+        }
454
+    } else if (avctx->codec_tag == MKTAG('I','L','B','M')) { // interleaved
444 455
         if (avctx->pix_fmt == PIX_FMT_PAL8 || avctx->pix_fmt == PIX_FMT_GRAY8) {
445 456
             for(y = 0; y < avctx->height; y++ ) {
446 457
                 uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
... ...
@@ -43,6 +43,7 @@
43 43
 #define ID_BMHD       MKTAG('B','M','H','D')
44 44
 #define ID_CAMG       MKTAG('C','A','M','G')
45 45
 #define ID_CMAP       MKTAG('C','M','A','P')
46
+#define ID_ACBM       MKTAG('A','C','B','M')
46 47
 
47 48
 #define ID_FORM       MKTAG('F','O','R','M')
48 49
 #define ID_ANNO       MKTAG('A','N','N','O')
... ...
@@ -53,6 +54,7 @@
53 53
 #define ID_FVER       MKTAG('F','V','E','R')
54 54
 #define ID_NAME       MKTAG('N','A','M','E')
55 55
 #define ID_TEXT       MKTAG('T','E','X','T')
56
+#define ID_ABIT       MKTAG('A','B','I','T')
56 57
 #define ID_BODY       MKTAG('B','O','D','Y')
57 58
 #define ID_ANNO       MKTAG('A','N','N','O')
58 59
 
... ...
@@ -118,7 +120,7 @@ static int iff_probe(AVProbeData *p)
118 118
     const uint8_t *d = p->buf;
119 119
 
120 120
     if ( AV_RL32(d)   == ID_FORM &&
121
-         (AV_RL32(d+8) == ID_8SVX || AV_RL32(d+8) == ID_PBM || AV_RL32(d+8) == ID_ILBM) )
121
+         (AV_RL32(d+8) == ID_8SVX || AV_RL32(d+8) == ID_PBM || AV_RL32(d+8) == ID_ILBM || AV_RL32(d+8) == ID_ACBM) )
122 122
         return AVPROBE_SCORE_MAX;
123 123
     return 0;
124 124
 }
... ...
@@ -166,6 +168,7 @@ static int iff_read_header(AVFormatContext *s,
166 166
             }
167 167
             break;
168 168
 
169
+        case ID_ABIT:
169 170
         case ID_BODY:
170 171
             iff->body_pos = avio_tell(pb);
171 172
             iff->body_size = data_size;