avcodec/nvenc: support RGB input

nvenc still encodes as yuv, but does the conversion internally which
brings some performance gains.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
pull/232/head
Sven C. Dack 8 years ago committed by Timo Rothenpieler
parent fa3ecad071
commit 4aeb7a88ec
  1. 10
      libavcodec/nvenc.c

@ -81,6 +81,8 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
AV_PIX_FMT_P010, AV_PIX_FMT_P010,
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_YUV444P16, AV_PIX_FMT_YUV444P16,
AV_PIX_FMT_0RGB32,
AV_PIX_FMT_0BGR32,
#if CONFIG_CUDA #if CONFIG_CUDA
AV_PIX_FMT_CUDA, AV_PIX_FMT_CUDA,
#endif #endif
@ -1032,6 +1034,14 @@ static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx)
ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_YUV444_10BIT; ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
break; break;
case AV_PIX_FMT_0RGB32:
ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_ARGB;
break;
case AV_PIX_FMT_0BGR32:
ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_ABGR;
break;
default: default:
av_log(avctx, AV_LOG_FATAL, "Invalid input pixel format\n"); av_log(avctx, AV_LOG_FATAL, "Invalid input pixel format\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);

Loading…
Cancel
Save