[Libva] [Libva-intel-driver][PATCH v2 2/3] Save other bitrate control parameters in the common encoder context

Zhao Yakui yakui.zhao at intel.com
Wed Nov 30 00:22:10 UTC 2016


On 11/29/2016 12:33 PM, Xiang, Haihao wrote:
> From: "peng.chen"<peng.c.chen at intel.com>
>
> These parameters can be used for all codecs

This looks fine to me.

Thanks

>
> v2: Save mb_rate_control/target_percentage per layer too
>
> Signed-off-by: peng.chen<peng.c.chen at intel.com>
> Signed-off-by: Xiang, Haihao<haihao.xiang at intel.com>
> ---
>   src/i965_encoder.c | 14 +++++++++++++-
>   src/i965_encoder.h |  2 ++
>   2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/src/i965_encoder.c b/src/i965_encoder.c
> index 4aa3ee1..bca8ebd 100644
> --- a/src/i965_encoder.c
> +++ b/src/i965_encoder.c
> @@ -393,11 +393,23 @@ intel_encoder_check_rate_control_parameter(VADriverContextP ctx,
>       if (temporal_id>= encoder_context->layer.num_layers)
>           return;
>
> -    // TODO: for VBR
> +    if (misc->rc_flags.bits.reset)
> +        encoder_context->brc.need_reset = 1;
> +
>       if (encoder_context->brc.bits_per_second[temporal_id] != misc->bits_per_second) {
>           encoder_context->brc.bits_per_second[temporal_id] = misc->bits_per_second;
>           encoder_context->brc.need_reset = 1;
>       }
> +
> +    if (encoder_context->brc.mb_rate_control[temporal_id] != misc->rc_flags.bits.mb_rate_control) {
> +        encoder_context->brc.mb_rate_control[temporal_id] = misc->rc_flags.bits.mb_rate_control;
> +        encoder_context->brc.need_reset = 1;
> +    }
> +
> +    if (encoder_context->brc.target_percentage[temporal_id] != misc->target_percentage) {
> +        encoder_context->brc.target_percentage[temporal_id] = misc->target_percentage;
> +        encoder_context->brc.need_reset = 1;
> +    }
>   }
>
>   static void
> diff --git a/src/i965_encoder.h b/src/i965_encoder.h
> index fe5a595..0b636d6 100644
> --- a/src/i965_encoder.h
> +++ b/src/i965_encoder.h
> @@ -81,6 +81,8 @@ struct intel_encoder_context
>           unsigned short num_bframes_in_gop;
>           unsigned int bits_per_second[MAX_TEMPORAL_LAYERS];
>           unsigned int framerate_per_100s[MAX_TEMPORAL_LAYERS];
> +        unsigned int mb_rate_control[MAX_TEMPORAL_LAYERS];
> +        unsigned int target_percentage[MAX_TEMPORAL_LAYERS];
>           unsigned int hrd_buffer_size;
>           unsigned int hrd_initial_buffer_fullness;
>           unsigned int need_reset;



More information about the Libva mailing list