Discussion:
[PATCH] Add new sequence flag check for HEVC/VP9 Encoding
(too old to reply)
Zhao Yakui
2016-12-28 05:45:28 UTC
Permalink
Signed-off-by: Zhao Yakui <***@intel.com>
---
src/i965_encoder.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/src/i965_encoder.c b/src/i965_encoder.c
index be37b84..3099175 100644
--- a/src/i965_encoder.c
+++ b/src/i965_encoder.c
@@ -1047,8 +1047,15 @@ intel_encoder_check_hevc_parameter(VADriverContextP ctx,
struct object_buffer *obj_buffer;
VAEncPictureParameterBufferHEVC *pic_param = (VAEncPictureParameterBufferHEVC *)encode_state->pic_param_ext->buffer;
VAEncSliceParameterBufferHEVC *slice_param;
+ VAEncSequenceParameterBufferHEVC *seq_param;
int i;

+ seq_param = NULL;
+
+ if (encode_state->seq_param_ext &&
+ encode_state->seq_param_ext->buffer)
+ seq_param = (VAEncSequenceParameterBufferHEVC *)(encode_state->seq_param_ext->buffer);
+
assert(!(pic_param->decoded_curr_pic.flags & VA_PICTURE_HEVC_INVALID));

if (pic_param->decoded_curr_pic.flags & VA_PICTURE_HEVC_INVALID)
@@ -1101,6 +1108,8 @@ intel_encoder_check_hevc_parameter(VADriverContextP ctx,
/* TODO: add more check here */
}

+ encoder_context->is_new_sequence = (pic_param->pic_fields.bits.idr_pic_flag && seq_param);
+
return VA_STATUS_SUCCESS;

error:
@@ -1114,6 +1123,7 @@ intel_encoder_check_vp9_parameter(VADriverContextP ctx,
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
VAEncPictureParameterBufferVP9 *pic_param;
+ VAEncSequenceParameterBufferVP9 *seq_param;
struct object_surface *obj_surface;
struct object_buffer *obj_buffer;
int i = 0;
@@ -1124,6 +1134,10 @@ intel_encoder_check_vp9_parameter(VADriverContextP ctx,
encode_state->pic_param_ext->buffer == NULL)
return VA_STATUS_ERROR_INVALID_PARAMETER;

+ seq_param = NULL;
+ if (encode_state->seq_param_ext &&
+ encode_state->seq_param_ext->buffer)
+ seq_param = (VAEncSequenceParameterBufferVP9 *)(encode_state->seq_param_ext->buffer);
pic_param = (VAEncPictureParameterBufferVP9 *)encode_state->pic_param_ext->buffer;

obj_surface = SURFACE(pic_param->reconstructed_frame);
@@ -1169,6 +1183,8 @@ intel_encoder_check_vp9_parameter(VADriverContextP ctx,
for ( ; i < 16; i++)
encode_state->reference_objects[i] = NULL;

+ encoder_context->is_new_sequence = (is_key_frame && seq_param);
+
return VA_STATUS_SUCCESS;

error:
--
1.9.1
Xiang, Haihao
2016-12-29 02:51:52 UTC
Permalink
LGTM and applied.

Thanks
Haihao
---
 src/i965_encoder.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff --git a/src/i965_encoder.c b/src/i965_encoder.c
index be37b84..3099175 100644
--- a/src/i965_encoder.c
+++ b/src/i965_encoder.c
@@ -1047,8 +1047,15 @@
intel_encoder_check_hevc_parameter(VADriverContextP ctx,
     struct object_buffer *obj_buffer;
     VAEncPictureParameterBufferHEVC *pic_param =
(VAEncPictureParameterBufferHEVC *)encode_state->pic_param_ext-
Post by Zhao Yakui
buffer;
     VAEncSliceParameterBufferHEVC *slice_param;
+    VAEncSequenceParameterBufferHEVC *seq_param;
     int i;
 
+    seq_param = NULL;
+
+    if (encode_state->seq_param_ext &&
+            encode_state->seq_param_ext->buffer)
+        seq_param = (VAEncSequenceParameterBufferHEVC
*)(encode_state->seq_param_ext->buffer);
+
     assert(!(pic_param->decoded_curr_pic.flags &
VA_PICTURE_HEVC_INVALID));
 
     if (pic_param->decoded_curr_pic.flags & VA_PICTURE_HEVC_INVALID)
@@ -1101,6 +1108,8 @@
intel_encoder_check_hevc_parameter(VADriverContextP ctx,
         /* TODO: add more check here */
     }
 
+    encoder_context->is_new_sequence = (pic_param-
Post by Zhao Yakui
pic_fields.bits.idr_pic_flag && seq_param);
+
     return VA_STATUS_SUCCESS;
 
@@ -1114,6 +1123,7 @@
intel_encoder_check_vp9_parameter(VADriverContextP ctx,
 {
     struct i965_driver_data *i965 = i965_driver_data(ctx);
     VAEncPictureParameterBufferVP9 *pic_param;
+    VAEncSequenceParameterBufferVP9 *seq_param;
     struct object_surface *obj_surface;
     struct object_buffer *obj_buffer;
     int i = 0;
@@ -1124,6 +1134,10 @@
intel_encoder_check_vp9_parameter(VADriverContextP ctx,
         encode_state->pic_param_ext->buffer == NULL)
         return VA_STATUS_ERROR_INVALID_PARAMETER;
 
+    seq_param = NULL;
+    if (encode_state->seq_param_ext &&
+            encode_state->seq_param_ext->buffer)
+        seq_param = (VAEncSequenceParameterBufferVP9
*)(encode_state->seq_param_ext->buffer);
     pic_param = (VAEncPictureParameterBufferVP9 *)encode_state-
Post by Zhao Yakui
pic_param_ext->buffer;
 
     obj_surface = SURFACE(pic_param->reconstructed_frame);
@@ -1169,6 +1183,8 @@
intel_encoder_check_vp9_parameter(VADriverContextP ctx,
     for ( ; i < 16; i++)
         encode_state->reference_objects[i] = NULL;
 
+    encoder_context->is_new_sequence = (is_key_frame && seq_param);
+
     return VA_STATUS_SUCCESS;
 
Loading...