Unified · Split
| @@ -743,6 +743,15 @@ static av_cold void set_constqp(AVCodecContext *avctx) · 742 unmodified lines | ||
| 743 | 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 | 755 | avctx->qmin = -1; |
| 747 | 756 | avctx->qmax = -1; |
| 748 | 757 | } |
| @@ -70,6 +70,11 @@ typedef void ID3D11Device; · 69 unmodified lines | ||
| 70 | 70 | #define NVENC_HAVE_H264_LVL6 |
| 71 | 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 | 78 | typedef struct NvencSurface |
| 74 | 79 | { |
| 75 | 80 | NV_ENC_INPUT_PTR input_surface; |
| @@ -213,6 +218,8 @@ typedef struct NvencContext · 137 unmodified lines | ||
| 213 | 218 | int init_qp_b; |
| 214 | 219 | int init_qp_i; |
| 215 | 220 | int cqp; |
| 221 | + int qp_cb_offset; | |
| 222 | + int qp_cr_offset; | |
| 216 | 223 | int weighted_pred; |
| 217 | 224 | int coder; |
| 218 | 225 | int b_ref_mode; |
| @@ -147,6 +147,10 @@ static const AVOption options[] = { · 146 unmodified lines | ||
| 147 | 147 | { "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, |
| 148 | 148 | { "qp", "Constant quantization parameter rate control method", |
| 149 | 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 | 154 | { "weighted_pred","Set 1 to enable weighted prediction", |
| 151 | 155 | OFFSET(weighted_pred),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, |
| 152 | 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 | 134 | { "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, |
| 135 | 135 | { "qp", "Constant quantization parameter rate control method", |
| 136 | 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 | 141 | { "weighted_pred","Set 1 to enable weighted prediction", |
| 138 | 142 | OFFSET(weighted_pred),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, |
| 139 | 143 | #ifdef NVENC_HAVE_HEVC_BFRAME_REF_MODE |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #define LIBAVCODEC_VERSION_MAJOR 59 |
| 31 | 31 | #define LIBAVCODEC_VERSION_MINOR 4 |
| 32 | −#define LIBAVCODEC_VERSION_MICRO 100 | |
| 32 | +#define LIBAVCODEC_VERSION_MICRO 101 | |
| 33 | 33 | |
| 34 | 34 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 35 | 35 | LIBAVCODEC_VERSION_MINOR, \ |