50 #define CHECK_PIXEL_PTR(n) \
51 if ((pixel_ptr + n > pixel_limit) || (pixel_ptr + n < 0)) { \
52 av_log (s->avctx, AV_LOG_ERROR, "Problem: pixel_ptr = %d, pixel_limit = %d\n",\
53 pixel_ptr + n, pixel_limit); \
78 while (lines_to_change) {
79 skip = bytestream2_get_byte(&s->
g);
80 rle_code = (int8_t)bytestream2_get_byte(&s->
g);
86 pixel_ptr = row_ptr + 2 * (skip & 0x7f);
88 pixel_ptr += 2 * skip;
100 pi0 = bytestream2_get_byte(&s->
g);
101 pi1 = bytestream2_get_byte(&s->
g);
105 rgb[pixel_ptr++] = pi0;
106 rgb[pixel_ptr++] = pi1;
114 pixel_ptr += rle_code;
120 int lines_to_change,
int bpp)
128 int num_pixels = (bpp == 4) ? 8 : 16;
130 while (lines_to_change--) {
131 pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
134 while ((rle_code = (int8_t)bytestream2_get_byte(&s->
g)) != -1) {
137 pixel_ptr += (num_pixels * (bytestream2_get_byte(&s->
g) - 1));
139 }
else if (rle_code < 0) {
141 rle_code = -rle_code;
144 for (i = num_pixels-1; i >= 0; i--) {
145 pi[num_pixels-1-i] = (bytestream2_peek_byte(&s->
g) >> ((i*bpp) & 0x07)) & ((1<<bpp)-1);
150 memcpy(&rgb[pixel_ptr], &pi, num_pixels);
151 pixel_ptr += num_pixels;
159 int x = bytestream2_get_byte(&s->
g);
160 rgb[pixel_ptr++] = (x >> 4) & 0x0f;
161 rgb[pixel_ptr++] = x & 0x0f;
163 int x = bytestream2_get_byte(&s->
g);
164 rgb[pixel_ptr++] = (x >> 6) & 0x03;
165 rgb[pixel_ptr++] = (x >> 4) & 0x03;
166 rgb[pixel_ptr++] = (x >> 2) & 0x03;
167 rgb[pixel_ptr++] = x & 0x03;
185 while (lines_to_change--) {
186 pixel_ptr = row_ptr + (4 * (bytestream2_get_byte(&s->
g) - 1));
189 while ((rle_code = (int8_t)bytestream2_get_byte(&s->
g)) != -1) {
192 pixel_ptr += (4 * (bytestream2_get_byte(&s->
g) - 1));
194 }
else if (rle_code < 0) {
196 rle_code = -rle_code;
199 pi1 = bytestream2_get_byte(&s->
g);
200 pi2 = bytestream2_get_byte(&s->
g);
201 pi3 = bytestream2_get_byte(&s->
g);
202 pi4 = bytestream2_get_byte(&s->
g);
207 rgb[pixel_ptr++] = pi1;
208 rgb[pixel_ptr++] = pi2;
209 rgb[pixel_ptr++] = pi3;
210 rgb[pixel_ptr++] = pi4;
218 pixel_ptr += rle_code;
234 while (lines_to_change--) {
235 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 2;
238 while ((rle_code = (int8_t)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 *(uint16_t *)(&rgb[pixel_ptr]) = rgb16;
259 rgb16 = bytestream2_get_be16(&s->
g);
260 *(uint16_t *)(&rgb[pixel_ptr]) = rgb16;
278 while (lines_to_change--) {
279 pixel_ptr = row_ptr + (bytestream2_get_byte(&s->
g) - 1) * 3;
282 while ((rle_code = (int8_t)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 = (int8_t)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);
406 void *
data,
int *got_frame,
427 header = bytestream2_get_be16(&s->
g);
430 if (header & 0x0008) {
431 if (avpkt->
size < 14)
433 start_line = bytestream2_get_be16(&s->
g);
435 height = bytestream2_get_be16(&s->
g);