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 { 23 /* 24 Buffer layout after shuffle 25 _________________________________________________ 26 |_______Block0__________|_______Block1__________| 27 |_______Block2__________|_______Block3__________| 28 |_______Block4__________|_______Block5__________| 29 |_______Block6__________|_______Block7__________| 30 31 Write back buffer layout correlate to the block number#, each box stands for 1 GRF 32 _______________________________________________ 33 |____R0_________R1_____|____R2_________R3_____| 34 |____G0_________G1_____|____G2_________G3_____| 35 |____B0_________B1_____|____B2_________B3_____| 36 |____A0_________A1_____|____A2_________A3_____| 37 |____R4_________R5_____|____R6_________R7_____| 38 |____G4_________G5_____|____G6_________G7_____| 39 |____B4_________B5_____|____B6_________B7_____| 40 |____A4_________A5_____|____A6_________A7_____| 41 */ 42 43 matrix_ref<uchar, 16, 16> Result_Y = DataBuffer.format<uchar, 192, 16>().select<16, 1, 16, 1>(128, 0); 44 45 SurfaceIndex Dst_Surface(MDF_FC_OUTPUT_BTI_START); 46 47 #pragma unroll 48 // Write Y plane 49 for (uchar i = 0; i < 4; i++) 50 { 51 Result_Y.select<1, 1, 8, 1>(4 * i, 0) = DataBuffer.format<uchar, 96, 32>().select<1, 1, 8, 2>(16 * i + 2, 1); 52 Result_Y.select<1, 1, 8, 1>(4 * i, 8) = DataBuffer.format<uchar, 96, 32>().select<1, 1, 8, 2>(16 * i + 10, 1); 53 Result_Y.select<1, 1, 8, 1>(4 * i + 1, 0) = DataBuffer.format<uchar, 96, 32>().select<1, 1, 8, 2>(16 * i + 2, 17); 54 Result_Y.select<1, 1, 8, 1>(4 * i + 1, 8) = DataBuffer.format<uchar, 96, 32>().select<1, 1, 8, 2>(16 * i + 10, 17); 55 Result_Y.select<1, 1, 8, 1>(4 * i + 2, 0) = DataBuffer.format<uchar, 96, 32>().select<1, 1, 8, 2>(16 * i + 3, 1); 56 Result_Y.select<1, 1, 8, 1>(4 * i + 2, 8) = DataBuffer.format<uchar, 96, 32>().select<1, 1, 8, 2>(16 * i + 11, 1); 57 Result_Y.select<1, 1, 8, 1>(4 * i + 3, 0) = DataBuffer.format<uchar, 96, 32>().select<1, 1, 8, 2>(16 * i + 3, 17); 58 Result_Y.select<1, 1, 8, 1>(4 * i + 3, 8) = DataBuffer.format<uchar, 96, 32>().select<1, 1, 8, 2>(16 * i + 11, 17); 59 } 60 61 write(Dst_Surface, DstX, DstY, Result_Y); 62 }