From 24552933342b6f50738f4947db74d4e5203952a0 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Tue, 13 Sep 2016 16:02:31 +0800 Subject: [PATCH] Add an internal flag to indicate the start of a new sequence v2: rebased Signed-off-by: Xiang, Haihao Tested-by: Luo, Focus Reviewed-by: Zhao Yakui (cherry picked from commit 1e888af12bfda0e195dbeae243aa4090a77df7d8) --- 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, -- 2.11.0