]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/nvenc: support RGB input
authorSven C. Dack <sven.c.dack@sky.com>
Wed, 7 Sep 2016 13:35:14 +0000 (15:35 +0200)
committerTimo Rothenpieler <timo@rothenpieler.org>
Wed, 7 Sep 2016 16:44:10 +0000 (18:44 +0200)
nvenc still encodes as yuv, but does the conversion internally which
brings some performance gains.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
libavcodec/nvenc.c

index b33511600703a0536afb65f3016e52b69f6f3cd0..bff204d9266a1f97f8ba6b5305455f153c97ce1a 100644 (file)
@@ -81,6 +81,8 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
     AV_PIX_FMT_P010,
     AV_PIX_FMT_YUV444P,
     AV_PIX_FMT_YUV444P16,
+    AV_PIX_FMT_0RGB32,
+    AV_PIX_FMT_0BGR32,
 #if CONFIG_CUDA
     AV_PIX_FMT_CUDA,
 #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;
         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:
         av_log(avctx, AV_LOG_FATAL, "Invalid input pixel format\n");
         return AVERROR(EINVAL);