Debian Codegraph @

src/shaders/post_processing/gen5_6/Core_Kernels/DNDI.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 #include "undefall.inc"
50
51 //---------------------------------------------------------------------------
52 // Message descriptors
53 //---------------------------------------------------------------------------
54 // Extended message descriptor
55 // Message descriptor for sampler read
56 // // = 000 0010 (message len 2) 00000 (resp len - set later, 12 or 5 or 11)
57 // // 1 (header present 1) 0 11 (SIMD32/64 mode)
58 // // 1000 (message type) 0000 (DI state index)
59 // // 00000000 (binding table index - set later)
60 // // = 0x040b8000
61 #define nSMPL_DI_MSGDSC 0x040b8000
62
63 #define nSMPL_RESP_LEN_DNDI nRESLEN_12 // 12 - for DN + DI Alg
64 #define nSMPL_RESP_LEN_DN_PL nRESLEN_5 // 5 - for DN Planar Alg
65 #define nSMPL_RESP_LEN_DN_PA nRESLEN_9 // 9 - for DN Packed Alg
66 #define nSMPL_RESP_LEN_DI nRESLEN_9 // 9 - for DI Only Alg
67 #define nSMPL_RESP_LEN_PDI nRESLEN_11 // 11 - for Partial DI Alg
68
69 // Attention: The Message Length is The Number of GRFs with Data Only, without the Header
70 #define nDPMW_MSG_LEN_STMM nMSGLEN_1 // 1 - For STMM Save
71 #define nDPMW_MSG_LEN_HIST nMSGLEN_1 // 1 - For Denoise History Save
72 #define nDPMW_MSG_LEN_PA_DN_DI nMSGLEN_4 // 4 - For DN Curr Save
73 #define nDPMW_MSG_LEN_PA_DN_NODI nMSGLEN_8 // 8 - For DN Curr Save (denoise only - DI disabled)
74 #define nDPMW_MSG_LEN_PL_DN_DI nMSGLEN_2 // 2 - For DN Curr Save
75 #define nDPMW_MSG_LEN_PL_DN_NODI nMSGLEN_4 // 4 - For DN Curr Save (denoise only - DI disabled)
76
77 #define nDPW_BLOCK_SIZE_STMM nBLOCK_WIDTH_8+nBLOCK_HEIGHT_4 // Y block size 8x4
78
79 #undef nDPW_BLOCK_SIZE_DI
80 #undef nDPW_MSG_SIZE_DI
81 #define nDPW_BLOCK_SIZE_DI nBLOCK_WIDTH_32+nBLOCK_HEIGHT_4
82 #define nDPW_MSG_SIZE_DI nMSGLEN_4
83
84
85 //---------------------------------------------------------------------------
86 // Kernel GRF variables
87 //---------------------------------------------------------------------------
88 // Defines for DI enabled
89 #define nDI_PREV_FRAME_LUMA_OFFSET 0
90 #define nDI_PREV_FRAME_CHROMA_OFFSET 2
91 #define nDI_CURR_FRAME_LUMA_OFFSET 4
92 #define nDI_CURR_FRAME_CHROMA_OFFSET 6
93 #define nDI_STMM_OFFSET 8
94 #define nDI_HIST_OFFSET 9
95 #define nDI_CURR_2ND_FIELD_LUMA_OFFSET 10
96 #define nDI_CURR_2ND_FIELD_CHROMA_OFFSET 11
97
98 // Defines for DI disabled
99 #define nNODI_LUMA_OFFSET 0
100 #define nNODI_HIST_OFFSET 4
101 #define nNODI_CHROMA_OFFSET 5
102
103 #ifdef DI_ENABLE
104 #define nHIST_OFFSET nDI_HIST_OFFSET
105 #undef nY_NUM_OF_ROWS
106 #define nY_NUM_OF_ROWS 8 // Number of Y rows per block (4 rows for each frame)
107 #undef nUV_NUM_OF_ROWS
108 #define nUV_NUM_OF_ROWS 8 // Number of U/V rows per block
109
110 #endif
111
112 #ifdef DI_DISABLE
113 #define nHIST_OFFSET nNODI_HIST_OFFSET
114 #endif
115
116 #if (nSRC_REGION==nREGION_2)
117 #define ub2SRC_Y ub2BOT_Y
118 #define ub2SRC_U ub2BOT_U
119 #define ub2SRC_V ub2BOT_V
120 #define uwDEST_Y uwBOT_Y
121 #define uwDEST_U uwBOT_U
122 #define uwDEST_V uwBOT_V
123 #define nDEST_YUV_REG nTOP_Y
124 #define udDEST_YUV udTOP_Y_IO
125
126 #define nRESP nTEMP0 // DI return message requires 12 GRFs
127 #define nDN_YUV nTOP_Y // Space for Packing DN for next run requires 8 GRFs
128
129 #undef nSRC_REGION
130 #define nSRC_REGION nREGION_2
131
132 #else
133 #define ub2SRC_Y ub2TOP_Y
134 #define ub2SRC_U ub2TOP_U
135 #define ub2SRC_V ub2TOP_V
136 #define uwDEST_Y uwTOP_Y
137 #define uwDEST_U uwTOP_U
138 #define uwDEST_V uwTOP_V
139 #define nDEST_YUV_REG nBOT_Y
140 #define udDEST_YUV udBOT_Y_IO
141 #define nRESP nTEMP0 // DI return message requires 12 GRFs
142 #define nDN_YUV nBOT_Y // Space for Packing DN for next run requires 8 GRFs
143
144 #undef nSRC_REGION
145 #define nSRC_REGION nREGION_1 // REGION_1 will be the source region for first kernel
146
147 #endif
148
149
150
151
152
153
154
155
156
157 // Message response (Denoised & DI-ed pixels & statistics)
158 .declare udRESP Base=REG(r,nRESP) ElementSize=4 SrcRegion=REGION(8,1) DstRegion=<1> Type=ud
159 .declare ubRESP Base=REG(r,nRESP) ElementSize=1 SrcRegion=REGION(16,1) DstRegion=<1> Type=ub
160
161 // For Denoised Curr Output (Used as Priv in Next Run)
162 .declare ubDN_YUV Base=REG(r,nDN_YUV) ElementSize=1 Type=ub
163 .declare udDN_YUV Base=REG(r,nDN_YUV) ElementSize=4 Type=ud
164 #define npDN_YUV nDN_YUV*nGRFWIB
165
166 // For DI Process Output (1st and 2nd Frames Output)
167 //.declare udDI_YUV_PRIV Base=REG(r,nTEMP0) ElementSize=4 Type=ud // Previous frame DI output
168 //.declare udDI_YUV_CURR Base=REG(r,nTEMP0) ElementSize=4 Type=ud // Current frame DI output
169 //#define npDI_YUV nTEMP0*nGRFWIB
170
171 //---------------------------------------------------------------------------
172 // Kernel MRF variables
173 //---------------------------------------------------------------------------
174 #define mMSG_SMPL m1 // Sampler Command is in: m1~m2
175 .declare mudMSG_SMPL Base=mMSG_SMPL ElementSize=4 Type=ud
176 .declare muwMSG_SMPL Base=mMSG_SMPL ElementSize=2 Type=uw
177
178 #define mMSGHDR_DN m1 // Denoise Output: m1~m9 for PA, m3~m5 for PL
179 .declare mudMSGHDR_DN Base=mMSGHDR_DN ElementSize=4 Type=ud
180 .declare mubMSGHDR_DN Base=mMSGHDR_DN ElementSize=1 Type=ub
181
182 #define mMSGHDR_STMM m11 // STMM Output: m11~m12
183 .declare mudMSGHDR_STMM Base=mMSGHDR_STMM ElementSize=4 Type=ud
184 #define mMSGHDR_HIST m13 // HIST Output: m13~m14
185 .declare mudMSGHDR_HIST Base=mMSGHDR_HIST ElementSize=1 Type=ud
186
187 #define mMSGHDR_DI_1ST m1 // DI output: m1~m5
188 .declare mudMSGHDR_DI_1ST Base=mMSGHDR_DI_1ST ElementSize=4 Type=ud
189 #define mMSGHDR_DI_2ND m6 // DI output: m6~m10
190 .declare mudMSGHDR_DI_2ND Base=mMSGHDR_DI_2ND ElementSize=4 Type=ud
191
192 // end of DNDI.inc