Browse code

avocdec: add MagicYUV decoder

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2016/05/22 22:18:30
Showing 10 changed files
... ...
@@ -37,6 +37,7 @@ version <next>:
37 37
 - Direct Stream Transfer (DST) decoder
38 38
 - loudnorm filter
39 39
 - MTAF demuxer and decoder
40
+- MagicYUV decoder
40 41
 
41 42
 version 3.0:
42 43
 - Common Encryption (CENC) MP4 encoding and decoding support
... ...
@@ -2387,6 +2387,7 @@ jv_decoder_select="blockdsp"
2387 2387
 lagarith_decoder_select="huffyuvdsp"
2388 2388
 ljpeg_encoder_select="aandcttables idctdsp jpegtables"
2389 2389
 loco_decoder_select="golomb"
2390
+magicyuv_decoder_select="huffyuvdsp"
2390 2391
 mdec_decoder_select="blockdsp idctdsp mpegvideo"
2391 2392
 metasound_decoder_select="lsp mdct sinewin"
2392 2393
 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
... ...
@@ -744,6 +744,7 @@ following image formats are supported:
744 744
 @item LucasArts SANM/Smush   @tab     @tab  X
745 745
     @tab Used in LucasArts games / SMUSH animations.
746 746
 @item lossless MJPEG         @tab  X  @tab  X
747
+@item MagicYUV Lossless Video @tab     @tab  X
747 748
 @item Microsoft ATC Screen   @tab     @tab  X
748 749
     @tab Also known as Microsoft Screen 3.
749 750
 @item Microsoft Expression Encoder Screen  @tab     @tab  X
... ...
@@ -348,6 +348,7 @@ OBJS-$(CONFIG_LOCO_DECODER)            += loco.o
348 348
 OBJS-$(CONFIG_M101_DECODER)            += m101.o
349 349
 OBJS-$(CONFIG_MACE3_DECODER)           += mace.o
350 350
 OBJS-$(CONFIG_MACE6_DECODER)           += mace.o
351
+OBJS-$(CONFIG_MAGICYUV_DECODER)        += magicyuv.o
351 352
 OBJS-$(CONFIG_MDEC_DECODER)            += mdec.o mpeg12.o mpeg12data.o
352 353
 OBJS-$(CONFIG_METASOUND_DECODER)       += metasound.o metasound_data.o \
353 354
                                           twinvq.o
... ...
@@ -219,6 +219,7 @@ void avcodec_register_all(void)
219 219
     REGISTER_ENCODER(LJPEG,             ljpeg);
220 220
     REGISTER_DECODER(LOCO,              loco);
221 221
     REGISTER_DECODER(M101,              m101);
222
+    REGISTER_DECODER(MAGICYUV,          magicyuv);
222 223
     REGISTER_DECODER(MDEC,              mdec);
223 224
     REGISTER_DECODER(MIMIC,             mimic);
224 225
     REGISTER_ENCDEC (MJPEG,             mjpeg);
... ...
@@ -406,6 +406,7 @@ enum AVCodecID {
406 406
     AV_CODEC_ID_CFHD,
407 407
     AV_CODEC_ID_TRUEMOTION2RT,
408 408
     AV_CODEC_ID_M101,
409
+    AV_CODEC_ID_MAGICYUV,
409 410
 
410 411
     /* various PCM "codecs" */
411 412
     AV_CODEC_ID_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at the start of audio codecs
... ...
@@ -1542,6 +1542,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
1542 1542
         .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0 Real Time"),
1543 1543
         .props     = AV_CODEC_PROP_LOSSY,
1544 1544
     },
1545
+    {
1546
+        .id        = AV_CODEC_ID_MAGICYUV,
1547
+        .type      = AVMEDIA_TYPE_VIDEO,
1548
+        .name      = "magicyuv",
1549
+        .long_name = NULL_IF_CONFIG_SMALL("MagicYUV Lossless Video"),
1550
+        .props     = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
1551
+    },
1545 1552
 
