[Libva] [Libva-intel-driver][PATCH v2 02/18] Add an internal flag to indicate the start of a new sequence

Xiang, Haihao haihao.xiang at intel.com
Thu Sep 8 14:44:49 UTC 2016


v2: rebased

Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
 src/i965_encoder.c | 10 +++++++++-
 src/i965_encoder.h |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/i965_encoder.c b/src/i965_encoder.c
index e398756..7d9c083 100644
--- a/src/i965_encoder.c
+++ b/src/i965_encoder.c
@@ -331,6 +331,7 @@ intel_encoder_check_avc_parameter(VADriverContextP ctx,
     struct object_surface *obj_surface;	
     struct object_buffer *obj_buffer;
     VAEncPictureParameterBufferH264 *pic_param = (VAEncPictureParameterBufferH264 *)encode_state->pic_param_ext->buffer;
+    VAEncSequenceParameterBufferH264 *seq_param = (VAEncSequenceParameterBufferH264 *)encode_state->seq_param_ext->buffer;
     int i;
 
     assert(!(pic_param->CurrPic.flags & VA_PICTURE_H264_INVALID));
@@ -373,7 +374,14 @@ intel_encoder_check_avc_parameter(VADriverContextP ctx,
 
     for ( ; i < 16; i++)
         encode_state->reference_objects[i] = NULL;
-    
+
+    /*
+     * A sequence consists of an IDR unit, followed by zero or more non-IDR unit, but not including any
+     * subsequent IDR unit, so idr_pic_flag can indicate the current frame is the start of a new
+     * sequnce
+     */
+    encoder_context->is_new_sequence = (pic_param->pic_fields.bits.idr_pic_flag && seq_param);
+
     return VA_STATUS_SUCCESS;
 
 error:
diff --git a/src/i965_encoder.h b/src/i965_encoder.h
index db7e698..bec83e3 100644
--- a/src/i965_encoder.h
+++ b/src/i965_encoder.h
@@ -67,6 +67,7 @@ struct intel_encoder_context
     unsigned int low_power_mode:1;
     unsigned int soft_batch_force:1;
     unsigned int context_roi:1;
+    unsigned int is_new_sequence:1; /* Currently only valid for H.264, TODO for other codecs */
 
     void (*vme_context_destroy)(void *vme_context);
     VAStatus (*vme_pipeline)(VADriverContextP ctx,
-- 
1.9.1



More information about the Libva mailing list