Regression since ece068a771ac3f725e854c681ecbef08e792addc. Signed-off-by: Marton Balint <c...@passwd.hu> --- libavutil/hwcontext_cuda.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c index cb5d15c9d9..e16d0a2b4b 100644 --- a/libavutil/hwcontext_cuda.c +++ b/libavutil/hwcontext_cuda.c @@ -159,10 +159,13 @@ static int cuda_get_buffer(AVHWFramesContext *ctx, AVFrame *frame) return res; // YUV420P is a special case. - // Nvenc expects the U/V planes in swapped order from how ffmpeg expects them. + // Nvenc expects the U/V planes in swapped order from how ffmpeg expects them, also chroma is half-aligned if (ctx->sw_format == AV_PIX_FMT_YUV420P) { - FFSWAP(uint8_t*, frame->data[1], frame->data[2]); - FFSWAP(int, frame->linesize[1], frame->linesize[2]); + int aligned_width = FFALIGN(ctx->width, CUDA_FRAME_ALIGNMENT); + frame->data[2] = frame->data[0] + aligned_width * ctx->height; + frame->data[1] = frame->data[2] + aligned_width * ctx->height / 4; + frame->linesize[1] = aligned_width / 2; + frame->linesize[2] = aligned_width / 2; } frame->format = AV_PIX_FMT_CUDA; -- 2.13.6 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel