Initial code release
[profile/ivi/xorg-x11-drv-intel.git] / src / xvmc / shader / vld / field_f_b.g4a
1 /*
2  * Copyright © 2009 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  *
23  * Author:
24  *    Zou Nan hai <nanhai.zou@intel.com>
25  *    Yan Li <li.l.yan@intel.com>
26  *    Liu Xi bin<xibin.liu@intel.com>
27  */
28 /* GRF allocation:
29    g1~g30: constant buffer
30            g1~g2:intra IQ matrix
31            g3~g4:non intra IQ matrix
32            g5~g20:IDCT table
33    g31:    thread payload 
34    g58~g81:reference data
35    g82:    thread payload backup
36    g83~g106:IDCT data
37    g115:   message descriptor for reading reference data   */
38 mov (8) g82.0<1>UD g31.0<8,8,1>UD {align1};
39 mov(2) g31.0<1>UD g82.12<2,2,1>UW {align1};
40 mov (1) g126.8<1>UD ip {align1};
41 mov (1) ip g21.0<1,1,1>UD {align1};
42
43 /*field 0 forward prediction of Y*/
44 asr (2) g31.14<1>W g82.16<2,2,1>W 1W {align1};
45 shl (1) g31.16<1>W g31.16<1,1,1>W 1W {align1};
46 add (2) g115.0<1>UD g31.0<2,2,1>UD g31.14<2,2,1>W {align1};
47 and (1) g115.4<1>UD g115.4<1,1,1>UD 0xFFFFFFFEUD {align1};
48 and.nz (1) null g82.2<1,1,1>UW 0x1000UW {align1};
49 (f0) add (1) g115.4<1>UD g115.4<1,1,1>UD 1UD {align1};
50 define(`surface',`4')
51 define(`mv1',`g82.16')
52 define(`mv2',`g82.18')
53 include(`motion_field_y.g4i')
54 mov (8) g58.0<1>UD g32.0<8,8,1>UD {align1};
55 mov (8) g60.0<1>UD g33.0<8,8,1>UD {align1};
56 mov (8) g62.0<1>UD g34.0<8,8,1>UD {align1};
57 mov (8) g64.0<1>UD g35.0<8,8,1>UD {align1};
58 mov (8) g66.0<1>UD g36.0<8,8,1>UD {align1};
59 mov (8) g68.0<1>UD g37.0<8,8,1>UD {align1};
60 mov (8) g70.0<1>UD g38.0<8,8,1>UD {align1};
61 mov (8) g72.0<1>UD g39.0<8,8,1>UD {align1};
62
63 /*field 1 forward prediction of Y*/
64 asr (2) g31.14<1>W g82.24<2,2,1>W 1W {align1};
65 shl (1) g31.16<1>W g31.16<1,1,1>W 1W {align1};
66 add (2) g115.0<1>UD g31.0<2,2,1>UD g31.14<2,2,1>W {align1};
67 and (1) g115.4<1>UD g115.4<1,1,1>UD 0xFFFFFFFEUD {align1};
68 and.nz (1) null g82.2<1,1,1>UW 0x4000UW {align1};
69 (f0) add (1) g115.4<1>UD g115.4<1,1,1>UD 1UD {align1};
70 define(`surface',`4')
71 define(`mv1',`g82.24')
72 define(`mv2',`g82.26')
73 include(`motion_field_y.g4i')
74 mov (8) g59.0<1>UD g32.0<8,8,1>UD {align1};
75 mov (8) g61.0<1>UD g33.0<8,8,1>UD {align1};
76 mov (8) g63.0<1>UD g34.0<8,8,1>UD {align1};
77 mov (8) g65.0<1>UD g35.0<8,8,1>UD {align1};
78 mov (8) g67.0<1>UD g36.0<8,8,1>UD {align1};
79 mov (8) g69.0<1>UD g37.0<8,8,1>UD {align1};
80 mov (8) g71.0<1>UD g38.0<8,8,1>UD {align1};
81 mov (8) g73.0<1>UD g39.0<8,8,1>UD {align1};
82
83 /*field 0 forward prediction of UV*/
84 shr (2) g31.0<1>UD g31.0<2,2,1>UD 1UD {align1};
85 asr (2) g82.16<1>W g82.16<2,2,1>W 1W {align1};
86 asr (2) g31.14<1>W g82.16<2,2,1>W 1W {align1};
87 shl (1) g31.16<1>W g31.16<1,1,1>W 1W {align1};
88 add (2) g115.0<1>UD g31.0<2,2,1>UD g31.14<2,2,1>W {align1};
89 and (1) g115.4<1>UD g115.4<1,1,1>UD 0xFFFFFFFEUD {align1};
90 and.nz (1) null g82.2<1,1,1>UW 0x1000UW {align1};
91 (f0) add (1) g115.4<1>UD g115.4<1,1,1>UD 1UD {align1};
92 define(`surface_u', `5')
93 define(`surface_v', `6')
94 define(`mv1',`g82.16')
95 define(`mv2',`g82.18')
96 include(`motion_field_uv.g4i')
97 mov (8) g74.0<1>UW g32.0<8,8,1>UW {align1};
98 mov (8) g75.0<1>UW g33.0<8,8,1>UW {align1};
99 mov (8) g76.0<1>UW g34.0<8,8,1>UW {align1};
100 mov (8) g77.0<1>UW g35.0<8,8,1>UW {align1};
101 mov (8) g78.0<1>UW g36.0<8,8,1>UW {align1};
102 mov (8) g79.0<1>UW g37.0<8,8,1>UW {align1};
103 mov (8) g80.0<1>UW g38.0<8,8,1>UW {align1};
104 mov (8) g81.0<1>UW g39.0<8,8,1>UW {align1};
105
106 /*field 1 forward prediction of UV*/
107 asr (2) g82.24<1>W g82.24<2,2,1>W 1W {align1};
108 asr (2) g31.14<1>W g82.24<2,2,1>W 1W {align1};
109 shl (1) g31.16<1>W g31.16<1,1,1>W 1W {align1};
110 add (2) g115.0<1>UD g31.0<2,2,1>UD g31.14<2,2,1>W {align1};
111 and (1) g115.4<1>UD g115.4<1,1,1>UD 0xFFFFFFFEUD {align1};
112 and.nz (1) null g82.2<1,1,1>UW 0x4000UW {align1};
113 (f0) add (1) g115.4<1>UD g115.4<1,1,1>UD 1UD {align1};
114 define(`mv1',`g82.24')
115 define(`mv2',`g82.26')
116 include(`motion_field_uv.g4i')
117 mov (8) g74.16<1>UW g32.0<8,8,1>UW {align1};
118 mov (8) g75.16<1>UW g33.0<8,8,1>UW {align1};
119 mov (8) g76.16<1>UW g34.0<8,8,1>UW {align1};
120 mov (8) g77.16<1>UW g35.0<8,8,1>UW {align1};
121 mov (8) g78.16<1>UW g36.0<8,8,1>UW {align1};
122 mov (8) g79.16<1>UW g37.0<8,8,1>UW {align1};
123 mov (8) g80.16<1>UW g38.0<8,8,1>UW {align1};
124 mov (8) g81.16<1>UW g39.0<8,8,1>UW {align1};
125
126 /*field 0 backward prediction of Y*/
127 mov(2) g31.0<1>UD g82.12<2,2,1>UW {align1};
128
129 asr (2) g31.14<1>W g82.20<2,2,1>W 1W {align1};
130 shl (1) g31.16<1>W g31.16<1,1,1>W 1W {align1};
131 add (2) g115.0<1>UD g31.0<2,2,1>UD g31.14<2,2,1>W {align1};
132 and (1) g115.4<1>UD g115.4<1,1,1>UD 0xFFFFFFFEUD {align1};
133 and.nz (1) null g82.2<1,1,1>UW 0x2000UW {align1};
134 (f0) add (1) g115.4<1>UD g115.4<1,1,1>UD 1UD {align1};
135 define(`surface',`7')
136 define(`mv1',`g82.20')
137 define(`mv2',`g82.22')
138 include(`motion_field_y.g4i')
139 avg.sat (16) g58.0<1>UW g58.0<16,16,1>UW g32.0<16,16,1>UW {align1};
140 avg.sat (16) g60.0<1>UW g60.0<16,16,1>UW g33.0<16,16,1>UW {align1};
141 avg.sat (16) g62.0<1>UW g62.0<16,16,1>UW g34.0<16,16,1>UW {align1};
142 avg.sat (16) g64.0<1>UW g64.0<16,16,1>UW g35.0<16,16,1>UW {align1};
143 avg.sat (16) g66.0<1>UW g66.0<16,16,1>UW g36.0<16,16,1>UW {align1};
144 avg.sat (16) g68.0<1>UW g68.0<16,16,1>UW g37.0<16,16,1>UW {align1};
145 avg.sat (16) g70.0<1>UW g70.0<16,16,1>UW g38.0<16,16,1>UW {align1};
146 avg.sat (16) g72.0<1>UW g72.0<16,16,1>UW g39.0<16,16,1>UW {align1};
147
148 /*field 1 backward prediction of Y*/
149 asr (2) g31.14<1>W g82.28<2,2,1>W 1W {align1};
150 shl (1) g31.16<1>W g31.16<1,1,1>W 1W {align1};
151 add (2) g115.0<1>UD g31.0<2,2,1>UD g31.14<2,2,1>W {align1};
152 and (1) g115.4<1>UD g115.4<1,1,1>UD 0xFFFFFFFEUD {align1};
153 and.nz (1) null g82.2<1,1,1>UW 0x8000UW {align1};
154 (f0) add (1) g115.4<1>UD g115.4<1,1,1>UD 1UD {align1};
155 define(`surface',`7')
156 define(`mv1',`g82.28')
157 define(`mv2',`g82.30')
158 include(`motion_field_y.g4i')
159 avg.sat (16) g59.0<1>UW g59.0<16,16,1>UW g32.0<16,16,1>UW {align1};
160 avg.sat (16) g61.0<1>UW g61.0<16,16,1>UW g33.0<16,16,1>UW {align1};
161 avg.sat (16) g63.0<1>UW g63.0<16,16,1>UW g34.0<16,16,1>UW {align1};
162 avg.sat (16) g65.0<1>UW g65.0<16,16,1>UW g35.0<16,16,1>UW {align1};
163 avg.sat (16) g67.0<1>UW g67.0<16,16,1>UW g36.0<16,16,1>UW {align1};
164 avg.sat (16) g69.0<1>UW g69.0<16,16,1>UW g37.0<16,16,1>UW {align1};
165 avg.sat (16) g71.0<1>UW g71.0<16,16,1>UW g38.0<16,16,1>UW {align1};
166 avg.sat (16) g73.0<1>UW g73.0<16,16,1>UW g39.0<16,16,1>UW {align1};
167
168 /*field 0 backward prediction of UV*/
169 shr (2) g31.0<1>UD g31.0<2,2,1>UD 1UD {align1};
170 asr (2) g82.20<1>W g82.20<2,2,1>W 1W {align1};
171 asr (2) g31.14<1>W g82.20<2,2,1>W 1W {align1};
172 shl (1) g31.16<1>W g31.16<1,1,1>W 1W {align1};
173 add (2) g115.0<1>UD g31.0<2,2,1>UD g31.14<2,2,1>W {align1};
174 and (1) g115.4<1>UD g115.4<1,1,1>UD 0xFFFFFFFEUD {align1};
175 and.nz (1) null g82.2<1,1,1>UW 0x2000UW {align1};
176 (f0) add (1) g115.4<1>UD g115.4<1,1,1>UD 1UD {align1};
177 define(`surface_u', `8')
178 define(`surface_v', `9')
179 define(`mv1',`g82.20')
180 define(`mv2',`g82.22')
181 include(`motion_field_uv.g4i')
182 avg.sat (8) g74.0<1>UW g74.0<8,8,1>UW g32.0<8,8,1>UW {align1};
183 avg.sat (8) g75.0<1>UW g75.0<8,8,1>UW g33.0<8,8,1>UW {align1};
184 avg.sat (8) g76.0<1>UW g76.0<8,8,1>UW g34.0<8,8,1>UW {align1};
185 avg.sat (8) g77.0<1>UW g77.0<8,8,1>UW g35.0<8,8,1>UW {align1};
186 avg.sat (8) g78.0<1>UW g78.0<8,8,1>UW g36.0<8,8,1>UW {align1};
187 avg.sat (8) g79.0<1>UW g79.0<8,8,1>UW g37.0<8,8,1>UW {align1};
188 avg.sat (8) g80.0<1>UW g80.0<8,8,1>UW g38.0<8,8,1>UW {align1};
189 avg.sat (8) g81.0<1>UW g81.0<8,8,1>UW g39.0<8,8,1>UW {align1};
190
191 /*field 1 backward prediction of UV*/
192 asr (2) g82.28<1>W g82.28<2,2,1>W 1W {align1};
193 asr (2) g31.14<1>W g82.28<2,2,1>W 1W {align1};
194 shl (1) g31.16<1>W g31.16<1,1,1>W 1W {align1};
195 add (2) g115.0<1>UD g31.0<2,2,1>UD g31.14<2,2,1>W {align1};
196 and (1) g115.4<1>UD g115.4<1,1,1>UD 0xFFFFFFFEUD {align1};
197 and.nz (1) null g82.2<1,1,1>UW 0x8000UW {align1};
198 (f0) add (1) g115.4<1>UD g115.4<1,1,1>UD 1UD {align1};
199 define(`mv1',`g82.28')
200 define(`mv2',`g82.30')
201 include(`motion_field_uv.g4i')
202 avg.sat (8) g74.16<1>UW g74.16<8,8,1>UW g32.0<8,8,1>UW {align1};
203 avg.sat (8) g75.16<1>UW g75.16<8,8,1>UW g33.0<8,8,1>UW {align1};
204 avg.sat (8) g76.16<1>UW g76.16<8,8,1>UW g34.0<8,8,1>UW {align1};
205 avg.sat (8) g77.16<1>UW g77.16<8,8,1>UW g35.0<8,8,1>UW {align1};
206 avg.sat (8) g78.16<1>UW g78.16<8,8,1>UW g36.0<8,8,1>UW {align1};
207 avg.sat (8) g79.16<1>UW g79.16<8,8,1>UW g37.0<8,8,1>UW {align1};
208 avg.sat (8) g80.16<1>UW g80.16<8,8,1>UW g38.0<8,8,1>UW {align1};
209 avg.sat (8) g81.16<1>UW g81.16<8,8,1>UW g39.0<8,8,1>UW {align1};
210
211 include(`addidct.g4i')
212 send (16) 0 acc0<1>UW g0<8,8,1>UW 
213         thread_spawner(0, 0, 0) mlen 1 rlen 0 { align1 EOT};