summaryrefslogtreecommitdiff
path: root/src/i965_encoder.c
diff options
context:
space:
mode:
authorZhong Li <zhong.li@intel.com>2015-01-15 22:04:54 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2015-03-19 10:01:29 +0800
commitd954c80771a83d511d950aec0a8fbe0bd15f4957 (patch)
treeafd6031361353f789126499f07ccbd14efa834d3 /src/i965_encoder.c
parent4f0df22066c00528f463a0eb6f5c0b6f95e09b05 (diff)
downloadlibva-intel-driver-d954c80771a83d511d950aec0a8fbe0bd15f4957.tar.gz
VP8 HWEnc: Build VP8 PAK pipeline and enabling I frame
Signed-off-by: Zhong Li <zhong.li@intel.com> (cherry picked from commit a18ce4664113d5b1a9b29ed45bf137df6b7a7898) Conflicts: src/i965_encoder_utils.c
Diffstat (limited to 'src/i965_encoder.c')
-rw-r--r--src/i965_encoder.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/i965_encoder.c b/src/i965_encoder.c
index 86f87577..83187b6a 100644
--- a/src/i965_encoder.c
+++ b/src/i965_encoder.c
@@ -422,6 +422,71 @@ error:
}
static VAStatus
+intel_encoder_check_vp8_parameter(VADriverContextP ctx,
+ struct encode_state *encode_state,
+ struct intel_encoder_context *encoder_context)
+{
+ struct i965_driver_data *i965 = i965_driver_data(ctx);
+ VAEncPictureParameterBufferVP8 *pic_param = (VAEncPictureParameterBufferVP8 *)encode_state->pic_param_ext->buffer;
+ struct object_surface *obj_surface;
+ struct object_buffer *obj_buffer;
+ int i = 0;
+ int is_key_frame = !pic_param->pic_flags.bits.frame_type;
+
+ obj_surface = SURFACE(pic_param->reconstructed_frame);
+ assert(obj_surface); /* It is possible the store buffer isn't allocated yet */
+
+ if (!obj_surface)
+ goto error;
+
+ encode_state->reconstructed_object = obj_surface;
+ obj_buffer = BUFFER(pic_param->coded_buf);
+ assert(obj_buffer && obj_buffer->buffer_store && obj_buffer->buffer_store->bo);
+
+ if (!obj_buffer || !obj_buffer->buffer_store || !obj_buffer->buffer_store->bo)
+ goto error;
+
+ encode_state->coded_buf_object = obj_buffer;
+
+ if (!is_key_frame) {
+ assert(pic_param->ref_last_frame != VA_INVALID_SURFACE);
+ obj_surface = SURFACE(pic_param->ref_last_frame);
+ assert(obj_surface && obj_surface->bo);
+
+ if (!obj_surface || !obj_surface->bo)
+ goto error;
+
+ encode_state->reference_objects[i++] = obj_surface;
+
+ assert(pic_param->ref_gf_frame != VA_INVALID_SURFACE);
+ obj_surface = SURFACE(pic_param->ref_gf_frame);
+ assert(obj_surface && obj_surface->bo);
+
+ if (!obj_surface || !obj_surface->bo)
+ goto error;
+
+ encode_state->reference_objects[i++] = obj_surface;
+
+ assert(pic_param->ref_arf_frame != VA_INVALID_SURFACE);
+ obj_surface = SURFACE(pic_param->ref_arf_frame);
+ assert(obj_surface && obj_surface->bo);
+
+ if (!obj_surface || !obj_surface->bo)
+ goto error;
+
+ encode_state->reference_objects[i++] = obj_surface;
+ }
+
+ for ( ; i < 16; i++)
+ encode_state->reference_objects[i] = NULL;
+
+ return VA_STATUS_SUCCESS;
+
+error:
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+}
+
+static VAStatus
intel_encoder_sanity_check_input(VADriverContextP ctx,
VAProfile profile,
struct encode_state *encode_state,
@@ -458,6 +523,14 @@ intel_encoder_sanity_check_input(VADriverContextP ctx,
vaStatus = intel_encoder_check_jpeg_yuv_surface(ctx, profile, encode_state, encoder_context);
break;
}
+
+ case VAProfileVP8Version0_3: {
+ vaStatus = intel_encoder_check_vp8_parameter(ctx, encode_state, encoder_context);
+ if (vaStatus != VA_STATUS_SUCCESS)
+ goto out;
+ vaStatus = intel_encoder_check_yuv_surface(ctx, profile, encode_state, encoder_context);
+ break;
+ }
default:
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;