Fixed multipul slices edge prediction issue for Intra
authorZhou Chang <chang.zhou@intel.com>
Fri, 6 Apr 2012 07:57:13 +0000 (15:57 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Fri, 6 Apr 2012 08:07:02 +0000 (16:07 +0800)
src/gen6_vme.c
src/shaders/vme/intra_frame.asm
src/shaders/vme/intra_frame.g6b
src/shaders/vme/intra_frame.g7b
src/shaders/vme/vme.inc

index a0efc37..6a2cdf0 100644 (file)
@@ -381,49 +381,44 @@ gen6_vme_fill_vme_batchbuffer(VADriverContextP ctx,
                               struct intel_encoder_context *encoder_context)
 {
     struct gen6_vme_context *vme_context = encoder_context->vme_context;
-    int total_mbs = mb_width * mb_height;
-    int number_mb_cmds = 128;
+    int number_mb_cmds;
     int mb_x = 0, mb_y = 0;
-    int i, count = 0;
+    int i, s;
     unsigned int *command_ptr;
 
     dri_bo_map(vme_context->vme_batchbuffer.bo, 1);
     command_ptr = vme_context->vme_batchbuffer.bo->virtual;
 
-    for (i = 0; i < total_mbs / number_mb_cmds; i++) {
-        mb_x = count % mb_width;
-        mb_y = count / mb_width;
-
-        *command_ptr++ = (CMD_MEDIA_OBJECT | (8 - 2));
-        *command_ptr++ = kernel;
-        *command_ptr++ = 0;
-        *command_ptr++ = 0;
-        *command_ptr++ = 0;
-        *command_ptr++ = 0;
+    for (s = 0; s < encode_state->num_slice_params_ext; s++) {
+        VAEncSliceParameterBufferH264 *pSliceParameter = (VAEncSliceParameterBufferH264 *)encode_state->slice_params_ext[s]->buffer; 
+        int slice_mb_begin = pSliceParameter->macroblock_address;
+        int slice_mb_number = pSliceParameter->num_macroblocks;
+        
+        for (i = 0; i < slice_mb_number;  ) {
+            int mb_count = i + slice_mb_begin;    
+            mb_x = mb_count % mb_width;
+            mb_y = mb_count / mb_width;
+            if( i == 0 ) {
+                number_mb_cmds = mb_width;          // we must mark the slice edge. 
+            } else if ( (i + 128 ) <= slice_mb_number) {
+                number_mb_cmds = 128;
+            } else {
+                number_mb_cmds = slice_mb_number - i;
+            }
+
+            *command_ptr++ = (CMD_MEDIA_OBJECT | (8 - 2));
+            *command_ptr++ = kernel;
+            *command_ptr++ = 0;
+            *command_ptr++ = 0;
+            *command_ptr++ = 0;
+            *command_ptr++ = 0;
    
-        /*inline data */
-        *command_ptr++ = (mb_width << 16 | mb_y << 8 | mb_x);
-        *command_ptr++ = (number_mb_cmds << 16 | transform_8x8_mode_flag);
-
-        count += number_mb_cmds;
-    }
+            /*inline data */
+            *command_ptr++ = (mb_width << 16 | mb_y << 8 | mb_x);
+            *command_ptr++ = (number_mb_cmds << 16 | transform_8x8_mode_flag | ((i==0) << 1));
 
-    number_mb_cmds = total_mbs - count;
-    
-    if (number_mb_cmds) {
-        mb_x = count % mb_width;
-        mb_y = count / mb_width;
-
-        *command_ptr++ = (CMD_MEDIA_OBJECT | (8 - 2));
-        *command_ptr++ = kernel;
-        *command_ptr++ = 0;
-        *command_ptr++ = 0;
-        *command_ptr++ = 0;
-        *command_ptr++ = 0;
-   
-        /*inline data */
-        *command_ptr++ = (mb_width << 16 | mb_y << 8 | mb_x);
-        *command_ptr++ = (number_mb_cmds << 16 | transform_8x8_mode_flag);
+            i += number_mb_cmds;
+        } 
     }
 
     *command_ptr++ = 0;
index d40369d..23f99be 100644 (file)
@@ -61,9 +61,9 @@ mov  (8) vme_msg_0.0<1>:UD      vme_m0.0<8,8,1>:UD {align1};
 
 /* m1 */
 mov  (1) intra_flag<1>:UW       0x0:UW {align1}                     ;
-cmp.nz.f0.0 (1) null<1>:UW transform_8x8_ub<0,1,0>:UB 1:UW {align1};
+and.z.f0.0 (1) null<1>:UW transform_8x8_ub<0,1,0>:UB 1:UW {align1};
 (f0.0) mov  (1) intra_part_mask_ub<1>:UB  LUMA_INTRA_8x8_DISABLE {align1};
-        
+
 cmp.nz.f0.0 (1) null<1>:UW orig_x_ub<0,1,0>:UB 0:UW {align1};                                                   /* X != 0 */
 (f0.0) add (1) mb_intra_struct_ub<1>:UB mb_intra_struct_ub<0,1,0>:UB INTRA_PRED_AVAIL_FLAG_AE {align1};         /* A */
 
@@ -78,6 +78,10 @@ add  (1) tmp_x_w<1>:W w_in_mb_uw<0,1,0>:UW -tmp_x_w<0,1,0>:W {align1};
 mul.nz.f0.0 (1) null<1>:UD tmp_x_w<0,1,0>:W orig_y_ub<0,1,0>:UB {align1};                                       /* (width - (X + 1)) * Y != 0 */
 (f0.0) add (1) mb_intra_struct_ub<1>:UB mb_intra_struct_ub<0,1,0>:UB INTRA_PRED_AVAIL_FLAG_C {align1};          /* C */
 
+and.nz.f0.0 (1) null<1>:UW slice_edge_ub<0,1,0>:UB 2:UW {align1};
+(f0.0) and (1) mb_intra_struct_ub<1>:UB mb_intra_struct_ub<0,1,0>:UB  0xE0 {align1};                            /* slice edge disable B,C,D*/
+
+
 mov  (8) vme_msg_1<1>:UD        vme_m1.0<8,8,1>:UD {align1};
 
 /* m2 */        
index ddc7404..29ef5cc 100644 (file)
@@ -21,7 +21,7 @@
    { 0x04600031, 0x22801cd1, 0x00000000, 0x02288004 },
    { 0x00600001, 0x20000022, 0x008d0440, 0x00000000 },
    { 0x00000001, 0x247c0169, 0x00000000, 0x00000000 },
-   { 0x02000010, 0x20002e28, 0x000000a4, 0x00010001 },
+   { 0x01000005, 0x20002e28, 0x000000a4, 0x00010001 },
    { 0x00010001, 0x247c00f1, 0x00000000, 0x00000002 },
    { 0x02000010, 0x20002e28, 0x000000a0, 0x00000000 },
    { 0x00010040, 0x247d1e31, 0x0000047d, 0x00000060 },
@@ -33,6 +33,8 @@
    { 0x00000040, 0x2520352d, 0x000000a2, 0x00004520 },
    { 0x02000041, 0x200045a0, 0x00000520, 0x000000a1 },
    { 0x00010040, 0x247d1e31, 0x0000047d, 0x00000008 },
+   { 0x02000005, 0x20002e28, 0x000000a4, 0x00020002 },
+   { 0x00010005, 0x247d1e31, 0x0000047d, 0x000000e0 },
    { 0x00600001, 0x20200022, 0x008d0460, 0x00000000 },
    { 0x00600001, 0x20400062, 0x00000000, 0x00000000 },
    { 0x00600001, 0x20400022, 0x008d0240, 0x00000000 },
@@ -61,6 +63,6 @@
    { 0x00010040, 0x244a2d29, 0x0000044a, 0x00100010 },
    { 0x00000040, 0x24882c21, 0x00000488, 0x00010001 },
    { 0x01000040, 0x20a63dad, 0x000000a6, 0xffffffff },
-   { 0x00110020, 0x34001c00, 0x00001400, 0xffffffa2 },
+   { 0x00110020, 0x34001c00, 0x00001400, 0xffffff9e },
    { 0x00600001, 0x20000022, 0x008d0000, 0x00000000 },
    { 0x07800031, 0x24001cc8, 0x00000000, 0x82000010 },
index db5b2a0..d0b91c2 100644 (file)
@@ -21,7 +21,7 @@
    { 0x04600031, 0x22801cb1, 0x00000800, 0x02290004 },
    { 0x00600001, 0x28000021, 0x008d0440, 0x00000000 },
    { 0x00000001, 0x247c0169, 0x00000000, 0x00000000 },
-   { 0x02000010, 0x20002e28, 0x000000a4, 0x00010001 },
+   { 0x01000005, 0x20002e28, 0x000000a4, 0x00010001 },
    { 0x00010001, 0x247c00f1, 0x00000000, 0x00000002 },
    { 0x02000010, 0x20002e28, 0x000000a0, 0x00000000 },
    { 0x00010040, 0x247d1e31, 0x0000047d, 0x00000060 },
@@ -33,6 +33,8 @@
    { 0x00000040, 0x2520352d, 0x000000a2, 0x00004520 },
    { 0x02000041, 0x200045a0, 0x00000520, 0x000000a1 },
    { 0x00010040, 0x247d1e31, 0x0000047d, 0x00000008 },
+   { 0x02000005, 0x20002e28, 0x000000a4, 0x00020002 },
+   { 0x00010005, 0x247d1e31, 0x0000047d, 0x000000e0 },
    { 0x00600001, 0x28200021, 0x008d0460, 0x00000000 },
    { 0x00600001, 0x28400061, 0x00000000, 0x00000000 },
    { 0x00600001, 0x28600021, 0x008d0240, 0x00000000 },
@@ -61,6 +63,6 @@
    { 0x00010040, 0x244a2d29, 0x0000044a, 0x00100010 },
    { 0x00000040, 0x24882c21, 0x00000488, 0x00010001 },
    { 0x01000040, 0x20a63dad, 0x000000a6, 0xffffffff },
-   { 0x00110020, 0x34001c00, 0x00001400, 0xffffffa2 },
+   { 0x00110020, 0x34001c00, 0x00001400, 0xffffff9e },
    { 0x00600001, 0x28000021, 0x008d0000, 0x00000000 },
    { 0x07800031, 0x24001ca8, 0x00000800, 0x82000010 },
index cbd189b..a79d2b0 100644 (file)
@@ -132,6 +132,7 @@ define(`orig_xy_ub',            `inline_reg0.0')
 define(`orig_x_ub',             `inline_reg0.0')    /* in macroblock */    
 define(`orig_y_ub',             `inline_reg0.1')
 define(`transform_8x8_ub',      `inline_reg0.4')
+define(`slice_edge_ub',         `inline_reg0.4')
 define(`num_macroblocks',       `inline_reg0.6')
 
 /*