Encoder: directly use the objects for the reconstructed picture and coded buffer
authorXiang, Haihao <haihao.xiang@intel.com>
Mon, 11 Mar 2013 02:44:56 +0000 (10:44 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Fri, 15 Mar 2013 07:45:28 +0000 (15:45 +0800)
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
src/gen6_mfc_common.c
src/gen75_mfc.c
src/gen7_mfc.c
src/i965_drv_video.h
src/i965_encoder.c

index 1393f1b..d7aae3c 100644 (file)
@@ -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);
index 5da00de..2674aef 100644 (file)
@@ -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);
index 3abcacd..73c01ac 100644 (file)
@@ -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);
index 77ba9ab..0a20b67 100644 (file)
@@ -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
index 0343b1a..f2d7f6b 100644 (file)
@@ -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: