Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2017-11-14 08:11:27 +0300
committerPhilip Langdale <philipl@overt.org>2017-11-15 06:39:06 +0300
commitbb4c9d0a8ead02f7d943c2bae3e36b30e605b30b (patch)
tree21cc04abb0531f74a9693167a756862de7247486
parent54f8ac199fe38b2837146621963bb543868130be (diff)
avcodec: Don't assume separate u and v planes in ff_alloc_picture
alloc_frame_buffer in ff_alloc_picture asserts that the linesize of planes 1 and 2 are the same. If the pixfmt has a single uv plane, like NV12, this won't be true. So, let's only do this check if there are more than 2 planes. We never hit this with previous hw formats because they don't set linesize to meaningful values, but the cuda hw format sets the values based on the underlying data layout.
-rw-r--r--libavcodec/mpegpicture.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index 9811a778b7..2b72346fb2 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -22,6 +22,7 @@
#include "libavutil/avassert.h"
#include "libavutil/common.h"
+#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "motion_est.h"
@@ -155,7 +156,8 @@ static int alloc_frame_buffer(AVCodecContext *avctx, Picture *pic,
return -1;
}
- if (pic->f->linesize[1] != pic->f->linesize[2]) {
+ if (av_pix_fmt_count_planes(pic->f->format) > 2 &&
+ pic->f->linesize[1] != pic->f->linesize[2]) {
av_log(avctx, AV_LOG_ERROR,
"get_buffer() failed (uv stride mismatch)\n");
ff_mpeg_unref_picture(avctx, pic);