mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/nvenc: add initial QP value options
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
This commit is contained in:
parent
a549243b89
commit
5f44a4a0a9
|
@ -547,16 +547,33 @@ static av_cold void set_vbr(AVCodecContext *avctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
rc->enableInitialRCQP = 1;
|
rc->enableInitialRCQP = 1;
|
||||||
rc->initialRCQP.qpInterP = qp_inter_p;
|
|
||||||
|
|
||||||
|
if (ctx->init_qp_p < 0) {
|
||||||
|
rc->initialRCQP.qpInterP = qp_inter_p;
|
||||||
|
} else {
|
||||||
|
rc->initialRCQP.qpInterP = ctx->init_qp_p;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->init_qp_i < 0) {
|
||||||
if (avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) {
|
if (avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) {
|
||||||
rc->initialRCQP.qpIntra = av_clip(
|
rc->initialRCQP.qpIntra = av_clip(
|
||||||
qp_inter_p * fabs(avctx->i_quant_factor) + avctx->i_quant_offset + 0.5, 0, 51);
|
rc->initialRCQP.qpInterP * fabs(avctx->i_quant_factor) + avctx->i_quant_offset + 0.5, 0, 51);
|
||||||
rc->initialRCQP.qpInterB = av_clip(
|
|
||||||
qp_inter_p * fabs(avctx->b_quant_factor) + avctx->b_quant_offset + 0.5, 0, 51);
|
|
||||||
} else {
|
} else {
|
||||||
rc->initialRCQP.qpIntra = qp_inter_p;
|
rc->initialRCQP.qpIntra = rc->initialRCQP.qpInterP;
|
||||||
rc->initialRCQP.qpInterB = qp_inter_p;
|
}
|
||||||
|
} else {
|
||||||
|
rc->initialRCQP.qpIntra = ctx->init_qp_i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->init_qp_b < 0) {
|
||||||
|
if (avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) {
|
||||||
|
rc->initialRCQP.qpInterB = av_clip(
|
||||||
|
rc->initialRCQP.qpInterP * fabs(avctx->b_quant_factor) + avctx->b_quant_offset + 0.5, 0, 51);
|
||||||
|
} else {
|
||||||
|
rc->initialRCQP.qpInterB = rc->initialRCQP.qpInterP;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rc->initialRCQP.qpInterB = ctx->init_qp_b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,9 @@ typedef struct NvencContext
|
||||||
int quality;
|
int quality;
|
||||||
int aud;
|
int aud;
|
||||||
int bluray_compat;
|
int bluray_compat;
|
||||||
|
int init_qp_p;
|
||||||
|
int init_qp_b;
|
||||||
|
int init_qp_i;
|
||||||
} NvencContext;
|
} NvencContext;
|
||||||
|
|
||||||
int ff_nvenc_encode_init(AVCodecContext *avctx);
|
int ff_nvenc_encode_init(AVCodecContext *avctx);
|
||||||
|
|
|
@ -109,6 +109,9 @@ static const AVOption options[] = {
|
||||||
OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 51, VE },
|
OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 51, VE },
|
||||||
{ "aud", "Use access unit delimiters", OFFSET(aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
{ "aud", "Use access unit delimiters", OFFSET(aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||||
{ "bluray-compat", "Bluray compatibility workarounds", OFFSET(bluray_compat),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
{ "bluray-compat", "Bluray compatibility workarounds", OFFSET(bluray_compat),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||||
|
{ "init_qpP", "Initial QP value for P frame", OFFSET(init_qp_p), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE },
|
||||||
|
{ "init_qpB", "Initial QP value for B frame", OFFSET(init_qp_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE },
|
||||||
|
{ "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,9 @@ static const AVOption options[] = {
|
||||||
OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 51, VE },
|
OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 51, VE },
|
||||||
{ "aud", "Use access unit delimiters", OFFSET(aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
{ "aud", "Use access unit delimiters", OFFSET(aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||||
{ "bluray-compat", "Bluray compatibility workarounds", OFFSET(bluray_compat),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
{ "bluray-compat", "Bluray compatibility workarounds", OFFSET(bluray_compat),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||||
|
{ "init_qpP", "Initial QP value for P frame", OFFSET(init_qp_p), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE },
|
||||||
|
{ "init_qpB", "Initial QP value for B frame", OFFSET(init_qp_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE },
|
||||||
|
{ "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_MAJOR 57
|
#define LIBAVCODEC_VERSION_MAJOR 57
|
||||||
#define LIBAVCODEC_VERSION_MINOR 81
|
#define LIBAVCODEC_VERSION_MINOR 81
|
||||||
#define LIBAVCODEC_VERSION_MICRO 100
|
#define LIBAVCODEC_VERSION_MICRO 101
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||||
LIBAVCODEC_VERSION_MINOR, \
|
LIBAVCODEC_VERSION_MINOR, \
|
||||||
|
|
Loading…
Reference in New Issue