|
|
@@ -1292,7 +1292,8 @@ static int nvenc_copy_frame(AVCodecContext *avctx, NvencSurface *inSurf, |
|
|
uint8_t *buf = lockBufferParams->bufferDataPtr; |
|
|
int off = inSurf->height * lockBufferParams->pitch; |
|
|
|
|
|
if (frame->format == AV_PIX_FMT_YUV420P) { |
|
|
switch (frame->format) { |
|
|
case AV_PIX_FMT_YUV420P: |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch, |
|
|
frame->data[0], frame->linesize[0], |
|
|
avctx->width, avctx->height); |
|
|
@@ -1308,7 +1309,8 @@ static int nvenc_copy_frame(AVCodecContext *avctx, NvencSurface *inSurf, |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch >> 1, |
|
|
frame->data[1], frame->linesize[1], |
|
|
avctx->width >> 1, avctx->height >> 1); |
|
|
} else if (frame->format == AV_PIX_FMT_NV12) { |
|
|
break; |
|
|
case AV_PIX_FMT_NV12: |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch, |
|
|
frame->data[0], frame->linesize[0], |
|
|
avctx->width, avctx->height); |
|
|
@@ -1318,7 +1320,8 @@ static int nvenc_copy_frame(AVCodecContext *avctx, NvencSurface *inSurf, |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch, |
|
|
frame->data[1], frame->linesize[1], |
|
|
avctx->width, avctx->height >> 1); |
|
|
} else if (frame->format == AV_PIX_FMT_P010) { |
|
|
break; |
|
|
case AV_PIX_FMT_P010: |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch, |
|
|
frame->data[0], frame->linesize[0], |
|
|
avctx->width << 1, avctx->height); |
|
|
@@ -1328,7 +1331,8 @@ static int nvenc_copy_frame(AVCodecContext *avctx, NvencSurface *inSurf, |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch, |
|
|
frame->data[1], frame->linesize[1], |
|
|
avctx->width << 1, avctx->height >> 1); |
|
|
} else if (frame->format == AV_PIX_FMT_YUV444P) { |
|
|
break; |
|
|
case AV_PIX_FMT_YUV444P: |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch, |
|
|
frame->data[0], frame->linesize[0], |
|
|
avctx->width, avctx->height); |
|
|
@@ -1344,7 +1348,8 @@ static int nvenc_copy_frame(AVCodecContext *avctx, NvencSurface *inSurf, |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch, |
|
|
frame->data[2], frame->linesize[2], |
|
|
avctx->width, avctx->height); |
|
|
} else if (frame->format == AV_PIX_FMT_YUV444P16) { |
|
|
break; |
|
|
case AV_PIX_FMT_YUV444P16: |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch, |
|
|
frame->data[0], frame->linesize[0], |
|
|
avctx->width << 1, avctx->height); |
|
|
@@ -1360,11 +1365,14 @@ static int nvenc_copy_frame(AVCodecContext *avctx, NvencSurface *inSurf, |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch, |
|
|
frame->data[2], frame->linesize[2], |
|
|
avctx->width << 1, avctx->height); |
|
|
} else if (frame->format == AV_PIX_FMT_0RGB32 || frame->format == AV_PIX_FMT_0BGR32) { |
|
|
break; |
|
|
case AV_PIX_FMT_0RGB32: |
|
|
case AV_PIX_FMT_0BGR32: |
|
|
av_image_copy_plane(buf, lockBufferParams->pitch, |
|
|
frame->data[0], frame->linesize[0], |
|
|
avctx->width << 2, avctx->height); |
|
|
} else { |
|
|
break; |
|
|
default: |
|
|
av_log(avctx, AV_LOG_FATAL, "Invalid pixel format!\n"); |
|
|
return AVERROR(EINVAL); |
|
|
} |
|
|
|