Browse code

initial support for Duck TrueMotion v1 (think of it as On2 VP1); only 16-bit mode supported thus far

Originally committed as revision 2555 to svn://svn.ffmpeg.org/ffmpeg/trunk

Mike Melanson authored on 2003/12/03 13:22:15
Showing 7 changed files
... ...
@@ -10,6 +10,8 @@ version <next>:
10 10
 - Id Quake II CIN playback support
11 11
 - 8BPS video decoder
12 12
 - FLIC playback support
13
+- RealVideo 2.0 (RV20) decoder
14
+- Duck TrueMotion v1 (DUCK) video decoder
13 15
 
14 16
 version 0.4.8:
15 17
 
... ...
@@ -707,6 +707,7 @@ following image formats are supported:
707 707
 @item Id Cinematic Video     @tab     @tab  X @tab used in Quake II
708 708
 @item Planar RGB             @tab     @tab  X @tab fourcc: 8BPS
709 709
 @item FLIC video             @tab     @tab  X
710
+@item Duck TrueMotion v1     @tab     @tab  X @tab fourcc: DUCK
710 711
 @end multitable
711 712
 
712 713
 @code{X} means that the encoding (resp. decoding) is supported.
... ...
@@ -19,7 +19,7 @@ OBJS= common.o utils.o mem.o allcodecs.o \
19 19
       vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o \
20 20
       roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o \
21 21
       msvideo1.o vqavideo.o idcinvideo.o adx.o rational.o faandct.o 8bps.o \
22
-      smc.o parser.o flicvideo.o
22
+      smc.o parser.o flicvideo.o truemotion1.o
23 23
 
24 24
 ifeq ($(AMR_NB),yes)
25 25
 ifeq ($(AMR_NB_FIXED),yes)
... ...
@@ -139,6 +139,7 @@ void avcodec_register_all(void)
139 139
     register_avcodec(&eightbps_decoder);
140 140
     register_avcodec(&smc_decoder);
141 141
     register_avcodec(&flic_decoder);
142
+    register_avcodec(&truemotion1_decoder);
142 143
 #ifdef CONFIG_AC3
143 144
     register_avcodec(&ac3_decoder);
144 145
 #endif
