Debian Codegraph @

src/shaders/mpeg2/vld/iq_intra.g4i

raw
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 <[email protected]>
25 * Yan Li <[email protected]>
26 * Liu Xi bin<[email protected]>
27 */
28 /* GRF allocation:
29 g1~g30: constant buffer
30 g1~g2:intra IQ matrix in UB format
31 g3~g4:non intra IQ matrix in UB format
32 g5~g20:IDCT table
33 g32~g55:DCT data before IQ
34 g56~g79:DCT data after IQ
35 g82: thread payload backup
36 g109: g109.0:q_scale_code, g109.4:intra_dc_mult,
37 g110: q_scale_code
38 g111: intra DC coefficient
39 g112~g115: intra IQ matrix in UW format (in order to use instruction compress), copys from g1~g2
40 g125: ip before jump
41 */
42 and (1) g109.0<1>UW g82.8<1,1,1>UW 0x1fUW {align1}; //q_scale_code
43
44 and (1) g109.4<1>UW g82.8<1,1,1>UW 0x6000UW {align1}; //intra_dc_presion
45 shr (1) g109.4<1>UW g109.4<1,1,1>UW 13UW {align1};
46 mov (1) g109.6<1>UW 0x8UW {align1};
47 shr (1) g109.4<1>UW g109.6<1,1,1>UW g109.4<1,1,1>UW {align1}; //intra_dc_mult
48
49 and.z (1) null g82.8<1,1,1>UW 0x20UW {align1}; //if(q_scale_type==0) q_scale=q_scale_code*2;
50 (f0) jmpi Q_SCALE_TYPE_0;
51
52 cmp.l (1) null g109.0<1,1,1>UW 9UW {align1}; //if(q_scale_type!=0) calculate q_scale
53 (f0) jmpi DO_IQ;
54 cmp.l (1) null g109.0<1,1,1>UW 17UW {align1};
55 (f0) jmpi RANG_9_16;
56 cmp.l (1) null g109.0<1,1,1>UW 25UW {align1};
57 (f0) jmpi RANG_17_24;
58
59 RANG_25_31:
60 add (1) g109.0<1>UW g109.0<1,1,1>UW -25W {align1};
61 shl (1) g109.0<1>UW g109.0<1,1,1>UW 3UW {align1};
62 add (1) g109.0<1>UW g109.0<1,1,1>UW 64UW {align1};
63 jmpi DO_IQ;
64
65 RANG_9_16:
66 add (1) g109.0<1>UW g109.0<1,1,1>UW -9W {align1};
67 shl (1) g109.0<1>UW g109.0<1,1,1>UW 1UW {align1};
68 add (1) g109.0<1>UW g109.0<1,1,1>UW 10UW {align1};
69 jmpi DO_IQ;
70
71 RANG_17_24:
72 add (1) g109.0<1>UW g109.0<1,1,1>UW -17W {align1};
73 shl (1) g109.0<1>UW g109.0<1,1,1>UW 2UW {align1};
74 add (1) g109.0<1>UW g109.0<1,1,1>UW 28UW {align1};
75 jmpi DO_IQ;
76
77 Q_SCALE_TYPE_0:
78 shl (1) g109.0<1>UW g109.0<1,1,1>UW 1UD {align1};
79
80 DO_IQ:
81 mov (1) g110.0<1>UW g109.0<1,1,1>UW {align1};
82
83 mov (16) g112.0<1>UW g1.0<16,16,1>UB {align1};
84 mov (16) g113.0<1>UW g1.16<16,16,1>UB {align1};
85 mov (16) g114.0<1>UW g2.0<16,16,1>UB {align1};
86 mov (16) g115.0<1>UW g2.16<16,16,1>UB {align1};
87
88 mov (1) a0.0<1>UD 0x03F003E0UD {align1};
89
90 mov (1) g125.0<1>UD ip {align1};
91 jmpi DO_IQ_INTRA;
92 mov (16) g56.0<1>W g116.0<16,8,2>W {align1};
93 mov (16) g57.0<1>W g118.0<16,8,2>W {align1};
94 mov (16) g58.0<1>W g120.0<16,8,2>W {align1};
95 mov (16) g59.0<1>W g122.0<16,8,2>W {align1};
96
97 mov (1) g125.0<1>UD ip {align1};
98 jmpi DO_IQ_INTRA;
99 mov (16) g60.0<1>W g116.0<16,8,2>W {align1};
100 mov (16) g61.0<1>W g118.0<16,8,2>W {align1};
101 mov (16) g62.0<1>W g120.0<16,8,2>W {align1};
102 mov (16) g63.0<1>W g122.0<16,8,2>W {align1};
103
104 mov (1) g125.0<1>UD ip {align1};
105 jmpi DO_IQ_INTRA;
106 mov (16) g64.0<1>W g116.0<16,8,2>W {align1};
107 mov (16) g65.0<1>W g118.0<16,8,2>W {align1};
108 mov (16) g66.0<1>W g120.0<16,8,2>W {align1};
109 mov (16) g67.0<1>W g122.0<16,8,2>W {align1};
110
111 mov (1) g125.0<1>UD ip {align1};
112 jmpi DO_IQ_INTRA;
113 mov (16) g68.0<1>W g116.0<16,8,2>W {align1};
114 mov (16) g69.0<1>W g118.0<16,8,2>W {align1};
115 mov (16) g70.0<1>W g120.0<16,8,2>W {align1};
116 mov (16) g71.0<1>W g122.0<16,8,2>W {align1};
117
118 mov (1) g125.0<1>UD ip {align1};
119 jmpi DO_IQ_INTRA;
120 mov (16) g72.0<1>W g116.0<16,8,2>W {align1};
121 mov (16) g73.0<1>W g118.0<16,8,2>W {align1};
122 mov (16) g74.0<1>W g120.0<16,8,2>W {align1};
123 mov (16) g75.0<1>W g122.0<16,8,2>W {align1};
124
125 mov (1) g125.0<1>UD ip {align1};
126 jmpi DO_IQ_INTRA;
127 mov (16) g76.0<1>W g116.0<16,8,2>W {align1};
128 mov (16) g77.0<1>W g118.0<16,8,2>W {align1};
129 mov (16) g78.0<1>W g120.0<16,8,2>W {align1};
130 mov (16) g79.0<1>W g122.0<16,8,2>W {align1};
131