summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-03-01 14:01:33 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-04-04 09:44:48 +0200
commita870f078984ce829f797e5610b30d39a3921af4f (patch)
tree92559022ebe8b75527f06d897d3f52b39982fbd2
parent94874e7f90111eb9741a3b9614b55f9a80d85879 (diff)
API: h264 decode: introduce num_emulation_prevention_bytes.
num_emulation_prevention_bytes represent the number of emulation prevention bytes available in the slice_header(). This helps VA drivers determine how many emulation prevention bytes there are so that to program the hardware appropriately, without having to parse the slice_header() again. Rationale: it is not always possible to parse the slice_header() again. For instance, if "protected slices" are used, the slice data is uploaded into a VAProtectedSliceDataBuffer and it is no longer possible to read bytes from it afterwards. e.g. it could be in encrypted memory region or protected memory region only accessible from the video decoder. In newly written code, this member shall be filled in appropriately along with emulation_prevention_bytes_flag set to 1. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
-rw-r--r--va/va.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/va/va.h b/va/va.h
index 2d92ce7..a8e53a2 100644
--- a/va/va.h
+++ b/va/va.h
@@ -1501,6 +1501,10 @@ typedef struct _VASliceParameterBufferH264
*
* Basically, this field represents the number of bits parsed in
* the slice_header() + 8 for the initial NAL unit byte.
+ *
+ * See the "Emulation Prevention Bytes" section hereunder for more
+ * details about how slices with emulation prevention bytes need
+ * to be handled.
*/
unsigned short slice_data_bit_offset;
unsigned short first_mb_in_slice;
@@ -1529,6 +1533,37 @@ typedef struct _VASliceParameterBufferH264
unsigned char chroma_weight_l1_flag;
short chroma_weight_l1[32][2];
short chroma_offset_l1[32][2];
+
+ /** @name Emulation Prevention Bytes */
+ /**@{*/
+ /**
+ * \brief Determines whether \ref num_emulation_prevention_bytes
+ * is set or not.
+ *
+ * \ref slice_data_bit_offset represents a bit offset from the NAL
+ * Header Unit to the begining of slice_data(). However, some VA
+ * drivers require a bit offset without emulation prevention bytes.
+ *
+ * If \ref emulation_prevention_bytes_flag is 1, then the driver
+ * will be able to determine this bit offset without parsing the
+ * slice_header() again. This is especially important for "protected
+ * slices" as once the data is uploaded to a VAProtectedSliceData
+ * buffer, the data in cyphered and no longer available to the
+ * driver.
+ *
+ * If \ref emulation_prevention_bytes_flag is 0, then the driver
+ * will parse the slice_header() and count the number of emulation
+ * prevention bytes itself and adjust the bit offset for the
+ * hardware accordingly.
+ *
+ * \ref emulation_prevention_bytes_flag shall always be set to 1
+ * for newly written code and \ref num_emulation_prevention_bytes
+ * shall be filled in appropriately.
+ */
+ unsigned char emulation_prevention_bytes_flag;
+ /** \brief Number of emulation prevention bytes in slice_header(). */
+ unsigned int num_emulation_prevention_bytes;
+ /**@}*/
} VASliceParameterBufferH264;
/****************************