From e5009b7c2638e1fe10443ae2efafaa3a4e7f19c7 Mon Sep 17 00:00:00 2001 From: Boyuan Zhang Date: Tue, 6 Sep 2016 16:39:45 -0400 Subject: st/va: enable vbr rate control for vaapi encode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch enables variable bit-rate for vaapi encoding. According to va.h, target bit-rate equals to maximum bit-rate multiplies by target_percentage. Signed-off-by: Boyuan Zhang Reviewed-by: Christian König --- src/gallium/state_trackers/va/picture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/state_trackers/va/picture.c') diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index a283e8307bf..7f3d96d67ab 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -322,7 +322,7 @@ handleVAEncMiscParameterTypeRateControl(vlVaContext *context, VAEncMiscParameter PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT) context->desc.h264enc.rate_ctrl.target_bitrate = rc->bits_per_second; else - context->desc.h264enc.rate_ctrl.target_bitrate = rc->bits_per_second * rc->target_percentage; + context->desc.h264enc.rate_ctrl.target_bitrate = rc->bits_per_second * rc->target_percentage / 100; context->desc.h264enc.rate_ctrl.peak_bitrate = rc->bits_per_second; if (context->desc.h264enc.rate_ctrl.target_bitrate < 2000000) context->desc.h264enc.rate_ctrl.vbv_buffer_size = MIN2((context->desc.h264enc.rate_ctrl.target_bitrate * 2.75), 2000000); -- cgit v1.2.3