| 1 |
/* |
| 2 |
* Copyright 2000-2011 Intel Corporation All Rights Reserved |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 5 |
* copy of this software and associated documentation files (the |
| 6 |
* "Software"), to deal in the Software without restriction, including |
| 7 |
* without limitation the rights to use, copy, modify, merge, publish, |
| 8 |
* distribute, sub license, and/or sell copies of the Software, and to |
| 9 |
* permit persons to whom the Software is furnished to do so, subject to |
| 10 |
* the following conditions: |
| 11 |
* |
| 12 |
* The above copyright notice and this permission notice (including the |
| 13 |
* next paragraph) shall be included in all copies or substantial portions |
| 14 |
* of the Software. |
| 15 |
* |
| 16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 17 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
| 19 |
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR |
| 20 |
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 21 |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 22 |
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 |
* |
| 24 |
* This file was originally licensed under the following license |
| 25 |
* |
| 26 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 27 |
* you may not use this file except in compliance with the License. |
| 28 |
* You may obtain a copy of the License at |
| 29 |
* |
| 30 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 31 |
* |
| 32 |
* Unless required by applicable law or agreed to in writing, software |
| 33 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 34 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 35 |
* See the License for the specific language governing permissions and |
| 36 |
* limitations under the License. |
| 37 |
*/ |
| 38 |
// 33 // Total instruction count |
| 39 |
// 1 // Total kernel count |
| 40 |
|
| 41 |
|
| 42 |
// Module name: common.inc |
| 43 |
// |
| 44 |
// Common header file for all Video-Processing kernels |
| 45 |
// |
| 46 |
|
| 47 |
.default_execution_size (16) |
| 48 |
.default_register_type :ub |
| 49 |
|
| 50 |
.reg_count_total 128 |
| 51 |
.reg_count_payload 7 |
| 52 |
|
| 53 |
//========== Common constants ========== |
| 54 |
|
| 55 |
|
| 56 |
//========== Macros ========== |
| 57 |
|
| 58 |
|
| 59 |
//Fast Jump, For more details see "Set_Layer_N.asm" |
| 60 |
|
| 61 |
|
| 62 |
//========== Defines ==================== |
| 63 |
|
| 64 |
//========== Static Parameters (Common To All) ========== |
| 65 |
//r1 |
| 66 |
|
| 67 |
|
| 68 |
//r2 |
| 69 |
|
| 70 |
// e.g. byte0 byte1 byte2 |
| 71 |
// YUYV 0 1 3 |
| 72 |
// YVYU 0 3 1 |
| 73 |
|
| 74 |
//Color Pipe (IECP) parameters |
| 75 |
|
| 76 |
|
| 77 |
//r4 |
| 78 |
|
| 79 |
// e.g. byte0 byte1 byte2 |
| 80 |
// YUYV 0 1 3 |
| 81 |
// YVYU 0 3 1 |
| 82 |
|
| 83 |
|
| 84 |
//========== Inline parameters (Common To All) =========== |
| 85 |
|
| 86 |
|
| 87 |
//============== Binding Index Table=========== |
| 88 |
//Common between DNDI and DNUV |
| 89 |
|
| 90 |
|
| 91 |
//================= Common Message Descriptor ===== |
| 92 |
// Message descriptor for thread spawning |
| 93 |
// Message Descriptors |
| 94 |
// = 000 0001 (min message len 1 ) 0,0000 (resp len 0 -add later) |
| 95 |
// 0000,0000,0000 |
| 96 |
// 0001(Spawn a root thread),0001 (Root thread spawn thread) |
| 97 |
// = 0x02000011 |
| 98 |
// Thread Spawner Message Descriptor |
| 99 |
|
| 100 |
|
| 101 |
// Message descriptor for atomic operation add |
| 102 |
// Message Descriptors |
| 103 |
// = 000 0110 (min message len 6 ) 0,0000 (resp len 0 -add later) |
| 104 |
// 1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add) |
| 105 |
// 0000,0000 (Binding table index, added later) |
| 106 |
// = 0x02000011 |
| 107 |
|
| 108 |
// Atomic Operation Add Message Descriptor |
| 109 |
|
| 110 |
|
| 111 |
// Message descriptor for dataport media write |
| 112 |
// Message Descriptors |
| 113 |
// = 000 0001 (min message len 1 - add later) 00000 (resp len 0) |
| 114 |
// 1 (header present 1) 0 1010 (media block write) 000000 |
| 115 |
// 00000000 (binding table index - set later) |
| 116 |
// = 0x020A8000 |
| 117 |
|
| 118 |
|
| 119 |
// Message Length defines |
| 120 |
|
| 121 |
|
| 122 |
// Response Length defines |
| 123 |
|
| 124 |
|
| 125 |
// Block Width and Height Size defines |
| 126 |
|
| 127 |
|
| 128 |
// Extended Message Descriptors |
| 129 |
|
| 130 |
|
| 131 |
// Common message descriptors: |
| 132 |
|
| 133 |
|
| 134 |
//===================== Math Function Control =================================== |
| 135 |
|
| 136 |
|
| 137 |
//============ Message Registers =============== |
| 138 |
// buf4 starts from r28 |
| 139 |
|
| 140 |
|
| 141 |
//#define mMSGHDR_EOT r43 // Dummy Message Register for EOT |
| 142 |
|
| 143 |
|
| 144 |
.declare mubMSGPAYLOAD Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub |
| 145 |
.declare muwMSGPAYLOAD Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw |
| 146 |
.declare mudMSGPAYLOAD Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud |
| 147 |
.declare mfMSGPAYLOAD Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f |
| 148 |
|
| 149 |
//=================== End of thread instruction =========================== |
| 150 |
|
| 151 |
|
| 152 |
//=====================Pointers Used===================================== |
| 153 |
|
| 154 |
|
| 155 |
//======================================================================= |
| 156 |
|
| 157 |
|
| 158 |
//r11-r17 |
| 159 |
// Define temp space for any usages |
| 160 |
|
| 161 |
|
| 162 |
// Common Buffers |
| 163 |
|
| 164 |
|
| 165 |
// End of common.inc |
| 166 |
|
| 167 |
// FileName: DI_Save_PA_16x4.asm |
| 168 |
// Author: Vivek Kumar |
| 169 |
// Description: Save two 16x4 blocks of DI output in Packed format |
| 170 |
|
| 171 |
|
| 172 |
// FileName: DNDI.inc |
| 173 |
// Author: Vivek Kumar |
| 174 |
// Description: Include file for DN, DI and DNDI |
| 175 |
// Inputs: DI_ENABLE, DN_ENABLE, DN_PLANAR, DN_PACKED |
| 176 |
|
| 177 |
|
| 178 |
// End of common.inc |
| 179 |
|
| 180 |
|
| 181 |
//Interface: |
| 182 |
//Static Parameters: |
| 183 |
//r1 |
| 184 |
|
| 185 |
|
| 186 |
//====================== Binding table (Explicit To DNDI)========================================= |
| 187 |
|
| 188 |
|
| 189 |
.declare mudMSGHDR_DNDI Base=r18 ElementSize=4 Type=ud |
| 190 |
.declare mdMSGHDR_DNDI Base=r18 ElementSize=4 Type=d |
| 191 |
.declare mwMSGHDR_DNDI Base=r18 ElementSize=2 Type=w |
| 192 |
|
| 193 |
|
| 194 |
.declare mudMSGHDR_STMM Base=r20 ElementSize=4 Type=ud |
| 195 |
|
| 196 |
|
| 197 |
.declare mudMSGHDR_HIST Base=r22 ElementSize=4 Type=ud |
| 198 |
|
| 199 |
|
| 200 |
.declare mudMSGHDR_ENC_STATS Base=r24 ElementSize=4 Type=ud |
| 201 |
.declare muwMSGHDR_ENC_STATS Base=r24 ElementSize=2 Type=uw |
| 202 |
.declare mubMSGHDR_ENC_STATS Base=r24 ElementSize=1 Type=ub |
| 203 |
|
| 204 |
|
| 205 |
.declare mudMSGHDR_DN_OUT Base=r31.0 ElementSize=4 Type=ud |
| 206 |
.declare mdMSGHDR_DN_OUT Base=r31.0 ElementSize=4 Type=d |
| 207 |
.declare mubMSGHDR_DN_OUT Base=r31.0 ElementSize=1 Type=ub |
| 208 |
|
| 209 |
|
| 210 |
.declare mudMSGHDR_UVCOPY Base=r36 ElementSize=4 Type=ud |
| 211 |
.declare mdMSGHDR_UVCOPY Base=r36 ElementSize=4 Type=d |
| 212 |
.declare mudMSGHDR_UCOPY Base=r36 ElementSize=4 Type=ud |
| 213 |
.declare mudMSGHDR_VCOPY Base=r38 ElementSize=4 Type=ud |
| 214 |
|
| 215 |
|
| 216 |
.declare mudMSGHDR_DI_OUT1 Base=r18.0 ElementSize=4 Type=ud |
| 217 |
.declare mubMSGHDR_DI_OUT1 Base=r18.0 ElementSize=1 Type=ub |
| 218 |
|
| 219 |
|
| 220 |
.declare mudMSGHDR_DI_OUT2 Base=r23.0 ElementSize=4 Type=ud |
| 221 |
.declare mubMSGHDR_DI_OUT2 Base=r23.0 ElementSize=1 Type=ub |
| 222 |
|
| 223 |
//r45 |
| 224 |
//Use r45 as message header, so no need to "mov" the data. |
| 225 |
|
| 226 |
.declare mudDN_Y_OUT Base=r45.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud |
| 227 |
|
| 228 |
// Message response (Denoised & DI-ed pixels & statistics); Use buffer 5 |
| 229 |
.declare udDNDI_RESP Base=r46.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud |
| 230 |
.declare uwDNDI_RESP Base=r46.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw |
| 231 |
.declare ubDNDI_RESP Base=r46.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub |
| 232 |
|
| 233 |
// Message response (UV Copy); Use buffer 5 |
| 234 |
.declare udDNDI_UV_RESP Base=r58.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud |
| 235 |
.declare ubDNDI_UV_RESP Base=r58.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub |
| 236 |
|
| 237 |
//Temp GRFs: For 42X to 422 Conversion |
| 238 |
.declare uwDNDI_UVCOPY_TEMP Base=r10.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw //8 GRFs |
| 239 |
.declare ubDNDI_UVCOPY_TEMP Base=r10.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub //8 GRFs |
| 240 |
//--------------------------------------------------------------------------- |
| 241 |
// Message descriptors |
| 242 |
//--------------------------------------------------------------------------- |
| 243 |
// Extended message descriptor |
| 244 |
// Message descriptor for sampler read |
| 245 |
// = 000 0010 (message len 2) 00000 (resp len - set later, 12 or 5 or 11) |
| 246 |
// 1 (header present 1) 0 11 (SIMD32/64 mode) |
| 247 |
// 1000 (message type) 0000 (DI state index) |
| 248 |
// 00000000 (binding table index - set later) |
| 249 |
// = 0x040b8000 |
| 250 |
|
| 251 |
|
| 252 |
// Attention: The Message Length is The Number of GRFs with Data Only, without the Header |
| 253 |
|
| 254 |
|
| 255 |
//--------------------------------------------------------------------------- |
| 256 |
// VDI Return Data format |
| 257 |
//--------------------------------------------------------------------------- |
| 258 |
// Defines for DI enabled |
| 259 |
|
| 260 |
|
| 261 |
// Defines for DI disabled |
| 262 |
|
| 263 |
|
| 264 |
add (4) a0.4<1>:uw r2.28<4;4,1>:ub 608:w // Initial Y,U,V offset in YUV422 block; it starts at m20 |
| 265 |
|
| 266 |
mov (8) r27.0<1>:ud r0.0<8;8,1>:ud |
| 267 |
shl (1) r27.0<1>:d r9.0<0;1,0>:w 1:w { NoDDClr } // H. block origin need to be doubled |
| 268 |
mov (1) r27.1<1>:d r9.1<0;1,0>:w { NoDDClr, NoDDChk } // Block origin |
| 269 |
mov (1) r27.2<1>:ud 0x3001F:ud { NoDDChk } // Block width and height (32x8) |
| 270 |
|
| 271 |
//prepare the message headers |
| 272 |
mov (8) r18.0<1>:ud r27<8;8,1>:ud |
| 273 |
mov (8) r23.0<1>:ud r27<8;8,1>:ud |
| 274 |
|
| 275 |
// Pack 2nd field Y |
| 276 |
mov (16) r[a0.4, 0]<2> ubDNDI_RESP(0,0) { NoDDClr } |
| 277 |
mov (16) r[a0.4, 32]<2> ubDNDI_RESP(0,16) { NoDDClr } |
| 278 |
mov (16) r[a0.4, 64]<2> ubDNDI_RESP(0,32) { NoDDClr } |
| 279 |
mov (16) r[a0.4, 96]<2> ubDNDI_RESP(0,48) { NoDDClr } |
| 280 |
// Pack 2nd field U |
| 281 |
mov (8) r[a0.5, 0]<4> ubDNDI_RESP(2,1)<16;8,2> { NoDDClr, NoDDChk } //U pixels |
| 282 |
mov (8) r[a0.5, 32]<4> ubDNDI_RESP(2,17)<16;8,2> { NoDDClr, NoDDChk } //U pixels |
| 283 |
mov (8) r[a0.5, 64]<4> ubDNDI_RESP(2,33)<16;8,2> { NoDDClr, NoDDChk } //U pixels |
| 284 |
mov (8) r[a0.5, 96]<4> ubDNDI_RESP(2,49)<16;8,2> { NoDDClr, NoDDChk } //U pixels |
| 285 |
// Pack 2nd field V |
| 286 |
mov (8) r[a0.6, 0]<4> ubDNDI_RESP(2,0)<16;8,2> { NoDDChk } //Vpixels |
| 287 |
mov (8) r[a0.6, 32]<4> ubDNDI_RESP(2,16)<16;8,2> { NoDDChk } //Vpixels |
| 288 |
mov (8) r[a0.6, 64]<4> ubDNDI_RESP(2,32)<16;8,2> { NoDDChk } //Vpixels |
| 289 |
mov (8) r[a0.6, 96]<4> ubDNDI_RESP(2,48)<16;8,2> { NoDDChk } //Vpixels |
| 290 |
|
| 291 |
// Pack 1st field Y |
| 292 |
mov (16) r[a0.4, 160]<2> ubDNDI_RESP(4,0) { NoDDClr } |
| 293 |
mov (16) r[a0.4, 192]<2> ubDNDI_RESP(4,16) { NoDDClr } |
| 294 |
mov (16) r[a0.4, 224]<2> ubDNDI_RESP(4,32) { NoDDClr } |
| 295 |
mov (16) r[a0.4, 256]<2> ubDNDI_RESP(4,48) { NoDDClr } |
| 296 |
// Pack 1st field U |
| 297 |
mov (8) r[a0.5, 160]<4> ubDNDI_RESP(6,1)<16;8,2> { NoDDClr, NoDDChk } //U pixels |
| 298 |
mov (8) r[a0.5, 192]<4> ubDNDI_RESP(6,17)<16;8,2> { NoDDClr, NoDDChk } //U pixels |
| 299 |
mov (8) r[a0.5, 224]<4> ubDNDI_RESP(6,33)<16;8,2> { NoDDClr, NoDDChk } //U pixels |
| 300 |
mov (8) r[a0.5, 256]<4> ubDNDI_RESP(6,49)<16;8,2> { NoDDClr, NoDDChk } //U pixels |
| 301 |
// Pack 1st field V |
| 302 |
mov (8) r[a0.6, 160]<4> ubDNDI_RESP(6,0)<16;8,2> { NoDDChk } //Vpixels |
| 303 |
mov (8) r[a0.6, 192]<4> ubDNDI_RESP(6,16)<16;8,2> { NoDDChk } //Vpixels |
| 304 |
mov (8) r[a0.6, 224]<4> ubDNDI_RESP(6,32)<16;8,2> { NoDDChk } //Vpixels |
| 305 |
mov (8) r[a0.6, 256]<4> ubDNDI_RESP(6,48)<16;8,2> { NoDDChk } //Vpixels |
| 306 |
|
| 307 |
//save the previous frame |
| 308 |
send (8) null<1>:d r18.0 0x5 0xA0A801B:ud |
| 309 |
|
| 310 |
//save the current frame |
| 311 |
send (8) null<1>:d r23.0 0x5 0xA0A801E:ud |