Clean up for setting up reference surface state on BDW
authorXiang, Haihao <haihao.xiang@intel.com>
Tue, 8 Oct 2013 05:11:18 +0000 (13:11 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Thu, 27 Feb 2014 02:22:33 +0000 (10:22 +0800)
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
src/gen8_vme.c

index cb6f143..a5ca183 100644 (file)
@@ -240,7 +240,6 @@ gen8_vme_surface_setup(VADriverContextP ctx,
                        struct intel_encoder_context *encoder_context)
 {
     struct object_surface *obj_surface;
-    struct i965_driver_data *i965 = i965_driver_data(ctx);
 
     /*Setup surfaces state*/
     /* current picture for encoding */
@@ -252,42 +251,14 @@ gen8_vme_surface_setup(VADriverContextP ctx,
     if (!is_intra) {
        VAEncSliceParameterBufferH264 *slice_param = (VAEncSliceParameterBufferH264 *)encode_state->slice_params_ext[0]->buffer;
        int slice_type;
-       struct object_surface *slice_obj_surface;
-       int ref_surface_id;
 
        slice_type = intel_avc_enc_slice_type_fixup(slice_param->slice_type);
+       assert(slice_type != SLICE_TYPE_I && slice_type != SLICE_TYPE_SI);
 
-       if (slice_type == SLICE_TYPE_P || slice_type == SLICE_TYPE_B) {
-            slice_obj_surface = NULL;
-            ref_surface_id = slice_param->RefPicList0[0].picture_id;
-            if (ref_surface_id != VA_INVALID_SURFACE) {
-                slice_obj_surface = SURFACE(ref_surface_id);
-            }
-            if (slice_obj_surface && slice_obj_surface->bo) {
-                obj_surface = slice_obj_surface;
-            } else {
-                obj_surface = encode_state->reference_objects[0];
-            }
-            /* reference 0 */
-            if (obj_surface && obj_surface->bo)
-                gen8_vme_source_surface_state(ctx, 1, obj_surface, encoder_context);
-       }
-       if (slice_type == SLICE_TYPE_B) {
-            /* reference 1 */
-            slice_obj_surface = NULL;
-            ref_surface_id = slice_param->RefPicList1[0].picture_id;
-            if (ref_surface_id != VA_INVALID_SURFACE) {
-                slice_obj_surface = SURFACE(ref_surface_id);
-            }
-            if (slice_obj_surface && slice_obj_surface->bo) {
-                obj_surface = slice_obj_surface;
-            } else {
-                obj_surface = encode_state->reference_objects[1];
-            }
+       intel_avc_vme_reference_state(ctx, encode_state, encoder_context, 0, 1, gen8_vme_source_surface_state);
 
-            if (obj_surface && obj_surface->bo)
-                gen8_vme_source_surface_state(ctx, 2, obj_surface, encoder_context);
-       }
+       if (slice_type == SLICE_TYPE_B)
+            intel_avc_vme_reference_state(ctx, encode_state, encoder_context, 1, 2, gen8_vme_source_surface_state);
     }
 
     /* VME output */