annotate xan.c @ 10387:19a4f1ecd8fe libavcodec

Move dnxhdenc to execute2 multithreading API. This allows for some simplifications like removing some outer loops and gives much better performance for thread_count > number of idle CPUs.
author reimar
date Mon, 12 Oct 2009 14:43:57 +0000
parents a3abf068e05e
children d7ed9dcc78e3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
1 /*
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
2 * Wing Commander/Xan Video Decoder
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
3 * Copyright (C) 2003 the ffmpeg project
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
15 * Lesser General Public License for more details.
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
16 *
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2967
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
20 */
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
21
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
22 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8573
diff changeset
23 * @file libavcodec/xan.c
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
24 * Xan video decoder for Wing Commander III computer game
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
25 * by Mario Brito (mbrito@student.dei.uc.pt)
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
26 * and Mike Melanson (melanson@pcisys.net)
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
27 *
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
28 * The xan_wc3 decoder outputs PAL8 data.
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
29 */
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
30
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
31 #include <stdio.h>
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
32 #include <stdlib.h>
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
33 #include <string.h>
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
34
8573
2acf0ae7b041 Fix build: Add intreadwrite.h and bswap.h #includes where necessary.
diego
parents: 7040
diff changeset
35 #include "libavutil/intreadwrite.h"
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
36 #include "avcodec.h"
9489
f4fdab353f6f Some more simplifications of xan_unpack
reimar
parents: 9488
diff changeset
37 #include "bytestream.h"
9496
2c6a58787aeb Simplify xan_huffman_decode by using get_bits
reimar
parents: 9491
diff changeset
38 #define ALT_BITSTREAM_READER_LE
2c6a58787aeb Simplify xan_huffman_decode by using get_bits
reimar
parents: 9491
diff changeset
39 #include "get_bits.h"
9475
4faccfb98672 Replace bytecopy with the equivalent but faster av_memcpy_backptr.
reimar
parents: 9473
diff changeset
40 // for av_memcpy_backptr
4faccfb98672 Replace bytecopy with the equivalent but faster av_memcpy_backptr.
reimar
parents: 9473
diff changeset
41 #include "libavutil/lzo.h"
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
42
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
43 typedef struct XanContext {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
44
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
45 AVCodecContext *avctx;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
46 AVFrame last_frame;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
47 AVFrame current_frame;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
48
6302
michael
parents: 5215
diff changeset
49 const unsigned char *buf;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
50 int size;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
51
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
52 /* scratch space */
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
53 unsigned char *buffer1;
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
54 int buffer1_size;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
55 unsigned char *buffer2;
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
56 int buffer2_size;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
57
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
58 int frame_size;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
59
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
60 } XanContext;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
61
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6452
diff changeset
62 static av_cold int xan_decode_init(AVCodecContext *avctx)
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
63 {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
64 XanContext *s = avctx->priv_data;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
65
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
66 s->avctx = avctx;
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
67 s->frame_size = 0;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
68
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2831
diff changeset
69 if ((avctx->codec->id == CODEC_ID_XAN_WC3) &&
1585
6b224ca24033 revised palette API, courtesy of Roberto Togni (rtogni at freemail.it)
melanson
parents: 1476
diff changeset
70 (s->avctx->palctrl == NULL)) {
1598
932d306bf1dc av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1585
diff changeset
71 av_log(avctx, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n");
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
72 return -1;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
73 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
74
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
75 avctx->pix_fmt = PIX_FMT_PAL8;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
76
2422
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 1881
diff changeset
77 if(avcodec_check_dimensions(avctx, avctx->width, avctx->height))
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 1881
diff changeset
78 return -1;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2831
diff changeset
79
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
80 s->buffer1_size = avctx->width * avctx->height;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
81 s->buffer1 = av_malloc(s->buffer1_size);
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
82 s->buffer2_size = avctx->width * avctx->height;
9485
90d4d9708969 Increase buffer padding to avoid most space checks in xan_unpack
reimar
parents: 9479
diff changeset
83 s->buffer2 = av_malloc(s->buffer2_size + 130);
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
84 if (!s->buffer1 || !s->buffer2)
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
85 return -1;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
86
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
87 return 0;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
88 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
89
6302
michael
parents: 5215
diff changeset
90 static int xan_huffman_decode(unsigned char *dest, const unsigned char *src,
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
91 int dest_len)
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
92 {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
93 unsigned char byte = *src++;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
94 unsigned char ival = byte + 0x16;
6302
michael
parents: 5215
diff changeset
95 const unsigned char * ptr = src + byte*2;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
96 unsigned char val = ival;
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
97 unsigned char *dest_end = dest + dest_len;
9496
2c6a58787aeb Simplify xan_huffman_decode by using get_bits
reimar
parents: 9491
diff changeset
98 GetBitContext gb;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
99
9496
2c6a58787aeb Simplify xan_huffman_decode by using get_bits
reimar
parents: 9491
diff changeset
100 init_get_bits(&gb, ptr, 0); // FIXME: no src size available
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
101
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
102 while ( val != 0x16 ) {
9496
2c6a58787aeb Simplify xan_huffman_decode by using get_bits
reimar
parents: 9491
diff changeset
103 val = src[val - 0x17 + get_bits1(&gb) * byte];
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
104
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
105 if ( val < 0x16 ) {
9497
cb387dff812d Change buffer check to avoid an unlikely pointer arithmetic overflow.
reimar
parents: 9496
diff changeset
106 if (dest >= dest_end)
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
107 return 0;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
108 *dest++ = val;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
109 val = ival;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
110 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
111 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
112
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
113 return 0;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
114 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
115
9475
4faccfb98672 Replace bytecopy with the equivalent but faster av_memcpy_backptr.
reimar
parents: 9473
diff changeset
116 /**
4faccfb98672 Replace bytecopy with the equivalent but faster av_memcpy_backptr.
reimar
parents: 9473
diff changeset
117 * unpack simple compression
4faccfb98672 Replace bytecopy with the equivalent but faster av_memcpy_backptr.
reimar
parents: 9473
diff changeset
118 *
9485
90d4d9708969 Increase buffer padding to avoid most space checks in xan_unpack
reimar
parents: 9479
diff changeset
119 * @param dest destination buffer of dest_len, must be padded with at least 130 bytes
9475
4faccfb98672 Replace bytecopy with the equivalent but faster av_memcpy_backptr.
reimar
parents: 9473
diff changeset
120 */
6302
michael
parents: 5215
diff changeset
121 static void xan_unpack(unsigned char *dest, const unsigned char *src, int dest_len)
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
122 {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
123 unsigned char opcode;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
124 int size;
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
125 unsigned char *dest_end = dest + dest_len;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
126
9485
90d4d9708969 Increase buffer padding to avoid most space checks in xan_unpack
reimar
parents: 9479
diff changeset
127 while (dest < dest_end) {
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
128 opcode = *src++;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
129
9487
ab354d259380 Avoid some code duplication in xan_unpack
reimar
parents: 9485
diff changeset
130 if (opcode < 0xe0) {
9488
bae097827a6d Reindent xan_unpack code
reimar
parents: 9487
diff changeset
131 int size2, back;
bae097827a6d Reindent xan_unpack code
reimar
parents: 9487
diff changeset
132 if ( (opcode & 0x80) == 0 ) {
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
133
9488
bae097827a6d Reindent xan_unpack code
reimar
parents: 9487
diff changeset
134 size = opcode & 3;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
135
9491
28978a75c865 Cosmetics to improve xan_unpack readability
reimar
parents: 9490
diff changeset
136 back = ((opcode & 0x60) << 3) + *src++ + 1;
9488
bae097827a6d Reindent xan_unpack code
reimar
parents: 9487
diff changeset
137 size2 = ((opcode & 0x1c) >> 2) + 3;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
138
9488
bae097827a6d Reindent xan_unpack code
reimar
parents: 9487
diff changeset
139 } else if ( (opcode & 0x40) == 0 ) {
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
140
9489
f4fdab353f6f Some more simplifications of xan_unpack
reimar
parents: 9488
diff changeset
141 size = *src >> 6;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
142
9491
28978a75c865 Cosmetics to improve xan_unpack readability
reimar
parents: 9490
diff changeset
143 back = (bytestream_get_be16(&src) & 0x3fff) + 1;
9488
bae097827a6d Reindent xan_unpack code
reimar
parents: 9487
diff changeset
144 size2 = (opcode & 0x3f) + 4;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
145
9488
bae097827a6d Reindent xan_unpack code
reimar
parents: 9487
diff changeset
146 } else {
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
147
9488
bae097827a6d Reindent xan_unpack code
reimar
parents: 9487
diff changeset
148 size = opcode & 3;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
149
9491
28978a75c865 Cosmetics to improve xan_unpack readability
reimar
parents: 9490
diff changeset
150 back = ((opcode & 0x10) << 12) + bytestream_get_be16(&src) + 1;
28978a75c865 Cosmetics to improve xan_unpack readability
reimar
parents: 9490
diff changeset
151 size2 = ((opcode & 0x0c) << 6) + *src++ + 5;
9490
9999ab77829b Fix buffer size check for xan_unpack which was broken by r18586
reimar
parents: 9489
diff changeset
152 if (size + size2 > dest_end - dest)
9488
bae097827a6d Reindent xan_unpack code
reimar
parents: 9487
diff changeset
153 return;
9487
ab354d259380 Avoid some code duplication in xan_unpack
reimar
parents: 9485
diff changeset
154 }
ab354d259380 Avoid some code duplication in xan_unpack
reimar
parents: 9485
diff changeset
155 memcpy(dest, src, size); dest += size; src += size;
ab354d259380 Avoid some code duplication in xan_unpack
reimar
parents: 9485
diff changeset
156 av_memcpy_backptr(dest, back, size2);
ab354d259380 Avoid some code duplication in xan_unpack
reimar
parents: 9485
diff changeset
157 dest += size2;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
158 } else {
10134
1d71688b4549 Slightly simplify detection of end of compressed data in xan_unpack
reimar
parents: 9981
diff changeset
159 int finish = opcode >= 0xfc;
1d71688b4549 Slightly simplify detection of end of compressed data in xan_unpack
reimar
parents: 9981
diff changeset
160 size = finish ? opcode & 3 : ((opcode & 0x1f) << 2) + 4;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
161
9473
e38284cd69dc Use memcpy instead of the very inefficient bytecopy where both are correct
reimar
parents: 9355
diff changeset
162 memcpy(dest, src, size); dest += size; src += size;
9501
880d9562d218 Avoid code duplication in xan_unpack for the final memcpy.
reimar
parents: 9500
diff changeset
163 if (finish)
880d9562d218 Avoid code duplication in xan_unpack for the final memcpy.
reimar
parents: 9500
diff changeset
164 return;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
165 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
166 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
167 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
168
4908
777f250df232 Fix multiple "¡Æinline/static¡Ç is not at beginning of declaration" warnings.
diego
parents: 4801
diff changeset
169 static inline void xan_wc3_output_pixel_run(XanContext *s,
6303
aurel
parents: 6302
diff changeset
170 const unsigned char *pixel_buffer, int x, int y, int pixel_count)
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
171 {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
172 int stride;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
173 int line_inc;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
174 int index;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
175 int current_x;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
176 int width = s->avctx->width;
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
177 unsigned char *palette_plane;
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
178
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
179 palette_plane = s->current_frame.data[0];
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
180 stride = s->current_frame.linesize[0];
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
181 line_inc = stride - width;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
182 index = y * stride + x;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
183 current_x = x;
10135
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
184 while(pixel_count && (index < s->frame_size)) {
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
185 int count = FFMIN(pixel_count, width - current_x);
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
186 memcpy(palette_plane + index, pixel_buffer, count);
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
187 pixel_count -= count;
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
188 index += count;
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
189 pixel_buffer += count;
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
190 current_x += count;
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
191
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
192 if (current_x >= width) {
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
193 index += line_inc;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
194 current_x = 0;
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
195 }
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
196 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
197 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
198
4908
777f250df232 Fix multiple "¡Æinline/static¡Ç is not at beginning of declaration" warnings.
diego
parents: 4801
diff changeset
199 static inline void xan_wc3_copy_pixel_run(XanContext *s,
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
200 int x, int y, int pixel_count, int motion_x, int motion_y)
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
201 {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
202 int stride;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
203 int line_inc;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
204 int curframe_index, prevframe_index;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
205 int curframe_x, prevframe_x;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
206 int width = s->avctx->width;
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
207 unsigned char *palette_plane, *prev_palette_plane;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
208
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
209 palette_plane = s->current_frame.data[0];
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
210 prev_palette_plane = s->last_frame.data[0];
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
211 stride = s->current_frame.linesize[0];
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
212 line_inc = stride - width;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
213 curframe_index = y * stride + x;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
214 curframe_x = x;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
215 prevframe_index = (y + motion_y) * stride + x + motion_x;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
216 prevframe_x = x + motion_x;
10135
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
217 while(pixel_count && (curframe_index < s->frame_size)) {
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
218 int count = FFMIN3(pixel_count, width - curframe_x, width - prevframe_x);
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
219
10135
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
220 memcpy(palette_plane + curframe_index, prev_palette_plane + prevframe_index, count);
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
221 pixel_count -= count;
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
222 curframe_index += count;
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
223 prevframe_index += count;
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
224 curframe_x += count;
a3abf068e05e Use memcpy to copy till end of line in one go instead of copying pixel by pixel
reimar
parents: 10134
diff changeset
225 prevframe_x += count;
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
226
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
227 if (curframe_x >= width) {
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
228 curframe_index += line_inc;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
229 curframe_x = 0;
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
230 }
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
231
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
232 if (prevframe_x >= width) {
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
233 prevframe_index += line_inc;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
234 prevframe_x = 0;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
235 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
236 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
237 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
238
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
239 static void xan_wc3_decode_frame(XanContext *s) {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
240
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
241 int width = s->avctx->width;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
242 int height = s->avctx->height;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
243 int total_pixels = width * height;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
244 unsigned char opcode;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
245 unsigned char flag = 0;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
246 int size = 0;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
247 int motion_x, motion_y;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
248 int x, y;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
249
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
250 unsigned char *opcode_buffer = s->buffer1;
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
251 int opcode_buffer_size = s->buffer1_size;
6303
aurel
parents: 6302
diff changeset
252 const unsigned char *imagedata_buffer = s->buffer2;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
253
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
254 /* pointers to segments inside the compressed chunk */
6302
michael
parents: 5215
diff changeset
255 const unsigned char *huffman_segment;
michael
parents: 5215
diff changeset
256 const unsigned char *size_segment;
michael
parents: 5215
diff changeset
257 const unsigned char *vector_segment;
michael
parents: 5215
diff changeset
258 const unsigned char *imagedata_segment;
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
259
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
260 huffman_segment = s->buf + AV_RL16(&s->buf[0]);
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
261 size_segment = s->buf + AV_RL16(&s->buf[2]);
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
262 vector_segment = s->buf + AV_RL16(&s->buf[4]);
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
263 imagedata_segment = s->buf + AV_RL16(&s->buf[6]);
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
264
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
265 xan_huffman_decode(opcode_buffer, huffman_segment, opcode_buffer_size);
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
266
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
267 if (imagedata_segment[0] == 2)
6303
aurel
parents: 6302
diff changeset
268 xan_unpack(s->buffer2, &imagedata_segment[1], s->buffer2_size);
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
269 else
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
270 imagedata_buffer = &imagedata_segment[1];
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
271
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
272 /* use the decoded data segments to build the frame */
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
273 x = y = 0;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
274 while (total_pixels) {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
275
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
276 opcode = *opcode_buffer++;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
277 size = 0;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
278
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
279 switch (opcode) {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
280
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
281 case 0:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
282 flag ^= 1;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
283 continue;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
284
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
285 case 1:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
286 case 2:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
287 case 3:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
288 case 4:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
289 case 5:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
290 case 6:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
291 case 7:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
292 case 8:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
293 size = opcode;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
294 break;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
295
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
296 case 12:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
297 case 13:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
298 case 14:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
299 case 15:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
300 case 16:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
301 case 17:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
302 case 18:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
303 size += (opcode - 10);
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
304 break;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
305
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
306 case 9:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
307 case 19:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
308 size = *size_segment++;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
309 break;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
310
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
311 case 10:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
312 case 20:
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
313 size = AV_RB16(&size_segment[0]);
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
314 size_segment += 2;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
315 break;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
316
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
317 case 11:
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
318 case 21:
5089
bff60ecc02f9 Use AV_xx throughout libavcodec
ramiro
parents: 4962
diff changeset
319 size = AV_RB24(size_segment);
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
320 size_segment += 3;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
321 break;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
322 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
323
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
324 if (opcode < 12) {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
325 flag ^= 1;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
326 if (flag) {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
327 /* run of (size) pixels is unchanged from last frame */
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
328 xan_wc3_copy_pixel_run(s, x, y, size, 0, 0);
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
329 } else {
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
330 /* output a run of pixels from imagedata_buffer */
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
331 xan_wc3_output_pixel_run(s, imagedata_buffer, x, y, size);
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
332 imagedata_buffer += size;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
333 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
334 } else {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
335 /* run-based motion compensation from last frame */
9500
9157421b6239 Use sign_extend function instead of reimplementing it.
reimar
parents: 9499
diff changeset
336 motion_x = sign_extend(*vector_segment >> 4, 4);
9157421b6239 Use sign_extend function instead of reimplementing it.
reimar
parents: 9499
diff changeset
337 motion_y = sign_extend(*vector_segment & 0xF, 4);
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
338 vector_segment++;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
339
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
340 /* copy a run of pixels from the previous frame */
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
341 xan_wc3_copy_pixel_run(s, x, y, size, motion_x, motion_y);
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
342
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
343 flag = 0;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
344 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
345
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
346 /* coordinate accounting */
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
347 total_pixels -= size;
9498
6abd94fdd827 Use / and % operators instead of reimplementing them with a loop.
reimar
parents: 9497
diff changeset
348 y += (x + size) / width;
6abd94fdd827 Use / and % operators instead of reimplementing them with a loop.
reimar
parents: 9497
diff changeset
349 x = (x + size) % width;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
350 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
351 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
352
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
353 static void xan_wc4_decode_frame(XanContext *s) {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
354 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
355
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
356 static int xan_decode_frame(AVCodecContext *avctx,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
357 void *data, int *data_size,
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8718
diff changeset
358 AVPacket *avpkt)
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
359 {
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8718
diff changeset
360 const uint8_t *buf = avpkt->data;
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8718
diff changeset
361 int buf_size = avpkt->size;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
362 XanContext *s = avctx->priv_data;
1585
6b224ca24033 revised palette API, courtesy of Roberto Togni (rtogni at freemail.it)
melanson
parents: 1476
diff changeset
363 AVPaletteControl *palette_control = avctx->palctrl;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
364
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
365 if (avctx->get_buffer(avctx, &s->current_frame)) {
1598
932d306bf1dc av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1585
diff changeset
366 av_log(s->avctx, AV_LOG_ERROR, " Xan Video: get_buffer() failed\n");
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
367 return -1;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
368 }
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
369 s->current_frame.reference = 3;
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
370
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
371 if (!s->frame_size)
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
372 s->frame_size = s->current_frame.linesize[0] * s->avctx->height;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
373
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
374 palette_control->palette_changed = 0;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2831
diff changeset
375 memcpy(s->current_frame.data[1], palette_control->palette,
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
376 AVPALETTE_SIZE);
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
377 s->current_frame.palette_has_changed = 1;
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
378
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
379 s->buf = buf;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
380 s->size = buf_size;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
381
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
382 if (avctx->codec->id == CODEC_ID_XAN_WC3)
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
383 xan_wc3_decode_frame(s);
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
384 else if (avctx->codec->id == CODEC_ID_XAN_WC4)
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
385 xan_wc4_decode_frame(s);
1459
201d4e25c207 xan_wc3 decoder now works correctly; added a bunch of output
tmmm
parents: 1443
diff changeset
386
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
387 /* release the last frame if it is allocated */
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
388 if (s->last_frame.data[0])
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
389 avctx->release_buffer(avctx, &s->last_frame);
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
390
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
391 *data_size = sizeof(AVFrame);
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
392 *(AVFrame*)data = s->current_frame;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
393
6452
2a2f9cb7f1b0 fix the WC3 Xan decoder by correcting the frame accounting logic
melanson
parents: 6303
diff changeset
394 /* shuffle frames */
2a2f9cb7f1b0 fix the WC3 Xan decoder by correcting the frame accounting logic
melanson
parents: 6303
diff changeset
395 FFSWAP(AVFrame, s->current_frame, s->last_frame);
2a2f9cb7f1b0 fix the WC3 Xan decoder by correcting the frame accounting logic
melanson
parents: 6303
diff changeset
396
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
397 /* always report that the buffer was completely consumed */
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
398 return buf_size;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
399 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
400
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6452
diff changeset
401 static av_cold int xan_decode_end(AVCodecContext *avctx)
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
402 {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
403 XanContext *s = avctx->priv_data;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
404
6452
2a2f9cb7f1b0 fix the WC3 Xan decoder by correcting the frame accounting logic
melanson
parents: 6303
diff changeset
405 /* release the frames */
2831
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
406 if (s->last_frame.data[0])
ad9d121cc6e9 tinfoil patch: no array is written to in bulk before counts are
melanson
parents: 2422
diff changeset
407 avctx->release_buffer(avctx, &s->last_frame);
6452
2a2f9cb7f1b0 fix the WC3 Xan decoder by correcting the frame accounting logic
melanson
parents: 6303
diff changeset
408 if (s->current_frame.data[0])
2a2f9cb7f1b0 fix the WC3 Xan decoder by correcting the frame accounting logic
melanson
parents: 6303
diff changeset
409 avctx->release_buffer(avctx, &s->current_frame);
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
410
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
411 av_free(s->buffer1);
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
412 av_free(s->buffer2);
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
413
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
414 return 0;
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
415 }
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
416
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
417 AVCodec xan_wc3_decoder = {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
418 "xan_wc3",
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
419 CODEC_TYPE_VIDEO,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
420 CODEC_ID_XAN_WC3,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
421 sizeof(XanContext),
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
422 xan_decode_init,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
423 NULL,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
424 xan_decode_end,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
425 xan_decode_frame,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
426 CODEC_CAP_DR1,
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6712
diff changeset
427 .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"),
1443
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
428 };
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
429
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
430 /*
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
431 AVCodec xan_wc4_decoder = {
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
432 "xan_wc4",
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
433 CODEC_TYPE_VIDEO,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
434 CODEC_ID_XAN_WC4,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
435 sizeof(XanContext),
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
436 xan_decode_init,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
437 NULL,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
438 xan_decode_end,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
439 xan_decode_frame,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
440 CODEC_CAP_DR1,
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
441 };
47f4c8a5a7fc New fringe codecs: WC3/Xan video, Xan DPCM, DK3 & DK4 ADPCM
tmmm
parents:
diff changeset
442 */