[FFmpeg-cvslog] Merge commit '7c25523cc8e618e77dc84d960e41e9644eaf8c33'
James Almer
git at videolan.org
Mon Oct 30 19:26:38 EET 2017
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Oct 30 14:20:58 2017 -0300| [b428d445a8175ecd872b56a2c3272326c48a5eb9] | committer: James Almer
Merge commit '7c25523cc8e618e77dc84d960e41e9644eaf8c33'
* commit '7c25523cc8e618e77dc84d960e41e9644eaf8c33':
utvideodec: Fix decoding odd sizes with interlaced video with some formats
See 9ef21a897c64417a0575cbc6fad6222f3163d103
Merged-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b428d445a8175ecd872b56a2c3272326c48a5eb9
---
libavcodec/utvideodec.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 40c12772b3..26c3f8a506 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -229,6 +229,16 @@ fail:
return AVERROR_INVALIDDATA;
}
+static int compute_cmask(int plane_no, int interlaced, enum AVPixelFormat pix_fmt)
+{
+ const int is_luma = (pix_fmt == AV_PIX_FMT_YUV420P) && !plane_no;
+
+ if (interlaced)
+ return ~(1 + 2 * is_luma);
+
+ return ~is_luma;
+}
+
static int decode_plane(UtvideoContext *c, int plane_no,
uint8_t *dst, int step, ptrdiff_t stride,
int width, int height,
@@ -239,7 +249,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
VLC vlc;
GetBitContext gb;
int prev, fsym;
- const int cmask = c->interlaced ? ~(1 + 2 * (!plane_no && c->avctx->pix_fmt == AV_PIX_FMT_YUV420P)) : ~(!plane_no && c->avctx->pix_fmt == AV_PIX_FMT_YUV420P);
+ const int cmask = compute_cmask(plane_no, c->interlaced, c->avctx->pix_fmt);
if (build_huff(src, &vlc, &fsym)) {
av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
======================================================================
diff --cc libavcodec/utvideodec.c
index 40c12772b3,0f58c83979..26c3f8a506
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@@ -229,6 -228,16 +229,16 @@@ fail
return AVERROR_INVALIDDATA;
}
-static int compute_cmask(int plane_no, int interlaced, int pix_fmt)
++static int compute_cmask(int plane_no, int interlaced, enum AVPixelFormat pix_fmt)
+ {
+ const int is_luma = (pix_fmt == AV_PIX_FMT_YUV420P) && !plane_no;
+
+ if (interlaced)
+ return ~(1 + 2 * is_luma);
+
+ return ~is_luma;
+ }
+
static int decode_plane(UtvideoContext *c, int plane_no,
uint8_t *dst, int step, ptrdiff_t stride,
int width, int height,
@@@ -237,9 -246,9 +247,9 @@@
int i, j, slice, pix;
int sstart, send;
VLC vlc;
- BitstreamContext bc;
+ GetBitContext gb;
int prev, fsym;
- const int cmask = c->interlaced ? ~(1 + 2 * (!plane_no && c->avctx->pix_fmt == AV_PIX_FMT_YUV420P)) : ~(!plane_no && c->avctx->pix_fmt == AV_PIX_FMT_YUV420P);
+ const int cmask = compute_cmask(plane_no, c->interlaced, c->avctx->pix_fmt);
if (build_huff(src, &vlc, &fsym)) {
av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
More information about the ffmpeg-cvslog
mailing list