#define FETCH_NEXT_STREAM_BYTE() \
if (stream_ptr >= s->size) \
{ \
- printf(" MS RLE: stream ptr just went out of bounds (1)\n"); \
+ av_log(s->avctx, AV_LOG_ERROR, " MS RLE: stream ptr just went out of bounds (1)\n"); \
return; \
} \
stream_byte = s->buf[stream_ptr++];
int row_ptr = (s->avctx->height - 1) * row_dec;
int frame_size = row_dec * s->avctx->height;
+ /* make the palette available */
+ memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
+ if (s->avctx->palctrl->palette_changed) {
+ s->frame.palette_has_changed = 1;
+ s->avctx->palctrl->palette_changed = 0;
+ }
+
while (row_ptr >= 0) {
FETCH_NEXT_STREAM_BYTE();
rle_code = stream_byte;
/* copy pixels from encoded stream */
if ((row_ptr + pixel_ptr + stream_byte > frame_size) ||
(row_ptr < 0)) {
- printf(" MS RLE: frame ptr just went out of bounds (1)\n");
+ av_log(s->avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n");
return;
}
rle_code = stream_byte;
extra_byte = stream_byte & 0x01;
if (stream_ptr + rle_code + extra_byte > s->size) {
- printf(" MS RLE: stream ptr just went out of bounds (2)\n");
+ av_log(s->avctx, AV_LOG_ERROR, " MS RLE: stream ptr just went out of bounds (2)\n");
return;
}
/* decode a run of data */
if ((row_ptr + pixel_ptr + stream_byte > frame_size) ||
(row_ptr < 0)) {
- printf(" MS RLE: frame ptr just went out of bounds (2)\n");
+ av_log(s->avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (2)\n");
return;
}
}
}
- /* make the palette available */
- memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
- if (s->avctx->palctrl->palette_changed) {
- s->frame.palette_has_changed = 1;
- s->avctx->palctrl->palette_changed = 0;
- }
-
/* one last sanity check on the way out */
if (stream_ptr < s->size)
- printf(" MS RLE: ended frame decode with bytes left over (%d < %d)\n",
+ av_log(s->avctx, AV_LOG_ERROR, " MS RLE: ended frame decode with bytes left over (%d < %d)\n",
stream_ptr, s->size);
}
s->frame.reference = 1;
if (avctx->get_buffer(avctx, &s->frame)) {
- printf (" MS RLE: get_buffer() failed\n");
+ av_log(avctx, AV_LOG_ERROR, " MS RLE: get_buffer() failed\n");
return -1;
}
if (s->prev_frame.data[0] && (s->frame.linesize[0] != s->prev_frame.linesize[0]))
- printf (" MS RLE: Buffer linesize changed: current %u, previous %u.\n"
+ av_log(avctx, AV_LOG_ERROR, " MS RLE: Buffer linesize changed: current %u, previous %u.\n"
" Expect wrong image and/or crash!\n",
s->frame.linesize[0], s->prev_frame.linesize[0]);