1 /* 2 * Copyright (c) 2019, 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 shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 #if (defined BUFFER_0) || (defined BUFFER_1) || (defined BUFFER_2) || (defined BUFFER_3) 23 vector <ushort, 16> LoadMaskTemp = (TempMask0.select<1, 1, 16, 1>(0, 0) != 0); 24 #elif (defined BUFFER_4) || (defined BUFFER_5) 25 uchar sec_half_shift = (Layer_Index >> 7) * 8; 26 vector <ushort, 16> LoadMaskTemp = (TempMask.select<16, 1>(0) != 0); 27 #endif 28 29 #if defined BUFFER_0 30 Buffer_Index = 0; 31 CalculationMask = cm_pack_mask(LoadMaskTemp) & 0x000F; 32 #elif defined BUFFER_1 33 Buffer_Index = 1; 34 CalculationMask = (cm_pack_mask(LoadMaskTemp) >> 4) & 0x000F; 35 #elif defined BUFFER_2 36 Buffer_Index = 2; 37 CalculationMask = (cm_pack_mask(LoadMaskTemp) >> 8) & 0x000F; 38 #elif defined BUFFER_3 39 Buffer_Index = 3; 40 CalculationMask = (cm_pack_mask(LoadMaskTemp) >> 12) & 0x000F; 41 #elif defined BUFFER_4 42 CalculationMask = (cm_pack_mask(LoadMaskTemp) >> sec_half_shift) & 0x000F; 43 Buffer_Index = 4; 44 #elif defined BUFFER_5 45 CalculationMask = (cm_pack_mask(LoadMaskTemp) >> (4 + sec_half_shift)) & 0x000F; 46 Buffer_Index = 5; 47 #endif 48 49 if (CalculationMask != 0) 50 { 51 float StartX; 52 float StartY; 53 float StartX1; 54 float StartY1; 55 float DeltaX; 56 float DeltaY; 57 uchar RotationFlag; 58 59 /* 60 AVS Sampler 16x4 write back buffer layout for R/V, G/Y, B/U channel, each box stands for 8x1 ushort write back pixel 61 16x4 pixle deviding to 8 8x1 pixel block 62 _________________________________________________ 63 |_______Block0__________|_______Block1__________| 64 |_______Block2__________|_______Block3__________| 65 |_______Block4__________|_______Block5__________| 66 |_______Block6__________|_______Block7__________| 67 68 Write back buffer layout correlate to the block number#, each box stands for 1 GRF 69 _______________________________________________ 70 |____R0_________R2_____|____R4_________R6_____| 71 |____G0_________G2_____|____G4_________G6_____| 72 |____B0_________B2_____|____B4_________B6_____| 73 |____A0_________A2_____|____A4_________A6_____| 74 |____R1_________R3_____|____R5_________R7_____| 75 |____G1_________G3_____|____G5_________G7_____| 76 |____B1_________B3_____|____B5_________B7_____| 77 |____A1_________A3_____|____A5_________A7_____| 78 */ 79 matrix <float, 2, 8> mesg; 80 matrix <ushort, 4, 16> pl2_temp; 81 82 mesg.select<1, 1, 8, 1>(0, 0).format<uint>() = cm_get_r0<uint>(); 83 mesg.select<1, 1, 8, 1>(1, 0).format<uint>() = cm_get_r0<uint>(); 84 uint desc_y; 85 uchar Layer_Index_45; 86 87 #ifdef BUFFER_0 88 #ifdef ROTATE_90 89 StartX = Start_X(0); 90 StartY = Start_Y(0); 91 DeltaX = Delta_X(0); 92 DeltaY = Delta_Y(0); 93 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 94 95 StartX = StartX + DstY * DeltaX; 96 97 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 98 { 99 StartY = StartY + (DstX + MDF_FC_SAMPLER_UNORM_WIDTH)* DeltaY; 100 } 101 else 102 { 103 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaY; 104 } 105 106 StartY1 = StartY - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 107 108 //StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 109 110 StartX1 = StartX; 111 #elif defined ROTATE_180 112 StartX = Start_X(0); 113 StartY = Start_Y(0); 114 DeltaX = Delta_X(0); 115 DeltaY = Delta_Y(0); 116 117 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 118 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 119 { 120 StartX = StartX + DeltaX * (MDF_FC_SAMPLER_UNORM_WIDTH + DstX); 121 StartX1 = StartX - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaX; 122 } 123 else 124 { 125 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaX; 126 StartX1 = StartX - DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 127 } 128 129 //StartX = StartX + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 130 StartY = StartY + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 12) * DeltaY; 131 132 StartY1 = StartY; 133 #elif defined ROTATE_270 134 StartX = Start_X(0); 135 StartY = Start_Y(0); 136 DeltaX = Delta_X(0); 137 DeltaY = Delta_Y(0); 138 139 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 140 141 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 12) * DeltaX; 142 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 143 { 144 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 145 } 146 else 147 { 148 StartY = StartY + DstX * DeltaY; 149 } 150 151 StartY1 = StartY + MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 152 //StartY = StartY + DstX * DeltaY; 153 StartX1 = StartX; 154 #else 155 StartX = Start_X(0); 156 StartY = Start_Y(0); 157 DeltaX = Delta_X(0); 158 DeltaY = Delta_Y(0); 159 160 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 161 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 162 { 163 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 164 } 165 else 166 { 167 StartX += DstX * DeltaX; 168 } 169 170 StartX1 = StartX + MDF_FC_SAMPLER_UNORM_WIDTH * DeltaX; 171 172 StartY += DstY * DeltaY; 173 StartY1 = StartY; 174 #endif 175 #endif 176 177 #ifdef BUFFER_1 178 #ifdef ROTATE_90 179 StartX = Start_X(0); 180 StartY = Start_Y(0); 181 DeltaX = Delta_X(0); 182 DeltaY = Delta_Y(0); 183 184 StartX = StartX + (DstY + 4) * DeltaX; 185 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 186 187 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 188 { 189 StartY = StartY + (DstX + MDF_FC_SAMPLER_UNORM_WIDTH)* DeltaY; 190 } 191 else 192 { 193 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaY; 194 } 195 196 //StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 197 198 StartX1 = StartX; 199 StartY1 = StartY - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 200 201 #elif defined ROTATE_180 202 StartX = Start_X(0); 203 StartY = Start_Y(0); 204 DeltaX = Delta_X(0); 205 DeltaY = Delta_Y(0); 206 207 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 208 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 209 { 210 StartX = StartX + DeltaX * (MDF_FC_SAMPLER_UNORM_WIDTH + DstX); 211 StartX1 = StartX - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaX; 212 } 213 else 214 { 215 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaX; 216 StartX1 = StartX - DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 217 } 218 219 //StartX = StartX + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 220 StartY = StartY + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 8) * DeltaY; 221 222 //StartX1 = StartX + DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 223 StartY1 = StartY; 224 225 #elif defined ROTATE_270 226 StartX = Start_X(0); 227 StartY = Start_Y(0); 228 DeltaX = Delta_X(0); 229 DeltaY = Delta_Y(0); 230 231 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 232 233 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 8) * DeltaX; 234 235 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 236 { 237 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 238 } 239 else 240 { 241 StartY = StartY + DstX * DeltaY; 242 } 243 244 //StartY = StartY + DstX * DeltaY; 245 246 StartX1 = StartX; 247 StartY1 = StartY + MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 248 #else 249 StartX = Start_X(0); 250 StartY = Start_Y(0); 251 DeltaX = Delta_X(0); 252 DeltaY = Delta_Y(0); 253 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 254 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 255 { 256 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 257 } 258 else 259 { 260 StartX += DstX * DeltaX; 261 } 262 //StartX += DstX * DeltaX; 263 StartY += (DstY + MDF_FC_SAMPLER_UNORM_HEIGHT)* DeltaY; 264 265 StartX1 = StartX + DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 266 StartY1 = StartY; 267 #endif 268 #endif 269 270 #ifdef BUFFER_2 271 #ifdef ROTATE_90 272 StartX = Start_X(0); 273 StartY = Start_Y(0); 274 DeltaX = Delta_X(0); 275 DeltaY = Delta_Y(0); 276 277 StartX = StartX + (DstY + 8) * DeltaX; 278 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 279 280 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 281 { 282 StartY = StartY + (DstX + MDF_FC_SAMPLER_UNORM_WIDTH)* DeltaY; 283 } 284 else 285 { 286 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaY; 287 } 288 289 //StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 290 291 StartX1 = StartX; 292 StartY1 = StartY - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 293 294 #elif defined ROTATE_180 295 StartX = Start_X(0); 296 StartY = Start_Y(0); 297 DeltaX = Delta_X(0); 298 DeltaY = Delta_Y(0); 299 300 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 301 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 302 { 303 StartX = StartX + DeltaX * (MDF_FC_SAMPLER_UNORM_WIDTH + DstX); 304 StartX1 = StartX - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaX; 305 } 306 else 307 { 308 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaX; 309 StartX1 = StartX - DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 310 } 311 312 //StartX = StartX + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 313 StartY = StartY + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 4) * DeltaY; 314 315 //StartX1 = StartX + DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 316 StartY1 = StartY; 317 #elif defined ROTATE_270 318 StartX = Start_X(0); 319 StartY = Start_Y(0); 320 DeltaX = Delta_X(0); 321 DeltaY = Delta_Y(0); 322 323 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 324 325 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 4) * DeltaX; 326 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 327 { 328 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 329 } 330 else 331 { 332 StartY = StartY + DstX * DeltaY; 333 } 334 335 //StartY = StartY + DstX * DeltaY; 336 337 StartX1 = StartX; 338 StartY1 = StartY + MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 339 #else 340 StartX = Start_X(0); 341 StartY = Start_Y(0); 342 DeltaX = Delta_X(0); 343 DeltaY = Delta_Y(0); 344 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 345 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 346 { 347 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 348 } 349 else 350 { 351 StartX += DstX * DeltaX; 352 } 353 //StartX += DstX * DeltaX; 354 StartY += (DstY + 2 * MDF_FC_SAMPLER_UNORM_HEIGHT)* DeltaY; 355 StartX1 = StartX + DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 356 StartY1 = StartY; 357 #endif 358 #endif 359 360 #ifdef BUFFER_3 361 #ifdef ROTATE_90 362 StartX = Start_X(0); 363 StartY = Start_Y(0); 364 DeltaX = Delta_X(0); 365 DeltaY = Delta_Y(0); 366 367 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 368 StartX = StartX + (DstY + 12) * DeltaX; 369 370 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 371 { 372 StartY = StartY + (DstX + MDF_FC_SAMPLER_UNORM_WIDTH)* DeltaY; 373 } 374 else 375 { 376 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaY; 377 } 378 379 //StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 380 381 StartX1 = StartX; 382 StartY1 = StartY - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 383 384 #elif defined ROTATE_180 385 StartX = Start_X(0); 386 StartY = Start_Y(0); 387 DeltaX = Delta_X(0); 388 DeltaY = Delta_Y(0); 389 390 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 391 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 392 { 393 StartX = StartX + DeltaX * (MDF_FC_SAMPLER_UNORM_WIDTH + DstX); 394 StartX1 = StartX - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaX; 395 } 396 else 397 { 398 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaX; 399 StartX1 = StartX - DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 400 } 401 //StartX = StartX + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 402 StartY = StartY + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY) * DeltaY; 403 404 //StartX1 = StartX + DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 405 StartY1 = StartY; 406 #elif defined ROTATE_270 407 StartX = Start_X(0); 408 StartY = Start_Y(0); 409 DeltaX = Delta_X(0); 410 DeltaY = Delta_Y(0); 411 412 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 413 414 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY) * DeltaX; 415 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 416 { 417 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 418 } 419 else 420 { 421 StartY = StartY + DstX * DeltaY; 422 } 423 424 //StartY = StartY + DstX * DeltaY; 425 426 StartX1 = StartX; 427 StartY1 = StartY + MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 428 #else 429 StartX = Start_X(0); 430 StartY = Start_Y(0); 431 DeltaX = Delta_X(0); 432 DeltaY = Delta_Y(0); 433 434 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 435 436 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 437 { 438 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 439 } 440 else 441 { 442 StartX += DstX * DeltaX; 443 } 444 //StartX += DstX * DeltaX; 445 StartY += (DstY + 3 * MDF_FC_SAMPLER_UNORM_HEIGHT)* DeltaY; 446 StartX1 = StartX + DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 447 StartY1 = StartY; 448 #endif 449 #endif 450 451 #ifdef BUFFER_4 452 #ifdef ROTATE_90 453 Layer_Index_45 = Layer_Index & 0x7f; 454 StartX = Start_X(Layer_Index_45); 455 StartY = Start_Y(Layer_Index_45); 456 DeltaX = Delta_X(Layer_Index_45); 457 DeltaY = Delta_Y(Layer_Index_45); 458 459 StartX = StartX + (DstY + 8 * (Layer_Index >> 7)) * DeltaX; 460 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 461 462 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 463 { 464 StartY = StartY + (DstX + MDF_FC_SAMPLER_UNORM_WIDTH)* DeltaY; 465 } 466 else 467 { 468 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaY; 469 } 470 471 //StartY = StartY + (Dst_Width - MDF_FC_BLOCK_HEIGHT - DstX) * DeltaY; 472 473 StartX1 = StartX; 474 StartY1 = StartY - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 475 476 #elif defined ROTATE_180 477 Layer_Index_45 = Layer_Index & 0x7f; 478 StartX = Start_X(Layer_Index_45); 479 StartY = Start_Y(Layer_Index_45); 480 DeltaX = Delta_X(Layer_Index_45); 481 DeltaY = Delta_Y(Layer_Index_45); 482 483 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 484 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 485 { 486 StartX = StartX + DeltaX * (MDF_FC_SAMPLER_UNORM_WIDTH + DstX); 487 StartX1 = StartX - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaX; 488 } 489 else 490 { 491 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaX; 492 StartX1 = StartX - DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 493 } 494 495 //StartX = StartX + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 496 StartY = StartY + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 12 - 8 * (Layer_Index >> 7)) * DeltaY; 497 498 //StartX1 = StartX + DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 499 StartY1 = StartY; 500 #elif defined ROTATE_270 501 Layer_Index_45 = Layer_Index & 0x7f; 502 503 StartX = Start_X(Layer_Index_45); 504 StartY = Start_Y(Layer_Index_45); 505 DeltaX = Delta_X(Layer_Index_45); 506 DeltaY = Delta_Y(Layer_Index_45); 507 508 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 509 510 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 12 - 8 * (Layer_Index >> 7)) * DeltaX; 511 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 512 { 513 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 514 } 515 else 516 { 517 StartY = StartY + DstX * DeltaY; 518 } 519 //StartY = StartY + DstX * DeltaY; 520 521 StartX1 = StartX; 522 StartY1 = StartY + MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 523 #else 524 Layer_Index_45 = Layer_Index & 0x7f; 525 StartX = Start_X(Layer_Index_45); 526 StartY = Start_Y(Layer_Index_45); 527 DeltaX = Delta_X(Layer_Index_45); 528 DeltaY = Delta_Y(Layer_Index_45); 529 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 530 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 531 { 532 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 533 } 534 else 535 { 536 StartX += DstX * DeltaX; 537 } 538 539 //StartX += DstX * DeltaX; 540 StartY = StartY + (DstY + 2 * (Layer_Index >> 7) * MDF_FC_SAMPLER_UNORM_HEIGHT) * DeltaY; 541 StartX1 = StartX + DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 542 StartY1 = StartY; 543 #endif 544 #endif 545 546 #ifdef BUFFER_5 547 #ifdef ROTATE_90 548 Layer_Index_45 = Layer_Index & 0x7f; 549 StartX = Start_X(Layer_Index_45); 550 StartY = Start_Y(Layer_Index_45); 551 DeltaX = Delta_X(Layer_Index_45); 552 DeltaY = Delta_Y(Layer_Index_45); 553 554 StartX = StartX + (DstY + 8 * (Layer_Index >> 7) + 4) * DeltaX; 555 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 556 557 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 558 { 559 StartY = StartY + (DstX + MDF_FC_SAMPLER_UNORM_WIDTH)* DeltaY; 560 } 561 else 562 { 563 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaY; 564 } 565 566 //StartY = StartY + (Dst_Width - MDF_FC_BLOCK_HEIGHT - DstX) * DeltaY; 567 568 StartX1 = StartX; 569 StartY1 = StartY - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 570 571 #elif defined ROTATE_180 572 Layer_Index_45 = Layer_Index & 0x7f; 573 StartX = Start_X(Layer_Index_45); 574 StartY = Start_Y(Layer_Index_45); 575 DeltaX = Delta_X(Layer_Index_45); 576 DeltaY = Delta_Y(Layer_Index_45); 577 578 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 579 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 580 { 581 StartX = StartX + DeltaX * (MDF_FC_SAMPLER_UNORM_WIDTH + DstX); 582 StartX1 = StartX - MDF_FC_SAMPLER_UNORM_WIDTH * DeltaX; 583 } 584 else 585 { 586 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX + MDF_FC_SAMPLER_UNORM_WIDTH) * DeltaX; 587 StartX1 = StartX - DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 588 } 589 590 //StartX = StartX + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 591 StartY = StartY + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 8 - 8 * (Layer_Index >> 7)) * DeltaY; 592 593 //StartX1 = StartX + DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 594 StartY1 = StartY; 595 #elif defined ROTATE_270 596 Layer_Index_45 = Layer_Index & 0x7f; 597 598 StartX = Start_X(Layer_Index_45); 599 StartY = Start_Y(Layer_Index_45); 600 DeltaX = Delta_X(Layer_Index_45); 601 DeltaY = Delta_Y(Layer_Index_45); 602 603 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 604 605 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 8 - 8 * (Layer_Index >> 7)) * DeltaX; 606 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 607 { 608 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 609 } 610 else 611 { 612 StartY = StartY + DstX * DeltaY; 613 } 614 //StartY = StartY + DstX * DeltaY; 615 616 StartX1 = StartX; 617 StartY1 = StartY + MDF_FC_SAMPLER_UNORM_WIDTH * DeltaY; 618 #else 619 Layer_Index_45 = Layer_Index & 0x7f; 620 StartX = Start_X(Layer_Index_45); 621 StartY = Start_Y(Layer_Index_45); 622 DeltaX = Delta_X(Layer_Index_45); 623 DeltaY = Delta_Y(Layer_Index_45); 624 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 625 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 626 { 627 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 628 } 629 else 630 { 631 StartX += DstX * DeltaX; 632 } 633 //StartX += DstX * DeltaX; 634 StartY = StartY + (DstY + (2 * (Layer_Index >> 7) + 1) * MDF_FC_SAMPLER_UNORM_HEIGHT) * DeltaY; 635 StartX1 = StartX + DeltaX * MDF_FC_SAMPLER_UNORM_WIDTH; 636 StartY1 = StartY; 637 #endif 638 #endif 639 640 #ifdef BUFFER_0 641 #define WriteBackBuffer DataBuffer0 642 // Y channel 643 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_CHANNEL_444_16; 644 645 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 646 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 647 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 648 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 649 650 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_1CH + (MDF_FC_3D_SAMPLER_SI_Y << 8) + MDF_FC_INPUT_BTI_START; 651 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 652 mesg.format<ushort, 2, 16>(), 653 nSMPL_ENGINE, 654 desc_y, 655 0); 656 657 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(2, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 658 659 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 660 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 661 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 662 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 663 664 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 665 mesg.format<ushort, 2, 16>(), 666 nSMPL_ENGINE, 667 desc_y, 668 0); 669 670 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(10, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 671 672 // UV channel 673 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_GREEN_CHANNEL_444_16; 674 675 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 676 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 677 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 678 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 679 680 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_2CH + (MDF_FC_3D_SAMPLER_SI_U << 8) + MDF_FC_INPUT_BTI_START + MDF_FC_UV_PLANE_BTI_OFFSET; 681 cm_send(pl2_temp, 682 mesg.format<ushort, 2, 16>(), 683 nSMPL_ENGINE, 684 desc_y, 685 0); 686 687 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(0, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 688 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(4, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 689 690 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 691 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 692 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 693 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 694 695 cm_send(pl2_temp, 696 mesg.format<ushort, 2, 16>(), 697 nSMPL_ENGINE, 698 desc_y, 699 0); 700 701 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(8, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 702 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(12, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 703 704 #endif 705 #ifdef BUFFER_1 706 #define WriteBackBuffer DataBuffer1 707 // Y channel 708 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_CHANNEL_444_16; 709 710 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 711 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 712 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 713 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 714 715 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_1CH + (MDF_FC_3D_SAMPLER_SI_Y << 8) + MDF_FC_INPUT_BTI_START; 716 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 717 mesg.format<ushort, 2, 16>(), 718 nSMPL_ENGINE, 719 desc_y, 720 0); 721 722 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(2, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 723 724 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 725 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 726 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 727 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 728 729 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 730 mesg.format<ushort, 2, 16>(), 731 nSMPL_ENGINE, 732 desc_y, 733 0); 734 735 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(10, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 736 737 // UV channel 738 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_GREEN_CHANNEL_444_16; 739 740 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 741 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 742 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 743 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 744 745 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_2CH + (MDF_FC_3D_SAMPLER_SI_U << 8) + MDF_FC_INPUT_BTI_START + MDF_FC_UV_PLANE_BTI_OFFSET; 746 cm_send(pl2_temp, 747 mesg.format<ushort, 2, 16>(), 748 nSMPL_ENGINE, 749 desc_y, 750 0); 751 752 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(0, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 753 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(4, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 754 755 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 756 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 757 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 758 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 759 760 cm_send(pl2_temp, 761 mesg.format<ushort, 2, 16>(), 762 nSMPL_ENGINE, 763 desc_y, 764 0); 765 766 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(8, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 767 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(12, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 768 769 #endif 770 #ifdef BUFFER_2 771 #define WriteBackBuffer DataBuffer2 772 // Y channel 773 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_CHANNEL_444_16; 774 775 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 776 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 777 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 778 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 779 780 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_1CH + (MDF_FC_3D_SAMPLER_SI_Y << 8) + MDF_FC_INPUT_BTI_START; 781 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 782 mesg.format<ushort, 2, 16>(), 783 nSMPL_ENGINE, 784 desc_y, 785 0); 786 787 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(2, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 788 789 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 790 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 791 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 792 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 793 794 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 795 mesg.format<ushort, 2, 16>(), 796 nSMPL_ENGINE, 797 desc_y, 798 0); 799 800 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(10, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 801 802 // UV channel 803 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_GREEN_CHANNEL_444_16; 804 805 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 806 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 807 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 808 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 809 810 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_2CH + (MDF_FC_3D_SAMPLER_SI_U << 8) + MDF_FC_INPUT_BTI_START + MDF_FC_UV_PLANE_BTI_OFFSET; 811 cm_send(pl2_temp, 812 mesg.format<ushort, 2, 16>(), 813 nSMPL_ENGINE, 814 desc_y, 815 0); 816 817 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(0, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 818 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(4, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 819 820 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 821 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 822 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 823 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 824 825 cm_send(pl2_temp, 826 mesg.format<ushort, 2, 16>(), 827 nSMPL_ENGINE, 828 desc_y, 829 0); 830 831 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(8, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 832 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(12, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 833 834 #endif 835 #ifdef BUFFER_3 836 #define WriteBackBuffer DataBuffer3 837 // Y channel 838 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_CHANNEL_444_16; 839 840 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 841 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 842 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 843 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 844 845 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_1CH + (MDF_FC_3D_SAMPLER_SI_Y << 8) + MDF_FC_INPUT_BTI_START; 846 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 847 mesg.format<ushort, 2, 16>(), 848 nSMPL_ENGINE, 849 desc_y, 850 0); 851 852 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(2, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 853 854 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 855 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 856 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 857 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 858 859 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 860 mesg.format<ushort, 2, 16>(), 861 nSMPL_ENGINE, 862 desc_y, 863 0); 864 865 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(10, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 866 867 // UV channel 868 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_GREEN_CHANNEL_444_16; 869 870 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 871 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 872 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 873 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 874 875 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_2CH + (MDF_FC_3D_SAMPLER_SI_U << 8) + MDF_FC_INPUT_BTI_START + MDF_FC_UV_PLANE_BTI_OFFSET; 876 cm_send(pl2_temp, 877 mesg.format<ushort, 2, 16>(), 878 nSMPL_ENGINE, 879 desc_y, 880 0); 881 882 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(0, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 883 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(4, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 884 885 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 886 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 887 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 888 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 889 890 cm_send(pl2_temp, 891 mesg.format<ushort, 2, 16>(), 892 nSMPL_ENGINE, 893 desc_y, 894 0); 895 896 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(8, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 897 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(12, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 898 899 #endif 900 #ifdef BUFFER_4 901 #define WriteBackBuffer DataBuffer4 902 // Y channel 903 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_CHANNEL_444_16; 904 905 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 906 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 907 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 908 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 909 910 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_1CH + (MDF_FC_3D_SAMPLER_SI_Y << 8) + MDF_FC_INPUT_BTI_START + MDF_FC_INPUT_BTI_PER_LAYER * Layer_Index_45; 911 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 912 mesg.format<ushort, 2, 16>(), 913 nSMPL_ENGINE, 914 desc_y, 915 0); 916 917 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(2, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 918 919 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 920 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 921 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 922 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 923 924 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 925 mesg.format<ushort, 2, 16>(), 926 nSMPL_ENGINE, 927 desc_y, 928 0); 929 930 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(10, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 931 932 // UV channel 933 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_GREEN_CHANNEL_444_16; 934 935 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 936 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 937 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 938 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 939 940 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_2CH + (MDF_FC_3D_SAMPLER_SI_U << 8) + MDF_FC_INPUT_BTI_START + MDF_FC_INPUT_BTI_PER_LAYER * Layer_Index_45 + MDF_FC_UV_PLANE_BTI_OFFSET; 941 cm_send(pl2_temp, 942 mesg.format<ushort, 2, 16>(), 943 nSMPL_ENGINE, 944 desc_y, 945 0); 946 947 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(0, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 948 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(4, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 949 950 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 951 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 952 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 953 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 954 955 cm_send(pl2_temp, 956 mesg.format<ushort, 2, 16>(), 957 nSMPL_ENGINE, 958 desc_y, 959 0); 960 961 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(8, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 962 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(12, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 963 964 #endif 965 #ifdef BUFFER_5 966 #define WriteBackBuffer DataBuffer5 967 // Y channel 968 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_CHANNEL_444_16; 969 970 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 971 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 972 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 973 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 974 975 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_1CH + (MDF_FC_3D_SAMPLER_SI_Y << 8) + MDF_FC_INPUT_BTI_START + MDF_FC_INPUT_BTI_PER_LAYER * Layer_Index_45; 976 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 977 mesg.format<ushort, 2, 16>(), 978 nSMPL_ENGINE, 979 desc_y, 980 0); 981 982 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(2, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 983 984 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 985 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 986 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 987 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 988 989 cm_send(pl2_temp.select<2, 1, 16, 1>(0, 0), 990 mesg.format<ushort, 2, 16>(), 991 nSMPL_ENGINE, 992 desc_y, 993 0); 994 995 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(10, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 996 997 // UV channel 998 mesg.format<uint, 2, 8>().select<1, 1, 1, 1>(0, 2) = nSMPL_RED_GREEN_CHANNEL_444_16; 999 1000 mesg.select<1, 1, 1, 1>(1, 2) = StartX; 1001 mesg.select<1, 1, 1, 1>(1, 3) = StartY; 1002 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 1003 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 1004 1005 desc_y = nSMPL_UNORM_444_16BITS_MSGDSC_2CH + (MDF_FC_3D_SAMPLER_SI_U << 8) + MDF_FC_INPUT_BTI_START + MDF_FC_INPUT_BTI_PER_LAYER * Layer_Index_45 + MDF_FC_UV_PLANE_BTI_OFFSET; 1006 cm_send(pl2_temp, 1007 mesg.format<ushort, 2, 16>(), 1008 nSMPL_ENGINE, 1009 desc_y, 1010 0); 1011 1012 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(0, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 1013 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(4, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 1014 1015 mesg.select<1, 1, 1, 1>(1, 2) = StartX1; 1016 mesg.select<1, 1, 1, 1>(1, 3) = StartY1; 1017 mesg.select<1, 1, 1, 1>(1, 4) = DeltaX; 1018 mesg.select<1, 1, 1, 1>(1, 5) = DeltaY; 1019 1020 cm_send(pl2_temp, 1021 mesg.format<ushort, 2, 16>(), 1022 nSMPL_ENGINE, 1023 desc_y, 1024 0); 1025 1026 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(8, 0) = pl2_temp.select<2, 1, 16, 1>(2, 0); 1027 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(12, 0) = pl2_temp.select<2, 1, 16, 1>(0, 0); 1028 1029 #endif 1030 1031 1032 // Shuffle the write back of sampler 1033 /* 1034 Buffer layout after shuffle 1035 _________________________________________________ 1036 |_______Block0__________|_______Block1__________| 1037 |_______Block2__________|_______Block3__________| 1038 |_______Block4__________|_______Block5__________| 1039 |_______Block6__________|_______Block7__________| 1040 1041 Write back buffer layout correlate to the block number#, each box stands for 1 GRF 1042 _______________________________________________ 1043 |____R0_________R1_____|____R2_________R3_____| 1044 |____G0_________G1_____|____G2_________G3_____| 1045 |____B0_________B1_____|____B2_________B3_____| 1046 |____A0_________A1_____|____A2_________A3_____| 1047 |____R4_________R5_____|____R6_________R7_____| 1048 |____G4_________G5_____|____G6_________G7_____| 1049 |____B4_________B5_____|____B6_________B7_____| 1050 |____A4_________A5_____|____A6_________A7_____| 1051 */ 1052 1053 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(6, 0) = 0xffff; 1054 WriteBackBuffer.format<ushort, 16, 16>().select<2, 1, 16, 1>(14, 0) = 0xffff; 1055 #undef WriteBackBuffer 1056 }