OSDN Git Service

i965_drv_video: add support for H264 on Clarkdale/Arrandale
[android-x86/hardware-intel-common-libva.git] / i965_drv_video / shaders / h264 / mc / initialize_MBPara.asm
1 /*\r
2  * Initialize parameters\r
3  * Copyright © <2010>, Intel Corporation.\r
4  *\r
5  * This program is licensed under the terms and conditions of the\r
6  * Eclipse Public License (EPL), version 1.0.  The full text of the EPL is at\r
7  * http://www.opensource.org/licenses/eclipse-1.0.php.\r
8  *\r
9  */\r
10 // Kernel name: Initialize_MBPara.asm\r
11 //\r
12 \r
13 \r
14 //#if !defined(__INITIALIZE_MBPARA__)           // Make sure this is only included once\r
15 //#define __INITIALIZE_MBPARA__\r
16 \r
17 \r
18 // WA for weighted prediction - 2007/09/06              // shlee\r
19 //      mov (1)         guwW128(0)<1>                   guwR1(0)<0;1,0>         // Copy the unique number indicating weight/offset=(128,0)\r
20 \r
21 \r
22 \r
23 //      MB Type         Category\r
24 //      1                       B_L0_16x16\r
25 //      2                       B_L1_16x16\r
26 //      3                       B_Bi_16x16\r
27 //      4                       B_L0_L0_16x8\r
28 //      5                       B_L0_L0_8x16\r
29 //      6                       B_L1_L1_16x8\r
30 //      7                       B_L1_L1_8x16\r
31 //      8                       B_L0_L1_16x8\r
32 //      9                       B_L0_L1_8x16\r
33 //      10                      B_L1_L0_16x8\r
34 //      11                      B_L1_L0_8x16\r
35 //      12                      B_L0_Bi_16x8\r
36 //      13                      B_L0_Bi_8x16\r
37 //      14                      B_L1_Bi_16x8\r
38 //      15                      B_L1_Bi_8x16\r
39 //      16                      B_Bi_L0_16x8\r
40 //      17                      B_Bi_L0_8x16\r
41 //      18                      B_Bi_L1_16x8\r
42 //      19                      B_Bi_L1_8x16\r
43 //      20                      B_Bi_Bi_16x8\r
44 //      21                      B_Bi_Bi_8x16\r
45 //      22                      B_8x8\r
46 \r
47         // TODO:\r
48         // Initialize interpolation area to eliminate uninitialized registers making the results of mac instructions XX.\r
49         // This issue was reported by Sharath on 5/25/2006, and why multiplication by zero still yields XX has not been understood yet.\r
50 #if 0\r
51         mov (16)        gudINTPY0(0)<1>         0:ud    {Compr}\r
52         mov (16)        gudINTPY0(2)<1>         0:ud    {Compr}\r
53         mov (16)        gudINTPY1(0)<1>         0:ud    {Compr}\r
54         mov (16)        gudINTPY1(2)<1>         0:ud    {Compr}\r
55         mov (16)        gudINTPC0(0)<1>         0:ud    {Compr}\r
56         mov (16)        gudINTPC1(0)<1>         0:ud    {Compr}\r
57 #endif\r
58 \r
59         mov (1)         gMVSTEP:w                       0:w                                                             // Address increament for MV read\r
60 \r
61         cmp.e.f0.0 (1) null:w                   gwMBTYPE<0;1,0>                                 22:w\r
62         (-f0.0)         jmpi                            INTERLABEL(NOT_8x8_MODE)\r
63 \r
64         //--- 8x8 mode\r
65                 \r
66         // Starting address of error data blocks\r
67         cmp.e.f0.1 (2) null<1>:w                gSUBMB_SHAPE<0;1,0>:ub                  0:w\r
68         (f0.1) jmpi INTERLABEL(CONVERT_MVS)\r
69 \r
70         // Note: MVs and Weights/Offsets are already expanded by HW or driver\r
71         \r
72         // MV conversion - Convert each MV to absolute coord. (= MV + MB org. + block offset) \r
73         shl (16)        gwTEMP(0)<1>            gX<0;2,1>:w                                             2:w // Convert MB origin to 1/4-pel unit\r
74         mov (1)         gMVSTEP:w                       24:w                                                    // Address increament for MV read\r
75         add (2)         gwTEMP(0,4)<2>          gwTEMP(0,4)<4;2,2>                              16:w\r
76         add (2)         gwTEMP(0,9)<2>          gwTEMP(0,9)<4;2,2>                              16:w\r
77         add (4)         gwTEMP(0,12)<1>         gwTEMP(0,12)<4;4,1>                             16:w\r
78         \r
79         add (16)        gMV<1>:w                        gMV<16;16,1>:w                                  gwTEMP(0)<16;16,1>\r
80         add (8)         gwTEMP(0)<2>            gwTEMP(0)<16;8,2>                               32:w\r
81         add (16)        gwMV(1,0)<1>            gwMV(1,0)<16;16,1>                              gwTEMP(0)<16;16,1>      \r
82         add (8)         gwTEMP(0,1)<2>          gwTEMP(0,1)<16;8,2>                             32:w\r
83         add (16)        gwMV(3,0)<1>            gwMV(3,0)<16;16,1>                              gwTEMP(0)<16;16,1>      \r
84         add (8)         gwTEMP(0)<2>            gwTEMP(0)<16;8,2>                               -32:w\r
85         add (16)        gwMV(2,0)<1>            gwMV(2,0)<16;16,1>                              gwTEMP(0)<16;16,1>      \r
86 \r
87         jmpi INTERLABEL(INIT_ADDRESS_REGS)\r
88 \r
89 INTERLABEL(NOT_8x8_MODE):\r
90 \r
91         //--- !8x8 mode (16x16, 16x8, 8x16)\r
92 \r
93         // MVs and Weights/Offsets are expanded\r
94         cmp.le.f0.1 (8) null<1>:w               gwMBTYPE<0;1,0>                                 3:w // Check 16x16\r
95         mov (1)         gSUBMB_SHAPE:ub         0:uw                                                    // subMB shape\r
96         (f0.1) mov (8)  gMV<1>:d                gMV<0;2,1>:d                                    \r
97         (f0.1) mov (8)  gdWGT(1,0)<1>   gWGT<0;4,1>:d                                   \r
98         (f0.1) mov (4)  gdWGT(0,4)<1>   gWGT<4;4,1>:d                                   \r
99         \r
100 INTERLABEL(CONVERT_MVS):\r
101         // MV conversion - Convert each MV to absolute coord. (= MV + MB org. + block offset)\r
102         shl (2)         gwTEMP(0)<1>            gX<2;2,1>:w                                             2:w // Convert MB origin to 1/4-pel unit\r
103         add (16)        gMV<1>:w                        gMV<16;16,1>:w                                  gwTEMP(0)<0;2,1>\r
104         add (2)         gwMV(0,4)<2>            gwMV(0,4)<4;2,2>                                32:w    //{NoDDClr}\r
105         add (2)         gwMV(0,9)<2>            gwMV(0,9)<4;2,2>                                32:w    //{NoDDChk,NoDDClr}\r
106         add (4)         gwMV(0,12)<1>           gwMV(0,12)<4;4,1>                               32:w    //{NoDDChk}\r
107                 \r
108 INTERLABEL(INIT_ADDRESS_REGS):\r
109         // Initialize the address registers\r
110         mov (2)         pERRORYC:ud                     nOFFSET_ERROR:ud                                {NoDDClr} // Address of Y and C error blocks\r
111         mov (1)         pRECON_MV:ud            nOFFSET_RECON_MV:ud                             {NoDDChk,NoDDClr} // Address of recon area and motion vectors\r
112         mov (1)         pWGT_BIDX:ud            nOFFSET_WGT_BIDX:ud                             {NoDDChk} // Address of weights/offsets and binding tbl idx\r
113         \r
114         // Read the parity of the current field (gPARITY - 0:top, 1:bottom, 3:frame)\r
115         // and set message descriptor for frame/field write\r
116 #if defined(MBAFF)\r
117         and.nz.f0.0 (1) null:uw                 gFIELDMBFLAG:ub                                 nFIELDMB_MASK:uw\r
118         (f0.0) and (1)  gPARITY:uw              gMBPARITY:ub                                    nMBPARITY_MASK:uw\r
119         (-f0.0) mov (1) gPARITY:uw              3:uw\r
120 #elif defined(FIELD)\r
121         and (1)         gPARITY:uw                      gMBPARITY:ub                                    nMBPARITY_MASK:uw\r
122 #endif\r
123         \r
124         \r
125 //#endif        // !defined(__INITIALIZE_MBPARA__)\r