Unified · Split
| @@ -547,16 +547,33 @@ static av_cold void set_vbr(AVCodecContext *avctx) · 546 unmodified lines | |||
| 547 | } | 547 | } |
| 548 | 548 | ||
| 549 | rc->enableInitialRCQP = 1; | 549 | rc->enableInitialRCQP = 1; |
| 550 | rc->initialRCQP.qpInterP = qp_inter_p; | ||
| 551 | 550 | ||
| 552 | if (avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) { | 551 | if (ctx->init_qp_p < 0) { |
| 553 | rc->initialRCQP.qpIntra = av_clip( | 552 | rc->initialRCQP.qpInterP = qp_inter_p; |
| 554 | qp_inter_p * fabs(avctx->i_quant_factor) + avctx->i_quant_offset + 0.5, 0, 51); | ||
| 555 | rc->initialRCQP.qpInterB = av_clip( | ||
| 556 | qp_inter_p * fabs(avctx->b_quant_factor) + avctx->b_quant_offset + 0.5, 0, 51); | ||
| 557 | } else { | 553 | } else { |
| 558 | rc->initialRCQP.qpIntra = qp_inter_p; | 554 | rc->initialRCQP.qpInterP = ctx->init_qp_p; |
| 559 | rc->initialRCQP.qpInterB = qp_inter_p; | 555 | } |
| 556 | |||
| 557 | if (ctx->init_qp_i < 0) { | ||
| 558 | if (avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) { | ||
| 559 | rc->initialRCQP.qpIntra = av_clip( | ||
| 560 | rc->initialRCQP.qpInterP * fabs(avctx->i_quant_factor) + avctx->i_quant_offset + 0.5, 0, 51); | ||
| 561 | } else { | ||
| 562 | rc->initialRCQP.qpIntra = rc->initialRCQP.qpInterP; | ||
| 563 | } | ||
| 564 | } else { | ||
| 565 | rc->initialRCQP.qpIntra = ctx->init_qp_i; | ||
| 566 | } | ||
| 567 | |||
| 568 | if (ctx->init_qp_b < 0) { | ||
| 569 | if (avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) { | ||
| 570 | rc->initialRCQP.qpInterB = av_clip( | ||
| 571 | rc->initialRCQP.qpInterP * fabs(avctx->b_quant_factor) + avctx->b_quant_offset + 0.5, 0, 51); | ||
| 572 | } else { | ||
| 573 | rc->initialRCQP.qpInterB = rc->initialRCQP.qpInterP; | ||
| 574 | } | ||
| 575 | } else { | ||
| 576 | rc->initialRCQP.qpInterB = ctx->init_qp_b; | ||
| 560 | } | 577 | } |
| 561 | } | 578 | } |
| 562 | 579 | ||
| @@ -155,6 +155,9 @@ typedef struct NvencContext · 154 unmodified lines | |||
| 155 | int quality; | 155 | int quality; |
| 156 | int aud; | 156 | int aud; |
| 157 | int bluray_compat; | 157 | int bluray_compat; |
| 158 | int init_qp_p; | ||
| 159 | int init_qp_b; | ||
| 160 | int init_qp_i; | ||
| 158 | } NvencContext; | 161 | } NvencContext; |
| 159 | 162 | ||
| 160 | int ff_nvenc_encode_init(AVCodecContext *avctx); | 163 | int ff_nvenc_encode_init(AVCodecContext *avctx); |
| @@ -109,6 +109,9 @@ static const AVOption options[] = { · 108 unmodified lines | |||
| 109 | OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 51, VE }, | 109 | OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 51, VE }, |
| 110 | { "aud", "Use access unit delimiters", OFFSET(aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, | 110 | { "aud", "Use access unit delimiters", OFFSET(aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| 111 | { "bluray-compat", "Bluray compatibility workarounds", OFFSET(bluray_compat),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, | 111 | { "bluray-compat", "Bluray compatibility workarounds", OFFSET(bluray_compat),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| 112 | { "init_qpP", "Initial QP value for P frame", OFFSET(init_qp_p), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, | ||
| 113 | { "init_qpB", "Initial QP value for B frame", OFFSET(init_qp_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, | ||
| 114 | { "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, | ||
| 112 | { NULL } | 115 | { NULL } |
| 113 | }; | 116 | }; |
| 114 | 117 | ||
| @@ -106,6 +106,9 @@ static const AVOption options[] = { · 105 unmodified lines | |||
| 106 | OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 51, VE }, | 106 | OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 51, VE }, |
| 107 | { "aud", "Use access unit delimiters", OFFSET(aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, | 107 | { "aud", "Use access unit delimiters", OFFSET(aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| 108 | { "bluray-compat", "Bluray compatibility workarounds", OFFSET(bluray_compat),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, | 108 | { "bluray-compat", "Bluray compatibility workarounds", OFFSET(bluray_compat),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| 109 | { "init_qpP", "Initial QP value for P frame", OFFSET(init_qp_p), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, | ||
| 110 | { "init_qpB", "Initial QP value for B frame", OFFSET(init_qp_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, | ||
| 111 | { "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, | ||
| 109 | { NULL } | 112 | { NULL } |
| 110 | }; | 113 | }; |
| 111 | 114 | ||
| @@ -29,7 +29,7 @@ · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | #define LIBAVCODEC_VERSION_MAJOR 57 | 30 | #define LIBAVCODEC_VERSION_MAJOR 57 |
| 31 | #define LIBAVCODEC_VERSION_MINOR 81 | 31 | #define LIBAVCODEC_VERSION_MINOR 81 |
| 32 | #define LIBAVCODEC_VERSION_MICRO 100 | 32 | #define LIBAVCODEC_VERSION_MICRO 101 |
| 33 | 33 | ||
| 34 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 34 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 35 | LIBAVCODEC_VERSION_MINOR, \ | 35 | LIBAVCODEC_VERSION_MINOR, \ |