aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/nvenc.c
diff options
context:
space:
mode:
authorTimo Rothenpieler2017-05-09 13:57:39 +0200
committerTimo Rothenpieler2017-05-09 18:38:30 +0200
commitcfbebe9dda7d0833b89dc6c2a69a56e50f2a7989 (patch)
treef0037adf20a5db063b397e8a5df38a089b88d7b5 /libavcodec/nvenc.c
parentef390e348eba8aac9f1569278bd2b5d203cd6c1f (diff)
avcodec/nvenc: deprecated old rc modes, add new ones
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r--libavcodec/nvenc.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 0a625512c0..b7723fe949 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -32,9 +32,9 @@
#include "internal.h"
#define NVENC_CAP 0x30
-#define IS_CBR(rc) (rc == NV_ENC_PARAMS_RC_CBR || \
- rc == NV_ENC_PARAMS_RC_2_PASS_QUALITY || \
- rc == NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP)
+#define IS_CBR(rc) (rc == NV_ENC_PARAMS_RC_CBR || \
+ rc == NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ || \
+ rc == NV_ENC_PARAMS_RC_CBR_HQ)
const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
AV_PIX_FMT_YUV420P,
@@ -633,13 +633,13 @@ static void nvenc_override_rate_control(AVCodecContext *avctx)
return;
}
/* fall through */
- case NV_ENC_PARAMS_RC_2_PASS_VBR:
+ case NV_ENC_PARAMS_RC_VBR_HQ:
case NV_ENC_PARAMS_RC_VBR:
set_vbr(avctx);
break;
case NV_ENC_PARAMS_RC_CBR:
- case NV_ENC_PARAMS_RC_2_PASS_QUALITY:
- case NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP:
+ case NV_ENC_PARAMS_RC_CBR_HQ:
+ case NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ:
break;
}
@@ -715,19 +715,29 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx)
if (ctx->cbr) {
if (ctx->twopass) {
- ctx->rc = NV_ENC_PARAMS_RC_2_PASS_QUALITY;
+ ctx->rc = NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ;
} else {
ctx->rc = NV_ENC_PARAMS_RC_CBR;
}
} else if (ctx->cqp >= 0) {
ctx->rc = NV_ENC_PARAMS_RC_CONSTQP;
} else if (ctx->twopass) {
- ctx->rc = NV_ENC_PARAMS_RC_2_PASS_VBR;
+ ctx->rc = NV_ENC_PARAMS_RC_VBR_HQ;
} else if (avctx->qmin >= 0 && avctx->qmax >= 0) {
ctx->rc = NV_ENC_PARAMS_RC_VBR_MINQP;
}
}
+ if (ctx->rc >= 0 && ctx->rc & RC_MODE_DEPRECATED) {
+ av_log(avctx, AV_LOG_WARNING, "Specified rc mode is deprecated.\n");
+ av_log(avctx, AV_LOG_WARNING, "\tll_2pass_quality -> cbr_ld_hq\n");
+ av_log(avctx, AV_LOG_WARNING, "\tll_2pass_size -> cbr_hq\n");
+ av_log(avctx, AV_LOG_WARNING, "\tvbr_2pass -> vbr_hq\n");
+ av_log(avctx, AV_LOG_WARNING, "\tvbr_minqp -> (no replacement)\n");
+
+ ctx->rc &= ~RC_MODE_DEPRECATED;
+ }
+
if (ctx->flags & NVENC_LOSSLESS) {
set_lossless(avctx);
} else if (ctx->rc >= 0) {
@@ -830,9 +840,9 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
h264->outputPictureTimingSEI = 1;
}
- if (cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_2_PASS_QUALITY ||
- cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP ||
- cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_2_PASS_VBR) {
+ if (cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ ||
+ cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_CBR_HQ ||
+ cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_VBR_HQ) {
h264->adaptiveTransformMode = NV_ENC_H264_ADAPTIVE_TRANSFORM_ENABLE;
h264->fmoMode = NV_ENC_H264_FMO_DISABLE;
}