49 #define CHECK_PIXEL_PTR(n) \
50 if ((pixel_ptr + n > pixel_limit) || (pixel_ptr + n < 0)) { \
51 av_log (s->avctx, AV_LOG_INFO, "Problem: pixel_ptr = %d, pixel_limit = %d\n", \
52 pixel_ptr + n, pixel_limit); \
61 unsigned char pi0, pi1;
69 while (lines_to_change) {
70 skip = bytestream2_get_byte(&s->
g);
71 rle_code = (
signed char)bytestream2_get_byte(&s->
g);
77 pixel_ptr = row_ptr + 2 * (skip & 0x7f);
79 pixel_ptr += 2 * skip;
91 pi0 = bytestream2_get_byte(&s->
g);
92 pi1 = bytestream2_get_byte(&s->
g);
96 rgb[pixel_ptr++] = pi0;
97 rgb[pixel_ptr++] = pi1;
105 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
111 int lines_to_change,
int bpp)
116 unsigned char pi[16];
119 int num_pixels = (bpp == 4) ? 8 : 16;
121 while (lines_to_change--) {
122 pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
125 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
128 pixel_ptr += (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
130 }
else if (rle_code < 0) {
132 rle_code = -rle_code;
135 for (i = num_pixels-1; i >= 0; i--) {
136 pi[num_pixels-1-i] = (bytestream2_peek_byte(&s->
g) >> ((i*bpp) & 0x07)) & ((1<<bpp)-1);
141 for (i = 0; i < num_pixels; i++)
142 rgb[pixel_ptr++] = pi[i];
150 int x = bytestream2_get_byte(&s->
g);
151 rgb[pixel_ptr++] = (x >> 4) & 0x0f;
152 rgb[pixel_ptr++] = x & 0x0f;
154 int x = bytestream2_get_byte(&s->
g);
155 rgb[pixel_ptr++] = (x >> 6) & 0x03;
156 rgb[pixel_ptr++] = (x >> 4) & 0x03;
157 rgb[pixel_ptr++] = (x >> 2) & 0x03;
158 rgb[pixel_ptr++] = x & 0x03;
172 unsigned char pi1, pi2, pi3, pi4;
176 while (lines_to_change--) {
177 pixel_ptr = row_ptr + (4 * (bytestream2_get_byte(&s->
g) - 1));
180 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
183 pixel_ptr += (4 * (bytestream2_get_byte(&s->
g) - 1));
185 }
else if (rle_code < 0) {
187 rle_code = -rle_code;
190 pi1 = bytestream2_get_byte(&s->
g);
191 pi2 = bytestream2_get_byte(&s->
g);
192 pi3 = bytestream2_get_byte(&s->
g);
193 pi4 = bytestream2_get_byte(&s->
g);
198 rgb[pixel_ptr++] = pi1;
199 rgb[pixel_ptr++] = pi2;
200 rgb[pixel_ptr++] = pi3;
201 rgb[pixel_ptr++] = pi4;
209 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
222 unsigned short rgb16;
226 while (lines_to_change--) {
227 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 2;
230 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
233 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 2;
235 }
else if (rle_code < 0) {
237 rle_code = -rle_code;
238 rgb16 = bytestream2_get_be16(&s->
g);
243 *(
unsigned short *)(&rgb[pixel_ptr]) = rgb16;
251 rgb16 = bytestream2_get_be16(&s->
g);
252 *(
unsigned short *)(&rgb[pixel_ptr]) = rgb16;
266 unsigned char r,
g,
b;
270 while (lines_to_change--) {
271 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 3;
274 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
277 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 3;
279 }
else if (rle_code < 0) {
281 rle_code = -rle_code;
282 r = bytestream2_get_byte(&s->
g);
283 g = bytestream2_get_byte(&s->
g);
284 b = bytestream2_get_byte(&s->
g);
289 rgb[pixel_ptr++] =
r;
290 rgb[pixel_ptr++] =
g;
291 rgb[pixel_ptr++] =
b;
298 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
299 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
300 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
317 while (lines_to_change--) {
318 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 4;
321 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
324 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 4;
326 }
else if (rle_code < 0) {
328 rle_code = -rle_code;
329 argb = bytestream2_get_be32(&s->
g);
342 argb = bytestream2_get_be32(&s->
g);
397 void *
data,
int *got_frame,
401 int header, start_line;
422 header = bytestream2_get_be16(&s->
g);
425 if (header & 0x0008) {
426 if (avpkt->
size < 14)
428 start_line = bytestream2_get_be16(&s->
g);
430 height = bytestream2_get_be16(&s->
g);