summaryrefslogtreecommitdiff
path: root/libavcodec/nvenc.c
diff options
context:
space:
mode:
authorSumit Agarwal <sumita@nvidia.com>2017-05-09 19:54:54 +0530
committerTimo Rothenpieler <timo@rothenpieler.org>2017-05-10 10:22:41 +0200
commit01775730fd1e1877c142518f8cce9d23c47060b1 (patch)
tree19520b5c59789e3d671f03a797e770bd323ae9ea /libavcodec/nvenc.c
parent18a659d1b653c24de1a691c13f7db1b6e6a95aee (diff)
avcodec/nvenc: add weighted prediction support
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r--libavcodec/nvenc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index d6c1005625..6181e7e138 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -298,6 +298,12 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
return AVERROR(ENOSYS);
}
+ ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_WEIGHTED_PREDICTION);
+ if (ctx->weighted_pred > 0 && ret <= 0) {
+ av_log (avctx, AV_LOG_VERBOSE, "Weighted Prediction not supported\n");
+ return AVERROR(ENOSYS);
+ }
+
return 0;
}
@@ -1032,6 +1038,9 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
ctx->init_encode_params.enableEncodeAsync = 0;
ctx->init_encode_params.enablePTD = 1;
+ if (ctx->weighted_pred == 1)
+ ctx->init_encode_params.enableWeightedPrediction = 1;
+
if (ctx->bluray_compat) {
ctx->aud = 1;
avctx->refs = FFMIN(FFMAX(avctx->refs, 0), 6);