annotate qtrle.c @ 5742:f8029206caa2 libavcodec

simplify lpc
author lorenm
date Sun, 30 Sep 2007 03:36:13 +0000
parents 2b72f9bc4f06
children 9ac5c0cfeb56
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
1 /*
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
2 * Quicktime Animation (RLE) Video Decoder
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
3 * Copyright (C) 2004 the ffmpeg project
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
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
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
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.
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
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,
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
15 * Lesser General Public License for more details.
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
16 *
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
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: 2964
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
20 */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
21
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
22 /**
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
23 * @file qtrle.c
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
24 * QT RLE Video Decoder by Mike Melanson (melanson@pcisys.net)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
25 * For more information about the QT RLE format, visit:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
26 * http://www.pcisys.net/~melanson/codecs/
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
27 *
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
28 * The QT RLE decoder has seven modes of operation:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
29 * 1, 2, 4, 8, 16, 24, and 32 bits per pixel. For modes 1, 2, 4, and 8
1881
39ad6cd5d4a6 remove numerous definitions of BE_*/LE_* macros; convert FOURCC_TAG ->
melanson
parents: 1808
diff changeset
30 * the decoder outputs PAL8 colorspace data. 16-bit data yields RGB555
4494
ce643a22f049 Replace deprecated PIX_FMT names by the newer variants.
diego
parents: 4364
diff changeset
31 * data. 24-bit data is RGB24 and 32-bit data is RGB32.
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
32 */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
33
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
34 #include <stdio.h>
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
35 #include <stdlib.h>
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
36 #include <string.h>
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
37 #include <unistd.h>
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
38
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
39 #include "avcodec.h"
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
40 #include "dsputil.h"
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
41
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
42 typedef struct QtrleContext {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
43
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
44 AVCodecContext *avctx;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
45 DSPContext dsp;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
46 AVFrame frame;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
47
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
48 unsigned char *buf;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
49 int size;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
50
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
51 } QtrleContext;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
52
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
53 #define CHECK_STREAM_PTR(n) \
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
54 if ((stream_ptr + n) > s->size) { \
1807
db067aa9fc2b Use av_log
rtognimp
parents: 1783
diff changeset
55 av_log (s->avctx, AV_LOG_INFO, "Problem: stream_ptr out of bounds (%d >= %d)\n", \
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
56 stream_ptr + n, s->size); \
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
57 return; \
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
58 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
59
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
60 #define CHECK_PIXEL_PTR(n) \
2827
deaf39d8381b tinfoil patch: make sure pixel_ptr never goes negative
melanson
parents: 2453
diff changeset
61 if ((pixel_ptr + n > pixel_limit) || (pixel_ptr + n < 0)) { \
deaf39d8381b tinfoil patch: make sure pixel_ptr never goes negative
melanson
parents: 2453
diff changeset
62 av_log (s->avctx, AV_LOG_INFO, "Problem: pixel_ptr = %d, pixel_limit = %d\n", \
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
63 pixel_ptr + n, pixel_limit); \
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
64 return; \
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
65 } \
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
66
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
67 static void qtrle_decode_1bpp(QtrleContext *s)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
68 {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
69 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
70
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
71 static void qtrle_decode_2bpp(QtrleContext *s)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
72 {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
73 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
74
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
75 static void qtrle_decode_4bpp(QtrleContext *s)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
76 {
2049
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
77 int stream_ptr;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
78 int header;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
79 int start_line;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
80 int lines_to_change;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
81 int rle_code;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
82 int row_ptr, pixel_ptr;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
83 int row_inc = s->frame.linesize[0];
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
84 unsigned char pi1, pi2, pi3, pi4, pi5, pi6, pi7, pi8; /* 8 palette indices */
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
85 unsigned char *rgb = s->frame.data[0];
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
86 int pixel_limit = s->frame.linesize[0] * s->avctx->height;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
87
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
88 /* check if this frame is even supposed to change */
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
89 if (s->size < 8)
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
90 return;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
91
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
92 /* start after the chunk size */
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
93 stream_ptr = 4;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
94
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
95 /* fetch the header */
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
96 CHECK_STREAM_PTR(2);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
97 header = AV_RB16(&s->buf[stream_ptr]);
2049
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
98 stream_ptr += 2;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
99
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
100 /* if a header is present, fetch additional decoding parameters */
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
101 if (header & 0x0008) {
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
102 CHECK_STREAM_PTR(8);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
103 start_line = AV_RB16(&s->buf[stream_ptr]);
2049
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
104 stream_ptr += 4;
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
105 lines_to_change = AV_RB16(&s->buf[stream_ptr]);
2049
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
106 stream_ptr += 4;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
107 } else {
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
108 start_line = 0;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
109 lines_to_change = s->avctx->height;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
110 }
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
111
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
112 row_ptr = row_inc * start_line;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
113 while (lines_to_change--) {
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
114 CHECK_STREAM_PTR(2);
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
115 pixel_ptr = row_ptr + (8 * (s->buf[stream_ptr++] - 1));
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
116
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
117 while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
118 if (rle_code == 0) {
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
119 /* there's another skip code in the stream */
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
120 CHECK_STREAM_PTR(1);
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
121 pixel_ptr += (8 * (s->buf[stream_ptr++] - 1));
2827
deaf39d8381b tinfoil patch: make sure pixel_ptr never goes negative
melanson
parents: 2453
diff changeset
122 CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
2049
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
123 } else if (rle_code < 0) {
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
124 /* decode the run length code */
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
125 rle_code = -rle_code;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
126 /* get the next 4 bytes from the stream, treat them as palette
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
127 * indices, and output them rle_code times */
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
128 CHECK_STREAM_PTR(4);
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
129 pi1 = ((s->buf[stream_ptr]) >> 4) & 0x0f;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
130 pi2 = (s->buf[stream_ptr++]) & 0x0f;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
131 pi3 = ((s->buf[stream_ptr]) >> 4) & 0x0f;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
132 pi4 = (s->buf[stream_ptr++]) & 0x0f;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
133 pi5 = ((s->buf[stream_ptr]) >> 4) & 0x0f;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
134 pi6 = (s->buf[stream_ptr++]) & 0x0f;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
135 pi7 = ((s->buf[stream_ptr]) >> 4) & 0x0f;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
136 pi8 = (s->buf[stream_ptr++]) & 0x0f;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
137
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
138 CHECK_PIXEL_PTR(rle_code * 8);
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
139
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
140 while (rle_code--) {
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
141 rgb[pixel_ptr++] = pi1;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
142 rgb[pixel_ptr++] = pi2;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
143 rgb[pixel_ptr++] = pi3;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
144 rgb[pixel_ptr++] = pi4;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
145 rgb[pixel_ptr++] = pi5;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
146 rgb[pixel_ptr++] = pi6;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
147 rgb[pixel_ptr++] = pi7;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
148 rgb[pixel_ptr++] = pi8;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
149 }
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
150 } else {
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
151 /* copy the same pixel directly to output 4 times */
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
152 rle_code *= 4;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
153 CHECK_STREAM_PTR(rle_code);
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
154 CHECK_PIXEL_PTR(rle_code*2);
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
155
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
156 while (rle_code--) {
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
157 rgb[pixel_ptr++] = ((s->buf[stream_ptr]) >> 4) & 0x0f;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
158 rgb[pixel_ptr++] = (s->buf[stream_ptr++]) & 0x0f;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
159 }
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
160 }
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
161 }
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
162 row_ptr += row_inc;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
163 }
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
164 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
165
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
166 static void qtrle_decode_8bpp(QtrleContext *s)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
167 {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
168 int stream_ptr;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
169 int header;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
170 int start_line;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
171 int lines_to_change;
1808
9d860b33fd54 rle_code can overflow when multiplied by 4
rtognimp
parents: 1807
diff changeset
172 int rle_code;
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
173 int row_ptr, pixel_ptr;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
174 int row_inc = s->frame.linesize[0];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
175 unsigned char pi1, pi2, pi3, pi4; /* 4 palette indices */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
176 unsigned char *rgb = s->frame.data[0];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
177 int pixel_limit = s->frame.linesize[0] * s->avctx->height;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
178
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
179 /* check if this frame is even supposed to change */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
180 if (s->size < 8)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
181 return;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
182
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
183 /* start after the chunk size */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
184 stream_ptr = 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
185
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
186 /* fetch the header */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
187 CHECK_STREAM_PTR(2);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
188 header = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
189 stream_ptr += 2;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
190
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
191 /* if a header is present, fetch additional decoding parameters */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
192 if (header & 0x0008) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
193 CHECK_STREAM_PTR(8);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
194 start_line = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
195 stream_ptr += 4;
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
196 lines_to_change = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
197 stream_ptr += 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
198 } else {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
199 start_line = 0;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
200 lines_to_change = s->avctx->height;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
201 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
202
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
203 row_ptr = row_inc * start_line;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
204 while (lines_to_change--) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
205 CHECK_STREAM_PTR(2);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
206 pixel_ptr = row_ptr + (4 * (s->buf[stream_ptr++] - 1));
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
207
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
208 while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
209 if (rle_code == 0) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
210 /* there's another skip code in the stream */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
211 CHECK_STREAM_PTR(1);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
212 pixel_ptr += (4 * (s->buf[stream_ptr++] - 1));
2827
deaf39d8381b tinfoil patch: make sure pixel_ptr never goes negative
melanson
parents: 2453
diff changeset
213 CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
214 } else if (rle_code < 0) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
215 /* decode the run length code */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
216 rle_code = -rle_code;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
217 /* get the next 4 bytes from the stream, treat them as palette
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
218 * indices, and output them rle_code times */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
219 CHECK_STREAM_PTR(4);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
220 pi1 = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
221 pi2 = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
222 pi3 = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
223 pi4 = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
224
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
225 CHECK_PIXEL_PTR(rle_code * 4);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
226
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
227 while (rle_code--) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
228 rgb[pixel_ptr++] = pi1;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
229 rgb[pixel_ptr++] = pi2;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
230 rgb[pixel_ptr++] = pi3;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
231 rgb[pixel_ptr++] = pi4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
232 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
233 } else {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
234 /* copy the same pixel directly to output 4 times */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
235 rle_code *= 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
236 CHECK_STREAM_PTR(rle_code);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
237 CHECK_PIXEL_PTR(rle_code);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
238
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
239 while (rle_code--) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
240 rgb[pixel_ptr++] = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
241 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
242 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
243 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
244 row_ptr += row_inc;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
245 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
246 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
247
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
248 static void qtrle_decode_16bpp(QtrleContext *s)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
249 {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
250 int stream_ptr;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
251 int header;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
252 int start_line;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
253 int lines_to_change;
2925
89ce06bb1c87 Make rle_code int everywhere instead of signed char.
reimar
parents: 2827
diff changeset
254 int rle_code;
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
255 int row_ptr, pixel_ptr;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
256 int row_inc = s->frame.linesize[0];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
257 unsigned short rgb16;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
258 unsigned char *rgb = s->frame.data[0];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
259 int pixel_limit = s->frame.linesize[0] * s->avctx->height;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
260
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
261 /* check if this frame is even supposed to change */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
262 if (s->size < 8)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
263 return;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
264
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
265 /* start after the chunk size */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
266 stream_ptr = 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
267
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
268 /* fetch the header */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
269 CHECK_STREAM_PTR(2);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
270 header = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
271 stream_ptr += 2;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
272
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
273 /* if a header is present, fetch additional decoding parameters */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
274 if (header & 0x0008) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
275 CHECK_STREAM_PTR(8);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
276 start_line = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
277 stream_ptr += 4;
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
278 lines_to_change = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
279 stream_ptr += 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
280 } else {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
281 start_line = 0;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
282 lines_to_change = s->avctx->height;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
283 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
284
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
285 row_ptr = row_inc * start_line;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
286 while (lines_to_change--) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
287 CHECK_STREAM_PTR(2);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
288 pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 2;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
289
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
290 while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
291 if (rle_code == 0) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
292 /* there's another skip code in the stream */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
293 CHECK_STREAM_PTR(1);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
294 pixel_ptr += (s->buf[stream_ptr++] - 1) * 2;
2827
deaf39d8381b tinfoil patch: make sure pixel_ptr never goes negative
melanson
parents: 2453
diff changeset
295 CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
296 } else if (rle_code < 0) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
297 /* decode the run length code */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
298 rle_code = -rle_code;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
299 CHECK_STREAM_PTR(2);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
300 rgb16 = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
301 stream_ptr += 2;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
302
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
303 CHECK_PIXEL_PTR(rle_code * 2);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
304
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
305 while (rle_code--) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
306 *(unsigned short *)(&rgb[pixel_ptr]) = rgb16;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
307 pixel_ptr += 2;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
308 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
309 } else {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
310 CHECK_STREAM_PTR(rle_code * 2);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
311 CHECK_PIXEL_PTR(rle_code * 2);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
312
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
313 /* copy pixels directly to output */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
314 while (rle_code--) {
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
315 rgb16 = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
316 stream_ptr += 2;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
317 *(unsigned short *)(&rgb[pixel_ptr]) = rgb16;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
318 pixel_ptr += 2;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
319 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
320 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
321 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
322 row_ptr += row_inc;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
323 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
324 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
325
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
326 static void qtrle_decode_24bpp(QtrleContext *s)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
327 {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
328 int stream_ptr;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
329 int header;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
330 int start_line;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
331 int lines_to_change;
2925
89ce06bb1c87 Make rle_code int everywhere instead of signed char.
reimar
parents: 2827
diff changeset
332 int rle_code;
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
333 int row_ptr, pixel_ptr;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
334 int row_inc = s->frame.linesize[0];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
335 unsigned char r, g, b;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
336 unsigned char *rgb = s->frame.data[0];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
337 int pixel_limit = s->frame.linesize[0] * s->avctx->height;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
338
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
339 /* check if this frame is even supposed to change */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
340 if (s->size < 8)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
341 return;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
342
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
343 /* start after the chunk size */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
344 stream_ptr = 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
345
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
346 /* fetch the header */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
347 CHECK_STREAM_PTR(2);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
348 header = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
349 stream_ptr += 2;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
350
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
351 /* if a header is present, fetch additional decoding parameters */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
352 if (header & 0x0008) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
353 CHECK_STREAM_PTR(8);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
354 start_line = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
355 stream_ptr += 4;
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
356 lines_to_change = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
357 stream_ptr += 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
358 } else {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
359 start_line = 0;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
360 lines_to_change = s->avctx->height;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
361 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
362
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
363 row_ptr = row_inc * start_line;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
364 while (lines_to_change--) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
365 CHECK_STREAM_PTR(2);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
366 pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 3;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
367
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
368 while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
369 if (rle_code == 0) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
370 /* there's another skip code in the stream */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
371 CHECK_STREAM_PTR(1);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
372 pixel_ptr += (s->buf[stream_ptr++] - 1) * 3;
2827
deaf39d8381b tinfoil patch: make sure pixel_ptr never goes negative
melanson
parents: 2453
diff changeset
373 CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
374 } else if (rle_code < 0) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
375 /* decode the run length code */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
376 rle_code = -rle_code;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
377 CHECK_STREAM_PTR(3);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
378 r = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
379 g = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
380 b = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
381
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
382 CHECK_PIXEL_PTR(rle_code * 3);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
383
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
384 while (rle_code--) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
385 rgb[pixel_ptr++] = r;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
386 rgb[pixel_ptr++] = g;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
387 rgb[pixel_ptr++] = b;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
388 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
389 } else {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
390 CHECK_STREAM_PTR(rle_code * 3);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
391 CHECK_PIXEL_PTR(rle_code * 3);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
392
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
393 /* copy pixels directly to output */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
394 while (rle_code--) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
395 rgb[pixel_ptr++] = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
396 rgb[pixel_ptr++] = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
397 rgb[pixel_ptr++] = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
398 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
399 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
400 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
401 row_ptr += row_inc;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
402 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
403 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
404
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
405 static void qtrle_decode_32bpp(QtrleContext *s)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
406 {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
407 int stream_ptr;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
408 int header;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
409 int start_line;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
410 int lines_to_change;
2925
89ce06bb1c87 Make rle_code int everywhere instead of signed char.
reimar
parents: 2827
diff changeset
411 int rle_code;
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
412 int row_ptr, pixel_ptr;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
413 int row_inc = s->frame.linesize[0];
2964
8f732838179d correctly deal with the alpha channel in 32-bit QT RLE (courtesy of John
melanson
parents: 2925
diff changeset
414 unsigned char a, r, g, b;
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
415 unsigned int argb;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
416 unsigned char *rgb = s->frame.data[0];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
417 int pixel_limit = s->frame.linesize[0] * s->avctx->height;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
418
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
419 /* check if this frame is even supposed to change */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
420 if (s->size < 8)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
421 return;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
422
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
423 /* start after the chunk size */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
424 stream_ptr = 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
425
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
426 /* fetch the header */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
427 CHECK_STREAM_PTR(2);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
428 header = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
429 stream_ptr += 2;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
430
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
431 /* if a header is present, fetch additional decoding parameters */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
432 if (header & 0x0008) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
433 CHECK_STREAM_PTR(8);
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
434 start_line = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
435 stream_ptr += 4;
4364
05e932ddaaa9 rename BE/LE_8/16/32 to AV_RL/B_8/16/32
alex
parents: 3947
diff changeset
436 lines_to_change = AV_RB16(&s->buf[stream_ptr]);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
437 stream_ptr += 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
438 } else {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
439 start_line = 0;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
440 lines_to_change = s->avctx->height;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
441 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
442
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
443 row_ptr = row_inc * start_line;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
444 while (lines_to_change--) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
445 CHECK_STREAM_PTR(2);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
446 pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
447
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
448 while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
449 if (rle_code == 0) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
450 /* there's another skip code in the stream */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
451 CHECK_STREAM_PTR(1);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
452 pixel_ptr += (s->buf[stream_ptr++] - 1) * 4;
2827
deaf39d8381b tinfoil patch: make sure pixel_ptr never goes negative
melanson
parents: 2453
diff changeset
453 CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
454 } else if (rle_code < 0) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
455 /* decode the run length code */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
456 rle_code = -rle_code;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
457 CHECK_STREAM_PTR(4);
2964
8f732838179d correctly deal with the alpha channel in 32-bit QT RLE (courtesy of John
melanson
parents: 2925
diff changeset
458 a = s->buf[stream_ptr++];
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
459 r = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
460 g = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
461 b = s->buf[stream_ptr++];
2964
8f732838179d correctly deal with the alpha channel in 32-bit QT RLE (courtesy of John
melanson
parents: 2925
diff changeset
462 argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
463
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
464 CHECK_PIXEL_PTR(rle_code * 4);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
465
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
466 while (rle_code--) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
467 *(unsigned int *)(&rgb[pixel_ptr]) = argb;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
468 pixel_ptr += 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
469 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
470 } else {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
471 CHECK_STREAM_PTR(rle_code * 4);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
472 CHECK_PIXEL_PTR(rle_code * 4);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
473
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
474 /* copy pixels directly to output */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
475 while (rle_code--) {
2964
8f732838179d correctly deal with the alpha channel in 32-bit QT RLE (courtesy of John
melanson
parents: 2925
diff changeset
476 a = s->buf[stream_ptr++];
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
477 r = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
478 g = s->buf[stream_ptr++];
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
479 b = s->buf[stream_ptr++];
2964
8f732838179d correctly deal with the alpha channel in 32-bit QT RLE (courtesy of John
melanson
parents: 2925
diff changeset
480 argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
481 *(unsigned int *)(&rgb[pixel_ptr]) = argb;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
482 pixel_ptr += 4;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
483 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
484 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
485 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
486 row_ptr += row_inc;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
487 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
488 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
489
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
490 static int qtrle_decode_init(AVCodecContext *avctx)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
491 {
4827
b3ee9a1526b0 Get rid of unnecessary pointer casts.
diego
parents: 4801
diff changeset
492 QtrleContext *s = avctx->priv_data;
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
493
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
494 s->avctx = avctx;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
495 switch (avctx->bits_per_sample) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
496 case 1:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
497 case 2:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
498 case 4:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
499 case 8:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
500 case 33:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
501 case 34:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
502 case 36:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
503 case 40:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
504 avctx->pix_fmt = PIX_FMT_PAL8;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
505 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
506
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
507 case 16:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
508 avctx->pix_fmt = PIX_FMT_RGB555;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
509 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
510
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
511 case 24:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
512 avctx->pix_fmt = PIX_FMT_RGB24;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
513 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
514
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
515 case 32:
4494
ce643a22f049 Replace deprecated PIX_FMT names by the newer variants.
diego
parents: 4364
diff changeset
516 avctx->pix_fmt = PIX_FMT_RGB32;
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
517 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
518
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
519 default:
1807
db067aa9fc2b Use av_log
rtognimp
parents: 1783
diff changeset
520 av_log (avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
521 avctx->bits_per_sample);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
522 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
523 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
524 dsputil_init(&s->dsp, avctx);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
525
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
526 s->frame.data[0] = NULL;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
527
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
528 return 0;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
529 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
530
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
531 static int qtrle_decode_frame(AVCodecContext *avctx,
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
532 void *data, int *data_size,
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
533 uint8_t *buf, int buf_size)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
534 {
4827
b3ee9a1526b0 Get rid of unnecessary pointer casts.
diego
parents: 4801
diff changeset
535 QtrleContext *s = avctx->priv_data;
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
536
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
537 s->buf = buf;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
538 s->size = buf_size;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
539
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
540 s->frame.reference = 1;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
541 s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
542 FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
543 if (avctx->reget_buffer(avctx, &s->frame)) {
1807
db067aa9fc2b Use av_log
rtognimp
parents: 1783
diff changeset
544 av_log (s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
545 return -1;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
546 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
547
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
548 switch (avctx->bits_per_sample) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
549 case 1:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
550 case 33:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
551 qtrle_decode_1bpp(s);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
552 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
553
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
554 case 2:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
555 case 34:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
556 qtrle_decode_2bpp(s);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
557 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
558
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
559 case 4:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
560 case 36:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
561 qtrle_decode_4bpp(s);
2049
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
562 /* make the palette available on the way out */
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
563 memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
564 if (s->avctx->palctrl->palette_changed) {
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
565 s->frame.palette_has_changed = 1;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
566 s->avctx->palctrl->palette_changed = 0;
19c713e14316 Add support for qtrle4 (16 colors/gray levels)
rtognimp
parents: 1881
diff changeset
567 }
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
568 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
569
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
570 case 8:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
571 case 40:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
572 qtrle_decode_8bpp(s);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
573 /* make the palette available on the way out */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
574 memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
575 if (s->avctx->palctrl->palette_changed) {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
576 s->frame.palette_has_changed = 1;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
577 s->avctx->palctrl->palette_changed = 0;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
578 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
579 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
580
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
581 case 16:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
582 qtrle_decode_16bpp(s);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
583 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
584
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
585 case 24:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
586 qtrle_decode_24bpp(s);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
587 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
588
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
589 case 32:
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
590 qtrle_decode_32bpp(s);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
591 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
592
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
593 default:
1807
db067aa9fc2b Use av_log
rtognimp
parents: 1783
diff changeset
594 av_log (s->avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
595 avctx->bits_per_sample);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
596 break;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
597 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
598
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
599 *data_size = sizeof(AVFrame);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
600 *(AVFrame*)data = s->frame;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
601
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
602 /* always report that the buffer was completely consumed */
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
603 return buf_size;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
604 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
605
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
606 static int qtrle_decode_end(AVCodecContext *avctx)
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
607 {
4827
b3ee9a1526b0 Get rid of unnecessary pointer casts.
diego
parents: 4801
diff changeset
608 QtrleContext *s = avctx->priv_data;
1783
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
609
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
610 if (s->frame.data[0])
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
611 avctx->release_buffer(avctx, &s->frame);
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
612
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
613 return 0;
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
614 }
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
615
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
616 AVCodec qtrle_decoder = {
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
617 "qtrle",
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
618 CODEC_TYPE_VIDEO,
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
619 CODEC_ID_QTRLE,
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
620 sizeof(QtrleContext),
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
621 qtrle_decode_init,
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
622 NULL,
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
623 qtrle_decode_end,
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
624 qtrle_decode_frame,
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
625 CODEC_CAP_DR1,
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
626 };
66ae3c109d90 initial commit for Quicktime Animation (RLE) video decoder; bit depths
melanson
parents:
diff changeset
627