Ticket #1197: patchlagsyuy2.diff
| File patchlagsyuy2.diff, 2.3 KB (added by cehoyos, 14 months ago) |
|---|
-
libavcodec/lagarith.c
diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 22d427e..99b5d3f 100644
a b static void lag_pred_line(LagarithContext *l, uint8_t *buf, 258 258 if (line == 1) { 259 259 /* Second line, left predict first pixel, the rest of the line is median predicted 260 260 * NOTE: In the case of RGB this pixel is top predicted */ 261 TL = l->avctx->pix_fmt == PIX_FMT_YUV420P ? buf[-stride] : L; 261 TL = l->avctx->pix_fmt == PIX_FMT_YUV420P || 262 l->avctx->pix_fmt == PIX_FMT_YUV422P ? buf[-stride] : L; 262 263 } else { 263 264 /* Top left is 2 rows back, last pixel */ 264 265 TL = buf[width - (2 * stride) - 1]; … … static int lag_decode_frame(AVCodecContext *avctx, 590 591 avctx->height / 2, p->linesize[1], 591 592 buf + offset_bv, buf_size - offset_bv); 592 593 break; 594 case FRAME_ARITH_YUY2: 595 avctx->pix_fmt = PIX_FMT_YUV422P; 596 597 if (avctx->get_buffer(avctx, p) < 0) { 598 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); 599 return -1; 600 } 601 if (buf_size <= offset_ry || buf_size <= offset_gu || buf_size <= offset_bv) { 602 return AVERROR_INVALIDDATA; 603 } 604 605 if (offset_ry >= buf_size || 606 offset_gu >= buf_size || 607 offset_bv >= buf_size) { 608 av_log(avctx, AV_LOG_ERROR, 609 "Invalid frame offsets\n"); 610 return AVERROR_INVALIDDATA; 611 } 612 613 lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height, 614 p->linesize[0], buf + offset_ry, 615 buf_size - offset_ry); 616 lag_decode_arith_plane(l, p->data[2], avctx->width / 2, 617 avctx->height, p->linesize[2], 618 buf + offset_bv, buf_size - offset_bv); 619 lag_decode_arith_plane(l, p->data[1], avctx->width / 2, 620 avctx->height, p->linesize[1], 621 buf + offset_gu, buf_size - offset_gu); 622 break; 593 623 default: 594 624 av_log(avctx, AV_LOG_ERROR, 595 625 "Unsupported Lagarith frame type: %#x\n", frametype);
