mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
decoder: h264: fix slice data bit offset with MVC NAL units.
When MVC slice NAL units (coded slice extension and prefix NAL) are present, the number of NAL header bytes is 3, not 1 as usual. Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com> Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
5a3e51472d
commit
3f14745d61
1 changed files with 7 additions and 5 deletions
|
@ -2672,12 +2672,12 @@ decode_picture(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnit *unit)
|
|||
}
|
||||
|
||||
static inline guint
|
||||
get_slice_data_bit_offset(GstH264SliceHdr *slice_hdr)
|
||||
get_slice_data_bit_offset(GstH264SliceHdr *slice_hdr, guint nal_header_bytes)
|
||||
{
|
||||
guint epb_count;
|
||||
|
||||
epb_count = slice_hdr->n_emulation_prevention_bytes;
|
||||
return 8 /* nal_unit_type */ + slice_hdr->header_size - epb_count * 8;
|
||||
return 8 * nal_header_bytes + slice_hdr->header_size - epb_count * 8;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -2793,12 +2793,14 @@ fill_RefPicList(GstVaapiDecoderH264 *decoder,
|
|||
|
||||
static gboolean
|
||||
fill_slice(GstVaapiDecoderH264 *decoder,
|
||||
GstVaapiSlice *slice, GstH264SliceHdr *slice_hdr)
|
||||
GstVaapiSlice *slice, GstVaapiParserInfoH264 *pi)
|
||||
{
|
||||
VASliceParameterBufferH264 * const slice_param = slice->param;
|
||||
GstH264SliceHdr * const slice_hdr = &pi->data.slice_hdr;
|
||||
|
||||
/* Fill in VASliceParameterBufferH264 */
|
||||
slice_param->slice_data_bit_offset = get_slice_data_bit_offset(slice_hdr);
|
||||
slice_param->slice_data_bit_offset =
|
||||
get_slice_data_bit_offset(slice_hdr, pi->nalu.header_bytes);
|
||||
slice_param->first_mb_in_slice = slice_hdr->first_mb_in_slice;
|
||||
slice_param->slice_type = slice_hdr->type % 5;
|
||||
slice_param->direct_spatial_mv_pred_flag = slice_hdr->direct_spatial_mv_pred_flag;
|
||||
|
@ -2858,7 +2860,7 @@ decode_slice(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnit *unit)
|
|||
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
||||
}
|
||||
|
||||
if (!fill_slice(decoder, slice, slice_hdr)) {
|
||||
if (!fill_slice(decoder, slice, pi)) {
|
||||
gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(slice));
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue