if (!(ctx->va_rc_mode & VA_RC_CQP)) {
vseq->bits_per_second = ctx->va_bit_rate;
- vseq->intra_period = avctx->gop_size;
+ vseq->intra_period = ctx->gop_size;
}
return 0;
static av_cold int vaapi_encode_vp8_configure(AVCodecContext *avctx)
{
+ VAAPIEncodeContext *ctx = avctx->priv_data;
VAAPIEncodeVP8Context *priv = avctx->priv_data;
- priv->q_index_p = av_clip(avctx->global_quality, 0, VP8_MAX_QUANT);
+ priv->q_index_p = av_clip(ctx->rc_quality, 0, VP8_MAX_QUANT);
if (avctx->i_quant_factor > 0.0)
- priv->q_index_i = av_clip((avctx->global_quality *
- avctx->i_quant_factor +
- avctx->i_quant_offset) + 0.5,
- 0, VP8_MAX_QUANT);
+ priv->q_index_i =
+ av_clip((avctx->i_quant_factor * priv->q_index_p +
+ avctx->i_quant_offset) + 0.5,
+ 0, VP8_MAX_QUANT);
else
priv->q_index_i = priv->q_index_p;
.configure = &vaapi_encode_vp8_configure,
+ .default_quality = 40,
+
.sequence_params_size = sizeof(VAEncSequenceParameterBufferVP8),
.init_sequence_params = &vaapi_encode_vp8_init_sequence_params,
{
VAAPIEncodeContext *ctx = avctx->priv_data;
- if (avctx->max_b_frames > 0) {
- av_log(avctx, AV_LOG_ERROR, "B-frames are not supported.\n");
- return AVERROR_PATCHWELCOME;
- }
-
ctx->codec = &vaapi_encode_type_vp8;
- // Packed headers are not currently supported.
- ctx->va_packed_headers = 0;
+ // No packed headers are currently desired. VP8 has no metadata
+ // which would be useful to write, and no existing driver supports
+ // adding them anyway.
+ ctx->desired_packed_headers = 0;
ctx->surface_width = FFALIGN(avctx->width, 16);
ctx->surface_height = FFALIGN(avctx->height, 16);
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
static const AVOption vaapi_encode_vp8_options[] = {
VAAPI_ENCODE_COMMON_OPTIONS,
+ VAAPI_ENCODE_RC_OPTIONS,
+
{ "loop_filter_level", "Loop filter level",
OFFSET(loop_filter_level), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 63, FLAGS },
{ "loop_filter_sharpness", "Loop filter sharpness",
{ "b", "0" },
{ "bf", "0" },
{ "g", "120" },
- { "global_quality", "40" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ NULL },
.id = AV_CODEC_ID_VP8,
.priv_data_size = sizeof(VAAPIEncodeVP8Context),
.init = &vaapi_encode_vp8_init,
- .encode2 = &ff_vaapi_encode2,
+ .send_frame = &ff_vaapi_encode_send_frame,
+ .receive_packet = &ff_vaapi_encode_receive_packet,
.close = &ff_vaapi_encode_close,
.priv_class = &vaapi_encode_vp8_class,
.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE,