OSDN Git Service

Bump wayland-client dependency to 1.11.0
[android-x86/hardware-intel-common-libva.git] / va / va_enc_h264.h
index cfaa4ed..2e7eb8d 100644 (file)
@@ -65,7 +65,64 @@ extern "C" {
 /**@}*/
 
 /**
- * \brief Sequence parameter for H.264 encoding in main & high profiles.
+ * \brief Packed header types specific to H.264 encoding.
+ *
+ * Types of packed headers generally used for H.264 encoding. Each
+ * associated packed header data buffer shall contain the start code
+ * prefix 0x000001 followed by the complete NAL unit, thus also
+ * including the \c nal_unit_type.
+ *
+ * Note: the start code prefix can contain an arbitrary number of leading
+ * zeros. The driver will skip them for emulation prevention bytes insertion,
+ * if necessary.
+ */
+typedef enum {
+    /**
+     * \brief Packed Sequence Parameter Set (SPS).
+     *
+     * The corresponding packed header data buffer shall contain the
+     * complete seq_parameter_set_rbsp() syntax element.
+     *
+     * Note: packed \c nal_unit_type shall be equal to 7.
+     */
+    VAEncPackedHeaderH264_SPS   = VAEncPackedHeaderSequence,
+    /**
+     * \brief Packed Picture Parameter Set (PPS).
+     *
+     * The corresponding packed header data buffer shall contain the
+     * complete pic_parameter_set_rbsp() syntax element.
+     *
+     * Note: packed \c nal_unit_type shall be equal to 8.
+     */
+    VAEncPackedHeaderH264_PPS   = VAEncPackedHeaderPicture,
+    /**
+     * \brief Packed slice header.
+     *
+     * The corresponding packed header data buffer shall contain the
+     * \c slice_header() syntax element only, along with any start
+     * code prefix and NAL unit type preceeding it. i.e. this means
+     * that the buffer does not contain any of the \c slice_data() or
+     * the \c rbsp_slice_trailing_bits().
+     *
+     * Note: packed \c nal_unit_type shall be equal to 1 (non-IDR
+     * picture), or 5 (IDR picture).
+     */
+    VAEncPackedHeaderH264_Slice = VAEncPackedHeaderSlice,
+    /**
+     * \brief Packed Supplemental Enhancement Information (SEI).
+     *
+     * The corresponding packed header data buffer shall contain the
+     * complete sei_rbsp() syntax element, thus including several
+     * sei_message() elements if necessary.
+     *
+     * Note: packed \c nal_unit_type shall be equal to 6.
+     */
+    VAEncPackedHeaderH264_SEI   = (VAEncPackedHeaderMiscMask | 1),
+} VAEncPackedHeaderTypeH264;
+
+/**
+ * \brief Sequence parameter for H.264 encoding in baseline, main & high 
+ * profiles.
  *
  * This structure holds information for \c seq_parameter_set_data() as
  * defined by the H.264 specification.
@@ -79,19 +136,19 @@ extern "C" {
  * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
  *   header data.
  *
- * If \ref seq_scaling_matrix_present_flag is set to \c 1, then a
+ * If \c seq_scaling_matrix_present_flag is set to \c 1, then a
  * #VAIQMatrixBufferH264 buffer shall also be provided within the same
  * \c vaRenderPicture() call as this sequence parameter buffer.
  */
 typedef struct _VAEncSequenceParameterBufferH264 {
     /** \brief Same as the H.264 bitstream syntax element. */
     unsigned char   seq_parameter_set_id;
-    /** \brief XXX: implied by VA config. */
-    unsigned char   profile_idc;
     /** \brief Same as the H.264 bitstream syntax element. */
     unsigned char   level_idc;
     /** \brief Period between I frames. */
     unsigned int    intra_period;
+    /** \brief Period between IDR frames. */
+    unsigned int    intra_idr_period;
     /** \brief Period between I/P frames. */
     unsigned int    ip_period;
     /**
@@ -175,6 +232,8 @@ typedef struct _VAEncSequenceParameterBufferH264 {
     union {
         struct {
             /** \brief Same as the H.264 bitstream syntax element. */
+            unsigned int aspect_ratio_info_present_flag         : 1;
+            /** \brief Same as the H.264 bitstream syntax element. */
             unsigned int timing_info_present_flag               : 1;
             /** \brief Same as the H.264 bitstream syntax element. */
             unsigned int bitstream_restriction_flag             : 1;
@@ -186,6 +245,12 @@ typedef struct _VAEncSequenceParameterBufferH264 {
         unsigned int value;
     } vui_fields;
     /** \brief Same as the H.264 bitstream syntax element. */
+    unsigned char   aspect_ratio_idc;
+    /** \brief Same as the H.264 bitstream syntax element. */
+    unsigned int    sar_width;
+    /** \brief Same as the H.264 bitstream syntax element. */
+    unsigned int    sar_height;
+    /** \brief Same as the H.264 bitstream syntax element. */
     unsigned int    num_units_in_tick;
     /** \brief Same as the H.264 bitstream syntax element. */
     unsigned int    time_scale;
@@ -193,7 +258,8 @@ typedef struct _VAEncSequenceParameterBufferH264 {
 } VAEncSequenceParameterBufferH264;
 
 /**
- * \brief Picture parameter for H.264 encoding in main & high profiles.
+ * \brief Picture parameter for H.264 encoding in baseline, main & high 
+ * profiles.
  *
  * This structure holds information for \c pic_parameter_set_rbsp() as
  * defined by the H.264 specification.
@@ -207,15 +273,26 @@ typedef struct _VAEncSequenceParameterBufferH264 {
  * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
  *   header data.
  *
- * If \ref pic_scaling_matrix_present_flag is set to \c 1, then a
+ * If \c pic_scaling_matrix_present_flag is set to \c 1, then a
  * #VAIQMatrixBufferH264 buffer shall also be provided within the same
  * \c vaRenderPicture() call as this picture parameter buffer.
  */
 typedef struct _VAEncPictureParameterBufferH264 {
-    /** \brief Information about the picture to be encoded. */
+    /**
+     * \brief Information about the picture to be encoded.
+     *
+     * See #VAPictureH264 for further description of each field.
+     * Note that CurrPic.picture_id represents the reconstructed
+     * (decoded) picture. User provides a scratch VA surface ID here.
+     */
     VAPictureH264   CurrPic;
-    /** \brief Decoded Picture Buffer (DPB).
-     *  XXX: is this really used?
+    /**
+     * \brief Decoded Picture Buffer (DPB).
+     *
+     * This array represents the list of reconstructed (decoded)
+     * frames used as reference. It is important to keep track of
+     * reconstructed frames so that they can be used later on as
+     * reference for P or B-frames encoding.
      */
     VAPictureH264   ReferenceFrames[16];
     /**
@@ -244,7 +321,7 @@ typedef struct _VAEncPictureParameterBufferH264 {
     /** \brief The picture identifier.
      *   Range: 0 to \f$2^{log2\_max\_frame\_num\_minus4 + 4} - 1\f$, inclusive.
      */
-    unsigned short  frame_num;                       /* (0..65535) */
+    unsigned short  frame_num;
 
     /** \brief \c pic_init_qp_minus26 + 26. */
     unsigned char   pic_init_qp;
@@ -292,7 +369,7 @@ typedef struct _VAEncPictureParameterBufferH264 {
 } VAEncPictureParameterBufferH264;
 
 /**
- * \brief Slice parameter for H.264 encoding in main & high profiles.
+ * \brief Slice parameter for H.264 encoding in baseline, main & high profiles.
  *
  * This structure holds information for \c
  * slice_layer_without_partitioning_rbsp() as defined by the H.264
@@ -307,15 +384,16 @@ typedef struct _VAEncPictureParameterBufferH264 {
  * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
  *   header data.
  *
- * If per-macroblock encoder configuration is needed, \ref macroblock_info
+ * If per-macroblock encoder configuration is needed, \c macroblock_info
  * references a buffer of type #VAEncMacroblockParameterBufferH264. This
- * buffer is not passed to vaRenderPicture(). i.e. it is not destroyed
- * by subsequent calls to vaRenderPicture() and then can be re-used
+ * buffer is not passed to vaRenderPicture() and it can be re-used
  * without re-allocating the whole buffer.
  */
 typedef struct _VAEncSliceParameterBufferH264 {
     /** \brief Starting MB address for this slice. */
     unsigned int    macroblock_address;
+    /** \brief Number of macroblocks in this slice. */
+    unsigned int    num_macroblocks;
     /**
      * \brief Per-MB encoder configuration buffer, or \c VA_INVALID_ID.
      *
@@ -329,8 +407,6 @@ typedef struct _VAEncSliceParameterBufferH264 {
      * elements.
      */
     VABufferID      macroblock_info;
-    /** \brief Number of macroblocks in this slice. */
-    unsigned int    num_macroblocks;
     /** \brief Slice type.
      *  Range: 0..2, 5..7, i.e. no switching slices.
      */
@@ -374,34 +450,12 @@ typedef struct _VAEncSliceParameterBufferH264 {
      *  Range: 0 to 31, inclusive.
      */
     unsigned char   num_ref_idx_l1_active_minus1;
-    /** \brief XXX: is this really used? */
+    /** \brief Reference picture list 0 (for P slices). */
     VAPictureH264   RefPicList0[32];
-    /** \brief XXX: is this really used? */
+    /** \brief Reference picture list 1 (for B slices). */
     VAPictureH264   RefPicList1[32];
     /**@}*/
 
-    /** @name ref_pic_list_modification() */
-    /**@{*/
-    /** \brief Same as the H.264 bitstream syntax element. */
-    unsigned char   ref_pic_list_modification_flag_l0;
-    /** \brief Same as the H.264 bitstream syntax element. */
-    unsigned char   ref_pic_list_modification_flag_l1;
-    /** \brief Same as the H.264 bitstream syntax element. */
-    unsigned char   modification_of_pic_nums_idc_l0[32];
-    /** \brief Same as the H.264 bitstream syntax element. */
-    unsigned char   modification_of_pic_nums_idc_l1[32];
-    /** \brief List 0 values for each \c modification_of_pic_nums_idc_l0. */
-    /**
-     * - If \c modification_of_pic_nums_idc == 0 or 1:
-     *   - \c modification_of_pic_nums_value is \c abs_diff_pic_num_minus1
-     * - If \c modification_of_pic_nums_idc == 2:
-     *   - \c modification_of_pic_nums_value is \c long_term_pic_num
-     */
-    unsigned int    modification_of_pic_nums_value_l0[32];
-    /** \brief Same as \c modification_of_pic_nums_value_l0 but for list 1. */
-    unsigned int    modification_of_pic_nums_value_l1[32];
-    /**@}*/
-
     /** @name pred_weight_table() */
     /**@{*/
     /** \brief Same as the H.264 bitstream syntax element. */
@@ -434,38 +488,6 @@ typedef struct _VAEncSliceParameterBufferH264 {
     signed short    chroma_offset_l1[32][2];
     /**@}*/
 
-    /** @name dec_ref_pic_marking() */
-    /**@{*/
-    /** \brief Same as the H.264 bitstream syntax element. */
-    unsigned char   no_output_of_prior_pics_flag;
-    /** \brief Same as the H.264 bitstream syntax element. */
-    unsigned char   long_term_reference_flag;
-    /** \brief Same as the H.264 bitstream syntax element. */
-    unsigned char   adaptive_ref_pic_marking_mode_flag;
-    /** \brief Same as the \c memory_management_control_operation syntax element. */
-    unsigned char   mmco[32];
-    /**
-     * \brief Values for each \c memory_management_control_operation.
-     *
-     * - If \c mmco == 1:
-     *   - \c mmco_value[0] is \c difference_of_pic_nums_minus1
-     *   - \c mmco_value[1] is not used
-     * - If \c mmco == 2:
-     *   - \c mmco_value[0] is \c long_term_pic_num
-     *   - \c mmco_value[1] is not used
-     * - If \c mmco == 3:
-     *   - \c mmco_value[0] is \c difference_of_pic_nums_minus1
-     *   - \c mmco_value[1] is \c long_term_frame_idx
-     * - If \c mmco == 4:
-     *   - \c mmco_value[0] is \c max_long_term_frame_idx_plus1
-     *   - \c mmco_value[1] is not used
-     * - If \c mmco == 6:
-     *   - \c mmco_value[0] is \c long_term_frame_idx
-     *   - \c mmco_value[1] is not used
-     */
-    unsigned int    mmco_value[32][2];
-    /**@}*/
-
     /** \brief Range: 0 to 2, inclusive. */
     unsigned char   cabac_init_idc;
     /** \brief Same as the H.264 bitstream syntax element. */
@@ -501,7 +523,8 @@ typedef struct _VAEncSliceParameterBufferH264 {
 /**@}*/
 
 /**
- * \brief Macroblock parameter for H.264 encoding in main & high profiles.
+ * \brief Macroblock parameter for H.264 encoding in baseline, main & high 
+ * profiles.
  *
  * This structure holds per-macroblock information. The buffer must be
  * allocated with as many elements (macroblocks) as necessary to fit