Debian Codegraph @

src/shaders/post_processing/gen5_6/Core_Kernels/DI.inc

raw
1 /*
2 * All Video Processing kernels
3 * Copyright © <2010>, Intel Corporation.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 * This file was originally licensed under the following license
26 *
27 * Licensed under the Apache License, Version 2.0 (the "License");
28 * you may not use this file except in compliance with the License.
29 * You may obtain a copy of the License at
30 *
31 * http://www.apache.org/licenses/LICENSE-2.0
32 *
33 * Unless required by applicable law or agreed to in writing, software
34 * distributed under the License is distributed on an "AS IS" BASIS,
35 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36 * See the License for the specific language governing permissions and
37 * limitations under the License.
38 *
39 */
40
41 // Module name: DI.inc
42
43 #ifdef GT
44 // GT DI Kernel
45 #else // ILK
46 // ILK DI Kernel
47 #endif
48
49
50 //---------------------------------------------------------------------------
51 // Binding table indices
52 //---------------------------------------------------------------------------
53 #define nBIDX_DI_PRV 10 // Previous DI-ed frame
54 #define nBIDX_DI_CUR 13 // Current DI-ed frame
55 #define nBIDX_DN 7 // Denoised frame
56 #define nBIDX_STAT 20 // Statistics
57 #define nBIDX_DI_Source 4 // Source Surface
58
59
60 //---------------------------------------------------------------------------
61 // Message descriptors
62 //---------------------------------------------------------------------------
63 // Extended message descriptor
64 #define nSMPL_ENGINE 0x2
65 #define nDATAPORT_WRITE 0x5
66 #define nTS_EOT 0x27 // with End-Of-Thread bit ON
67
68 // Message descriptor for end-of-thread
69 // = 000 0001 (message len) 00000 (resp len)
70 // 0 (header present 0) 00000000000000 0 (URB dereferenced) 0000
71 #define nEOT_MSGDSC 0x02000000
72
73 // Message descriptor for sampler read
74 // = 000 0010 (message len 2) 00000 (resp len - set later, 12 or 5 or 11)
75 // 1 (header present 1) 0 11 (SIMD32/64 mode)
76 // 1000 (message type) 0000 (DI state index)
77 // 00000000 (binding table index - set later)
78 // = 0x040b8000
79
80 // comment begin
81 // The following is commented out because of walker feature
82 // It corresponds to the #ifdef GT #else and #endif
83 //#define nSMPL_MSGDSC 0x040b8000
84 //#define nSMPL_RESP_LEN_DI 0x00c00000 // 12
85 //#define nSMPL_RESP_LEN_NODI_PL 0x00500000 // 5
86 //#define nSMPL_RESP_LEN_NODI_PA 0x00900000 // 9
87 //#define nSMPL_RESP_LEN_NODN 0x00900000 // 9
88 //#define nSMPL_RESP_LEN_PDI 0x00b00000 // 11
89 // comment end
90
91 #ifdef GT
92
93 #define nSMPL_MSGDSC 0x040b8000
94 #define nSMPL_RESP_LEN_DI 0x00c00000 // 12
95 #define nSMPL_RESP_LEN_NODI_PL 0x00500000 // 5 //DI disable, the XY stored in 5th GRF, no impact to return length
96 #define nSMPL_RESP_LEN_NODI_PA 0x00900000 // 9 //DI disable, the XY stored in 5th GRF, no impact to return length
97 #define nSMPL_RESP_LEN_NODN 0x00a00000 // 10 //NO DN, originally use 9, now we need use 10 to store the XY with walker
98 #define nSMPL_RESP_LEN_PDI 0x00b00000 // 11
99
100 #else
101
102 #define nSMPL_MSGDSC 0x040b8000
103 #define nSMPL_RESP_LEN_DI 0x00c00000 // 12
104 #define nSMPL_RESP_LEN_NODI_PL 0x00500000 // 5
105 #define nSMPL_RESP_LEN_NODI_PA 0x00900000 // 9
106 #define nSMPL_RESP_LEN_NODN 0x00900000 // 9
107 #define nSMPL_RESP_LEN_PDI 0x00b00000 // 11
108
109 #endif
110
111 // Message descriptor for dataport media write
112 #ifdef GT
113 // = 000 0000 (message len - set later) 00000 (resp len 0)
114 // 1 (header present 1) 0 0 1010 (media block write) 00000
115 // 00000000 (binding table index - set later)
116 // = 0x00094000
117 #define nDPMW_MSGDSC 0x00094000
118 #else // ILK
119 // = 000 0000 (message len - set later) 00000 (resp len 0)
120 // 1 (header present 1) 000 0 010 (media block write) 0000
121 // 00000000 (binding table index - set later)
122 // = 0x00082000
123 #define nDPMW_MSGDSC 0x00082000
124 #endif
125 #define nDPMW_MSG_LEN_STMM 0x04000000 // 2 - STMM
126 #define nDPMW_MSG_LEN_DH 0x04000000 // 2 - Denoise history
127 #define nDPMW_MSG_LEN_PA_DN 0x0a000000 // 5 - Denoised output
128 #define nDPMW_MSG_LEN_PA_NODI 0x12000000 // 9 - Denoised output - denoise only - DI disabled
129 #define nDPMW_MSG_LEN_PL_DN 0x06000000 // 3 - Denoised output
130 #define nDPMW_MSG_LEN_PL_NODI 0x0a000000 // 5 - Denoised output - denoise only - DI disabled
131 #define nDPMW_MSG_LEN_DI 0x0a000000 // 5 - DI output
132
133
134 //---------------------------------------------------------------------------
135 // Static and inline parameters
136 //---------------------------------------------------------------------------
137 // Static parameters
138 .declare ubTFLD_FIRST Base=r1.27 ElementSize=1 Type=ub // top field first
139 .declare ubSRCYUVOFFSET Base=r1.4 ElementSize=1 Type=ub // source packed format
140 .declare ubDSTYUVOFFSET Base=r1.8 ElementSize=1 Type=ub // destination packed format
141 .declare uwSPITCH_DIV2 Base=r1.10 ElementSize=2 Type=uw // statistics surface pitch divided by 2
142
143 // Inline parameters
144 .declare uwXORIGIN Base=r5.0 ElementSize=2 Type=uw // X and Y origin
145 .declare uwYORIGIN Base=r5.1 ElementSize=2 Type=uw
146
147
148 //---------------------------------------------------------------------------
149 // Kernel GRF variables
150 //---------------------------------------------------------------------------
151 // Message response (Denoised & DI-ed pixels & statistics)
152 .declare dRESP Base=r8 ElementSize=4 Type=d // Response message (12 or 5 or 11)
153 .declare ubRESP Base=r8 ElementSize=1 Type=ub
154
155 .declare dSTMM Base=r16 ElementSize=4 Type=d // STMM
156 .declare ubDN_HIST_NODI Base=r12 ElementSize=1 Type=ub // Denoise history data (DI disabled)
157 .declare ubDN_HIST_DI Base=r17 ElementSize=1 Type=ub // Denoise history data (DI enabled)
158 .declare uwRETURNED_POSITION_DI Base=r17 ElementSize=2 Type=uw // XY_Return_Data (DI enabled)
159 .declare uwRETURNED_POSITION_DN Base=r12 ElementSize=2 Type=uw // XY_Return_Data (DI disabled)
160
161 .declare ub1ST_FLD_DN Base=r12 ElementSize=1 Type=ub // 1st field Denoised data (DI enabled)
162 .declare d1ST_FLD_DN Base=r12 ElementSize=4 Type=d
163 .declare ub2ND_FLD_DN Base=r18 ElementSize=1 Type=ub // 2nd field Denoised data (DI enabled)
164 .declare d2ND_FLD_DN Base=r18 ElementSize=4 Type=d
165 .declare ubPRV_DI Base=r8 ElementSize=1 Type=ub // Previous frame DI (DI enabled)
166 .declare ubCUR_DI Base=r12 ElementSize=1 Type=ub // Previous frame DI (DI enabled)
167
168 // Packed denoised output
169 .declare ubDN_YUV Base=r22 ElementSize=1 Type=ub // Denoised YUV422
170 .declare dDN_YUV Base=r22 ElementSize=4 Type=d
171 #define npDN_YUV 704 // = 22*32 = 0x280
172
173 // Packed DI output
174 .declare dDI_YUV_PRV Base=r32 ElementSize=4 Type=d // Previous frame DI output
175 .declare dDI_YUV_CUR Base=r36 ElementSize=4 Type=d // Current frame DI output
176 #define npDI_YUV 1024 // = 32*32 = 0x
177
178 // For packed output
179 #define p422_YOFFSET a0.2
180 #define p422_UOFFSET a0.3
181 #define p422_VOFFSET a0.4
182 #define pDN_TFLDSRC a0.6
183 #define pDN_BFLDSRC a0.7
184 #define npRESP 192 // = 6*32
185
186 // Message source
187 .declare udMSGSRC Base=r70 ElementSize=4 Type=ud
188 .declare uwMSGSRC Base=r70 ElementSize=2 Type=uw
189 .declare dMSGSRC Base=r70 ElementSize=4 Type=d
190
191
192 //---------------------------------------------------------------------------
193 // Kernel MRF variables
194 //---------------------------------------------------------------------------
195 #define mMSGHDR_SMPL m1 // Sampler response: m1~m2
196 .declare mudMSGHDR_SMPL Base=m1 ElementSize=4 Type=ud
197 .declare muwMSGHDR_SMPL Base=m1 ElementSize=2 Type=uw
198 #define mMSGHDR_DN m3 // Denoise output: m3~m7 for PA, m3~m5 for PL
199 .declare mdMSGHDR_DN Base=m3 ElementSize=4 Type=d
200 #define mMSGHDR_STAT m8 // Statistics output: m8~m9
201 .declare mdMSGHDR_STAT Base=m8 ElementSize=4 Type=d
202 .declare mubMSGHDR_STAT Base=m8 ElementSize=1 Type=ub
203 #define mMSGHDR_DI m10 // DI output: m10~m14
204 .declare mdMSGHDR_DI Base=m10 ElementSize=4 Type=d
205 #define mMSGHDR_EOT m15 // EOT
206
207 #ifdef GT
208 #define MSGSRC
209 #else
210 #define MSGSRC null:ud
211 #endif
212
213
214 //---------------------------------------------------------------------------
215 // End of thread instruction
216 //---------------------------------------------------------------------------
217 #ifdef GT
218 #define END_THREAD send (8) null<1>:d mMSGHDR_EOT nTS_EOT nEOT_MSGDSC
219 #else // ILK
220 #define END_THREAD send (8) null<1>:d mMSGHDR_EOT null:ud nTS_EOT nEOT_MSGDSC
221 #endif
222
223
224 // end of DI.inc