1546 1553
     /* various PCM "codecs" */
1547 1554
     {
1548 1555
new file mode 100644
... ...
@@ -0,0 +1,465 @@
0
+/*
1
+ * MagicYUV decoder
2
+ * Copyright (c) 2016 Paul B Mahol
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+#include <stdio.h>
22
+#include <stdlib.h>
23
+#include <string.h>
24
+
25
+#include "libavutil/qsort.h"
26
+#include "avcodec.h"
27
+#include "bytestream.h"
28
+#include "get_bits.h"
29
+#include "huffyuvdsp.h"
30
+#include "internal.h"
31
+#include "thread.h"
32
+
33
+typedef struct Slice {
34
+    uint32_t start;
35
+    uint32_t size;
36
+} Slice;
37
+
38
+typedef enum Prediction {
39
+    LEFT = 1,
40
+    GRADIENT,
41
+    MEDIAN,
42
+} Prediction;
43
+
44
+typedef struct MagicYUVContext {
45
+    AVFrame            *p;
46
+    int                 slice_height;
47
+    int                 nb_slices;
48
+    int                 planes;         // number of encoded planes in bitstream
49
+    int                 decorrelate;    // postprocessing work
50
+    int                 interlaced;     // video is interlaced
51
+    uint8_t             *buf;           // pointer to AVPacket->data
52
+    int                 hshift[4];
53
+    int                 vshift[4];
54
+    Slice               *slices[4];     // slice positions and size in bitstream for each plane
55
+    int                 slices_size[4];
56
+    uint8_t             len[4][256];    // table of code lengths for each plane
57
+    VLC                 vlc[4];         // VLC for each plane
58
+    HuffYUVDSPContext   hdsp;
59
+} MagicYUVContext;
60
+
61
+static av_cold int decode_init(AVCodecContext *avctx)
62
+{
63
+    MagicYUVContext *s = avctx->priv_data;
64
+    ff_huffyuvdsp_init(&s->hdsp);
65
+    return 0;
66
+}
67
+
68
+typedef struct HuffEntry {
69
+    uint8_t  sym;
70
+    uint8_t  len;
71
+    uint32_t code;
72
+} HuffEntry;
73
+
74
+static int ff_magy_huff_cmp_len(const void *a, const void *b)
75
+{
76
+    const HuffEntry *aa = a, *bb = b;
77
+    return (aa->len - bb->len) * 256 + aa->sym - bb->sym;
78
+}
79
+
80
+static int build_huff(VLC *vlc, uint8_t *len)
81
+{
82
+    HuffEntry he[256];
83
+    uint32_t codes[256];
84
+    uint8_t bits[256];
85
+    uint8_t syms[256];
86
+    uint32_t code;
87
+    int i;
88
+
89
+    for (i = 0; i < 256; i++) {
90
+        he[i].sym = 255 - i;
91
+        he[i].len = len[i];
92
+    }
93
+    AV_QSORT(he, 256, HuffEntry, ff_magy_huff_cmp_len);
94
+
95
+    code = 1;
96
+    for (i = 255; i >= 0; i--) {
97
+        codes[i] = code >> (32 - he[i].len);
98
+        bits[i]  = he[i].len;
99
+        syms[i]  = he[i].sym;
100
+        code += 0x80000000u >> (he[i].len - 1);
101
+    }
102
+
103
+    ff_free_vlc(vlc);
104
+    return ff_init_vlc_sparse(vlc, FFMIN(he[255].len, 12), 256,
105
+                              bits,  sizeof(*bits),  sizeof(*bits),
106
+                              codes, sizeof(*codes), sizeof(*codes),
107
+                              syms,  sizeof(*syms),  sizeof(*syms), 0);
108
+}
109
+
110
+static int decode_slice(AVCodecContext *avctx, void *tdata,
111
+                        int j, int threadnr)
112
+{
113
+    MagicYUVContext *s = avctx->priv_data;
114
+    int interlaced = s->interlaced;
115
+    AVFrame *p = s->p;
116
+    int i, k, x, ret;
117
+    GetBitContext b;
118
+    uint8_t *dst;
119
+
120
+    for (i = 0; i < s->planes; i++) {
121
+        int height = AV_CEIL_RSHIFT(FFMIN(s->slice_height, avctx->coded_height - j * s->slice_height), s->vshift[i]);
122
+        int width = AV_CEIL_RSHIFT(avctx->coded_width, s->hshift[i]);
123
+        int sheight = AV_CEIL_RSHIFT(s->slice_height, s->vshift[i]);
124
+        int fake_stride = p->linesize[i] * (1 + interlaced);
125
+        int stride = p->linesize[i];
126
+        int pred;
127
+
128
+        if ((ret = init_get_bits8(&b, s->buf + s->slices[i][j].start, s->slices[i][j].size)) < 0)
129
+            return ret;
130
+
131
+        pred = get_bits(&b, 16);
132
+        dst = p->data[i] + j * sheight * stride;
133
+        for (k = 0; k < height; k++) {
134
+            for (x = 0; x < width; x++) {
135
+                int pix;
136
+                if (get_bits_left(&b) <= 0) {
137
+                    return AVERROR_INVALIDDATA;
138
+                }
139
+                pix = get_vlc2(&b, s->vlc[i].table, s->vlc[i].bits, 3);
140
+                if (pix < 0) {
141
+                    return AVERROR_INVALIDDATA;
142
+                }
143
+                dst[x] = 255 - pix;
144
+            }
145
+            dst += stride;
146
+        }
147
+
148
+        if (pred == LEFT) {
149
+            dst = p->data[i] + j * sheight * stride;
150
+            s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
151
+            dst += stride;
152
+            if (interlaced) {
153
+                s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
154
+                dst += stride;
155
+            }
156
+            for (k = 1 + interlaced; k < height; k++) {
157
+                s->hdsp.add_hfyu_left_pred(dst, dst, width, dst[-fake_stride]);
158
+                dst += stride;
159
+            }
160
+        } else if (pred == GRADIENT) {
161
+            int left, lefttop, top;
162
+
163
+            dst = p->data[i] + j * sheight * stride;
164
+            s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
165
+            left = lefttop = 0;
166
+            dst += stride;
167
+            if (interlaced) {
168
+                s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
169
+                left = lefttop = 0;
170
+                dst += stride;
171
+            }
172
+            for (k = 1 + interlaced; k < height; k++) {
173
+                top = dst[-fake_stride];
174
+                left = top + dst[0];
175
+                dst[0] = left;
176
+                for (x = 1; x < width; x++) {
177
+                    top = dst[x - fake_stride];
178
+                    lefttop = dst[x - (fake_stride + 1)];
179
+                    left += top - lefttop + dst[x];
180
+                    dst[x] = left;
181
+                }
182
+                dst += stride;
183
+            }
184
+        } else if (pred == MEDIAN) {
185
+            int left, lefttop;
186
+
187
+            dst = p->data[i] + j * sheight * stride;
188
+            lefttop = left = dst[0];
189
+            s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
190
+            dst += stride;
191
+            if (interlaced) {
192
+                lefttop = left = dst[0];
193
+                s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
194
+                dst += stride;
195
+            }
196
+            for (k = 1 + interlaced; k < height; k++) {
197
+                s->hdsp.add_hfyu_median_pred(dst, dst - fake_stride, dst, width, &left, &lefttop);
198
+                lefttop = left = dst[0];
199
+                dst += stride;
200
+            }
201
+        } else {
202
+            avpriv_request_sample(avctx, "unknown prediction: %d", pred);
203
+        }
204
+    }
205
+
206
+    if (s->decorrelate) {
207
+        int height = FFMIN(s->slice_height, avctx->coded_height - j * s->slice_height);
208
+        int width = avctx->coded_width;
209
+        uint8_t *b = p->data[0] + j * s->slice_height * p->linesize[0];
210
+        uint8_t *g = p->data[1] + j * s->slice_height * p->linesize[1];
211
+        uint8_t *r = p->data[2] + j * s->slice_height * p->linesize[2];
212
+
213
+        for (i = 0; i < height; i++) {
214
+            s->hdsp.add_bytes(b, g, width);
215
+            s->hdsp.add_bytes(r, g, width);
216
+            b += p->linesize[0];
217
+            g += p->linesize[1];
218
+            r += p->linesize[2];
219
+        }
220
+    }
221
+
222
+    return 0;
223
+}
224
+
225
+static int decode_frame(AVCodecContext *avctx,
226
+                        void *data, int *got_frame,
227
+                        AVPacket *avpkt)
228
+{
229
+    uint32_t first_offset, offset, next_offset, header_size, slice_width;
230
+    int ret, format, version, table_size;
231
+    MagicYUVContext *s = avctx->priv_data;
232
+    ThreadFrame frame = { .f = data };
233
+    AVFrame *p = data;
234
+    GetByteContext gb;
235
+    GetBitContext b;
236
+    int i, j, k;
237
+
238
+    bytestream2_init(&gb, avpkt->data, avpkt->size);
239
+    if (bytestream2_get_le32(&gb) != MKTAG('M','A','G','Y'))
240
+        return AVERROR_INVALIDDATA;
241
+
242
+    header_size = bytestream2_get_le32(&gb);
243
+    if (header_size < 32 || header_size >= avpkt->size)
244
+        return AVERROR_INVALIDDATA;
245
+
246
+    version = bytestream2_get_byte(&gb);
247
+    if (version != 7) {
248
+        avpriv_request_sample(avctx, "unsupported version: %d", version);
249
+        return AVERROR_PATCHWELCOME;
250
+    }
251
+
252
+    s->hshift[1] = s->vshift[1] = 0;
253
+    s->hshift[2] = s->vshift[2] = 0;
254
+    s->decorrelate = 0;
255
+
256
+    format = bytestream2_get_byte(&gb);
257
+    switch (format) {
258
+    case 0x65:
259
+        avctx->pix_fmt = AV_PIX_FMT_GBRP;
260
+        s->decorrelate = 1;
261
+        s->planes = 3;
262
+        break;
263
+    case 0x66:
264
+        avctx->pix_fmt = AV_PIX_FMT_GBRAP;
265
+        s->decorrelate = 1;
266
+        s->planes = 4;
267
+        break;
268
+    case 0x67:
269
+        avctx->pix_fmt = AV_PIX_FMT_YUV444P;
270
+        s->planes = 3;
271
+        break;
272
+    case 0x68:
273
+        avctx->pix_fmt = AV_PIX_FMT_YUV422P;
274
+        s->planes = 3;
275
+        s->hshift[1] = s->hshift[2] = 1;
276
+        break;
277
+    case 0x69:
278
+        avctx->pix_fmt = AV_PIX_FMT_YUV420P;
279
+        s->planes = 3;
280
+        s->hshift[1] = s->vshift[1] = 1;
281
+        s->hshift[2] = s->vshift[2] = 1;
282
+        break;
283
+    case 0x6a:
284
+        avctx->pix_fmt = AV_PIX_FMT_YUVA444P;
285
+        s->planes = 4;
286
+        break;
287
+    case 0x6b:
288
+        avctx->pix_fmt = AV_PIX_FMT_GRAY8;
289
+        s->planes = 1;
290
+        break;
291
+    default:
292
+        avpriv_request_sample(avctx, "unsupported format: 0x%X", format);
293
+        return AVERROR_PATCHWELCOME;
294
+    }
295
+
296
+    bytestream2_skip(&gb, 2);
297
+    s->interlaced = !!(bytestream2_get_byte(&gb) & 2);
298
+    bytestream2_skip(&gb, 3);
299
+
300
+    avctx->coded_width  = bytestream2_get_le32(&gb);
301
+    avctx->coded_height = bytestream2_get_le32(&gb);
302
+    slice_width = bytestream2_get_le32(&gb);
303
+    if (slice_width != avctx->coded_width) {
304
+        avpriv_request_sample(avctx, "unsupported slice width: %d", slice_width);
305
+        return AVERROR_PATCHWELCOME;
306
+    }
307
+    s->slice_height = bytestream2_get_le32(&gb);
308
+    if ((s->slice_height <= 0) || (s->slice_height > INT_MAX - avctx->coded_height)) {
309
+        av_log(avctx, AV_LOG_ERROR, "invalid slice height: %d\n", s->slice_height);
310
+        return AVERROR_INVALIDDATA;
311
+    }
312
+
313
+    bytestream2_skip(&gb, 4);
314
+
315
+    s->nb_slices = (avctx->coded_height + s->slice_height - 1) / s->slice_height;
316
+    if (s->nb_slices > INT_MAX / sizeof(Slice)) {
317
+        av_log(avctx, AV_LOG_ERROR, "invalid number of slices: %d\n", s->nb_slices);
318
+        return AVERROR_INVALIDDATA;
319
+    }
320
+
321
+    for (i = 0; i < s->planes; i++) {
322
+        av_fast_malloc(&s->slices[i], &s->slices_size[i], s->nb_slices * sizeof(Slice));
323
+        if (!s->slices[i])
324
+            return AVERROR(ENOMEM);
325
+
326
+        offset = bytestream2_get_le32(&gb);
327
+        if (offset >= avpkt->size - header_size)
328
+            return AVERROR_INVALIDDATA;
329
+
330
+        if (i == 0)
331
+            first_offset = offset;
332
+
333
+        for (j = 0; j < s->nb_slices - 1; j++) {
334
+            s->slices[i][j].start = offset + header_size;
335
+            next_offset = bytestream2_get_le32(&gb);
336
+            s->slices[i][j].size  = next_offset - offset;
337
+            offset = next_offset;
338
+
339
+            if (offset >= avpkt->size - header_size)
340
+                return AVERROR_INVALIDDATA;
341
+        }
342
+
343
+        s->slices[i][j].start = offset + header_size;
344
+        s->slices[i][j].size  = avpkt->size - offset;
345
+    }
346
+
347
+    if (bytestream2_get_byte(&gb) != s->planes)
348
+        return AVERROR_INVALIDDATA;
349
+
350
+    bytestream2_skip(&gb, s->nb_slices * s->planes);
351
+
352
+    table_size = header_size + first_offset - bytestream2_tell(&gb);
353
+    if (table_size < 2)
354
+        return AVERROR_INVALIDDATA;
355
+
356
+    if ((ret = init_get_bits8(&b, avpkt->data + bytestream2_tell(&gb), table_size)) < 0)
357
+        return ret;
358
+
359
+    memset(s->len, 0, sizeof(s->len));
360
+    j = i = 0;
361
+    while (get_bits_left(&b) >= 8) {
362
+        int l = get_bits(&b, 4);
363
+        int x = get_bits(&b, 4);
364
+        int L = get_bitsz(&b, l) + 1;
365
+
366
+        for (k = 0; k < L; k++) {
367
+            if (j + k < 256)
368
+                s->len[i][j + k] = x;
369
+        }
370
+
371
+        j += L;
372
+        if (j == 256) {
373
+            j = 0;
374
+            if (build_huff(&s->vlc[i], s->len[i])) {
375
+                av_log(avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
376
+                return AVERROR_INVALIDDATA;
377
+            }
378
+            i++;
379
+            if (i == s->planes) {
380
+                break;
381
+            }
382
+        } else if (j > 256) {
383
+            return AVERROR_INVALIDDATA;
384
+        }
385
+    }
386
+
387
+    if (i != s->planes) {
388
+        av_log(avctx, AV_LOG_ERROR, "Huffman tables too short\n");
389
+        return AVERROR_INVALIDDATA;
390
+    }
391
+
392
+    p->pict_type = AV_PICTURE_TYPE_I;
393
+    p->key_frame = 1;
394
+
395
+    if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
396
+        return ret;
397
+
398
+    s->buf = avpkt->data;
399
+    s->p = p;
400
+    avctx->execute2(avctx, decode_slice, NULL, NULL, s->nb_slices);
401
+
402
+    if (avctx->pix_fmt == AV_PIX_FMT_GBRP ||
403
+        avctx->pix_fmt == AV_PIX_FMT_GBRAP) {
404
+        FFSWAP(uint8_t*, p->data[0], p->data[1]);
405
+        FFSWAP(int, p->linesize[0], p->linesize[1]);
406
+    }
407
+
408
+    *got_frame = 1;
409
+
410
+    if (ret < 0)
411
+        return ret;
412
+    return avpkt->size;
413
+}
414
+
415
+#if HAVE_THREADS
416
+static int decode_init_thread_copy(AVCodecContext *avctx)
417
+{
418
+    MagicYUVContext *s = avctx->priv_data;
419
+
420
+    s->slices[0] = 0;
421
+    s->slices[1] = 0;
422
+    s->slices[2] = 0;
423
+    s->slices[3] = 0;
424
+    s->slices_size[0] = 0;
425
+    s->slices_size[1] = 0;
426
+    s->slices_size[2] = 0;
427
+    s->slices_size[3] = 0;
428
+
429
+    return 0;
430
+}
431
+#endif
432
+
433
+static av_cold int decode_end(AVCodecContext *avctx)
434
+{
435
+    MagicYUVContext * const s = avctx->priv_data;
436
+
437
+    av_freep(&s->slices[0]);
438
+    av_freep(&s->slices[1]);
439
+    av_freep(&s->slices[2]);
440
+    av_freep(&s->slices[3]);
441
+    s->slices_size[0] = 0;
442
+    s->slices_size[1] = 0;
443
+    s->slices_size[2] = 0;
444
+    s->slices_size[3] = 0;
445
+    ff_free_vlc(&s->vlc[0]);
446
+    ff_free_vlc(&s->vlc[1]);
447
+    ff_free_vlc(&s->vlc[2]);
448
+    ff_free_vlc(&s->vlc[3]);
449
+
450
+    return 0;
451
+}
452
+
453
+AVCodec ff_magicyuv_decoder = {
454
+    .name             = "magicyuv",
455
+    .long_name        = NULL_IF_CONFIG_SMALL("MagicYUV Lossless Video"),
456
+    .type             = AVMEDIA_TYPE_VIDEO,
457
+    .id               = AV_CODEC_ID_MAGICYUV,
458
+    .priv_data_size   = sizeof(MagicYUVContext),
459
+    .init             = decode_init,
460
+    .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
461
+    .close            = decode_end,
462
+    .decode           = decode_frame,
463
+    .capabilities     = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_SLICE_THREADS,
464
+};
... ...
@@ -28,7 +28,7 @@
28 28
 #include "libavutil/version.h"
29 29
 
30 30
 #define LIBAVCODEC_VERSION_MAJOR  57
31
-#define LIBAVCODEC_VERSION_MINOR  43
31
+#define LIBAVCODEC_VERSION_MINOR  44
32 32
 #define LIBAVCODEC_VERSION_MICRO 100
33 33
 
34 34
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
... ...
@@ -421,6 +421,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
421 421
     { AV_CODEC_ID_CFHD,         MKTAG('C', 'F', 'H', 'D') },
422 422
     { AV_CODEC_ID_M101,         MKTAG('M', '1', '0', '1') },
423 423
     { AV_CODEC_ID_M101,         MKTAG('M', '1', '0', '2') },
424
+    { AV_CODEC_ID_MAGICYUV,     MKTAG('M', 'A', 'G', 'Y') },
424 425
 
425 426
     { AV_CODEC_ID_NONE,         0 }
426 427
 };