X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fvaapi_encode_vp8.c;h=ddbe4c90756335b1e493a693c4eb263bf0b72296;hb=18a567c369d74af5ef651b07c4c5615f5598616b;hp=4512609a19836953de5b3306ac512305d083b276;hpb=bf726c26fde26601a90daacf1b10a9860d21321c;p=ffmpeg diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c index 4512609a198..ddbe4c90756 100644 --- a/libavcodec/vaapi_encode_vp8.c +++ b/libavcodec/vaapi_encode_vp8.c @@ -161,14 +161,15 @@ static int vaapi_encode_vp8_write_quant_table(AVCodecContext *avctx, 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; @@ -185,6 +186,8 @@ static const VAAPIEncodeType vaapi_encode_type_vp8 = { .configure = &vaapi_encode_vp8_configure, + .default_quality = 40, + .sequence_params_size = sizeof(VAEncSequenceParameterBufferVP8), .init_sequence_params = &vaapi_encode_vp8_init_sequence_params, @@ -200,8 +203,10 @@ static av_cold int vaapi_encode_vp8_init(AVCodecContext *avctx) 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); @@ -213,6 +218,8 @@ static av_cold int vaapi_encode_vp8_init(AVCodecContext *avctx) #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", @@ -224,7 +231,6 @@ static const AVCodecDefault vaapi_encode_vp8_defaults[] = { { "b", "0" }, { "bf", "0" }, { "g", "120" }, - { "global_quality", "40" }, { "qmin", "-1" }, { "qmax", "-1" }, { NULL }, @@ -244,7 +250,8 @@ AVCodec ff_vp8_vaapi_encoder = { .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,