[Libva] [PATCH 2/3] HEVC: Fix the nal unit type generation in packed slice header.

sreerenj.balachandran at intel.com sreerenj.balachandran at intel.com
Thu May 21 18:46:04 PDT 2015


From: Sreerenj Balachandran <sreerenj.balachandran at intel.com>

Generate the Nal unit type for packed slice headers based
on idr_pic_flag and reference_pic_flag.
---
 src/i965_encoder_utils.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/i965_encoder_utils.c b/src/i965_encoder_utils.c
index 9c9619c..0b7df4c 100644
--- a/src/i965_encoder_utils.c
+++ b/src/i965_encoder_utils.c
@@ -1118,6 +1118,16 @@ static void slice_rbsp(avc_bitstream *bs,
     avc_rbsp_trailing_bits(bs);
 }
 
+int get_hevc_slice_nalu_type (VAEncPictureParameterBufferHEVC *pic_param)
+{
+    if (pic_param->pic_fields.bits.idr_pic_flag)
+      return IDR_WRADL_NUT;
+    else if (pic_param->pic_fields.bits.reference_pic_flag)
+      return SLICE_TRAIL_R_NUT;
+    else
+      return SLICE_TRAIL_N_NUT;
+}
+
 int build_hevc_slice_header(VAEncSequenceParameterBufferHEVC *seq_param,
                        VAEncPictureParameterBufferHEVC *pic_param,
                        VAEncSliceParameterBufferHEVC *slice_param,
@@ -1128,7 +1138,7 @@ int build_hevc_slice_header(VAEncSequenceParameterBufferHEVC *seq_param,
 
     avc_bitstream_start(&bs);
     nal_start_code_prefix(&bs);
-    nal_header_hevc(&bs, SLICE_TRAIL_N_NUT, 0);
+    nal_header_hevc(&bs, get_hevc_slice_nalu_type(pic_param), 0);
     slice_rbsp(&bs, slice_index, seq_param,pic_param,slice_param);
     avc_bitstream_end(&bs);
 
-- 
2.1.4



More information about the Libva mailing list