#endif
#endif
+#if QSV_HAVE_GPB
+ if (avctx->codec_id == AV_CODEC_ID_HEVC)
+ av_log(avctx, AV_LOG_VERBOSE,"GPB: %s\n", print_threestate(co3->GPB));
+#endif
+
if (avctx->codec_id == AV_CODEC_ID_H264) {
av_log(avctx, AV_LOG_VERBOSE, "Entropy coding: %s; MaxDecFrameBuffering: %"PRIu16"\n",
co->CAVLC == MFX_CODINGOPTION_ON ? "CAVLC" : "CABAC", co->MaxDecFrameBuffering);
//libmfx BRC parameters are 16 bits thus maybe overflow, then BRCParamMultiplier is needed
buffer_size_in_kilobytes = avctx->rc_buffer_size / 8000;
- initial_delay_in_kilobytes = avctx->rc_initial_buffer_occupancy / 1000;
+ initial_delay_in_kilobytes = avctx->rc_initial_buffer_occupancy / 8000;
target_bitrate_kbps = avctx->bit_rate / 1000;
max_bitrate_kbps = avctx->rc_max_rate / 1000;
brc_param_multiplier = (FFMAX(FFMAX3(target_bitrate_kbps, max_bitrate_kbps, buffer_size_in_kilobytes),
#endif
}
- // the HEVC encoder plugin currently fails if coding options
- // are provided
- if (avctx->codec_id != AV_CODEC_ID_HEVC) {
+ // The HEVC encoder plugin currently fails with some old libmfx version if coding options
+ // are provided. Can't find the extract libmfx version which fixed it, just enable it from
+ // V1.28 in order to keep compatibility security.
+ if ((avctx->codec_id != AV_CODEC_ID_HEVC) || QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 28)) {
q->extco.Header.BufferId = MFX_EXTBUFF_CODING_OPTION;
q->extco.Header.BufferSz = sizeof(q->extco);
#if QSV_HAVE_CO3
q->extco3.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3;
q->extco3.Header.BufferSz = sizeof(q->extco3);
+#if QSV_HAVE_GPB
+ if (avctx->codec_id == AV_CODEC_ID_HEVC)
+ q->extco3.GPB = q->gpb ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
+#endif
q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco3;
#endif
}
if (qsv_frame) {
surf = &qsv_frame->surface;
enc_ctrl = &qsv_frame->enc_ctrl;
- memset(enc_ctrl, 0, sizeof(mfxEncodeCtrl));
if (frame->pict_type == AV_PICTURE_TYPE_I) {
enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;