Commit e929b2f2 authored by Timo Rothenpieler's avatar Timo Rothenpieler

avcodec/nvenc: switch to dedicated dpb_size option

Signed-off-by: 's avatarTimo Rothenpieler <timo@rothenpieler.org>
parent 460f7449
......@@ -949,9 +949,9 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
h264->repeatSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1;
h264->outputAUD = ctx->aud;
if (avctx->refs >= 0) {
if (ctx->dpb_size >= 0) {
/* 0 means "let the hardware decide" */
h264->maxNumRefFrames = avctx->refs;
h264->maxNumRefFrames = ctx->dpb_size;
}
if (avctx->gop_size >= 0) {
h264->idrPeriod = cc->gopLength;
......@@ -1041,9 +1041,9 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
hevc->repeatSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1;
hevc->outputAUD = ctx->aud;
if (avctx->refs >= 0) {
if (ctx->dpb_size >= 0) {
/* 0 means "let the hardware decide" */
hevc->maxNumRefFramesInDPB = avctx->refs;
hevc->maxNumRefFramesInDPB = ctx->dpb_size;
}
if (avctx->gop_size >= 0) {
hevc->idrPeriod = cc->gopLength;
......@@ -1175,7 +1175,7 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
if (ctx->bluray_compat) {
ctx->aud = 1;
avctx->refs = FFMIN(FFMAX(avctx->refs, 0), 6);
ctx->dpb_size = FFMIN(FFMAX(avctx->refs, 0), 6);
avctx->max_b_frames = FFMIN(avctx->max_b_frames, 3);
switch (avctx->codec->id) {
case AV_CODEC_ID_H264:
......
......@@ -192,6 +192,7 @@ typedef struct NvencContext
int coder;
int b_ref_mode;
int a53_cc;
int dpb_size;
} NvencContext;
int ff_nvenc_encode_init(AVCodecContext *avctx);
......
......@@ -138,6 +138,8 @@ static const AVOption options[] = {
{ "middle", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, VE, "b_ref_mode" },
#endif
{ "a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE },
{ "dpb_size", "Specifies the DPB size used for encoding (0 means automatic)",
OFFSET(dpb_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
{ NULL }
};
......
......@@ -127,6 +127,8 @@ static const AVOption options[] = {
{ "each", "", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, VE, "b_ref_mode" },
{ "middle", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, VE, "b_ref_mode" },
#endif
{ "dpb_size", "Specifies the DPB size used for encoding (0 means automatic)",
OFFSET(dpb_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
{ NULL }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment