Commit 8b67ec77 authored by Peter Ross's avatar Peter Ross Committed by Michael Niedermayer

pictordec: fill any unset portion of the image

Fixes ticket #1710
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 49c2f2d5
...@@ -111,7 +111,7 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -111,7 +111,7 @@ static int decode_frame(AVCodecContext *avctx,
PicContext *s = avctx->priv_data; PicContext *s = avctx->priv_data;
uint32_t *palette; uint32_t *palette;
int bits_per_plane, bpp, etype, esize, npal, pos_after_pal; int bits_per_plane, bpp, etype, esize, npal, pos_after_pal;
int i, x, y, plane, tmp; int i, x, y, plane, tmp, val;
bytestream2_init(&s->g, avpkt->data, avpkt->size); bytestream2_init(&s->g, avpkt->data, avpkt->size);
...@@ -206,6 +206,7 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -206,6 +206,7 @@ static int decode_frame(AVCodecContext *avctx,
// skip remaining palette bytes // skip remaining palette bytes
bytestream2_seek(&s->g, pos_after_pal, SEEK_SET); bytestream2_seek(&s->g, pos_after_pal, SEEK_SET);
val = 0;
y = s->height - 1; y = s->height - 1;
if (bytestream2_get_le16(&s->g)) { if (bytestream2_get_le16(&s->g)) {
x = 0; x = 0;
...@@ -223,7 +224,7 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -223,7 +224,7 @@ static int decode_frame(AVCodecContext *avctx,
while (plane < s->nb_planes && y >= 0 && while (plane < s->nb_planes && y >= 0 &&
bytestream2_get_bytes_left(&s->g) > stop_size) { bytestream2_get_bytes_left(&s->g) > stop_size) {
int run = 1; int run = 1;
int val = bytestream2_get_byte(&s->g); val = bytestream2_get_byte(&s->g);
if (val == marker) { if (val == marker) {
run = bytestream2_get_byte(&s->g); run = bytestream2_get_byte(&s->g);
if (run == 0) if (run == 0)
...@@ -240,6 +241,14 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -240,6 +241,14 @@ static int decode_frame(AVCodecContext *avctx,
} }
} }
} }
if (x < avctx->width && y >= 0) {
int run = (y + 1) * avctx->width - x;
if (bits_per_plane == 8)
picmemset_8bpp(s, val, run, &x, &y);
else
picmemset(s, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane);
}
} else { } else {
while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) { while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) {
memcpy(s->frame.data[0] + y * s->frame.linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g))); memcpy(s->frame.data[0] + y * s->frame.linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment