mirror of https://git.ffmpeg.org/ffmpeg.git
vaapi_encode: Use gop_size consistently in RC parameters
The non-H.26[45] codecs already use this form. Since we don't
currently generate I frames for codecs which support them separately
to IDR, the p_per_i variable is set to infinity by default so that it
doesn't interfere with any other calculation. (All the code for I
frames still exists, and it works for H.264 if set manually.)
(cherry picked from commit 6af014f402
)
This commit is contained in:
parent
28aedeed19
commit
b658b5399e
|
@ -1435,8 +1435,7 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
|
||||||
ctx->output_order = - ctx->output_delay - 1;
|
ctx->output_order = - ctx->output_delay - 1;
|
||||||
|
|
||||||
// Currently we never generate I frames, only IDR.
|
// Currently we never generate I frames, only IDR.
|
||||||
ctx->p_per_i = ((avctx->gop_size - 1 + avctx->max_b_frames) /
|
ctx->p_per_i = INT_MAX;
|
||||||
(avctx->max_b_frames + 1));
|
|
||||||
ctx->b_per_p = avctx->max_b_frames;
|
ctx->b_per_p = avctx->max_b_frames;
|
||||||
|
|
||||||
if (ctx->codec->sequence_params_size > 0) {
|
if (ctx->codec->sequence_params_size > 0) {
|
||||||
|
|
|
@ -905,8 +905,8 @@ static int vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx)
|
||||||
mseq->nal_hrd_parameters_present_flag = 0;
|
mseq->nal_hrd_parameters_present_flag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vseq->intra_period = ctx->p_per_i * (ctx->b_per_p + 1);
|
vseq->intra_period = avctx->gop_size;
|
||||||
vseq->intra_idr_period = vseq->intra_period;
|
vseq->intra_idr_period = avctx->gop_size;
|
||||||
vseq->ip_period = ctx->b_per_p + 1;
|
vseq->ip_period = ctx->b_per_p + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -832,8 +832,8 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)
|
||||||
vseq->vui_time_scale = avctx->time_base.den;
|
vseq->vui_time_scale = avctx->time_base.den;
|
||||||
}
|
}
|
||||||
|
|
||||||
vseq->intra_period = ctx->p_per_i * (ctx->b_per_p + 1);
|
vseq->intra_period = avctx->gop_size;
|
||||||
vseq->intra_idr_period = vseq->intra_period;
|
vseq->intra_idr_period = avctx->gop_size;
|
||||||
vseq->ip_period = ctx->b_per_p + 1;
|
vseq->ip_period = ctx->b_per_p + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue