From 5fd61ebcd8621c095995e39cee1abda6b7d1b235 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Mon, 11 Mar 2013 10:44:56 +0800 Subject: [PATCH] Encoder: directly use the objects for the reconstructed picture and coded buffer Signed-off-by: Xiang, Haihao --- src/gen6_mfc_common.c | 6 ++---- src/gen75_mfc.c | 6 ++---- src/gen7_mfc.c | 6 ++---- src/i965_drv_video.h | 2 ++ src/i965_encoder.c | 8 +++++++- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c index 1393f1b..d7aae3c 100644 --- a/src/gen6_mfc_common.c +++ b/src/gen6_mfc_common.c @@ -552,8 +552,7 @@ VAStatus intel_mfc_avc_prepare(VADriverContextP ctx, /*Setup all the input&output object*/ /* Setup current frame and current direct mv buffer*/ - obj_surface = SURFACE(pPicParameter->CurrPic.picture_id); - assert(obj_surface); + obj_surface = encode_state->reconstructed_object; i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC('N','V','1','2'), SUBSAMPLE_YUV420); if ( obj_surface->private_data == NULL) { @@ -635,9 +634,8 @@ VAStatus intel_mfc_avc_prepare(VADriverContextP ctx, mfc_context->uncompressed_picture_source.bo = encode_state->input_yuv_object->bo; dri_bo_reference(mfc_context->uncompressed_picture_source.bo); - obj_buffer = BUFFER (pPicParameter->coded_buf); /* FIXME: fix this later */ + obj_buffer = encode_state->coded_buf_object; bo = obj_buffer->buffer_store->bo; - assert(bo); mfc_context->mfc_indirect_pak_bse_object.bo = bo; mfc_context->mfc_indirect_pak_bse_object.offset = I965_CODEDBUFFER_HEADER_SIZE; mfc_context->mfc_indirect_pak_bse_object.end_offset = ALIGN(obj_buffer->size_element - 0x1000, 0x1000); diff --git a/src/gen75_mfc.c b/src/gen75_mfc.c index 5da00de..2674aef 100644 --- a/src/gen75_mfc.c +++ b/src/gen75_mfc.c @@ -2411,8 +2411,7 @@ intel_mfc_mpeg2_prepare(VADriverContextP ctx, int i; /* reconstructed surface */ - obj_surface = SURFACE(pic_param->reconstructed_picture); - assert(obj_surface); + obj_surface = encode_state->reconstructed_object; i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC('N','V','1','2'), SUBSAMPLE_YUV420); mfc_context->pre_deblocking_output.bo = obj_surface->bo; dri_bo_reference(mfc_context->pre_deblocking_output.bo); @@ -2456,9 +2455,8 @@ intel_mfc_mpeg2_prepare(VADriverContextP ctx, dri_bo_reference(mfc_context->uncompressed_picture_source.bo); /* coded buffer */ - obj_buffer = BUFFER(pic_param->coded_buf); + obj_buffer = encode_state->coded_buf_object; bo = obj_buffer->buffer_store->bo; - assert(bo); mfc_context->mfc_indirect_pak_bse_object.bo = bo; mfc_context->mfc_indirect_pak_bse_object.offset = I965_CODEDBUFFER_HEADER_SIZE; mfc_context->mfc_indirect_pak_bse_object.end_offset = ALIGN(obj_buffer->size_element - 0x1000, 0x1000); diff --git a/src/gen7_mfc.c b/src/gen7_mfc.c index 3abcacd..73c01ac 100644 --- a/src/gen7_mfc.c +++ b/src/gen7_mfc.c @@ -1016,8 +1016,7 @@ gen7_mfc_mpeg2_prepare(VADriverContextP ctx, int i; /* reconstructed surface */ - obj_surface = SURFACE(pic_param->reconstructed_picture); - assert(obj_surface); + obj_surface = encode_state->reconstructed_object; i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC('N','V','1','2'), SUBSAMPLE_YUV420); mfc_context->pre_deblocking_output.bo = obj_surface->bo; dri_bo_reference(mfc_context->pre_deblocking_output.bo); @@ -1061,9 +1060,8 @@ gen7_mfc_mpeg2_prepare(VADriverContextP ctx, dri_bo_reference(mfc_context->uncompressed_picture_source.bo); /* coded buffer */ - obj_buffer = BUFFER(pic_param->coded_buf); + obj_buffer = encode_state->coded_buf_object; bo = obj_buffer->buffer_store->bo; - assert(bo); mfc_context->mfc_indirect_pak_bse_object.bo = bo; mfc_context->mfc_indirect_pak_bse_object.offset = I965_CODEDBUFFER_HEADER_SIZE; mfc_context->mfc_indirect_pak_bse_object.end_offset = ALIGN(obj_buffer->size_element - 0x1000, 0x1000); diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h index 77ba9ab..0a20b67 100644 --- a/src/i965_drv_video.h +++ b/src/i965_drv_video.h @@ -133,6 +133,8 @@ struct encode_state VASurfaceID current_render_target; struct object_surface *input_yuv_object; + struct object_surface *reconstructed_object; + struct object_buffer *coded_buf_object; }; struct proc_state diff --git a/src/i965_encoder.c b/src/i965_encoder.c index 0343b1a..f2d7f6b 100644 --- a/src/i965_encoder.c +++ b/src/i965_encoder.c @@ -153,13 +153,16 @@ intel_encoder_check_avc_parameter(VADriverContextP ctx, 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; + return VA_STATUS_SUCCESS; error: @@ -182,12 +185,15 @@ intel_encoder_check_mpeg2_parameter(VADriverContextP ctx, 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; + return VA_STATUS_SUCCESS; error: -- 2.7.4