| 1 |
/* |
| 2 |
* Copyright 2000-2011 Intel Corporation All Rights Reserved |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
// 7 // Total instruction count |
| 17 |
// 1 // Total kernel count |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
// Module name: common.inc |
| 22 |
// |
| 23 |
// Common header file for all Video-Processing kernels |
| 24 |
// |
| 25 |
|
| 26 |
.default_execution_size (16) |
| 27 |
.default_register_type :ub |
| 28 |
|
| 29 |
.reg_count_total 128 |
| 30 |
.reg_count_payload 7 |
| 31 |
|
| 32 |
//========== Common constants ========== |
| 33 |
|
| 34 |
|
| 35 |
//========== Macros ========== |
| 36 |
|
| 37 |
|
| 38 |
//Fast Jump, For more details see "Set_Layer_N.asm" |
| 39 |
|
| 40 |
|
| 41 |
//========== Defines ==================== |
| 42 |
|
| 43 |
//========== Static Parameters (Common To All) ========== |
| 44 |
//r1 |
| 45 |
|
| 46 |
|
| 47 |
//r2 |
| 48 |
|
| 49 |
// e.g. byte0 byte1 byte2 |
| 50 |
// YUYV 0 1 3 |
| 51 |
// YVYU 0 3 1 |
| 52 |
|
| 53 |
//Color Pipe (IECP) parameters |
| 54 |
|
| 55 |
|
| 56 |
//ByteCopy |
| 57 |
|
| 58 |
|
| 59 |
//r4 |
| 60 |
|
| 61 |
// e.g. byte0 byte1 byte2 |
| 62 |
// YUYV 0 1 3 |
| 63 |
// YVYU 0 3 1 |
| 64 |
|
| 65 |
|
| 66 |
//========== Inline parameters (Common To All) =========== |
| 67 |
|
| 68 |
|
| 69 |
//============== Binding Index Table=========== |
| 70 |
//Common between DNDI and DNUV |
| 71 |
|
| 72 |
|
| 73 |
//================= Common Message Descriptor ===== |
| 74 |
// Message descriptor for thread spawning |
| 75 |
// Message Descriptors |
| 76 |
// = 000 0001 (min message len 1 ) 0,0000 (resp len 0 -add later) |
| 77 |
// 0000,0000,0000 |
| 78 |
// 0001(Spawn a root thread),0001 (Root thread spawn thread) |
| 79 |
// = 0x02000011 |
| 80 |
// Thread Spawner Message Descriptor |
| 81 |
|
| 82 |
|
| 83 |
// Message descriptor for atomic operation add |
| 84 |
// Message Descriptors |
| 85 |
// = 000 0110 (min message len 6 ) 0,0000 (resp len 0 -add later) |
| 86 |
// 1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add) |
| 87 |
// 0000,0000 (Binding table index, added later) |
| 88 |
// = 0x02000011 |
| 89 |
|
| 90 |
// Atomic Operation Add Message Descriptor |
| 91 |
|
| 92 |
|
| 93 |
// Message descriptor for dataport media write |
| 94 |
// Message Descriptors |
| 95 |
// = 000 0001 (min message len 1 - add later) 00000 (resp len 0) |
| 96 |
// 1 (header present 1) 0 1010 (media block write) 000000 |
| 97 |
// 00000000 (binding table index - set later) |
| 98 |
// = 0x020A8000 |
| 99 |
|
| 100 |
|
| 101 |
// Message Length defines |
| 102 |
|
| 103 |
|
| 104 |
// Response Length defines |
| 105 |
|
| 106 |
|
| 107 |
// Block Width and Height Size defines |
| 108 |
|
| 109 |
|
| 110 |
// Extended Message Descriptors |
| 111 |
|
| 112 |
|
| 113 |
// Common message descriptors: |
| 114 |
|
| 115 |
|
| 116 |
//===================== Math Function Control =================================== |
| 117 |
|
| 118 |
|
| 119 |
//============ Message Registers =============== |
| 120 |
// buf4 starts from r28 |
| 121 |
|
| 122 |
|
| 123 |
//#define mMSGHDR_EOT r43 // Dummy Message Register for EOT |
| 124 |
|
| 125 |
|
| 126 |
.declare mubMSGPAYLOAD Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub |
| 127 |
.declare muwMSGPAYLOAD Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw |
| 128 |
.declare mudMSGPAYLOAD Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud |
| 129 |
.declare mfMSGPAYLOAD Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f |
| 130 |
|
| 131 |
//=================== End of thread instruction =========================== |
| 132 |
|
| 133 |
|
| 134 |
//=====================Pointers Used===================================== |
| 135 |
|
| 136 |
|
| 137 |
//======================================================================= |
| 138 |
|
| 139 |
|
| 140 |
//r11-r17 |
| 141 |
// Define temp space for any usages |
| 142 |
|
| 143 |
|
| 144 |
// Common Buffers |
| 145 |
|
| 146 |
|
| 147 |
// temp space for rotation |
| 148 |
|
| 149 |
.declare fROBUF Base=r11.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f |
| 150 |
|
| 151 |
.declare udROBUF Base=r11.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud |
| 152 |
|
| 153 |
.declare uwROBUF Base=r11.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw |
| 154 |
|
| 155 |
.declare ubROBUF Base=r11.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub |
| 156 |
|
| 157 |
.declare ub4ROBUF Base=r11.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub |
| 158 |
|
| 159 |
|
| 160 |
// End of common.inc |
| 161 |
|
| 162 |
|
| 163 |
//Module Name: Set_AVS_Buf_0123_VYUA.asm |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
//Module Name: Set_Buf_0123_VYUA |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
// Description: Includes all definitions explicit to Fast Composite. |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
// End of common.inc |
| 178 |
|
| 179 |
|
| 180 |
//========== GRF partition ========== |
| 181 |
// r0 header : r0 (1 GRF) |
| 182 |
// Static parameters : r1 - r6 (6 GRFS) |
| 183 |
// Inline parameters : r7 - r8 (2 GRFs) |
| 184 |
// MSGSRC : r27 (1 GRF) |
| 185 |
//=================================== |
| 186 |
|
| 187 |
//Interface: |
| 188 |
//========== Static Parameters (Explicit To Fast Composite) ========== |
| 189 |
//r1 |
| 190 |
//CSC Set 0 |
| 191 |
|
| 192 |
|
| 193 |
.declare udCSC_CURBE Base=r1.0 ElementSize=4 Type=ud |
| 194 |
|
| 195 |
//Constant alpha |
| 196 |
|
| 197 |
|
| 198 |
//r2 |
| 199 |
|
| 200 |
|
| 201 |
// Gen7 AVS WA |
| 202 |
|
| 203 |
|
| 204 |
// WiDi Definitions |
| 205 |
|
| 206 |
|
| 207 |
//Colorfill |
| 208 |
|
| 209 |
|
| 210 |
// 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise. |
| 211 |
|
| 212 |
.declare ubCOLOR_PIXEL_VAL Base=r2.20 ElementSize=1 SrcRegion=<0;1,0> DstRegion=<1> Type=ub |
| 213 |
|
| 214 |
//r3 |
| 215 |
//Normalised Ratio of Horizontal step size with main video for all layers |
| 216 |
|
| 217 |
|
| 218 |
//Normalised Ratio of Horizontal step size with main video for all layers becomes |
| 219 |
//Normalised Horizontal step size for all layers in VP_Setup.asm |
| 220 |
|
| 221 |
|
| 222 |
//r4 |
| 223 |
//Normalised Vertical step size for all layers |
| 224 |
|
| 225 |
|
| 226 |
//r5 |
| 227 |
//Normalised Vertical Frame Origin for all layers |
| 228 |
|
| 229 |
|
| 230 |
//r6 |
| 231 |
//Normalised Horizontal Frame Origin for all layers |
| 232 |
|
| 233 |
|
| 234 |
//========== Inline Parameters (Explicit To Fast Composite) ========== |
| 235 |
|
| 236 |
|
| 237 |
//Main video Step X |
| 238 |
|
| 239 |
|
| 240 |
//====================== Binding table (Explicit To Fast Composite)========================================= |
| 241 |
|
| 242 |
|
| 243 |
//Used by Interlaced Scaling Kernels |
| 244 |
|
| 245 |
|
| 246 |
//========== Sampler State Table Index (Explicit To Fast Composite)========== |
| 247 |
//Sampler Index for AVS/IEF messages |
| 248 |
|
| 249 |
|
| 250 |
//Sampler Index for SIMD16 sampler messages |
| 251 |
|
| 252 |
|
| 253 |
//============================================================================= |
| 254 |
|
| 255 |
.declare fBUFFER_0 Base=r64.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f |
| 256 |
.declare fBUFFER_1 Base=r80.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f |
| 257 |
.declare fBUFFER_2 Base=r96.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f |
| 258 |
.declare fBUFFER_3 Base=r112.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f |
| 259 |
.declare fBUFFER_4 Base=r28.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f |
| 260 |
.declare fBUFFER_5 Base=r46.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f |
| 261 |
|
| 262 |
.declare udBUFFER_0 Base=r64.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud |
| 263 |
.declare udBUFFER_1 Base=r80.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud |
| 264 |
.declare udBUFFER_2 Base=r96.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud |
| 265 |
.declare udBUFFER_3 Base=r112.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud |
| 266 |
.declare udBUFFER_4 Base=r28.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud |
| 267 |
.declare udBUFFER_5 Base=r46.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud |
| 268 |
|
| 269 |
.declare uwBUFFER_0 Base=r64.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw |
| 270 |
.declare uwBUFFER_1 Base=r80.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw |
| 271 |
.declare uwBUFFER_2 Base=r96.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw |
| 272 |
.declare uwBUFFER_3 Base=r112.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw |
| 273 |
.declare uwBUFFER_4 Base=r28.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw |
| 274 |
.declare uwBUFFER_5 Base=r46.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw |
| 275 |
|
| 276 |
.declare ubBUFFER_0 Base=r64.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub |
| 277 |
.declare ubBUFFER_1 Base=r80.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub |
| 278 |
.declare ubBUFFER_2 Base=r96.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub |
| 279 |
.declare ubBUFFER_3 Base=r112.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub |
| 280 |
.declare ubBUFFER_4 Base=r28.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub |
| 281 |
.declare ubBUFFER_5 Base=r46.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub |
| 282 |
|
| 283 |
.declare ub4BUFFER_0 Base=r64.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub |
| 284 |
.declare ub4BUFFER_1 Base=r80.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub |
| 285 |
.declare ub4BUFFER_2 Base=r96.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub |
| 286 |
.declare ub4BUFFER_3 Base=r112.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub |
| 287 |
.declare ub4BUFFER_4 Base=r28.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub |
| 288 |
.declare ub4BUFFER_5 Base=r46.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub |
| 289 |
|
| 290 |
//Pointer to mask reg |
| 291 |
|
| 292 |
|
| 293 |
//r18 |
| 294 |
|
| 295 |
|
| 296 |
//Always keep Cannel Pointers and Offsets in same GRF, so that we can use |
| 297 |
// NODDCLR, NODDCHK flags. -rT |
| 298 |
|
| 299 |
|
| 300 |
.declare udCSC_COEFF_0 Base=r18.0 ElementSize=4 Type=ud // 1 GRF |
| 301 |
|
| 302 |
//r19 |
| 303 |
|
| 304 |
|
| 305 |
.declare udCSC_COEFF_1 Base=r19.0 ElementSize=4 Type=ud // 1 GRF |
| 306 |
|
| 307 |
|
| 308 |
//r20 |
| 309 |
|
| 310 |
.declare uwALPHA_MASK_REG_TEMP Base=r20.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw // 1 GRF |
| 311 |
|
| 312 |
//r21 |
| 313 |
|
| 314 |
.declare uwALPHA_MASK_REG Base=r21.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw // 1 GRF |
| 315 |
|
| 316 |
//r22 |
| 317 |
|
| 318 |
|
| 319 |
//Always keep Cannel Pointers and Offsets in same GRF, so that we can use |
| 320 |
// NODDCLR, NODDCHK flags. -rT |
| 321 |
|
| 322 |
|
| 323 |
//Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as |
| 324 |
//sub registers of same GRF to enable using NODDCLR NODDCHK. -rT |
| 325 |
|
| 326 |
//r23 |
| 327 |
|
| 328 |
|
| 329 |
//Lumakey |
| 330 |
|
| 331 |
|
| 332 |
//r24 |
| 333 |
|
| 334 |
|
| 335 |
//r25 |
| 336 |
|
| 337 |
|
| 338 |
//r26 |
| 339 |
|
| 340 |
|
| 341 |
//defines to generate LABELS during compile time. |
| 342 |
|
| 343 |
|
| 344 |
//AVS LAYOUT:(VVYYUUAA) |
| 345 |
//Assign buffer channel order for Buffer 0123 in the order AUYV a0.3>A, a0.2>U, a0.1>Y, a0.0>V |
| 346 |
// V = 0, Y= 4, U = 8, A = 12. |
| 347 |
//YCrCb or YCrCb_Swap returns the following data: |
| 348 |
//Cr is returned on R-channel. 0 |
| 349 |
//Y is returned on G channel. 4 |
| 350 |
//Cb is returned on B channel. 8 |
| 351 |
mov (4) r22.0<1>:w 0x62EA:v //Subtract 6 from 0,4,8,12 |
| 352 |
add (4) r22.0<1>:w r22.0<4;4,1>:w 70:uw //add 6 back |
| 353 |
shl (4) r22.0<1>:w r22.0<4;4,1>:w 5:uw //Convert to BYTE address. |
| 354 |
|
| 355 |
//OPT: wAVS_SU_SHUFFLE_PTR_0 and udAVS_SU_SHUFFLE_OFF_0 are sub-regs of same GRF. -rT |
| 356 |
|
| 357 |
//SU LAYOUT:(VYUAVYUA) |
| 358 |
//V = 0, Y = 2, U = 4, A = 6 |
| 359 |
mov (4) r18.0<1>:w 0x6420:v |
| 360 |
add (4) r18.0<1>:w r18.0<4;4,1>:w 64:uw |
| 361 |
shl (4) r18.0<1>:w r18.0<4;4,1>:w 5:uw { NoDDClr } //Convert to BYTE address. |
| 362 |
|
| 363 |
//OFFSET: |
| 364 |
mov (1) r18.4<1>:ud 0x1000100:ud { NoDDChk } |
| 365 |
|
| 366 |
|