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 DeltaX; 54 float DeltaY; 55 uint Vertical_Block_Num; 56 uchar Layer_Index_45; 57 uchar RotationFlag; 58 bool IefBypass = true; 59 int TempOffset; 60 SamplerIndex Src_Sampler(MDF_FC_AVS_SI_Y); 61 62 /* 63 AVS Sampler 16x4 write back buffer layout for R/V, G/Y, B/U channel, each box stands for 8x1 ushort write back pixel 64 16x4 pixle deviding to 8 8x1 pixel block 65 _________________________________________________ 66 |_______Block0__________|_______Block1__________| 67 |_______Block2__________|_______Block3__________| 68 |_______Block4__________|_______Block5__________| 69 |_______Block6__________|_______Block7__________| 70 71 Write back buffer layout correlate to the block number#, each box stands for 1 GRF 72 _______________________________________________ 73 |____R0_________R2_____|____R4_________R6_____| 74 |____G0_________G2_____|____G4_________G6_____| 75 |____B0_________B2_____|____B4_________B6_____| 76 |____A0_________A2_____|____A4_________A6_____| 77 |____R1_________R3_____|____R5_________R7_____| 78 |____G1_________G3_____|____G5_________G7_____| 79 |____B1_________B3_____|____B5_________B7_____| 80 |____A1_________A3_____|____A5_________A7_____| 81 */ 82 #ifdef BUFFER_0 83 #ifdef ROTATE_90 84 StartX = Start_X(0); 85 StartY = Start_Y(0); 86 DeltaX = Delta_X(0); 87 DeltaY = Delta_Y(0); 88 Vertical_Block_Num = 0; 89 90 StartX = StartX + DstY * DeltaX; 91 92 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 93 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 94 { 95 StartY = StartY + DstX * DeltaY; 96 } 97 else 98 { 99 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 100 } 101 102 #elif defined ROTATE_180 103 StartX = Start_X(0); 104 StartY = Start_Y(0); 105 DeltaX = Delta_X(0); 106 DeltaY = Delta_Y(0); 107 Vertical_Block_Num = (((Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 12) >> 2)) & 15; 108 109 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 110 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 111 { 112 StartX += DstX * DeltaX; 113 } 114 else 115 { 116 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 117 } 118 119 TempOffset = Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 12; 120 TempOffset &= 0xFFFFFFC3; 121 StartY = StartY + TempOffset * DeltaY; 122 #elif defined ROTATE_270 123 StartX = Start_X(0); 124 StartY = Start_Y(0); 125 DeltaX = Delta_X(0); 126 DeltaY = Delta_Y(0); 127 Vertical_Block_Num = 0; 128 129 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 12) * DeltaX; 130 131 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 132 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 133 { 134 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 135 } 136 else 137 { 138 StartY = StartY + DstX * DeltaY; 139 } 140 141 #else 142 StartX = Start_X(0); 143 StartY = Start_Y(0); 144 DeltaX = Delta_X(0); 145 DeltaY = Delta_Y(0); 146 Vertical_Block_Num = (DstY >> 2) & 15; 147 148 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 149 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 150 { 151 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 152 } 153 else 154 { 155 StartX += DstX * DeltaX; 156 } 157 158 StartY = StartY + (DstY & 0xFFC3) * DeltaY; 159 #endif 160 #endif 161 162 #ifdef BUFFER_1 163 #ifdef ROTATE_90 164 StartX = Start_X(0); 165 StartY = Start_Y(0); 166 DeltaX = Delta_X(0); 167 DeltaY = Delta_Y(0); 168 Vertical_Block_Num = 0; 169 170 StartX = StartX + (DstY + 4) * DeltaX; 171 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 172 173 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 174 { 175 StartY = StartY + DstX * DeltaY; 176 } 177 else 178 { 179 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 180 } 181 182 #elif defined ROTATE_180 183 StartX = Start_X(0); 184 StartY = Start_Y(0); 185 DeltaX = Delta_X(0); 186 DeltaY = Delta_Y(0); 187 Vertical_Block_Num = (((Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 8) >> 2)) & 15; 188 189 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 190 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 191 { 192 StartX += DstX * DeltaX; 193 } 194 else 195 { 196 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 197 } 198 199 TempOffset = Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 8; 200 TempOffset &= 0xFFFFFFC3; 201 StartY = StartY + TempOffset * DeltaY; 202 #elif defined ROTATE_270 203 StartX = Start_X(0); 204 StartY = Start_Y(0); 205 DeltaX = Delta_X(0); 206 DeltaY = Delta_Y(0); 207 Vertical_Block_Num = 0; 208 209 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 8) * DeltaX; 210 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 211 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 212 { 213 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 214 } 215 else 216 { 217 StartY = StartY + DstX * DeltaY; 218 } 219 220 #else 221 StartX = Start_X(0); 222 StartY = Start_Y(0); 223 DeltaX = Delta_X(0); 224 DeltaY = Delta_Y(0); 225 Vertical_Block_Num = ((DstY >> 2) & 15) + 1; 226 227 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 228 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 229 { 230 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 231 } 232 else 233 { 234 StartX += DstX * DeltaX; 235 } 236 StartY = StartY + (DstY & 0xFFC3) * DeltaY; 237 #endif 238 #endif 239 240 #ifdef BUFFER_2 241 #ifdef ROTATE_90 242 StartX = Start_X(0); 243 StartY = Start_Y(0); 244 DeltaX = Delta_X(0); 245 DeltaY = Delta_Y(0); 246 Vertical_Block_Num = 0; 247 248 StartX = StartX + (DstY + 8) * DeltaX; 249 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 250 251 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 252 { 253 StartY = StartY + DstX * DeltaY; 254 } 255 else 256 { 257 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 258 } 259 260 #elif defined ROTATE_180 261 StartX = Start_X(0); 262 StartY = Start_Y(0); 263 DeltaX = Delta_X(0); 264 DeltaY = Delta_Y(0); 265 Vertical_Block_Num = (((Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 4) >> 2)) & 15; 266 267 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 268 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 269 { 270 StartX += DstX * DeltaX; 271 } 272 else 273 { 274 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 275 } 276 277 TempOffset = Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 4; 278 TempOffset &= 0xFFFFFFC3; 279 StartY = StartY + TempOffset * DeltaY; 280 #elif defined ROTATE_270 281 StartX = Start_X(0); 282 StartY = Start_Y(0); 283 DeltaX = Delta_X(0); 284 DeltaY = Delta_Y(0); 285 Vertical_Block_Num = 0; 286 287 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 4) * DeltaX; 288 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 289 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 290 { 291 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 292 } 293 else 294 { 295 StartY = StartY + DstX * DeltaY; 296 } 297 #else 298 StartX = Start_X(0); 299 StartY = Start_Y(0); 300 DeltaX = Delta_X(0); 301 DeltaY = Delta_Y(0); 302 Vertical_Block_Num = ((DstY >> 2) & 15) + 2; 303 304 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 305 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 306 { 307 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 308 } 309 else 310 { 311 StartX += DstX * DeltaX; 312 } 313 StartY = StartY + (DstY & 0xFFC3) * DeltaY; 314 #endif 315 #endif 316 317 #ifdef BUFFER_3 318 #ifdef ROTATE_90 319 StartX = Start_X(0); 320 StartY = Start_Y(0); 321 DeltaX = Delta_X(0); 322 DeltaY = Delta_Y(0); 323 Vertical_Block_Num = 0; 324 325 StartX = StartX + (DstY + 12) * DeltaX; 326 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 327 328 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 329 { 330 StartY = StartY + DstX * DeltaY; 331 } 332 else 333 { 334 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 335 } 336 337 #elif defined ROTATE_180 338 StartX = Start_X(0); 339 StartY = Start_Y(0); 340 DeltaX = Delta_X(0); 341 DeltaY = Delta_Y(0); 342 Vertical_Block_Num = ((Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY) >> 2) & 15; 343 344 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 345 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 346 { 347 StartX += DstX * DeltaX; 348 } 349 else 350 { 351 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 352 } 353 354 TempOffset = Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY; 355 TempOffset &= 0xFFFFFFC3; 356 StartY = StartY + TempOffset * DeltaY; 357 #elif defined ROTATE_270 358 StartX = Start_X(0); 359 StartY = Start_Y(0); 360 DeltaX = Delta_X(0); 361 DeltaY = Delta_Y(0); 362 Vertical_Block_Num = 0; 363 364 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY) * DeltaX; 365 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 366 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 367 { 368 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 369 } 370 else 371 { 372 StartY = StartY + DstX * DeltaY; 373 } 374 #else 375 StartX = Start_X(0); 376 StartY = Start_Y(0); 377 DeltaX = Delta_X(0); 378 DeltaY = Delta_Y(0); 379 Vertical_Block_Num = ((DstY >> 2) & 15) + 3; 380 381 RotationFlag = (uchar)(RotationChromaSitingFlag & 0x07); 382 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 383 { 384 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 385 } 386 else 387 { 388 StartX += DstX * DeltaX; 389 } 390 StartY = StartY + (DstY & 0xFFC3) * DeltaY; 391 #endif 392 #endif 393 394 #ifdef BUFFER_4 395 #ifdef ROTATE_90 396 Layer_Index_45 = Layer_Index & 0x7f; 397 StartX = Start_X(Layer_Index_45); 398 StartY = Start_Y(Layer_Index_45); 399 DeltaX = Delta_X(Layer_Index_45); 400 DeltaY = Delta_Y(Layer_Index_45); 401 Vertical_Block_Num = 0; 402 403 StartX = StartX + (DstY + 8 * (Layer_Index >> 7)) * DeltaX; 404 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 405 406 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 407 { 408 StartY = StartY + DstX * DeltaY; 409 } 410 else 411 { 412 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 413 } 414 415 #elif defined ROTATE_180 416 Layer_Index_45 = Layer_Index & 0x7f; 417 StartX = Start_X(Layer_Index_45); 418 StartY = Start_Y(Layer_Index_45); 419 DeltaX = Delta_X(Layer_Index_45); 420 DeltaY = Delta_Y(Layer_Index_45); 421 Vertical_Block_Num = ((Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 12 - 8 * (Layer_Index >> 7)) >> 2) & 15; 422 423 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 424 425 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 426 { 427 StartX += DstX * DeltaX; 428 } 429 else 430 { 431 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 432 } 433 434 TempOffset = Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 12 - 8 * (Layer_Index >> 7); 435 TempOffset &= 0xFFFFFFC3; 436 StartY = StartY + TempOffset * DeltaY; 437 #elif defined ROTATE_270 438 Layer_Index_45 = Layer_Index & 0x7f; 439 440 StartX = Start_X(Layer_Index_45); 441 StartY = Start_Y(Layer_Index_45); 442 DeltaX = Delta_X(Layer_Index_45); 443 DeltaY = Delta_Y(Layer_Index_45); 444 Vertical_Block_Num = 0; 445 446 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 12 - 8 * (Layer_Index >> 7)) * DeltaX; 447 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 448 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 449 { 450 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 451 } 452 else 453 { 454 StartY = StartY + DstX * DeltaY; 455 } 456 #else 457 Layer_Index_45 = Layer_Index & 0x7f; 458 StartX = Start_X(Layer_Index_45); 459 StartY = Start_Y(Layer_Index_45); 460 DeltaX = Delta_X(Layer_Index_45); 461 DeltaY = Delta_Y(Layer_Index_45); 462 Vertical_Block_Num = ((DstY >> 2) & 15) + (2 * (Layer_Index >> 7)); 463 464 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45))& 0x07); 465 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 466 { 467 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 468 } 469 else 470 { 471 StartX += DstX * DeltaX; 472 } 473 StartY = StartY + (DstY & 0xFFC3) * DeltaY; 474 #endif 475 #endif 476 477 #ifdef BUFFER_5 478 #ifdef ROTATE_90 479 Layer_Index_45 = Layer_Index & 0x7f; 480 StartX = Start_X(Layer_Index_45); 481 StartY = Start_Y(Layer_Index_45); 482 DeltaX = Delta_X(Layer_Index_45); 483 DeltaY = Delta_Y(Layer_Index_45); 484 Vertical_Block_Num = 0; 485 486 StartX = StartX + (DstY + 8 * (Layer_Index >> 7) + 4) * DeltaX; 487 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 488 489 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_HORIZONTAL) 490 { 491 StartY = StartY + DstX * DeltaY; 492 } 493 else 494 { 495 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 496 } 497 498 #elif defined ROTATE_180 499 Layer_Index_45 = Layer_Index & 0x7f; 500 StartX = Start_X(Layer_Index_45); 501 StartY = Start_Y(Layer_Index_45); 502 DeltaX = Delta_X(Layer_Index_45); 503 DeltaY = Delta_Y(Layer_Index_45); 504 Vertical_Block_Num = (((Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 8 - 8 * (Layer_Index >> 7)) >> 2)) & 15; 505 506 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 507 508 if (RotationFlag == MDF_FC_MIRROR_VERTICAL) 509 { 510 StartX += DstX * DeltaX; 511 } 512 else 513 { 514 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 515 } 516 TempOffset = Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 8 - 8 * (Layer_Index >> 7); 517 TempOffset &= 0xFFFFFFC3; 518 StartY = StartY + TempOffset * DeltaY; 519 #elif defined ROTATE_270 520 Layer_Index_45 = Layer_Index & 0x7f; 521 522 StartX = Start_X(Layer_Index_45); 523 StartY = Start_Y(Layer_Index_45); 524 DeltaX = Delta_X(Layer_Index_45); 525 DeltaY = Delta_Y(Layer_Index_45); 526 Vertical_Block_Num = 0; 527 528 StartX = StartX + (Dst_Height - MDF_FC_BLOCK_HEIGHT - DstY + 8 - (8 * (Layer_Index >> 7))) * DeltaX; 529 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 530 if (RotationFlag == MDF_FC_ROTATE_90_MIRROR_VERTICAL) 531 { 532 StartY = StartY + (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaY; 533 } 534 else 535 { 536 StartY = StartY + DstX * DeltaY; 537 } 538 #else 539 Layer_Index_45 = Layer_Index & 0x7f; 540 StartX = Start_X(Layer_Index_45); 541 StartY = Start_Y(Layer_Index_45); 542 DeltaX = Delta_X(Layer_Index_45); 543 DeltaY = Delta_Y(Layer_Index_45); 544 Vertical_Block_Num = ((DstY >> 2) & 15) + (2 * (Layer_Index >> 7)) + 1; 545 546 RotationFlag = (uchar)((RotationChromaSitingFlag >> (3 * Layer_Index_45)) & 0x07); 547 548 if (RotationFlag == MDF_FC_MIRROR_HORIZONTAL) 549 { 550 StartX += (Dst_Width - MDF_FC_BLOCK_WIDTH - DstX) * DeltaX; 551 } 552 else 553 { 554 StartX += DstX * DeltaX; 555 } 556 StartY = StartY + (DstY & 0xFFC3) * DeltaY; 557 #endif 558 #endif 559 560 561 #ifdef BUFFER_0 562 #define WriteBackBuffer DataBuffer0 563 SurfaceIndex Src_Surface(MDF_FC_INPUT_BTI_START); 564 cm_avs_sampler( 565 DataBuffer0, 566 CM_ABGR_ENABLE, 567 Src_Surface, 568 Src_Sampler, 569 StartX, 570 StartY, 571 DeltaX, 572 DeltaY, 573 0, 574 0, 575 Vertical_Block_Num, 576 CM_16_FULL, 577 0, 578 CM_AVS_16x4, 579 IefBypass); 580 581 #endif 582 #ifdef BUFFER_1 583 #define WriteBackBuffer DataBuffer1 584 SurfaceIndex Src_Surface(MDF_FC_INPUT_BTI_START); 585 cm_avs_sampler( 586 DataBuffer1, 587 CM_ABGR_ENABLE, 588 Src_Surface, 589 Src_Sampler, 590 StartX, 591 StartY, 592 DeltaX, 593 DeltaY, 594 0, 595 0, 596 Vertical_Block_Num, 597 CM_16_FULL, 598 0, 599 CM_AVS_16x4, 600 IefBypass); 601 602 #endif 603 #ifdef BUFFER_2 604 #define WriteBackBuffer DataBuffer2 605 SurfaceIndex Src_Surface(MDF_FC_INPUT_BTI_START); 606 cm_avs_sampler( 607 DataBuffer2, 608 CM_ABGR_ENABLE, 609 Src_Surface, 610 Src_Sampler, 611 StartX, 612 StartY, 613 DeltaX, 614 DeltaY, 615 0, 616 0, 617 Vertical_Block_Num, 618 CM_16_FULL, 619 0, 620 CM_AVS_16x4, 621 IefBypass); 622 623 #endif 624 #ifdef BUFFER_3 625 #define WriteBackBuffer DataBuffer3 626 SurfaceIndex Src_Surface(MDF_FC_INPUT_BTI_START); 627 cm_avs_sampler( 628 DataBuffer3, 629 CM_ABGR_ENABLE, 630 Src_Surface, 631 Src_Sampler, 632 StartX, 633 StartY, 634 DeltaX, 635 DeltaY, 636 0, 637 0, 638 Vertical_Block_Num, 639 CM_16_FULL, 640 0, 641 CM_AVS_16x4, 642 IefBypass); 643 644 #endif 645 #ifdef BUFFER_4 646 #define WriteBackBuffer DataBuffer4 647 SurfaceIndex Src_Surface(MDF_FC_INPUT_BTI_START + MDF_FC_INPUT_BTI_PER_LAYER * Layer_Index_45); 648 649 cm_avs_sampler( 650 DataBuffer4, 651 CM_ABGR_ENABLE, 652 Src_Surface, 653 Src_Sampler, 654 StartX, 655 StartY, 656 DeltaX, 657 DeltaY, 658 0, 659 0, 660 Vertical_Block_Num, 661 CM_16_FULL, 662 0, 663 CM_AVS_16x4, 664 IefBypass); 665 666 #endif 667 #ifdef BUFFER_5 668 #define WriteBackBuffer DataBuffer5 669 SurfaceIndex Src_Surface(MDF_FC_INPUT_BTI_START + MDF_FC_INPUT_BTI_PER_LAYER * Layer_Index_45); 670 671 cm_avs_sampler( 672 DataBuffer5, 673 CM_ABGR_ENABLE, 674 Src_Surface, 675 Src_Sampler, 676 StartX, 677 StartY, 678 DeltaX, 679 DeltaY, 680 0, 681 0, 682 Vertical_Block_Num, 683 CM_16_FULL, 684 0, 685 CM_AVS_16x4, 686 IefBypass); 687 688 #endif 689 690 691 // Shuffle the write back of sampler 692 /* 693 Buffer layout after shuffle 694 _________________________________________________ 695 |_______Block0__________|_______Block1__________| 696 |_______Block2__________|_______Block3__________| 697 |_______Block4__________|_______Block5__________| 698 |_______Block6__________|_______Block7__________| 699 700 Write back buffer layout correlate to the block number#, each box stands for 1 GRF 701 _______________________________________________ 702 |____R0_________R1_____|____R2_________R3_____| 703 |____G0_________G1_____|____G2_________G3_____| 704 |____B0_________B1_____|____B2_________B3_____| 705 |____A0_________A1_____|____A2_________A3_____| 706 |____R4_________R5_____|____R6_________R7_____| 707 |____G4_________G5_____|____G6_________G7_____| 708 |____B4_________B5_____|____B6_________B7_____| 709 |____A4_________A5_____|____A6_________A7_____| 710 */ 711 712 #ifdef Y410_SUPPORT 713 { 714 matrix<ushort, 1, 16> shuffle_temp; 715 shuffle_temp = WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(0, 0); 716 WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(0, 0) = WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(4, 0); 717 WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(4, 0) = shuffle_temp; 718 719 shuffle_temp = WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(1, 0); 720 WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(1, 0) = WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(5, 0); 721 WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(5, 0) = shuffle_temp; 722 723 shuffle_temp = WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(8, 0); 724 WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(8, 0) = WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(12, 0); 725 WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(12, 0) = shuffle_temp; 726 727 shuffle_temp = WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(9, 0); 728 WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(9, 0) = WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(13, 0); 729 WriteBackBuffer.format<ushort, 16, 16>().select<1, 1, 16, 1>(13, 0) = shuffle_temp; 730 } 731 #endif 732 733 #undef WriteBackBuffer 734 } 735