... ...
@@ -88,6 +88,7 @@ enum CodecID {
88 88
     CODEC_ID_8BPS,
89 89
     CODEC_ID_SMC,
90 90
     CODEC_ID_FLIC,
91
+    CODEC_ID_TRUEMOTION1,
91 92
 
92 93
     /* various pcm "codecs" */
93 94
     CODEC_ID_PCM_S16LE,
... ...
@@ -1581,6 +1582,7 @@ extern AVCodec idcin_decoder;
1581 1581
 extern AVCodec eightbps_decoder;
1582 1582
 extern AVCodec smc_decoder;
1583 1583
 extern AVCodec flic_decoder;
1584
+extern AVCodec truemotion1_decoder;
1584 1585
 extern AVCodec ra_144_decoder;
1585 1586
 extern AVCodec ra_288_decoder;
1586 1587
 extern AVCodec roq_dpcm_decoder;
1587 1588
new file mode 100644
... ...
@@ -0,0 +1,597 @@
0
+/*
1
+ * Duck TrueMotion 1.0 Decoder
2
+ * Copyright (C) 2003 Alex Beregszaszi & Mike Melanson
3
+ *
4
+ * This library is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2 of the License, or (at your option) any later version.
8
+ *
9
+ * This library is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with this library; if not, write to the Free Software
16
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
+ */
18
+
19
+/**
20
+ * @file truemotion1.c
21
+ * Duck TrueMotion v1 Video Decoder by 
22
+ * Alex Beregszaszi (alex@fsn.hu) and
23
+ * Mike Melanson (melanson@pcisys.net)
24
+ *
25
+ * The TrueMotion v1 decoder presently only decodes 16-bit TM1 data and
26
+ * outputs RGB555 data. 24-bit TM1 data is not supported yet.
27
+ */
28
+
29
+#include <stdio.h>
30
+#include <stdlib.h>
31
+#include <string.h>
32
+#include <unistd.h>
33
+
34
+#include "common.h"
35
+#include "avcodec.h"
36
+#include "dsputil.h"
37
+
38
+#include "truemotion1data.h"
39
+
40
+#define LE_16(x)  ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
41
+
42
+typedef struct TrueMotion1Context {
43
+    AVCodecContext *avctx;
44
+    AVFrame frame;
45
+    AVFrame prev_frame;
46
+
47
+    unsigned char *buf;
48
+    int size;
49
+
50
+    unsigned char *mb_change_bits;
51
+    int mb_change_bits_row_size;
52
+    unsigned char *index_stream;
53
+    int index_stream_size;
54
+
55
+    int flags;
56
+    int x, y, w, h;
57
+    
58
+    uint32_t y_predictor_table[1024];
59
+    uint32_t c_predictor_table[1024];
60
+    
61
+    int compression;
62
+    int block_type;
63
+    int block_width;
64
+    int block_height;
65
+
66
+    int16_t *ydt;
67
+    int16_t *cdt;
68
+    int16_t *fat_ydt;
69
+    int16_t *fat_cdt;
70
+    
71
+    int last_deltaset, last_vectable;
72
+
73
+    unsigned int *vert_pred;
74
+
75
+} TrueMotion1Context;
76
+
77
+#define FLAG_SPRITE         32
78
+#define FLAG_KEYFRAME       16
79
+#define FLAG_INTERFRAME      8
80
+#define FLAG_INTERPOLATED    4
81
+
82
+struct frame_header {
83
+    uint8_t header_size;
84
+    uint8_t compression;
85
+    uint8_t deltaset;
86
+    uint8_t vectable;
87
+    uint16_t ysize;
88
+    uint16_t xsize;
89
+    uint16_t checksum;
90
+    uint8_t version;
91
+    uint8_t header_type;
92
+    uint8_t flags;
93
+    uint8_t control;
94
+    uint16_t xoffset;
95
+    uint16_t yoffset;
96
+    uint16_t width;
97
+    uint16_t height;
98
+};
99
+
100
+#define ALGO_NOP        0
101
+#define ALGO_RGB16V     1
102
+#define ALGO_RGB16H     2
103
+#define ALGO_RGB24H     3
104
+
105
+/* these are the various block sizes that can occupy a 4x4 block */
106
+#define BLOCK_2x2  0
107
+#define BLOCK_2x4  1
108
+#define BLOCK_4x2  2
109
+#define BLOCK_4x4  3
110
+
111
+typedef struct comp_types {
112
+    int algorithm;
113
+    int block_width;
114
+    int block_height;
115
+    int block_type;
116
+} comp_types;
117
+
118
+/* { valid for metatype }, algorithm, num of deltas, horiz res, vert res */
119
+static comp_types compression_types[17] = {
120
+    { ALGO_NOP,    0, 0, 0 },
121
+
122
+    { ALGO_RGB16V, 4, 4, BLOCK_4x4 },
123
+    { ALGO_RGB16H, 4, 4, BLOCK_4x4 },
124
+    { ALGO_RGB16V, 4, 2, BLOCK_4x2 },
125
+    { ALGO_RGB16H, 4, 2, BLOCK_4x2 },
126
+
127
+    { ALGO_RGB16V, 2, 4, BLOCK_2x4 },
128
+    { ALGO_RGB16H, 2, 4, BLOCK_2x4 },
129
+    { ALGO_RGB16V, 2, 2, BLOCK_2x2 },
130
+    { ALGO_RGB16H, 2, 2, BLOCK_2x2 },
131
+
132
+    { ALGO_NOP,    4, 4, BLOCK_4x4 },
133
+    { ALGO_RGB24H, 4, 4, BLOCK_4x4 },
134
+    { ALGO_NOP,    4, 2, BLOCK_4x2 },
135
+    { ALGO_RGB24H, 4, 2, BLOCK_4x2 },
136
+
137
+    { ALGO_NOP,    2, 4, BLOCK_2x4 },
138
+    { ALGO_RGB24H, 2, 4, BLOCK_2x4 },
139
+    { ALGO_NOP,    2, 2, BLOCK_2x2 },
140
+    { ALGO_RGB24H, 2, 2, BLOCK_2x2 }
141
+};
142
+
143
+static void select_delta_tables(TrueMotion1Context *s, int delta_table_index)
144
+{
145
+    int i;
146
+
147
+    if (delta_table_index > 3)
148
+        return;
149
+
150
+    s->ydt = ydts[delta_table_index];
151
+    s->cdt = cdts[delta_table_index];
152
+    s->fat_ydt = fat_ydts[delta_table_index];
153
+    s->fat_cdt = fat_cdts[delta_table_index];
154
+
155
+    /* Y skinny deltas need to be halved for some reason; maybe the
156
+     * skinny Y deltas should be modified */
157
+    for (i = 0; i < 8; i++)
158
+    {
159
+        /* drop the lsb before dividing by 2-- net effect: round down
160
+         * when dividing a negative number (e.g., -3/2 = -2, not -1) */
161
+        s->ydt[i] &= 0xFFFE;
162
+        s->ydt[i] /= 2;
163
+    }
164
+}
165
+
166
+static int make_ydt_entry(int p1, int p2, int16_t *ydt)
167
+{
168
+    int lo, hi;
169
+    
170
+    lo = ydt[p1];
171
+    lo += (lo << 5) + (lo << 10);
172
+    hi = ydt[p2];
173
+    hi += (hi << 5) + (hi << 10);
174
+    return ((lo + (hi << 16)) << 1);
175
+}
176
+
177
+static int make_cdt_entry(int p1, int p2, int16_t *cdt)
178
+{
179
+    int r, b, lo;
180
+    
181
+    b = cdt[p2];
182
+    r = cdt[p1] << 10;
183
+    lo = b + r;
184
+    return ((lo + (lo << 16)) << 1);
185
+}
186
+
187
+static void gen_vector_table(TrueMotion1Context *s, uint8_t *sel_vector_table)
188
+{
189
+    int len, i, j;
190
+    unsigned char delta_pair;
191
+    
192
+    for (i = 0; i < 1024; i += 4)
193
+    {
194
+        len = *sel_vector_table++ / 2;
195
+        for (j = 0; j < len; j++)
196
+        {
197
+            delta_pair = *sel_vector_table++;
198
+            s->y_predictor_table[i+j] = 0xfffffffe & 
199
+                make_ydt_entry(delta_pair >> 4, delta_pair & 0xf, s->ydt);
200
+            s->c_predictor_table[i+j] = 0xfffffffe & 
201
+                make_cdt_entry(delta_pair >> 4, delta_pair & 0xf, s->cdt);
202
+        }
203
+        s->y_predictor_table[i+(j-1)] |= 1;
204
+        s->c_predictor_table[i+(j-1)] |= 1;
205
+    }
206
+}
207
+
208
+/* Returns the number of bytes consumed from the bytestream. Returns -1 if
209
+ * there was an error while decoding the header */ 
210
+static int truemotion1_decode_header(TrueMotion1Context *s)
211
+{
212
+    int i;
213
+    struct frame_header header;
214
+    uint8_t header_buffer[128];  /* logical maximum size of the header */
215
+    uint8_t *sel_vector_table;
216
+
217
+    /* There is 1 change bit per 4 pixels, so each change byte represents
218
+     * 32 pixels; divide width by 4 to obtain the number of change bits and
219
+     * then round up to the nearest byte. */
220
+    s->mb_change_bits_row_size = ((s->avctx->width >> 2) + 7) >> 3;
221
+
222
+    header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f;
223
+    if (s->buf[0] < 0x10)
224
+    {
225
+        printf("invalid header size\n");
226
+        return -1;
227
+    }
228
+
229
+    /* unscramble the header bytes with a XOR operation */
230
+    memset(header_buffer, 0, 128);
231
+    for (i = 1; i < header.header_size; i++)
232
+    header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1];
233
+    header.compression = header_buffer[0];
234
+    header.deltaset = header_buffer[1];
235
+    header.vectable = header_buffer[2];
236
+    header.ysize = LE_16(&header_buffer[3]);
237
+    header.xsize = LE_16(&header_buffer[5]);
238
+    header.checksum = LE_16(&header_buffer[7]);
239
+    header.version = header_buffer[9];
240
+    header.header_type = header_buffer[10];
241
+    header.flags = header_buffer[11];
242
+    header.control = header_buffer[12];
243
+
244
+    /* Version 2 */
245
+    if (header.version >= 2)
246
+    {
247
+        if (header.header_type > 3)
248
+        {
249
+            av_log(s->avctx, AV_LOG_ERROR, "truemotion1: invalid header type\n");
250
+            return -1;
251
+        } else if ((header.header_type == 2) || (header.header_type == 3)) {
252
+            s->flags = header.flags;
253
+            if (!(s->flags & FLAG_INTERFRAME))
254
+                s->flags |= FLAG_KEYFRAME;
255
+        } else
256
+            s->flags = FLAG_KEYFRAME;
257
+    } else /* Version 1 */
258
+        s->flags = FLAG_KEYFRAME;
259
+    
260
+    if (s->flags & FLAG_SPRITE) {
261
+        s->w = header.width;
262
+        s->h = header.height;
263
+        s->x = header.xoffset;
264
+        s->y = header.yoffset;
265
+    } else {
266
+        s->w = header.xsize;
267
+        s->h = header.ysize;
268
+        if (header.header_type < 2) {
269
+            if ((s->w < 213) && (s->h >= 176))
270
+                s->flags |= FLAG_INTERPOLATED;
271
+        }
272
+    }
273
+
274
+    if (header.compression > 17) {
275
+        printf("invalid compression type (%d)\n", header.compression);
276
+        return -1;
277
+    }
278
+    
279
+    if ((header.deltaset != s->last_deltaset) || 
280
+        (header.vectable != s->last_vectable))
281
+        select_delta_tables(s, header.deltaset);
282
+
283
+    if ((header.compression & 1) && header.header_type)
284
+        sel_vector_table = pc_tbl2;
285
+    else {
286
+        if (header.vectable < 4)
287
+            sel_vector_table = tables[header.vectable - 1];
288
+        else {
289
+            printf("invalid vector table id (%d)\n", header.vectable);
290
+            return -1;
291
+        }
292
+    }
293
+
294
+    if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable))
295
+    {
296
+        if (compression_types[header.compression].algorithm == ALGO_RGB24H)
297
+        {
298
+            printf("24bit compression not yet supported\n");
299
+        }
300
+        else
301
+            gen_vector_table(s, sel_vector_table);
302
+    }
303
+
304
+    /* set up pointers to the other key data chunks */
305
+    s->mb_change_bits = s->buf + header.header_size;
306
+    if (s->flags & FLAG_KEYFRAME) {
307
+        /* no change bits specified for a keyframe; only index bytes */
308
+        s->index_stream = s->mb_change_bits;
309
+    } else {
310
+        /* one change bit per 4x4 block */
311
+        s->index_stream = s->mb_change_bits + 
312
+            (s->mb_change_bits_row_size * (s->avctx->height >> 2));
313
+    }
314
+    s->index_stream_size = s->size - (s->index_stream - s->buf);
315
+
316
+    s->last_deltaset = header.deltaset;
317
+    s->last_vectable = header.vectable;
318
+    s->compression = header.compression;
319
+    s->block_width = compression_types[header.compression].block_width;
320
+    s->block_height = compression_types[header.compression].block_height;
321
+    s->block_type = compression_types[header.compression].block_type;
322
+
323
+    return header.header_size;    
324
+}
325
+
326
+static int truemotion1_decode_init(AVCodecContext *avctx)
327
+{
328
+    TrueMotion1Context *s = (TrueMotion1Context *)avctx->priv_data;
329
+
330
+    s->avctx = avctx;
331
+
332
+    avctx->pix_fmt = PIX_FMT_RGB555;
333
+    avctx->has_b_frames = 0;
334
+    s->frame.data[0] = s->prev_frame.data[0] = NULL;
335
+
336
+    /* there is a vertical predictor for each pixel in a line; each vertical
337
+     * predictor is 0 to start with */
338
+    s->vert_pred = 
339
+        (unsigned int *)av_malloc(s->avctx->width * sizeof(unsigned short));
340
+
341
+    return 0;
342
+}
343
+
344
+#define GET_NEXT_INDEX() \
345
+{\
346
+    if (index_stream_index >= s->index_stream_size) { \
347
+        printf (" help! truemotion1 decoder went out of bounds\n"); \
348
+        return; \
349
+    } \
350
+    index = s->index_stream[index_stream_index++] * 4; \
351
+}
352
+
353
+#define APPLY_C_PREDICTOR() \
354
+    predictor_pair = s->c_predictor_table[index]; \
355
+    horiz_pred += (predictor_pair >> 1); \
356
+    if (predictor_pair & 1) { \
357
+        GET_NEXT_INDEX() \
358
+        if (!index) { \
359
+            GET_NEXT_INDEX() \
360
+            predictor_pair = s->c_predictor_table[index]; \
361
+            horiz_pred += ((predictor_pair >> 1) * 5); \
362
+            if (predictor_pair & 1) \
363
+                GET_NEXT_INDEX() \
364
+            else \
365
+                index++; \
366
+        } \
367
+    } else \
368
+        index++;
369
+
370
+#define APPLY_Y_PREDICTOR() \
371
+    predictor_pair = s->y_predictor_table[index]; \
372
+    horiz_pred += (predictor_pair >> 1); \
373
+    if (predictor_pair & 1) { \
374
+        GET_NEXT_INDEX() \
375
+        if (!index) { \
376
+            GET_NEXT_INDEX() \
377
+            predictor_pair = s->y_predictor_table[index]; \
378
+            horiz_pred += ((predictor_pair >> 1) * 5); \
379
+            if (predictor_pair & 1) \
380
+                GET_NEXT_INDEX() \
381
+            else \
382
+                index++; \
383
+        } \
384
+    } else \
385
+        index++;
386
+
387
+#define OUTPUT_PIXEL_PAIR() \
388
+    *current_pixel_pair = *vert_pred + horiz_pred; \
389
+    *vert_pred++ = *current_pixel_pair++; \
390
+    prev_pixel_pair++;
391
+
392
+static void truemotion1_decode_16bit(TrueMotion1Context *s)
393
+{
394
+    int y;
395
+    int pixels_left;  /* remaining pixels on this line */
396
+    unsigned int predictor_pair;
397
+    unsigned int horiz_pred;
398
+    unsigned int *vert_pred;
399
+    unsigned int *current_pixel_pair;
400
+    unsigned int *prev_pixel_pair;
401
+    unsigned char *current_line = s->frame.data[0];
402
+    unsigned char *prev_line = s->prev_frame.data[0];
403
+    int keyframe = s->flags & FLAG_KEYFRAME;
404
+
405
+    /* these variables are for managing the stream of macroblock change bits */
406
+    unsigned char *mb_change_bits = s->mb_change_bits;
407
+    unsigned char mb_change_byte;
408
+    unsigned char mb_change_byte_mask;
409
+    int mb_change_index;
410
+
411
+    /* these variables are for managing the main index stream */
412
+    int index_stream_index = 0;  /* yes, the index into the index stream */
413
+    int index;
414
+
415
+    /* clean out the line buffer */
416
+    memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned short));
417
+
418
+    GET_NEXT_INDEX();
419
+
420
+    for (y = 0; y < s->avctx->height; y++) {
421
+
422
+        /* re-init variables for the next line iteration */
423
+        horiz_pred = 0;
424
+        current_pixel_pair = (unsigned int *)current_line;
425
+        prev_pixel_pair = (unsigned int *)prev_line;
426
+        vert_pred = s->vert_pred;
427
+        mb_change_index = 0;
428
+        mb_change_byte = mb_change_bits[mb_change_index++];
429
+        mb_change_byte_mask = 0x01;
430
+        pixels_left = s->avctx->width;
431
+
432
+        while (pixels_left > 0) {
433
+
434
+            if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) {
435
+
436
+                switch (y & 3) {
437
+                case 0:
438
+                    /* if macroblock width is 2, apply C-Y-C-Y; else 
439
+                     * apply C-Y-Y */
440
+                    if ((s->block_type == BLOCK_2x2) ||
441
+                        (s->block_type == BLOCK_2x4)) {
442
+                        APPLY_C_PREDICTOR();
443
+                        APPLY_Y_PREDICTOR();
444
+                        OUTPUT_PIXEL_PAIR();
445
+                        APPLY_C_PREDICTOR();
446
+                        APPLY_Y_PREDICTOR();
447
+                        OUTPUT_PIXEL_PAIR();
448
+                    } else {
449
+                        APPLY_C_PREDICTOR();
450
+                        APPLY_Y_PREDICTOR();
451
+                        OUTPUT_PIXEL_PAIR();
452
+                        APPLY_Y_PREDICTOR();
453
+                        OUTPUT_PIXEL_PAIR();
454
+                    }
455
+                    break;
456
+
457
+                case 1:
458
+                case 3:
459
+                    /* always apply 2 Y predictors on these iterations */
460
+                    APPLY_Y_PREDICTOR();
461
+                    OUTPUT_PIXEL_PAIR();
462
+                    APPLY_Y_PREDICTOR();
463
+                    OUTPUT_PIXEL_PAIR();
464
+                    break;
465
+
466
+                case 2:
467
+                    /* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y 
468
+                     * depending on the macroblock type */
469
+                    if (s->block_type == BLOCK_2x2) {
470
+                        APPLY_C_PREDICTOR();
471
+                        APPLY_Y_PREDICTOR();
472
+                        OUTPUT_PIXEL_PAIR();
473
+                        APPLY_C_PREDICTOR();
474
+                        APPLY_Y_PREDICTOR();
475
+                        OUTPUT_PIXEL_PAIR();
476
+                    } else if (s->block_type == BLOCK_4x2) {
477
+                        APPLY_C_PREDICTOR();
478
+                        APPLY_Y_PREDICTOR();
479
+                        OUTPUT_PIXEL_PAIR();
480
+                        APPLY_Y_PREDICTOR();
481
+                        OUTPUT_PIXEL_PAIR();
482
+                    } else {
483
+                        APPLY_Y_PREDICTOR();
484
+                        OUTPUT_PIXEL_PAIR();
485
+                        APPLY_Y_PREDICTOR();
486
+                        OUTPUT_PIXEL_PAIR();
487
+                    }
488
+                    break;
489
+                }
490
+
491
+            } else {
492
+
493
+                /* skip (copy) four pixels, but reassign the horizontal 
494
+                 * predictor */
495
+                *current_pixel_pair = *prev_pixel_pair++;
496
+                *vert_pred++ = *current_pixel_pair++;
497
+                *current_pixel_pair = *prev_pixel_pair++;
498
+                horiz_pred = *current_pixel_pair - *vert_pred;
499
+                *vert_pred++ = *current_pixel_pair++;
500
+                
501
+            }
502
+
503
+            if (!keyframe) {
504
+                mb_change_byte_mask <<= 1;
505
+
506
+                /* next byte */
507
+                if (!mb_change_byte_mask) {
508
+                    mb_change_byte = mb_change_bits[mb_change_index++];
509
+                    mb_change_byte_mask = 0x01;
510
+                }
511
+            }
512
+
513
+            pixels_left -= 4;
514
+        }
515
+
516
+        /* next change row */
517
+        if (((y + 1) & 3) == 0)
518
+            mb_change_bits += s->mb_change_bits_row_size;
519
+
520
+        current_line += s->frame.linesize[0];
521
+        prev_line += s->prev_frame.linesize[0];
522
+    }
523
+}
524
+
525
+static int truemotion1_decode_frame(AVCodecContext *avctx,
526
+                                    void *data, int *data_size,
527
+                                    uint8_t *buf, int buf_size)
528
+{
529
+    TrueMotion1Context *s = (TrueMotion1Context *)avctx->priv_data;
530
+
531
+    s->buf = buf;
532
+    s->size = buf_size;
533
+
534
+    s->frame.reference = 1;
535
+    if (avctx->get_buffer(avctx, &s->frame) < 0) {
536
+        fprintf(stderr, "truemotion1: get_buffer() failed\n");
537
+        return -1;
538
+    }
539
+
540
+    /* no supplementary picture */
541
+    if (buf_size == 0)
542
+        return 0;
543
+
544
+    *data_size = 0;
545
+    
546
+    if (truemotion1_decode_header(s) == -1)
547
+        return -1;
548
+
549
+    /* check for a do-nothing frame and copy the previous frame */
550
+    if (compression_types[s->compression].algorithm == ALGO_NOP)
551
+    {
552
+        memcpy(s->frame.data[0], s->prev_frame.data[0],
553
+            s->frame.linesize[0] * s->avctx->height);
554
+    } else if (compression_types[s->compression].algorithm == ALGO_RGB24H) {
555
+        printf ("  24-bit Duck TrueMotion decoding not yet implemented\n");
556
+    } else {
557
+        truemotion1_decode_16bit(s);
558
+    }
559
+
560
+    if (s->prev_frame.data[0])
561
+        avctx->release_buffer(avctx, &s->prev_frame);
562
+
563
+    /* shuffle frames */
564
+    s->prev_frame = s->frame;
565
+
566
+    *data_size = sizeof(AVFrame);
567
+    *(AVFrame*)data = s->frame;
568
+
569
+    /* report that the buffer was completely consumed */
570
+    return buf_size;
571
+}
572
+
573
+static int truemotion1_decode_end(AVCodecContext *avctx)
574
+{
575
+    TrueMotion1Context *s = (TrueMotion1Context *)avctx->priv_data;
576
+
577
+    /* release the last frame */
578
+    if (s->prev_frame.data[0])
579
+        avctx->release_buffer(avctx, &s->prev_frame);
580
+
581
+    av_free(s->vert_pred);
582
+
583
+    return 0;
584
+}
585
+
586
+AVCodec truemotion1_decoder = {
587
+    "truemotion1",
588
+    CODEC_TYPE_VIDEO,
589
+    CODEC_ID_TRUEMOTION1,
590
+    sizeof(TrueMotion1Context),
591
+    truemotion1_decode_init,
592
+    NULL,
593
+    truemotion1_decode_end,
594
+    truemotion1_decode_frame,
595
+    CODEC_CAP_DR1,
596
+};
0 597
new file mode 100644
... ...
@@ -0,0 +1,810 @@
0
+/*
1
+ * Duck Truemotion v1 Decoding Tables
2
+ *
3
+ * Data in this file was originally part of VpVision from On2 which is
4
+ * distributed under the GNU GPL. It is redistributed with ffmpeg under the
5
+ * GNU LGPL using the common understanding that data tables necessary for
6
+ * decoding algorithms are not necessarily licensable.
7
+ */
8
+
9
+/* Y delta tables, skinny and fat */
10
+static int16_t ydt1[8] = { 0, -2, 2, -6, 6, -12, 12, -12 };
11
+static int16_t ydt2[8] = { 0, -2, 2, -6, 6, -12, 12, -12 };
12
+static int16_t ydt3[8] = { 4, -6, 20, -20, 46, -46, 94, -94 };
13
+static int16_t fat_ydt3[8] = { 0, -15, 50, -50, 115, -115, 235, -235 };
14
+static int16_t ydt4[8] = { 0, -4, 4, -16, 16, -36, 36, -80 };
15
+static int16_t fat_ydt4[8] = { 0, 40, 80, -76, 160, -154, 236, -236 };
16
+
17
+/* C delta tables, skinny and fat */
18
+static int16_t cdt1[8] = { 0, -1, 1, -2, 3, -4, 5, -4 };
19
+static int16_t cdt2[8] = { 0, -4, 3, -16, 20, -32, 36, -32 };
20
+static int16_t fat_cdt2[8] = { 0, -20, 15, -80, 100, -160, 180, -160 };
21
+static int16_t cdt3[8] = { 0, -2, 2, -8, 8, -18, 18, -40 };
22
+/* NOTE: This table breaks the [+,-] pattern that the rest of the
23
+ * tables maintain. Is this intentional? */
24
+static int16_t fat_cdt3[8] = { 0, 40, 80, -76, 160, -154, 236, -236 };
25
+
26
+/* all the delta tables to choose from, at all 4 delta levels */
27
+static int16_t *ydts[] = { ydt1, ydt2, ydt3, ydt4, NULL };
28
+static int16_t *fat_ydts[] = { fat_ydt3, fat_ydt3, fat_ydt3, fat_ydt4, NULL };
29
+static int16_t *cdts[] = { cdt1, cdt2, cdt3, cdt3, NULL };
30
+static int16_t *fat_cdts[] = { fat_cdt2, fat_cdt2, fat_cdt2, fat_cdt3, NULL };
31
+
32
+static uint8_t pc_tbl2[] = {
33
+0x8,0x00,0x00,0x00,0x00,
34
+0x8,0x00,0x00,0x00,0x00,
35
+0x8,0x10,0x00,0x00,0x00,
36
+0x8,0x01,0x00,0x00,0x00,
37
+0x8,0x00,0x10,0x00,0x00,
38
+0x8,0x00,0x01,0x00,0x00,
39
+0x8,0x00,0x00,0x10,0x00,
40
+0x8,0x00,0x00,0x01,0x00,
41
+0x8,0x00,0x00,0x00,0x10,
42
+0x8,0x00,0x00,0x00,0x01,
43
+0x6,0x00,0x00,0x00,
44
+0x6,0x10,0x00,0x00,
45
+0x6,0x01,0x00,0x00,
46
+0x6,0x00,0x10,0x00,
47
+0x6,0x00,0x01,0x00,
48
+0x6,0x00,0x00,0x01,
49
+0x6,0x00,0x00,0x10,
50
+0x6,0x00,0x00,0x02,
51
+0x6,0x00,0x00,0x20,
52
+0x6,0x20,0x10,0x00,
53
+0x6,0x00,0x02,0x01,
54
+0x6,0x00,0x20,0x10,
55
+0x6,0x02,0x01,0x00,
56
+0x6,0x11,0x00,0x00,
57
+0x6,0x00,0x20,0x00,
58
+0x6,0x00,0x02,0x00,
59
+0x6,0x20,0x00,0x00,
60
+0x6,0x01,0x10,0x00,
61
+0x6,0x02,0x00,0x00,
62
+0x6,0x01,0x00,0x02,
63
+0x6,0x10,0x00,0x20,
64
+0x6,0x00,0x01,0x02,
65
+0x6,0x10,0x01,0x00,
66
+0x6,0x00,0x10,0x20,
67
+0x6,0x10,0x10,0x00,
68
+0x6,0x10,0x00,0x01,
69
+0x6,0x20,0x00,0x10,
70
+0x6,0x02,0x00,0x01,
71
+0x6,0x01,0x01,0x00,
72
+0x6,0x01,0x00,0x10,
73
+0x6,0x00,0x11,0x00,
74
+0x6,0x10,0x00,0x02,
75
+0x6,0x00,0x01,0x10,
76
+0x6,0x00,0x00,0x11,
77
+0x6,0x10,0x00,0x10,
78
+0x6,0x01,0x00,0x01,
79
+0x6,0x00,0x00,0x22,
80
+0x6,0x02,0x01,0x01,
81
+0x6,0x10,0x20,0x10,
82
+0x6,0x01,0x02,0x01,
83
+0x6,0x20,0x10,0x10,
84
+0x6,0x01,0x00,0x20,
85
+0x6,0x00,0x10,0x01,
86
+0x6,0x21,0x10,0x00,
87
+0x6,0x10,0x02,0x01,
88
+0x6,0x12,0x01,0x00,
89
+0x6,0x01,0x20,0x10,
90
+0x6,0x01,0x02,0x00,
91
+0x6,0x10,0x20,0x00,
92
+0x6,0x00,0x10,0x02,
93
+0x6,0x00,0x01,0x20,
94
+0x6,0x00,0x02,0x21,
95
+0x6,0x00,0x02,0x20,
96
+0x6,0x00,0x00,0x12,
97
+0x6,0x00,0x00,0x21,
98
+0x6,0x20,0x11,0x00,
99
+0x6,0x00,0x01,0x01,
100
+0x6,0x11,0x10,0x00,
101
+0x6,0x00,0x20,0x12,
102
+0x6,0x00,0x20,0x11,
103
+0x6,0x20,0x10,0x02,
104
+0x6,0x02,0x01,0x20,
105
+0x6,0x00,0x22,0x11,
106
+0x6,0x00,0x10,0x10,
107
+0x6,0x02,0x11,0x00,
108
+0x6,0x00,0x21,0x10,
109
+0x6,0x00,0x02,0x03,
110
+0x6,0x20,0x10,0x01,
111
+0x6,0x00,0x12,0x01,
112
+0x4,0x11,0x00,
113
+0x4,0x00,0x22,
114
+0x4,0x20,0x00,
115
+0x4,0x01,0x10,
116
+0x4,0x02,0x20,
117
+0x4,0x00,0x20,
118
+0x4,0x02,0x00,
119
+0x4,0x10,0x01,
120
+0x4,0x00,0x11,
121
+0x4,0x02,0x01,
122
+0x4,0x02,0x21,
123
+0x4,0x00,0x02,
124
+0x4,0x20,0x02,
125
+0x4,0x01,0x01,
126
+0x4,0x10,0x10,
127
+0x4,0x10,0x02,
128
+0x4,0x22,0x00,
129
+0x4,0x10,0x00,
130
+0x4,0x01,0x00,
131
+0x4,0x21,0x00,
132
+0x4,0x12,0x00,
133
+0x4,0x00,0x10,
134
+0x4,0x20,0x12,
135
+0x4,0x01,0x11,
136
+0x4,0x00,0x01,
137
+0x4,0x01,0x02,
138
+0x4,0x11,0x02,
139
+0x4,0x11,0x01,
140
+0x4,0x10,0x20,
141
+0x4,0x20,0x01,
142
+0x4,0x22,0x11,
143
+0x4,0x00,0x12,
144
+0x4,0x20,0x10,
145
+0x4,0x22,0x01,
146
+0x4,0x01,0x20,
147
+0x4,0x00,0x21,
148
+0x4,0x10,0x11,
149
+0x4,0x21,0x10,
150
+0x4,0x10,0x22,
151
+0x4,0x02,0x03,
152
+0x4,0x12,0x01,
153
+0x4,0x20,0x11,
154
+0x4,0x11,0x10,
155
+0x4,0x20,0x30,
156
+0x4,0x11,0x20,
157
+0x4,0x02,0x10,
158
+0x4,0x22,0x10,
159
+0x4,0x11,0x11,
160
+0x4,0x30,0x20,
161
+0x4,0x30,0x00,
162
+0x4,0x01,0x22,
163
+0x4,0x01,0x12,
164
+0x4,0x02,0x11,
165
+0x4,0x03,0x02,
166
+0x4,0x03,0x00,
167
+0x4,0x10,0x21,
168
+0x4,0x12,0x20,
169
+0x4,0x00,0x00,
170
+0x4,0x12,0x21,
171
+0x4,0x21,0x11,
172
+0x4,0x02,0x22,
173
+0x4,0x10,0x12,
174
+0x4,0x31,0x00,
175
+0x4,0x20,0x20,
176
+0x4,0x00,0x03,
177
+0x4,0x02,0x02,
178
+0x4,0x22,0x20,
179
+0x4,0x01,0x21,
180
+0x4,0x21,0x02,
181
+0x4,0x21,0x12,
182
+0x4,0x11,0x22,
183
+0x4,0x00,0x30,
184
+0x4,0x12,0x11,
185
+0x4,0x20,0x22,
186
+0x4,0x31,0x20,
187
+0x4,0x21,0x30,
188
+0x4,0x22,0x02,
189
+0x4,0x22,0x22,
190
+0x4,0x20,0x31,
191
+0x4,0x13,0x02,
192
+0x4,0x03,0x10,
193
+0x4,0x11,0x12,
194
+0x4,0x00,0x13,
195
+0x4,0x21,0x01,
196
+0x4,0x12,0x03,
197
+0x4,0x13,0x00,
198
+0x4,0x13,0x10,
199
+0x4,0x02,0x13,
200
+0x4,0x30,0x01,
201
+0x4,0x12,0x10,
202
+0x4,0x22,0x13,
203
+0x4,0x03,0x12,
204
+0x4,0x31,0x01,
205
+0x4,0x30,0x22,
206
+0x4,0x00,0x31,
207
+0x4,0x01,0x31,
208
+0x4,0x02,0x23,
209
+0x4,0x01,0x30,
210
+0x4,0x11,0x21,
211
+0x4,0x22,0x21,
212
+0x4,0x01,0x13,
213
+0x4,0x10,0x03,
214
+0x4,0x22,0x03,
215
+0x4,0x30,0x21,
216
+0x4,0x21,0x31,
217
+0x4,0x33,0x00,
218
+0x4,0x13,0x12,
219
+0x4,0x11,0x31,
220
+0x4,0x30,0x02,
221
+0x4,0x12,0x02,
222
+0x4,0x11,0x13,
223
+0x4,0x12,0x22,
224
+0x4,0x20,0x32,
225
+0x4,0x10,0x13,
226
+0x4,0x22,0x31,
227
+0x4,0x21,0x20,
228
+0x4,0x01,0x33,
229
+0x4,0x33,0x10,
230
+0x4,0x20,0x13,
231
+0x4,0x31,0x22,
232
+0x4,0x13,0x30,
233
+0x4,0x01,0x03,
234
+0x4,0x11,0x33,
235
+0x4,0x20,0x21,
236
+0x4,0x13,0x31,
237
+0x4,0x03,0x22,
238
+0x4,0x31,0x02,
239
+0x4,0x00,0x24,
240
+0x2,0x00,
241
+0x2,0x10,
242
+0x2,0x20,
243
+0x2,0x30,
244
+0x2,0x40,
245
+0x2,0x50,
246
+0x2,0x60,
247
+0x2,0x01,
248
+0x2,0x11,
249
+0x2,0x21,
250
+0x2,0x31,
251
+0x2,0x41,
252
+0x2,0x51,
253
+0x2,0x61,
254
+0x2,0x02,
255
+0x2,0x12,
256
+0x2,0x22,
257
+0x2,0x32,
258
+0x2,0x42,
259
+0x2,0x52,
260
+0x2,0x62,
261
+0x2,0x03,
262
+0x2,0x13,
263
+0x2,0x23,
264
+0x2,0x33,
265
+0x2,0x43,
266
+0x2,0x53,
267
+0x2,0x63,
268
+0x2,0x04,
269
+0x2,0x14,
270
+0x2,0x24,
271
+0x2,0x34,
272
+0x2,0x44,
273
+0x2,0x54,
274
+0x2,0x64,
275
+0x2,0x05,
276
+0x2,0x15,
277
+0x2,0x25,
278
+0x2,0x35,
279
+0x2,0x45,
280
+0x2,0x55,
281
+0x2,0x65,
282
+0x2,0x06,
283
+0x2,0x16,
284
+0x2,0x26,
285
+0x2,0x36,
286
+0x2,0x46,
287
+0x2,0x56,
288
+0x2,0x66
289
+};
290
+
291
+static uint8_t pc_tbl3[] = {
292
+0x6,0x00,0x00,0x00,
293
+0x6,0x00,0x00,0x00,
294
+0x6,0x00,0x00,0x01,
295
+0x6,0x00,0x00,0x10,
296
+0x6,0x00,0x00,0x11,
297
+0x6,0x00,0x01,0x00,
298
+0x6,0x00,0x01,0x01,
299
+0x6,0x00,0x01,0x10,
300
+0x6,0x00,0x01,0x11,
301
+0x6,0x00,0x10,0x00,
302
+0x6,0x00,0x10,0x01,
303
+0x6,0x00,0x10,0x10,
304
+0x6,0x00,0x10,0x11,
305
+0x6,0x00,0x11,0x00,
306
+0x6,0x00,0x11,0x01,
307
+0x6,0x00,0x11,0x10,
308
+0x6,0x00,0x11,0x11,
309
+0x6,0x01,0x00,0x00,
310
+0x6,0x01,0x00,0x01,
311
+0x6,0x01,0x00,0x10,
312
+0x6,0x01,0x00,0x11,
313
+0x6,0x01,0x01,0x00,
314
+0x6,0x01,0x01,0x01,
315
+0x6,0x01,0x01,0x10,
316
+0x6,0x01,0x01,0x11,
317
+0x6,0x01,0x10,0x00,
318
+0x6,0x01,0x10,0x01,
319
+0x6,0x01,0x10,0x10,
320
+0x6,0x01,0x10,0x11,
321
+0x6,0x01,0x11,0x00,
322
+0x6,0x01,0x11,0x01,
323
+0x6,0x01,0x11,0x10,
324
+0x6,0x01,0x11,0x11,
325
+0x6,0x10,0x00,0x00,
326
+0x6,0x10,0x00,0x01,
327
+0x6,0x10,0x00,0x10,
328
+0x6,0x10,0x00,0x11,
329
+0x6,0x10,0x01,0x00,
330
+0x6,0x10,0x01,0x01,
331
+0x6,0x10,0x01,0x10,
332
+0x6,0x10,0x01,0x11,
333
+0x6,0x10,0x10,0x00,
334
+0x6,0x10,0x10,0x01,
335
+0x6,0x10,0x10,0x10,
336
+0x6,0x10,0x10,0x11,
337
+0x6,0x10,0x11,0x00,
338
+0x6,0x10,0x11,0x01,
339
+0x6,0x10,0x11,0x10,
340
+0x6,0x10,0x11,0x11,
341
+0x6,0x11,0x00,0x00,
342
+0x6,0x11,0x00,0x01,
343
+0x6,0x11,0x00,0x10,
344
+0x6,0x11,0x00,0x11,
345
+0x6,0x11,0x01,0x00,
346
+0x6,0x11,0x01,0x01,
347
+0x6,0x11,0x01,0x10,
348
+0x6,0x11,0x01,0x11,
349
+0x6,0x11,0x10,0x00,
350
+0x6,0x11,0x10,0x01,
351
+0x6,0x11,0x10,0x10,
352
+0x6,0x11,0x10,0x11,
353
+0x6,0x11,0x11,0x00,
354
+0x6,0x11,0x11,0x01,
355
+0x6,0x11,0x11,0x10,
356
+0x4,0x00,0x00,
357
+0x4,0x00,0x01,
358
+0x4,0x00,0x02,
359
+0x4,0x00,0x03,
360
+0x4,0x00,0x10,
361
+0x4,0x00,0x11,
362
+0x4,0x00,0x12,
363
+0x4,0x00,0x13,
364
+0x4,0x00,0x20,
365
+0x4,0x00,0x21,
366
+0x4,0x00,0x22,
367
+0x4,0x00,0x23,
368
+0x4,0x00,0x30,
369
+0x4,0x00,0x31,
370
+0x4,0x00,0x32,
371
+0x4,0x00,0x33,
372
+0x4,0x01,0x00,
373
+0x4,0x01,0x01,
374
+0x4,0x01,0x02,
375
+0x4,0x01,0x03,
376
+0x4,0x01,0x10,
377
+0x4,0x01,0x11,
378
+0x4,0x01,0x12,
379
+0x4,0x01,0x13,
380
+0x4,0x01,0x20,
381
+0x4,0x01,0x21,
382
+0x4,0x01,0x22,
383
+0x4,0x01,0x23,
384
+0x4,0x01,0x30,
385
+0x4,0x01,0x31,
386
+0x4,0x01,0x32,
387
+0x4,0x01,0x33,
388
+0x4,0x02,0x00,
389
+0x4,0x02,0x01,
390
+0x4,0x02,0x02,
391
+0x4,0x02,0x03,
392
+0x4,0x02,0x10,
393
+0x4,0x02,0x11,
394
+0x4,0x02,0x12,
395
+0x4,0x02,0x13,
396
+0x4,0x02,0x20,
397
+0x4,0x02,0x21,
398
+0x4,0x02,0x22,
399
+0x4,0x02,0x23,
400
+0x4,0x02,0x30,
401
+0x4,0x02,0x31,
402
+0x4,0x02,0x32,
403
+0x4,0x02,0x33,
404
+0x4,0x03,0x00,
405
+0x4,0x03,0x01,
406
+0x4,0x03,0x02,
407
+0x4,0x03,0x03,
408
+0x4,0x03,0x10,
409
+0x4,0x03,0x11,
410
+0x4,0x03,0x12,
411
+0x4,0x03,0x13,
412
+0x4,0x03,0x20,
413
+0x4,0x03,0x21,
414
+0x4,0x03,0x22,
415
+0x4,0x03,0x23,
416
+0x4,0x03,0x30,
417
+0x4,0x03,0x31,
418
+0x4,0x03,0x32,
419
+0x4,0x03,0x33,
420
+0x4,0x10,0x00,
421
+0x4,0x10,0x01,
422
+0x4,0x10,0x02,
423
+0x4,0x10,0x03,
424
+0x4,0x10,0x10,
425
+0x4,0x10,0x11,
426
+0x4,0x10,0x12,
427
+0x4,0x10,0x13,
428
+0x4,0x10,0x20,
429
+0x4,0x10,0x21,
430
+0x4,0x10,0x22,
431
+0x4,0x10,0x23,
432
+0x4,0x10,0x30,
433
+0x4,0x10,0x31,
434
+0x4,0x10,0x32,
435
+0x4,0x10,0x33,
436
+0x4,0x11,0x00,
437
+0x4,0x11,0x01,
438
+0x4,0x11,0x02,
439
+0x4,0x11,0x03,
440
+0x4,0x11,0x10,
441
+0x4,0x11,0x11,
442
+0x4,0x11,0x12,
443
+0x4,0x11,0x13,
444
+0x4,0x11,0x20,
445
+0x4,0x11,0x21,
446
+0x4,0x11,0x22,
447
+0x4,0x11,0x23,
448
+0x4,0x11,0x30,
449
+0x4,0x11,0x31,
450
+0x4,0x11,0x32,
451
+0x4,0x11,0x33,
452
+0x4,0x12,0x00,
453
+0x4,0x12,0x01,
454
+0x4,0x12,0x02,
455
+0x4,0x12,0x03,
456
+0x4,0x12,0x10,
457
+0x4,0x12,0x11,
458
+0x4,0x12,0x12,
459
+0x4,0x12,0x13,
460
+0x4,0x12,0x20,
461
+0x4,0x12,0x21,
462
+0x4,0x12,0x22,
463
+0x4,0x12,0x23,
464
+0x4,0x12,0x30,
465
+0x4,0x12,0x31,
466
+0x4,0x12,0x32,
467
+0x4,0x12,0x33,
468
+0x4,0x13,0x00,
469
+0x4,0x13,0x01,
470
+0x4,0x13,0x02,
471
+0x4,0x13,0x03,
472
+0x4,0x13,0x10,
473
+0x4,0x13,0x11,
474
+0x4,0x13,0x12,
475
+0x4,0x13,0x13,
476
+0x4,0x13,0x20,
477
+0x4,0x13,0x21,
478
+0x4,0x13,0x22,
479
+0x4,0x13,0x23,
480
+0x4,0x13,0x30,
481
+0x4,0x13,0x31,
482
+0x4,0x13,0x32,
483
+0x4,0x13,0x33,
484
+0x2,0x00,
485
+0x2,0x10,
486
+0x2,0x20,
487
+0x2,0x30,
488
+0x2,0x40,
489
+0x2,0x50,
490
+0x2,0x60,
491
+0x2,0x70,
492
+0x2,0x01,
493
+0x2,0x11,
494
+0x2,0x21,
495
+0x2,0x31,
496
+0x2,0x41,
497
+0x2,0x51,
498
+0x2,0x61,
499
+0x2,0x71,
500
+0x2,0x02,
501
+0x2,0x12,
502
+0x2,0x22,
503
+0x2,0x32,
504
+0x2,0x42,
505
+0x2,0x52,
506
+0x2,0x62,
507
+0x2,0x72,
508
+0x2,0x03,
509
+0x2,0x13,
510
+0x2,0x23,
511
+0x2,0x33,
512
+0x2,0x43,
513
+0x2,0x53,
514
+0x2,0x63,
515
+0x2,0x73,
516
+0x2,0x04,
517
+0x2,0x14,
518
+0x2,0x24,
519
+0x2,0x34,
520
+0x2,0x44,
521
+0x2,0x54,
522
+0x2,0x64,
523
+0x2,0x74,
524
+0x2,0x05,
525
+0x2,0x15,
526
+0x2,0x25,
527
+0x2,0x35,
528
+0x2,0x45,
529
+0x2,0x55,
530
+0x2,0x65,
531
+0x2,0x75,
532
+0x2,0x06,
533
+0x2,0x16,
534
+0x2,0x26,
535
+0x2,0x36,
536
+0x2,0x46,
537
+0x2,0x56,
538
+0x2,0x66,
539
+0x2,0x76,
540
+0x2,0x07,
541
+0x2,0x17,
542
+0x2,0x27,
543
+0x2,0x37,
544
+0x2,0x47,
545
+0x2,0x57,
546
+0x2,0x67,
547
+0x2,0x77
548
+};
549
+
550
+static uint8_t pc_tbl4[] = {
551
+0x8,0x00,0x00,0x00,0x00,
552
+0x8,0x00,0x00,0x00,0x00,
553
+0x8,0x20,0x00,0x00,0x00,
554
+0x8,0x00,0x00,0x00,0x01,
555
+0x8,0x10,0x00,0x00,0x00,
556
+0x8,0x00,0x00,0x00,0x02,
557
+0x8,0x01,0x00,0x00,0x00,
558
+0x8,0x00,0x00,0x00,0x10,
559
+0x8,0x02,0x00,0x00,0x00,
560
+0x6,0x00,0x00,0x00,
561
+0x6,0x20,0x00,0x00,
562
+0x6,0x00,0x00,0x01,
563
+0x6,0x10,0x00,0x00,
564
+0x6,0x00,0x00,0x02,
565
+0x6,0x00,0x10,0x00,
566
+0x6,0x00,0x20,0x00,
567
+0x6,0x00,0x02,0x00,
568
+0x6,0x00,0x01,0x00,
569
+0x6,0x01,0x00,0x00,
570
+0x6,0x00,0x00,0x20,
571
+0x6,0x02,0x00,0x00,
572
+0x6,0x00,0x00,0x10,
573
+0x6,0x10,0x00,0x20,
574
+0x6,0x01,0x00,0x02,
575
+0x6,0x20,0x00,0x10,
576
+0x6,0x02,0x00,0x01,
577
+0x6,0x20,0x10,0x00,
578
+0x6,0x00,0x12,0x00,
579
+0x6,0x00,0x02,0x01,
580
+0x6,0x02,0x01,0x00,
581
+0x6,0x00,0x21,0x00,
582
+0x6,0x00,0x01,0x02,
583
+0x6,0x00,0x20,0x10,
584
+0x6,0x00,0x00,0x21,
585
+0x6,0x00,0x00,0x12,
586
+0x6,0x00,0x01,0x20,
587
+0x6,0x12,0x00,0x00,
588
+0x6,0x00,0x10,0x20,
589
+0x6,0x01,0x20,0x00,
590
+0x6,0x02,0x10,0x00,
591
+0x6,0x10,0x20,0x00,
592
+0x6,0x01,0x02,0x00,
593
+0x6,0x21,0x00,0x00,
594
+0x6,0x00,0x02,0x10,
595
+0x6,0x20,0x01,0x00,
596
+0x6,0x00,0x22,0x00,
597
+0x6,0x10,0x02,0x00,
598
+0x6,0x00,0x10,0x02,
599
+0x6,0x11,0x00,0x00,
600
+0x6,0x00,0x11,0x00,
601
+0x6,0x22,0x00,0x00,
602
+0x6,0x20,0x00,0x02,
603
+0x6,0x10,0x00,0x01,
604
+0x6,0x00,0x20,0x01,
605
+0x6,0x02,0x20,0x00,
606
+0x6,0x01,0x10,0x00,
607
+0x6,0x01,0x00,0x20,
608
+0x6,0x00,0x20,0x02,
609
+0x6,0x01,0x20,0x02,
610
+0x6,0x10,0x01,0x00,
611
+0x6,0x02,0x00,0x10,
612
+0x6,0x00,0x10,0x01,
613
+0x6,0x10,0x01,0x20,
614
+0x6,0x20,0x02,0x10,
615
+0x6,0x00,0x00,0x22,
616
+0x6,0x10,0x00,0x02,
617
+0x6,0x00,0x02,0x20,
618
+0x6,0x20,0x02,0x00,
619
+0x6,0x00,0x00,0x11,
620
+0x6,0x02,0x10,0x01,
621
+0x6,0x00,0x01,0x10,
622
+0x6,0x00,0x02,0x11,
623
+0x4,0x01,0x02,
624
+0x4,0x02,0x01,
625
+0x4,0x01,0x00,
626
+0x4,0x10,0x20,
627
+0x4,0x20,0x10,
628
+0x4,0x20,0x00,
629
+0x4,0x11,0x00,
630
+0x4,0x02,0x00,
631
+0x4,0x12,0x00,
632
+0x4,0x00,0x21,
633
+0x4,0x22,0x00,
634
+0x4,0x00,0x12,
635
+0x4,0x21,0x00,
636
+0x4,0x02,0x11,
637
+0x4,0x00,0x01,
638
+0x4,0x10,0x02,
639
+0x4,0x02,0x20,
640
+0x4,0x20,0x11,
641
+0x4,0x01,0x10,
642
+0x4,0x21,0x10,
643
+0x4,0x10,0x00,
644
+0x4,0x10,0x22,
645
+0x4,0x20,0x20,
646
+0x4,0x00,0x22,
647
+0x4,0x01,0x22,
648
+0x4,0x20,0x01,
649
+0x4,0x02,0x02,
650
+0x4,0x00,0x20,
651
+0x4,0x00,0x10,
652
+0x4,0x00,0x11,
653
+0x4,0x22,0x01,
654
+0x4,0x11,0x20,
655
+0x4,0x12,0x01,
656
+0x4,0x12,0x20,
657
+0x4,0x11,0x02,
658
+0x4,0x10,0x10,
659
+0x4,0x01,0x01,
660
+0x4,0x02,0x21,
661
+0x4,0x20,0x12,
662
+0x4,0x01,0x12,
663
+0x4,0x22,0x11,
664
+0x4,0x21,0x12,
665
+0x4,0x22,0x10,
666
+0x4,0x21,0x02,
667
+0x4,0x20,0x02,
668
+0x4,0x10,0x01,
669
+0x4,0x00,0x02,
670
+0x4,0x10,0x21,
671
+0x4,0x01,0x20,
672
+0x4,0x11,0x22,
673
+0x4,0x12,0x21,
674
+0x4,0x22,0x20,
675
+0x4,0x02,0x10,
676
+0x4,0x02,0x22,
677
+0x4,0x11,0x10,
678
+0x4,0x22,0x02,
679
+0x4,0x20,0x21,
680
+0x4,0x01,0x11,
681
+0x4,0x11,0x01,
682
+0x4,0x10,0x12,
683
+0x4,0x02,0x12,
684
+0x4,0x20,0x22,
685
+0x4,0x21,0x20,
686
+0x4,0x01,0x21,
687
+0x4,0x12,0x02,
688
+0x4,0x21,0x11,
689
+0x4,0x12,0x22,
690
+0x4,0x12,0x10,
691
+0x4,0x22,0x21,
692
+0x4,0x10,0x11,
693
+0x4,0x21,0x01,
694
+0x4,0x11,0x12,
695
+0x4,0x12,0x11,
696
+0x4,0x66,0x66,
697
+0x4,0x22,0x22,
698
+0x4,0x11,0x21,
699
+0x4,0x11,0x11,
700
+0x4,0x21,0x22,
701
+0x4,0x00,0x00,
702
+0x4,0x22,0x12,
703
+0x4,0x12,0x12,
704
+0x4,0x21,0x21,
705
+0x4,0x42,0x00,
706
+0x4,0x00,0x04,
707
+0x4,0x40,0x00,
708
+0x4,0x30,0x00,
709
+0x4,0x31,0x00,
710
+0x4,0x00,0x03,
711
+0x4,0x00,0x14,
712
+0x4,0x00,0x13,
713
+0x4,0x01,0x24,
714
+0x4,0x20,0x13,
715
+0x4,0x01,0x42,
716
+0x4,0x14,0x20,
717
+0x4,0x42,0x02,
718
+0x4,0x13,0x00,
719
+0x4,0x00,0x24,
720
+0x4,0x31,0x20,
721
+0x4,0x22,0x13,
722
+0x4,0x11,0x24,
723
+0x4,0x12,0x66,
724
+0x4,0x30,0x01,
725
+0x4,0x02,0x13,
726
+0x4,0x12,0x42,
727
+0x4,0x40,0x10,
728
+0x4,0x40,0x02,
729
+0x4,0x01,0x04,
730
+0x4,0x24,0x00,
731
+0x4,0x42,0x10,
732
+0x4,0x21,0x13,
733
+0x4,0x13,0x12,
734
+0x4,0x31,0x21,
735
+0x4,0x21,0x24,
736
+0x4,0x00,0x40,
737
+0x4,0x10,0x24,
738
+0x4,0x10,0x42,
739
+0x4,0x32,0x01,
740
+0x4,0x11,0x42,
741
+0x4,0x20,0x31,
742
+0x4,0x12,0x40,
743
+0x2,0x00,
744
+0x2,0x10,
745
+0x2,0x20,
746
+0x2,0x30,
747
+0x2,0x40,
748
+0x2,0x50,
749
+0x2,0x60,
750
+0x2,0x70,
751
+0x2,0x01,
752
+0x2,0x11,
753
+0x2,0x21,
754
+0x2,0x31,
755
+0x2,0x41,
756
+0x2,0x51,
757
+0x2,0x61,
758
+0x2,0x71,
759
+0x2,0x02,
760
+0x2,0x12,
761
+0x2,0x22,
762
+0x2,0x32,
763
+0x2,0x42,
764
+0x2,0x52,
765
+0x2,0x62,
766
+0x2,0x72,
767
+0x2,0x03,
768
+0x2,0x13,
769
+0x2,0x23,
770
+0x2,0x33,
771
+0x2,0x43,
772
+0x2,0x53,
773
+0x2,0x63,
774
+0x2,0x73,
775
+0x2,0x04,
776
+0x2,0x14,
777
+0x2,0x24,
778
+0x2,0x34,
779
+0x2,0x44,
780
+0x2,0x54,
781
+0x2,0x64,
782
+0x2,0x74,
783
+0x2,0x05,
784
+0x2,0x15,
785
+0x2,0x25,
786
+0x2,0x35,
787
+0x2,0x45,
788
+0x2,0x55,
789
+0x2,0x65,
790
+0x2,0x75,
791
+0x2,0x06,
792
+0x2,0x16,
793
+0x2,0x26,
794
+0x2,0x36,
795
+0x2,0x46,
796
+0x2,0x56,
797
+0x2,0x66,
798
+0x2,0x76,
799
+0x2,0x07,
800
+0x2,0x17,
801
+0x2,0x27,
802
+0x2,0x37,
803
+0x2,0x47,
804
+0x2,0x57,
805
+0x2,0x67,
806
+0x2,0x77
807
+};
808
+
809
+uint8_t *tables[] = { pc_tbl2, pc_tbl3, pc_tbl4 };