49 #define CHECK_PIXEL_PTR(n) \
50 if ((pixel_ptr + n > pixel_limit) || (pixel_ptr + n < 0)) { \
51 av_log (s->avctx, AV_LOG_ERROR, "Problem: pixel_ptr = %d, pixel_limit = %d\n",\
52 pixel_ptr + n, pixel_limit); \
61 unsigned char pi0, pi1;
77 while (lines_to_change) {
78 skip = bytestream2_get_byte(&s->
g);
79 rle_code = (
signed char)bytestream2_get_byte(&s->
g);
85 pixel_ptr = row_ptr + 2 * (skip & 0x7f);
87 pixel_ptr += 2 * skip;
99 pi0 = bytestream2_get_byte(&s->
g);
100 pi1 = bytestream2_get_byte(&s->
g);
104 rgb[pixel_ptr++] = pi0;
105 rgb[pixel_ptr++] = pi1;
113 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
119 int lines_to_change,
int bpp)
124 unsigned char pi[16];
127 int num_pixels = (bpp == 4) ? 8 : 16;
129 while (lines_to_change--) {
130 pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
133 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
136 pixel_ptr += (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
138 }
else if (rle_code < 0) {
140 rle_code = -rle_code;
143 for (i = num_pixels-1; i >= 0; i--) {
144 pi[num_pixels-1-i] = (bytestream2_peek_byte(&s->
g) >> ((i*bpp) & 0x07)) & ((1<<bpp)-1);
149 for (i = 0; i < num_pixels; i++)
150 rgb[pixel_ptr++] = pi[i];
158 int x = bytestream2_get_byte(&s->
g);
159 rgb[pixel_ptr++] = (x >> 4) & 0x0f;
160 rgb[pixel_ptr++] = x & 0x0f;
162 int x = bytestream2_get_byte(&s->
g);
163 rgb[pixel_ptr++] = (x >> 6) & 0x03;
164 rgb[pixel_ptr++] = (x >> 4) & 0x03;
165 rgb[pixel_ptr++] = (x >> 2) & 0x03;
166 rgb[pixel_ptr++] = x & 0x03;
180 unsigned char pi1, pi2, pi3, pi4;
184 while (lines_to_change--) {
185 pixel_ptr = row_ptr + (4 * (bytestream2_get_byte(&s->
g) - 1));
188 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
191 pixel_ptr += (4 * (bytestream2_get_byte(&s->
g) - 1));
193 }
else if (rle_code < 0) {
195 rle_code = -rle_code;
198 pi1 = bytestream2_get_byte(&s->
g);
199 pi2 = bytestream2_get_byte(&s->
g);
200 pi3 = bytestream2_get_byte(&s->
g);
201 pi4 = bytestream2_get_byte(&s->
g);
206 rgb[pixel_ptr++] = pi1;
207 rgb[pixel_ptr++] = pi2;
208 rgb[pixel_ptr++] = pi3;
209 rgb[pixel_ptr++] = pi4;
217 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
230 unsigned short rgb16;
234 while (lines_to_change--) {
235 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 2;
238 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
241 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 2;
243 }
else if (rle_code < 0) {
245 rle_code = -rle_code;
246 rgb16 = bytestream2_get_be16(&s->
g);
251 *(
unsigned short *)(&rgb[pixel_ptr]) = rgb16;
259 rgb16 = bytestream2_get_be16(&s->
g);
260 *(
unsigned short *)(&rgb[pixel_ptr]) = rgb16;
274 unsigned char r,
g,
b;
278 while (lines_to_change--) {
279 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 3;
282 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
285 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 3;
287 }
else if (rle_code < 0) {
289 rle_code = -rle_code;
290 r = bytestream2_get_byte(&s->
g);
291 g = bytestream2_get_byte(&s->
g);
292 b = bytestream2_get_byte(&s->
g);
297 rgb[pixel_ptr++] =
r;
298 rgb[pixel_ptr++] =
g;
299 rgb[pixel_ptr++] =
b;
306 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
307 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
308 rgb[pixel_ptr++] = bytestream2_get_byte(&s->
g);
325 while (lines_to_change--) {
326 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 4;
329 while ((rle_code = (
signed char)bytestream2_get_byte(&s->
g)) != -1) {
332 pixel_ptr += (bytestream2_get_byte(&s->
g) - 1) * 4;
334 }
else if (rle_code < 0) {
336 rle_code = -rle_code;
337 argb = bytestream2_get_be32(&s->
g);
350 argb = bytestream2_get_be32(&s->
g);
405 void *
data,
int *got_frame,
409 int header, start_line;
431 header = bytestream2_get_be16(&s->
g);
434 if (header & 0x0008) {
435 if (avpkt->
size < 14)
437 start_line = bytestream2_get_be16(&s->
g);
439 height = bytestream2_get_be16(&s->
g);