[Libva] [PATCH 1/3] Merge and modify encoding bit-rate control per temporal layer.

Sean V Kelley seanvk at posteo.de
Wed Sep 7 18:57:03 UTC 2016


On Tue, 2016-09-06 at 21:25 +0800, Xiang, Haihao wrote:
> Cherry-pick'ed from:
> e6f92ae: Added geneirc support for encoding bit-rate control per
> temporal layer
> 753ec17: va.h: add data structure for the structure of temporal layer
> encoding

lgtm.  pending client testing with driver patch series too.

Sean

> 
> Signed-off-by: Jonathan Bian <jonathan.bian at intel.com>
> Signed-off-by: Austin Yuan <shengquan.yuan at intel.com>
> Signed-off-by: Zhangfei Zhang <zhangfei.zhang at intel.com>
> Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
> ---
>  va/va.h | 84
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 83 insertions(+), 1 deletion(-)
> 
> diff --git a/va/va.h b/va/va.h
> index ef8595a..ed5bb73 100644
> --- a/va/va.h
> +++ b/va/va.h
> @@ -471,6 +471,15 @@ typedef enum
>       * VAEncMiscParameterTypeROI.
>       */
>      VAConfigAttribEncROI              = 25,
> +    /**
> +     * \brief Encoding extended rate control attribute. Read-only.
> +     *
> +     * This attribute conveys whether the driver supports any
> extended rate control features
> +     * The attribute value is partitioned into fields as defined in
> the
> +     * VAConfigAttribValEncRateControlExt union.
> +     */
> +    VAConfigAttribEncRateControlExt   = 26,
> +
>      /**@}*/
>      VAConfigAttribTypeMax
>  } VAConfigAttribType;
> @@ -622,6 +631,44 @@ typedef union _VAConfigAttribValEncROI {
>       unsigned int value;
>  } VAConfigAttribValEncROI;
>  
> +/** \brief Attribute value for VAConfigAttribEncRateControlExt */
> +typedef union _VAConfigAttribValEncRateControlExt {
> +    struct {
> +        /**
> +         * \brief The maximum number of temporal layers minus 1
> +         *
> +         * \ref max_num_temporal_layers_minus1 plus 1 specifies the
> maximum number of temporal
> +         * layers that supported by the underlying driver. \ref
> max_num_temporal_layers_minus1
> +         * equal to 0 implies the underlying driver doesn't support
> encoding with temporal layer.
> +         */
> +        unsigned int max_num_temporal_layers_minus1      : 8;
> +
> +        /**
> +         * /brief support temporal layer bit-rate control flag
> +         *
> +         * \ref temporal_layer_bitrate_control_flag equal to 1
> specifies the underlying driver
> +         * can support bit-rate control per temporal layer when
> (#VAConfigAttribRateControl == #VA_RC_CBR ||
> +         * #VAConfigAttribRateControl == #VA_RC_VBR).
> +         *
> +         * The underlying driver must set \ref
> temporal_layer_bitrate_control_flag to 0 when
> +         * \c max_num_temporal_layers_minus1 is equal to 0
> +         *
> +         * To use bit-rate control per temporal layer, the
> application should send the right layer
> +         * structure via #VAEncMiscParameterTemporalLayerStructure
> at the beginning of a coded sequence
> +         * and #VAEncMiscParameterRateControl and
> #VAEncMiscParameterFrameRate structures
> +         * for each layer, using the \c temporal_id field as the
> layer identifier, otherwise
> +         * the driver will return VA_STATUS_ERROR_INVALID_PARAMETER.
> +
> +         * The driver will ignore
> #VAEncMiscParameterTemporalLayerStructure and the \c temporal_id
> field
> +         * in #VAEncMiscParameterRateControl and
> #VAEncMiscParameterFrameRate if
> +         * \ref temporal_layer_bitrate_control_flag is equal to 0 or
> #VAConfigAttribRateControl == #VA_RC_CQP
> +         */
> +        unsigned int temporal_layer_bitrate_control_flag : 1;
> +        unsigned int reserved                            : 23;
> +    } bits;
> +    unsigned int value;
> +} VAConfigAttribValEncRateControlExt;
> +
>  /**
>   * if an attribute is not applicable for a given
>   * profile/entrypoint pair, then set the value to the following 
> @@ -1097,7 +1144,9 @@ typedef enum
>        * rate control, when the user has externally skipped frames.
> */
>      VAEncMiscParameterTypeSkipFrame     = 9,
>      /** \brief Buffer type used for region-of-interest (ROI)
> parameters. */
> -    VAEncMiscParameterTypeROI           = 10
> +    VAEncMiscParameterTypeROI           = 10,
> +    /** \brief Buffer type used for temporal layer structure */
> +    VAEncMiscParameterTypeTemporalLayerStructure   = 12,
>  } VAEncMiscParameterType;
>  
>  /** \brief Packed header type. */
> @@ -1154,6 +1203,22 @@ typedef struct _VAEncMiscParameterBuffer
>      unsigned int data[0];
>  } VAEncMiscParameterBuffer;
>  
> +/** \brief Temporal layer Structure*/
> +typedef struct _VAEncMiscParameterTemporalLayerStructure
> +{
> +    /** \brief The number of temporal layers */
> +    unsigned int number_of_layers;
> +    /** \brief The length of the array defining frame layer
> membership. Should be 1-32 */
> +    unsigned int periodicity;
> +    /**
> +     * \brief The array indicating the layer id for each frame
> +     *
> +     * The layer id for the first frame in a coded sequence is
> always 0, so layer_id[] specifies the layer
> +     * ids for frames starting from the 2nd frame.
> +     */
> +    unsigned int layer_id[32];
> +} VAEncMiscParameterTemporalLayerStructure;
> +
>  
>  /** \brief Rate control parameters */
>  typedef struct _VAEncMiscParameterRateControl
> @@ -1181,6 +1246,11 @@ typedef struct _VAEncMiscParameterRateControl
>              unsigned int disable_frame_skip : 1; /* Disable frame
> skip in rate control mode */
>              unsigned int disable_bit_stuffing : 1; /* Disable bit
> stuffing in rate control mode */
>              unsigned int mb_rate_control : 4; /* Control VA_RC_MB 0:
> default, 1: enable, 2: disable, other: reserved*/
> +            /*
> +             * The temporal layer that the rate control parameters
> are specified for.
> +             */
> +            unsigned int temporal_id : 8;
> +            unsigned int reserved : 17;
>          } bits;
>          unsigned int value;
>      } rc_flags;
> @@ -1189,6 +1259,18 @@ typedef struct _VAEncMiscParameterRateControl
>  typedef struct _VAEncMiscParameterFrameRate
>  {
>      unsigned int framerate;
> +    union
> +    {
> +        struct
> +        {
> +            /*
> +             * The temporal id the framerate parameters are
> specified for.
> +             */
> +            unsigned int temporal_id : 8;
> +            unsigned int reserved : 24;
> +         } bits;
> +         unsigned int value;
> +     } framerate_flags;
>  } VAEncMiscParameterFrameRate;
>  
>  /**
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/libva/attachments/20160907/0e96df64/attachment.sig>


More information about the Libva mailing list