avcodec/magicyuv: fix decoding of raw slices

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2016-06-02 06:59:46 +02:00
parent 7e0623b70b
commit a3c2a9c736
1 changed files with 24 additions and 13 deletions

View File

@ -124,13 +124,23 @@ static int decode_slice(AVCodecContext *avctx, void *tdata,
int sheight = AV_CEIL_RSHIFT(s->slice_height, s->vshift[i]); int sheight = AV_CEIL_RSHIFT(s->slice_height, s->vshift[i]);
int fake_stride = p->linesize[i] * (1 + interlaced); int fake_stride = p->linesize[i] * (1 + interlaced);
int stride = p->linesize[i]; int stride = p->linesize[i];
int pred; int flags, pred;
if ((ret = init_get_bits8(&b, s->buf + s->slices[i][j].start, s->slices[i][j].size)) < 0) if ((ret = init_get_bits8(&b, s->buf + s->slices[i][j].start, s->slices[i][j].size)) < 0)
return ret; return ret;
pred = get_bits(&b, 16); flags = get_bits(&b, 8);
pred = get_bits(&b, 8);
dst = p->data[i] + j * sheight * stride; dst = p->data[i] + j * sheight * stride;
if (flags & 1) {
for (k = 0; k < height; k++) {
for (x = 0; x < width; x++) {
dst[x] = get_bits(&b, 8);
}
dst += stride;
}
} else {
for (k = 0; k < height; k++) { for (k = 0; k < height; k++) {
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
int pix; int pix;
@ -145,6 +155,7 @@ static int decode_slice(AVCodecContext *avctx, void *tdata,
} }
dst += stride; dst += stride;
} }
}
if (pred == LEFT) { if (pred == LEFT) {
dst = p->data[i] + j * sheight * stride; dst = p->data[i] + j * sheight * stride;