]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/nvenc.c
configure: Remove reference to no longer existing avcodec_encode_video()
[ffmpeg] / libavcodec / nvenc.c
index 93fa9c689c780ad8d1e2c52bd4baf8b03fdba785..54906526eb59798187636d2faf1d406eed7abcf1 100644 (file)
@@ -759,14 +759,16 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
         ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate;
 
     if (lossless) {
-      ctx->encode_config.encodeCodecConfig.h264Config.qpPrimeYZeroTransformBypassFlag = 1;
-      ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_CONSTQP;
-      ctx->encode_config.rcParams.constQP.qpInterB = 0;
-      ctx->encode_config.rcParams.constQP.qpInterP = 0;
-      ctx->encode_config.rcParams.constQP.qpIntra = 0;
-
-      avctx->qmin = -1;
-      avctx->qmax = -1;
+        if (avctx->codec->id == AV_CODEC_ID_H264)
+            ctx->encode_config.encodeCodecConfig.h264Config.qpPrimeYZeroTransformBypassFlag = 1;
+
+        ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_CONSTQP;
+        ctx->encode_config.rcParams.constQP.qpInterB = 0;
+        ctx->encode_config.rcParams.constQP.qpInterP = 0;
+        ctx->encode_config.rcParams.constQP.qpIntra = 0;
+
+        avctx->qmin = -1;
+        avctx->qmax = -1;
     } else if (ctx->cbr) {
         if (!ctx->twopass) {
             ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_CBR;
@@ -789,7 +791,16 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
         avctx->qmin = -1;
         avctx->qmax = -1;
     } else if (avctx->qmin >= 0 && avctx->qmax >= 0) {
-        ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR;
+        if (ctx->twopass == 1) {
+            ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_2_PASS_VBR;
+
+            if (avctx->codec->id == AV_CODEC_ID_H264) {
+                ctx->encode_config.encodeCodecConfig.h264Config.adaptiveTransformMode = NV_ENC_H264_ADAPTIVE_TRANSFORM_ENABLE;
+                ctx->encode_config.encodeCodecConfig.h264Config.fmoMode = NV_ENC_H264_FMO_DISABLE;
+            }
+        } else {
+            ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR;
+        }
 
         ctx->encode_config.rcParams.enableMinQP = 1;
         ctx->encode_config.rcParams.enableMaxQP = 1;