Commit 1b247103 authored by Marton Balint's avatar Marton Balint

avutil/hwcontext_cuda: fix YUV420P cuda_get_buffer

Regression since ece068a7.
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent 2dbe936b
......@@ -159,10 +159,11 @@ 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]);
frame->linesize[1] = frame->linesize[2] = frame->linesize[0] / 2;
frame->data[2] = frame->data[1];
frame->data[1] = frame->data[2] + frame->linesize[2] * ctx->height / 2;
}
frame->format = AV_PIX_FMT_CUDA;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment