annotate qtrle.c @ 4852:8b92d313409d libavcodec

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