Unified · Split
| @@ -743,6 +743,15 @@ static av_cold void set_constqp(AVCodecContext *avctx) · 742 unmodified lines | |||
| 743 | rc->constQP.qpIntra = av_clip(ctx->cqp * fabs(avctx->i_quant_factor) + avctx->i_quant_offset + 0.5, 0, 51); | 743 | rc->constQP.qpIntra = av_clip(ctx->cqp * fabs(avctx->i_quant_factor) + avctx->i_quant_offset + 0.5, 0, 51); |
| 744 | } | 744 | } |
| 745 | 745 | ||
| 746 | #ifdef NVENC_HAVE_QP_CHROMA_OFFSETS | ||
| 747 | rc->cbQPIndexOffset = ctx->qp_cb_offset; | ||
| 748 | rc->crQPIndexOffset = ctx->qp_cr_offset; | ||
| 749 | #else | ||
| 750 | if (ctx->qp_cb_offset || ctx->qp_cr_offset) { | ||
| 751 | av_log(avctx, AV_LOG_WARNING, "Failed setting QP CB/CR offsets, SDK 11.1 or greater required at compile time.\n"); | ||
| 752 | } | ||
| 753 | #endif | ||
| 754 | |||
| 746 | avctx->qmin = -1; | 755 | avctx->qmin = -1; |
| 747 | avctx->qmax = -1; | 756 | avctx->qmax = -1; |
| 748 | } | 757 | } |
| @@ -70,6 +70,11 @@ typedef void ID3D11Device; · 69 unmodified lines | |||
| 70 | #define NVENC_HAVE_H264_LVL6 | 70 | #define NVENC_HAVE_H264_LVL6 |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | // SDK 11.1 compile time feature checks | ||
| 74 | #if NVENCAPI_CHECK_VERSION(11, 1) | ||
| 75 | #define NVENC_HAVE_QP_CHROMA_OFFSETS | ||
| 76 | #endif | ||
| 77 | |||
| 73 | typedef struct NvencSurface | 78 | typedef struct NvencSurface |
| 74 | { | 79 | { |
| 75 | NV_ENC_INPUT_PTR input_surface; | 80 | NV_ENC_INPUT_PTR input_surface; |
| @@ -213,6 +218,8 @@ typedef struct NvencContext · 137 unmodified lines | |||
| 213 | int init_qp_b; | 218 | int init_qp_b; |
| 214 | int init_qp_i; | 219 | int init_qp_i; |
| 215 | int cqp; | 220 | int cqp; |
| 221 | int qp_cb_offset; | ||
| 222 | int qp_cr_offset; | ||
| 216 | int weighted_pred; | 223 | int weighted_pred; |
| 217 | int coder; | 224 | int coder; |
| 218 | int b_ref_mode; | 225 | int b_ref_mode; |
| @@ -147,6 +147,10 @@ static const AVOption options[] = { · 146 unmodified lines | |||
| 147 | { "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, | 147 | { "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, |
| 148 | { "qp", "Constant quantization parameter rate control method", | 148 | { "qp", "Constant quantization parameter rate control method", |
| 149 | OFFSET(cqp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, | 149 | OFFSET(cqp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, |
| 150 | { "qp_cb_offset", "Quantization parameter offset for cb channel", | ||
| 151 | OFFSET(qp_cb_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, -12, 12, VE }, | ||
| 152 | { "qp_cr_offset", "Quantization parameter offset for cr channel", | ||
| 153 | OFFSET(qp_cr_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, -12, 12, VE }, | ||
| 150 | { "weighted_pred","Set 1 to enable weighted prediction", | 154 | { "weighted_pred","Set 1 to enable weighted prediction", |
| 151 | OFFSET(weighted_pred),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, | 155 | OFFSET(weighted_pred),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, |
| 152 | { "coder", "Coder type", OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = -1 },-1, 2, VE, "coder" }, | 156 | { "coder", "Coder type", OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = -1 },-1, 2, VE, "coder" }, |
| @@ -134,6 +134,10 @@ static const AVOption options[] = { · 133 unmodified lines | |||
| 134 | { "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, | 134 | { "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, |
| 135 | { "qp", "Constant quantization parameter rate control method", | 135 | { "qp", "Constant quantization parameter rate control method", |
| 136 | OFFSET(cqp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, | 136 | OFFSET(cqp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, |
| 137 | { "qp_cb_offset", "Quantization parameter offset for cb channel", | ||
| 138 | OFFSET(qp_cb_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, -12, 12, VE }, | ||
| 139 | { "qp_cr_offset", "Quantization parameter offset for cr channel", | ||
| 140 | OFFSET(qp_cr_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, -12, 12, VE }, | ||
| 137 | { "weighted_pred","Set 1 to enable weighted prediction", | 141 | { "weighted_pred","Set 1 to enable weighted prediction", |
| 138 | OFFSET(weighted_pred),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, | 142 | OFFSET(weighted_pred),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, |
| 139 | #ifdef NVENC_HAVE_HEVC_BFRAME_REF_MODE | 143 | #ifdef NVENC_HAVE_HEVC_BFRAME_REF_MODE |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | #define LIBAVCODEC_VERSION_MAJOR 59 | 30 | #define LIBAVCODEC_VERSION_MAJOR 59 |
| 31 | #define LIBAVCODEC_VERSION_MINOR 4 | 31 | #define LIBAVCODEC_VERSION_MINOR 4 |
| 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, \ |