1 /*
2 * Copyright (c) 2014-2018, 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 //! \file mhw_vebox_g8_X.cpp
24 //! \brief Constructs vebox commands on Gen8-based platforms
25 //! \details Each client facing function both creates a HW command and adds
26 //! that command to a command or batch buffer.
27 //!
28
29 #include "mhw_vebox_g8_X.h"
30
MhwVeboxInterfaceG8(PMOS_INTERFACE pInputInterface)31 MhwVeboxInterfaceG8::MhwVeboxInterfaceG8(
32 PMOS_INTERFACE pInputInterface)
33 : MhwVeboxInterfaceGeneric(pInputInterface)
34 {
35 MHW_FUNCTION_ENTER;
36 m_veboxSettings = g_Vebox_Settings_g8;
37 }
38
SetVeboxIecpStateCcm(mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD * pVeboxIecpState,PMHW_CAPPIPE_PARAMS pCapPipeParams,const unsigned int uCoeffValue)39 void MhwVeboxInterfaceG8::SetVeboxIecpStateCcm(
40 mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD *pVeboxIecpState,
41 PMHW_CAPPIPE_PARAMS pCapPipeParams,
42 const unsigned int uCoeffValue)
43 {
44 MHW_CHK_NULL_NO_STATUS_RETURN(pVeboxIecpState);
45 MHW_CHK_NULL_NO_STATUS_RETURN(pCapPipeParams);
46
47 pVeboxIecpState->AceState.DW0.FullImageHistogram = true;
48 pVeboxIecpState->CcmState.DW0.ColorCorrectionMatrixEnable = true;
49
50 // CleanupAfterSKLDone-AutoWhiteBalanceNotSupported
51 //
52 //if (pCapPipeParams->ColorCorrectionParams.bActive &&
53 // !pCapPipeParams->WhiteBalanceParams.bActive)
54 // Matrix for Color Correction provided by the application
55 if (pCapPipeParams->ColorCorrectionParams.bActive)
56 {
57 // Coeff is S8.12, so multiply the floating value by 4096
58 pVeboxIecpState->CcmState.DW0.C1CoefficientOf3X3TransformMatrix =
59 (uint32_t)(pCapPipeParams->ColorCorrectionParams.CCM[0][1] * uCoeffValue);
60 pVeboxIecpState->CcmState.DW1.C0CoefficientOf3X3TransformMatrix =
61 (uint32_t)(pCapPipeParams->ColorCorrectionParams.CCM[0][0] * uCoeffValue);
62 pVeboxIecpState->CcmState.DW2.C3CoefficientOf3X3TransformMatrix =
63 (uint32_t)(pCapPipeParams->ColorCorrectionParams.CCM[1][0] * uCoeffValue);
64 pVeboxIecpState->CcmState.DW3.C2CoefficientOf3X3TransformMatrix =
65 (uint32_t)(pCapPipeParams->ColorCorrectionParams.CCM[0][2] * uCoeffValue);
66 pVeboxIecpState->CcmState.DW4.C5CoefficientOf3X3TransformMatrix =
67 (uint32_t)(pCapPipeParams->ColorCorrectionParams.CCM[1][2] * uCoeffValue);
68 pVeboxIecpState->CcmState.DW5.C4CoefficientOf3X3TransformMatrix =
69 (uint32_t)(pCapPipeParams->ColorCorrectionParams.CCM[1][1] * uCoeffValue);
70 pVeboxIecpState->CcmState.DW6.C7CoefficientOf3X3TransformMatrix =
71 (uint32_t)(pCapPipeParams->ColorCorrectionParams.CCM[2][1] * uCoeffValue);
72 pVeboxIecpState->CcmState.DW7.C6CoefficientOf3X3TransformMatrix =
73 (uint32_t)(pCapPipeParams->ColorCorrectionParams.CCM[2][0] * uCoeffValue);
74 pVeboxIecpState->CcmState.DW8.C8CoefficientOf3X3TransformMatrix =
75 (uint32_t)(pCapPipeParams->ColorCorrectionParams.CCM[2][2] * uCoeffValue);
76 }
77
78 }
79
SetVeboxIecpStateBecsc(mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD * pVeboxIecpState,PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams,bool bEnableFECSC)80 void MhwVeboxInterfaceG8::SetVeboxIecpStateBecsc(
81 mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD *pVeboxIecpState,
82 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams,
83 bool bEnableFECSC)
84 {
85 PMHW_CAPPIPE_PARAMS pCapPipeParams;
86 MOS_FORMAT dstFormat;
87
88 MHW_CHK_NULL_NO_STATUS_RETURN(pVeboxIecpState);
89 MHW_CHK_NULL_NO_STATUS_RETURN(pVeboxIecpParams);
90
91 pCapPipeParams = &pVeboxIecpParams->CapPipeParams;
92 dstFormat = pVeboxIecpParams->dstFormat;
93
94 if (pCapPipeParams->bActive)
95 {
96 // Enable BECSC if YUV->RGB conversion is needed or RGB->BGR swap is needed
97 if ((bEnableFECSC && IS_RGB_FORMAT(dstFormat)) || dstFormat == Format_A8R8G8B8)
98 {
99 pVeboxIecpState->CscState.DW0.TransformEnable = true;
100 }
101
102 if (bEnableFECSC)
103 {
104 pVeboxIecpState->CscState.DW0.C0 = 1192;
105 pVeboxIecpState->CscState.DW1.C3 = 1192;
106 pVeboxIecpState->CscState.DW3.C6 = 1192;
107
108 pVeboxIecpState->CscState.DW5.OffsetIn1 = MOS_BITFIELD_VALUE((uint32_t)-64, 11);
109 pVeboxIecpState->CscState.DW5.OffsetOut1 = 0;
110 pVeboxIecpState->CscState.DW6.OffsetIn2 = MOS_BITFIELD_VALUE((uint32_t)-512, 11);
111 pVeboxIecpState->CscState.DW6.OffsetOut2 = 0;
112 pVeboxIecpState->CscState.DW7.OffsetIn3 = MOS_BITFIELD_VALUE((uint32_t)-512, 11);
113 pVeboxIecpState->CscState.DW7.OffsetOut3 = 0;
114
115 if (dstFormat == Format_A8B8G8R8) // Convert YUV->RGB
116 {
117 if (pVeboxIecpParams->ColorSpace == MHW_CSpace_BT601)
118 {
119 pVeboxIecpState->CscState.DW0.C1 = MOS_BITFIELD_VALUE((uint32_t)-2, 13);
120 pVeboxIecpState->CscState.DW1.C2 = 1634;
121
122 pVeboxIecpState->CscState.DW2.C4 = MOS_BITFIELD_VALUE((uint32_t)-401, 13);
123 pVeboxIecpState->CscState.DW2.C5 = MOS_BITFIELD_VALUE((uint32_t)-833, 13);
124
125 pVeboxIecpState->CscState.DW3.C7 = 2066;
126 pVeboxIecpState->CscState.DW4.C8 = MOS_BITFIELD_VALUE((uint32_t)-1, 13);
127 }
128 else if (pVeboxIecpParams->ColorSpace == MHW_CSpace_BT709)
129 {
130 pVeboxIecpState->CscState.DW0.C1 = MOS_BITFIELD_VALUE((uint32_t)-1, 13);
131 pVeboxIecpState->CscState.DW1.C2 = 1835;
132 pVeboxIecpState->CscState.DW2.C4 = MOS_BITFIELD_VALUE((uint32_t)-218, 13);
133 pVeboxIecpState->CscState.DW2.C5 = MOS_BITFIELD_VALUE((uint32_t)-537, 13);
134
135 pVeboxIecpState->CscState.DW3.C7 = 2164;
136 pVeboxIecpState->CscState.DW4.C8 = 1;
137 }
138 else
139 {
140 MHW_ASSERT(false);
141 }
142 }
143 else // if (dstFormat == Format_A8R8G8B8) convert YUV->BGR
144 {
145 if (pVeboxIecpParams->ColorSpace == MHW_CSpace_BT601)
146 {
147 pVeboxIecpState->CscState.DW0.C1 = 2066;
148 pVeboxIecpState->CscState.DW1.C2 = MOS_BITFIELD_VALUE((uint32_t)-1, 13);
149 pVeboxIecpState->CscState.DW2.C4 = MOS_BITFIELD_VALUE((uint32_t)-401, 13);
150 pVeboxIecpState->CscState.DW2.C5 = MOS_BITFIELD_VALUE((uint32_t)-833, 13);
151
152 pVeboxIecpState->CscState.DW3.C7 = MOS_BITFIELD_VALUE((uint32_t)-2, 13);
153 pVeboxIecpState->CscState.DW4.C8 = 1634;
154 }
155 else if (pVeboxIecpParams->ColorSpace == MHW_CSpace_BT709)
156 {
157 pVeboxIecpState->CscState.DW0.C1 = 2164;
158 pVeboxIecpState->CscState.DW1.C2 = 1;
159 pVeboxIecpState->CscState.DW2.C4 = MOS_BITFIELD_VALUE((uint32_t)-218, 13);
160 pVeboxIecpState->CscState.DW2.C5 = MOS_BITFIELD_VALUE((uint32_t)-537, 13);
161
162 pVeboxIecpState->CscState.DW3.C7 = MOS_BITFIELD_VALUE((uint32_t)-1, 13);
163 pVeboxIecpState->CscState.DW4.C8 = 1835;
164 }
165 else
166 {
167 MHW_ASSERT(false);
168 }
169 }
170 }
171 else if (dstFormat == Format_A8R8G8B8) // RGB->BGR
172 {
173 pVeboxIecpState->CscState.DW0.C0 = 0;
174 pVeboxIecpState->CscState.DW0.C1 = 0;
175 pVeboxIecpState->CscState.DW1.C2 = 1024;
176 pVeboxIecpState->CscState.DW1.C3 = 0;
177 pVeboxIecpState->CscState.DW2.C4 = 1024;
178 pVeboxIecpState->CscState.DW2.C5 = 0;
179 pVeboxIecpState->CscState.DW3.C6 = 1024;
180 pVeboxIecpState->CscState.DW3.C7 = 0;
181 pVeboxIecpState->CscState.DW4.C8 = 0;
182 pVeboxIecpState->CscState.DW5.OffsetIn1 = 0;
183 pVeboxIecpState->CscState.DW5.OffsetOut1 = 0;
184 pVeboxIecpState->CscState.DW6.OffsetIn2 = 0;
185 pVeboxIecpState->CscState.DW6.OffsetOut2 = 0;
186 pVeboxIecpState->CscState.DW7.OffsetIn3 = 0;
187 pVeboxIecpState->CscState.DW7.OffsetOut3 = 0;
188 }
189 }
190 else if (pVeboxIecpParams->bCSCEnable)
191 {
192 // Set CSC Params
193 pVeboxIecpState->CscState.DW0.TransformEnable = true;
194
195 pVeboxIecpState->CscState.DW0.C0 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscCoeff[0] * 1024.0F); // S2.10
196 pVeboxIecpState->CscState.DW0.C1 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscCoeff[1] * 1024.0F); // S2.10
197 pVeboxIecpState->CscState.DW1.C2 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscCoeff[2] * 1024.0F); // S2.10
198 pVeboxIecpState->CscState.DW1.C3 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscCoeff[3] * 1024.0F); // S2.10
199 pVeboxIecpState->CscState.DW2.C4 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscCoeff[4] * 1024.0F); // S2.10
200 pVeboxIecpState->CscState.DW2.C5 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscCoeff[5] * 1024.0F); // S2.10
201
202 pVeboxIecpState->CscState.DW3.C6 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscCoeff[6] * 1024.0F); // S2.10
203 pVeboxIecpState->CscState.DW3.C7 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscCoeff[7] * 1024.0F); // S2.10
204 pVeboxIecpState->CscState.DW4.C8 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscCoeff[8] * 1024.0F); // S2.10
205
206 // Offset is S10, but the SW offsets are calculated as 8bits, so left shift them 2bits to be in the position of MSB
207 pVeboxIecpState->CscState.DW5.OffsetIn1 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscInOffset[0] * 4.0F); // S10
208 pVeboxIecpState->CscState.DW6.OffsetIn2 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscInOffset[1] * 4.0F); // S10
209 pVeboxIecpState->CscState.DW7.OffsetIn3 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscInOffset[2] * 4.0F); // S10
210
211 pVeboxIecpState->CscState.DW5.OffsetOut1 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscOutOffset[0] * 4.0F); // S10
212 pVeboxIecpState->CscState.DW6.OffsetOut2 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscOutOffset[1] * 4.0F); // S10
213 pVeboxIecpState->CscState.DW7.OffsetOut3 = (uint32_t)MOS_F_ROUND(pVeboxIecpParams->pfCscOutOffset[2] * 4.0F); // S10
214
215 pVeboxIecpState->AlphaAoiState.DW0.AlphaFromStateSelect = pVeboxIecpParams->bAlphaEnable;
216
217 // Alpha is U12, but the SW alpha is calculated as 8bits, so left shift it 4bits to be in the position of MSB
218 pVeboxIecpState->AlphaAoiState.DW0.ColorPipeAlpha = pVeboxIecpParams->wAlphaValue * 16; // U12
219 }
220 }
221
VeboxAdjustBoundary(PMHW_VEBOX_SURFACE_PARAMS pSurfaceParam,uint32_t * pdwSurfaceWidth,uint32_t * pdwSurfaceHeight,bool bDIEnable)222 MOS_STATUS MhwVeboxInterfaceG8::VeboxAdjustBoundary(
223 PMHW_VEBOX_SURFACE_PARAMS pSurfaceParam,
224 uint32_t *pdwSurfaceWidth,
225 uint32_t *pdwSurfaceHeight,
226 bool bDIEnable)
227 {
228 uint16_t wWidthAlignUnit;
229 uint16_t wHeightAlignUnit;
230 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
231
232 MHW_CHK_NULL(pSurfaceParam);
233 MHW_CHK_NULL(pdwSurfaceWidth);
234 MHW_CHK_NULL(pdwSurfaceHeight);
235
236 // initialize
237 wHeightAlignUnit = 1;
238 wWidthAlignUnit = 1;
239
240 switch (pSurfaceParam->Format)
241 {
242 case Format_NV12:
243 wHeightAlignUnit = bDIEnable ? 4 : 2;
244 wWidthAlignUnit = 2;
245 break;
246
247 case Format_YUYV:
248 case Format_YUY2:
249 case Format_UYVY:
250 case Format_YVYU:
251 case Format_VYUY:
252 wHeightAlignUnit = bDIEnable ? 2 : 1;
253 wWidthAlignUnit = 2;
254 break;
255
256 // For other formats, we will not do any special alignment
257 case Format_A8R8G8B8:
258 case Format_X8R8G8B8:
259 case Format_A8B8G8R8:
260 case Format_X8B8G8R8:
261 case Format_L8:
262 default:
263 break;
264 }
265
266 // Align width and height with max src renctange with consideration of
267 // these conditions:
268 // The minimum of width/height should equal to or larger than
269 // MHW_VEBOX_MIN_WIDTH/HEIGHT. The maximum of width/heigh should equal
270 // to or smaller than surface width/height
271 *pdwSurfaceHeight = MOS_ALIGN_CEIL(
272 MOS_MIN(pSurfaceParam->dwHeight, MOS_MAX((uint32_t)pSurfaceParam->rcMaxSrc.bottom, MHW_VEBOX_MIN_HEIGHT)),
273 wHeightAlignUnit);
274 *pdwSurfaceWidth = MOS_ALIGN_CEIL(
275 MOS_MIN(pSurfaceParam->dwWidth, MOS_MAX((uint32_t)pSurfaceParam->rcMaxSrc.right, MHW_VEBOX_MIN_WIDTH)),
276 wWidthAlignUnit);
277
278 finish:
279 return eStatus;
280 }
281
AddVeboxState(PMOS_COMMAND_BUFFER pCmdBuffer,PMHW_VEBOX_STATE_CMD_PARAMS pVeboxStateCmdParams,bool bUseCmBuffer)282 MOS_STATUS MhwVeboxInterfaceG8::AddVeboxState(
283 PMOS_COMMAND_BUFFER pCmdBuffer,
284 PMHW_VEBOX_STATE_CMD_PARAMS pVeboxStateCmdParams,
285 bool bUseCmBuffer)
286 {
287 MOS_STATUS eStatus;
288 PMOS_INTERFACE pOsInterface;
289 PMOS_RESOURCE pVeboxParamResource = nullptr;
290 PMOS_RESOURCE pVeboxHeapResource = nullptr;
291 PMHW_VEBOX_HEAP pVeboxHeap;
292 PMHW_VEBOX_MODE pVeboxMode;
293 uint32_t uiInstanceBaseAddr = 0;
294 MHW_RESOURCE_PARAMS ResourceParams;
295 mhw_vebox_g8_X::VEBOX_STATE_CMD cmd;
296
297 MHW_CHK_NULL(m_osInterface);
298 MHW_CHK_NULL(m_veboxHeap);
299 MHW_CHK_NULL(pCmdBuffer);
300 MHW_CHK_NULL(pVeboxStateCmdParams);
301
302 // Initialize
303 eStatus = MOS_STATUS_SUCCESS;
304 pOsInterface = m_osInterface;
305 pVeboxHeap = m_veboxHeap;
306 pVeboxMode = &pVeboxStateCmdParams->VeboxMode;
307 if (bUseCmBuffer)
308 {
309 pVeboxParamResource = pVeboxStateCmdParams->pVeboxParamSurf;
310 }
311 else
312 {
313 pVeboxHeapResource = pVeboxStateCmdParams->bUseVeboxHeapKernelResource ? &pVeboxHeap->KernelResource : &pVeboxHeap->DriverResource;
314 // Calculate the instance base address
315 uiInstanceBaseAddr = pVeboxHeap->uiInstanceSize * pVeboxHeap->uiCurState;
316 }
317
318 cmd.DW1.DownsampleMethod422to420 = 1;
319 cmd.DW1.DownsampleMethod444to422 = 1;
320
321 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
322 if (bUseCmBuffer)
323 {
324 ResourceParams.presResource = pVeboxParamResource;
325 ResourceParams.dwOffset = pVeboxHeap->uiDndiStateOffset;
326 }
327 else
328 {
329 ResourceParams.presResource = pVeboxHeapResource;
330 ResourceParams.dwOffset = pVeboxHeap->uiDndiStateOffset + uiInstanceBaseAddr;
331 }
332 ResourceParams.pdwCmd = & (cmd.DW2.Value);
333 ResourceParams.dwLocationInCmd = 2;
334 ResourceParams.HwCommandType = MOS_VEBOX_STATE;
335
336 MHW_CHK_STATUS(pfnAddResourceToCmd(
337 pOsInterface,
338 pCmdBuffer,
339 &ResourceParams));
340
341 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
342 if (bUseCmBuffer)
343 {
344 ResourceParams.presResource = pVeboxParamResource;
345 ResourceParams.dwOffset = pVeboxHeap->uiIecpStateOffset;
346 }
347 else
348 {
349 ResourceParams.presResource = pVeboxHeapResource;
350 ResourceParams.dwOffset = pVeboxHeap->uiIecpStateOffset + uiInstanceBaseAddr;
351 }
352 ResourceParams.pdwCmd = & (cmd.DW4.Value);
353 ResourceParams.dwLocationInCmd = 4;
354 ResourceParams.HwCommandType = MOS_VEBOX_STATE;
355 ResourceParams.dwSharedMocsOffset = 1 - ResourceParams.dwLocationInCmd;
356
357 MHW_CHK_STATUS(pfnAddResourceToCmd(
358 pOsInterface,
359 pCmdBuffer,
360 &ResourceParams));
361
362 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
363 if (bUseCmBuffer)
364 {
365 ResourceParams.presResource = pVeboxParamResource;
366 ResourceParams.dwOffset = pVeboxHeap->uiGamutStateOffset;
367 }
368 else
369 {
370 ResourceParams.presResource = pVeboxHeapResource;
371 ResourceParams.dwOffset = pVeboxHeap->uiGamutStateOffset + uiInstanceBaseAddr;
372 }
373 ResourceParams.pdwCmd = & (cmd.DW6.Value);
374 ResourceParams.dwLocationInCmd = 6;
375 ResourceParams.HwCommandType = MOS_VEBOX_STATE;
376 ResourceParams.dwSharedMocsOffset = 1 - ResourceParams.dwLocationInCmd;
377
378 MHW_CHK_STATUS(pfnAddResourceToCmd(
379 pOsInterface,
380 pCmdBuffer,
381 &ResourceParams));
382
383 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
384 if (bUseCmBuffer)
385 {
386 ResourceParams.presResource = pVeboxParamResource;
387 ResourceParams.dwOffset = pVeboxHeap->uiVertexTableOffset;
388 }
389 else
390 {
391 ResourceParams.presResource = pVeboxHeapResource;
392 ResourceParams.dwOffset = pVeboxHeap->uiVertexTableOffset + uiInstanceBaseAddr;
393 }
394 ResourceParams.pdwCmd = & (cmd.DW8.Value);
395 ResourceParams.dwLocationInCmd = 8;
396 ResourceParams.HwCommandType = MOS_VEBOX_STATE;
397 ResourceParams.dwSharedMocsOffset = 1 - ResourceParams.dwLocationInCmd;
398
399 MHW_CHK_STATUS(pfnAddResourceToCmd(
400 pOsInterface,
401 pCmdBuffer,
402 &ResourceParams));
403
404 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
405 if (bUseCmBuffer)
406 {
407 ResourceParams.presResource = pVeboxParamResource;
408 ResourceParams.dwOffset = pVeboxHeap->uiCapturePipeStateOffset;
409 }
410 else
411 {
412 ResourceParams.presResource = pVeboxHeapResource;
413 ResourceParams.dwOffset = pVeboxHeap->uiCapturePipeStateOffset + uiInstanceBaseAddr;
414 }
415 ResourceParams.pdwCmd = & (cmd.DW10.Value);
416 ResourceParams.dwLocationInCmd = 10;
417 ResourceParams.HwCommandType = MOS_VEBOX_STATE;
418 ResourceParams.dwSharedMocsOffset = 1 - ResourceParams.dwLocationInCmd;
419
420 MHW_CHK_STATUS(pfnAddResourceToCmd(
421 pOsInterface,
422 pCmdBuffer,
423 &ResourceParams));
424
425 cmd.DW1.ColorGamutExpansionEnable = pVeboxMode->ColorGamutExpansionEnable;
426 cmd.DW1.ColorGamutCompressionEnable = pVeboxMode->ColorGamutCompressionEnable;
427 cmd.DW1.GlobalIecpEnable = pVeboxMode->GlobalIECPEnable;
428 cmd.DW1.DnEnable = pVeboxMode->DNEnable;
429 cmd.DW1.DiEnable = pVeboxMode->DIEnable;
430 cmd.DW1.DnDiFirstFrame = pVeboxMode->DNDIFirstFrame;
431 cmd.DW1.DiOutputFrames = pVeboxMode->DIOutputFrames;
432 cmd.DW1.DemosaicEnable = pVeboxMode->DemosaicEnable;
433 cmd.DW1.VignetteEnable = pVeboxMode->VignetteEnable;
434 cmd.DW1.AlphaPlaneEnable = pVeboxMode->AlphaPlaneEnable;
435 cmd.DW1.HotPixelFilteringEnable = pVeboxMode->HotPixelFilteringEnable;
436 cmd.DW1.SingleSliceVeboxEnable = pVeboxMode->SingleSliceVeboxEnable;
437
438 pOsInterface->pfnAddCommand(pCmdBuffer, &cmd, cmd.byteSize);
439
440 finish:
441 return eStatus;
442 }
443
AddVeboxSurfaces(PMOS_COMMAND_BUFFER pCmdBuffer,PMHW_VEBOX_SURFACE_STATE_CMD_PARAMS pVeboxSurfaceStateCmdParams)444 MOS_STATUS MhwVeboxInterfaceG8::AddVeboxSurfaces(
445 PMOS_COMMAND_BUFFER pCmdBuffer,
446 PMHW_VEBOX_SURFACE_STATE_CMD_PARAMS pVeboxSurfaceStateCmdParams)
447 {
448 mhw_vebox_g8_X::VEBOX_SURFACE_STATE_CMD cmd1, cmd2;
449
450 MHW_CHK_NULL_RETURN(m_osInterface);
451 MHW_CHK_NULL_RETURN(pCmdBuffer);
452 MHW_CHK_NULL_RETURN(pVeboxSurfaceStateCmdParams);
453
454 // Setup Surface State for Input surface
455 SetVeboxSurfaces(
456 &pVeboxSurfaceStateCmdParams->SurfInput,
457 nullptr,
458 nullptr,
459 &cmd1,
460 false,
461 pVeboxSurfaceStateCmdParams->bDIEnable);
462 m_osInterface->pfnAddCommand(pCmdBuffer, &cmd1, cmd1.byteSize);
463
464 // Setup Surface State for Output surface
465 SetVeboxSurfaces(
466 &pVeboxSurfaceStateCmdParams->SurfOutput,
467 nullptr,
468 nullptr,
469 &cmd2,
470 true,
471 pVeboxSurfaceStateCmdParams->bDIEnable);
472 m_osInterface->pfnAddCommand(pCmdBuffer, &cmd2, cmd2.byteSize);
473
474 return MOS_STATUS_SUCCESS;
475 }
476
SetVeboxSurfaces(PMHW_VEBOX_SURFACE_PARAMS pSurfaceParam,PMHW_VEBOX_SURFACE_PARAMS pDerivedSurfaceParam,PMHW_VEBOX_SURFACE_PARAMS pSkinScoreSurfaceParam,mhw_vebox_g8_X::VEBOX_SURFACE_STATE_CMD * pVeboxSurfaceState,bool bIsOutputSurface,bool bDIEnable)477 void MhwVeboxInterfaceG8::SetVeboxSurfaces(
478 PMHW_VEBOX_SURFACE_PARAMS pSurfaceParam,
479 PMHW_VEBOX_SURFACE_PARAMS pDerivedSurfaceParam,
480 PMHW_VEBOX_SURFACE_PARAMS pSkinScoreSurfaceParam,
481 mhw_vebox_g8_X::VEBOX_SURFACE_STATE_CMD *pVeboxSurfaceState,
482 bool bIsOutputSurface,
483 bool bDIEnable)
484 {
485 uint32_t dwFormat;
486 uint32_t dwSurfaceWidth;
487 uint32_t dwSurfaceHeight;
488 uint32_t dwSurfacePitch;
489 bool bHalfPitchForChroma;
490 bool bInterleaveChroma;
491 uint16_t wUXOffset;
492 uint16_t wUYOffset;
493 uint16_t wVXOffset;
494 uint16_t wVYOffset;
495 uint8_t bBayerOffset;
496 uint8_t bBayerStride;
497
498 mhw_vebox_g8_X::VEBOX_SURFACE_STATE_CMD VeboxSurfaceState;
499
500 if ((pSurfaceParam == nullptr) || (pVeboxSurfaceState == nullptr))
501 {
502 MHW_ASSERTMESSAGE("Invalid Input Parameter: pSurfaceParam is nullptr OR pVeboxSurfaceState is nullptr");
503 return;
504 }
505
506 // Initialize
507 dwSurfaceWidth = 0;
508 dwSurfaceHeight = 0;
509 dwSurfacePitch = 0;
510 bHalfPitchForChroma = false;
511 bInterleaveChroma = false;
512 wUXOffset = 0;
513 wUYOffset = 0;
514 wVXOffset = 0;
515 wVYOffset = 0;
516 bBayerOffset = 0;
517 bBayerStride = 0;
518 *pVeboxSurfaceState = VeboxSurfaceState;
519
520 switch (pSurfaceParam->Format)
521 {
522 case Format_NV12:
523 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_PLANAR4208;
524 bInterleaveChroma = true;
525 wUYOffset = (uint16_t)pSurfaceParam->dwHeight;
526 break;
527
528 case Format_YUYV:
529 case Format_YUY2:
530 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_YCRCBNORMAL;
531 break;
532
533 case Format_UYVY:
534 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_YCRCBSWAPY;
535 break;
536
537 case Format_YVYU:
538 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_YCRCBSWAPUV;
539 break;
540
541 case Format_VYUY:
542 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_YCRCBSWAPUVY;
543 break;
544
545 case Format_AYUV:
546 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_PACKED444A8;
547 break;
548
549 case Format_A8R8G8B8:
550 case Format_X8R8G8B8:
551 case Format_A8B8G8R8:
552 case Format_X8B8G8R8:
553 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_R8G8B8A8UNORMR8G8B8A8UNORMSRGB;
554 break;
555
556 case Format_L8:
557 case Format_P8:
558 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_Y8UNORM;
559 break;
560
561 case Format_IRW0:
562 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_BAYERPATTERN;
563 bBayerOffset = VeboxSurfaceState.BAYER_PATTERN_OFFSET_PIXELATX0_Y0ISBLUE;
564 bBayerStride = VeboxSurfaceState.BAYER_PATTERN_FORMAT_12OR10_BITINPUTATA16_BITSTRIDEVALIDDATAISINTHEMSBS;
565 break;
566
567 case Format_IRW1:
568 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_BAYERPATTERN;
569 bBayerOffset = VeboxSurfaceState.BAYER_PATTERN_OFFSET_PIXELATX0_Y0ISRED;
570 bBayerStride = VeboxSurfaceState.BAYER_PATTERN_FORMAT_12OR10_BITINPUTATA16_BITSTRIDEVALIDDATAISINTHEMSBS;
571 break;
572
573 case Format_IRW2:
574 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_BAYERPATTERN;
575 bBayerOffset = VeboxSurfaceState.BAYER_PATTERN_OFFSET_PIXELATX0_Y0ISGREEN_PIXELATX1_Y0ISRED;
576 bBayerStride = VeboxSurfaceState.BAYER_PATTERN_FORMAT_12OR10_BITINPUTATA16_BITSTRIDEVALIDDATAISINTHEMSBS;
577 break;
578
579 case Format_IRW3:
580 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_BAYERPATTERN;
581 bBayerOffset = VeboxSurfaceState.BAYER_PATTERN_OFFSET_PIXELATX0_Y0ISGREEN_PIXELATX1_Y0ISBLUE;
582 bBayerStride = VeboxSurfaceState.BAYER_PATTERN_FORMAT_12OR10_BITINPUTATA16_BITSTRIDEVALIDDATAISINTHEMSBS;
583 break;
584
585 case Format_IRW4:
586 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_BAYERPATTERN;
587 bBayerOffset = VeboxSurfaceState.BAYER_PATTERN_OFFSET_PIXELATX0_Y0ISBLUE;
588 bBayerStride = VeboxSurfaceState.BAYER_PATTERN_FORMAT_8_BITINPUTATA8_BITSTRIDE;
589 break;
590
591 case Format_IRW5:
592 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_BAYERPATTERN;
593 bBayerOffset = VeboxSurfaceState.BAYER_PATTERN_OFFSET_PIXELATX0_Y0ISRED;
594 bBayerStride = VeboxSurfaceState.BAYER_PATTERN_FORMAT_8_BITINPUTATA8_BITSTRIDE;
595 break;
596
597 case Format_IRW6:
598 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_BAYERPATTERN;
599 bBayerOffset = VeboxSurfaceState.BAYER_PATTERN_OFFSET_PIXELATX0_Y0ISGREEN_PIXELATX1_Y0ISRED;
600 bBayerStride = VeboxSurfaceState.BAYER_PATTERN_FORMAT_8_BITINPUTATA8_BITSTRIDE;
601 break;
602
603 case Format_IRW7:
604 dwFormat = VeboxSurfaceState.SURFACE_FORMAT_BAYERPATTERN;
605 bBayerOffset = VeboxSurfaceState.BAYER_PATTERN_OFFSET_PIXELATX0_Y0ISGREEN_PIXELATX1_Y0ISBLUE;
606 bBayerStride = VeboxSurfaceState.BAYER_PATTERN_FORMAT_8_BITINPUTATA8_BITSTRIDE;
607 break;
608
609 default:
610 MHW_ASSERTMESSAGE("Unsupported format.");
611 goto finish;
612 break;
613 }
614
615 // adjust boundary for vebox
616 VeboxAdjustBoundary(
617 pSurfaceParam,
618 &dwSurfaceWidth,
619 &dwSurfaceHeight,
620 bDIEnable);
621
622 dwSurfacePitch = (pSurfaceParam->TileType == MOS_TILE_LINEAR) ? MOS_ALIGN_CEIL(pSurfaceParam->dwPitch, MHW_VEBOX_LINEAR_PITCH) : pSurfaceParam->dwPitch;
623
624 // Re-set DW0
625 pVeboxSurfaceState->DW0.DwordLength = 4;
626
627 pVeboxSurfaceState->DW1.SurfaceIdentification = bIsOutputSurface;
628 pVeboxSurfaceState->DW2.Width = dwSurfaceWidth - 1;
629 pVeboxSurfaceState->DW2.Height = dwSurfaceHeight - 1;
630 pVeboxSurfaceState->DW3.HalfPitchForChroma = bHalfPitchForChroma;
631 pVeboxSurfaceState->DW3.InterleaveChroma = bInterleaveChroma;
632 pVeboxSurfaceState->DW3.SurfaceFormat = dwFormat;
633 pVeboxSurfaceState->DW3.BayerPatternOffset = bBayerOffset;
634 pVeboxSurfaceState->DW3.BayerPatternFormat = bBayerStride;
635 pVeboxSurfaceState->DW3.SurfacePitch = dwSurfacePitch - 1;
636 pVeboxSurfaceState->DW3.TiledSurface = (pSurfaceParam->TileType != MOS_TILE_LINEAR)
637 ? true
638 : false;
639 pVeboxSurfaceState->DW3.TileWalk = (pSurfaceParam->TileType == MOS_TILE_Y)
640 ? VeboxSurfaceState.TILE_WALK_TILEWALKYMAJOR
641 : VeboxSurfaceState.TILE_WALK_TILEWALKXMAJOR;
642 pVeboxSurfaceState->DW4.XOffsetForU = wUXOffset;
643 pVeboxSurfaceState->DW4.YOffsetForU = wUYOffset;
644 pVeboxSurfaceState->DW5.XOffsetForV = wVXOffset;
645 pVeboxSurfaceState->DW5.YOffsetForV = wVYOffset;
646
647 finish:
648 return;
649 }
650
AddVeboxDiIecp(PMOS_COMMAND_BUFFER pCmdBuffer,PMHW_VEBOX_DI_IECP_CMD_PARAMS pVeboxDiIecpCmdParams)651 MOS_STATUS MhwVeboxInterfaceG8::AddVeboxDiIecp(
652 PMOS_COMMAND_BUFFER pCmdBuffer,
653 PMHW_VEBOX_DI_IECP_CMD_PARAMS pVeboxDiIecpCmdParams)
654 {
655 MOS_STATUS eStatus;;
656 MHW_RESOURCE_PARAMS ResourceParams;
657 mhw_vebox_g8_X::VEB_DI_IECP_CMD cmd;
658
659 MHW_CHK_NULL(m_osInterface);
660 MHW_CHK_NULL(pCmdBuffer);
661 MHW_CHK_NULL(pVeboxDiIecpCmdParams);
662 MHW_ASSERT(MOS_IS_ALIGNED(pVeboxDiIecpCmdParams->dwCurrInputSurfOffset, MHW_PAGE_SIZE)); // offset should be aligned with 4KB
663 MHW_ASSERT(MOS_IS_ALIGNED(pVeboxDiIecpCmdParams->dwPrevInputSurfOffset, MHW_PAGE_SIZE)); // offset should be aligned with 4KB
664
665 // Initialize
666 eStatus = MOS_STATUS_SUCCESS;
667
668 if (pVeboxDiIecpCmdParams->pOsResCurrInput)
669 {
670 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
671 ResourceParams.presResource = pVeboxDiIecpCmdParams->pOsResCurrInput;
672 ResourceParams.dwOffset = pVeboxDiIecpCmdParams->CurrInputSurfCtrl.Value + pVeboxDiIecpCmdParams->dwCurrInputSurfOffset;
673 ResourceParams.pdwCmd = & (cmd.DW2.Value);
674 ResourceParams.dwLocationInCmd = 2;
675 ResourceParams.HwCommandType = MOS_VEBOX_DI_IECP;
676
677 MHW_CHK_STATUS(pfnAddResourceToCmd(
678 m_osInterface,
679 pCmdBuffer,
680 &ResourceParams));
681 }
682
683 if (pVeboxDiIecpCmdParams->pOsResPrevInput)
684 {
685 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
686 ResourceParams.presResource = pVeboxDiIecpCmdParams->pOsResPrevInput;
687 ResourceParams.dwOffset = pVeboxDiIecpCmdParams->PrevInputSurfCtrl.Value + pVeboxDiIecpCmdParams->dwPrevInputSurfOffset;
688 ResourceParams.pdwCmd = & (cmd.DW4.Value);
689 ResourceParams.dwLocationInCmd = 4;
690 ResourceParams.HwCommandType = MOS_VEBOX_DI_IECP;
691
692 MHW_CHK_STATUS(pfnAddResourceToCmd(
693 m_osInterface,
694 pCmdBuffer,
695 &ResourceParams));
696 }
697
698 // Patch STMM Input
699 if (pVeboxDiIecpCmdParams->pOsResStmmInput)
700 {
701 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
702 ResourceParams.presResource = pVeboxDiIecpCmdParams->pOsResStmmInput;
703 ResourceParams.dwOffset = pVeboxDiIecpCmdParams->StmmInputSurfCtrl.Value;
704 ResourceParams.pdwCmd = & (cmd.DW6.Value);
705 ResourceParams.dwLocationInCmd = 6;
706 ResourceParams.HwCommandType = MOS_VEBOX_DI_IECP;
707
708 MHW_CHK_STATUS(pfnAddResourceToCmd(
709 m_osInterface,
710 pCmdBuffer,
711 &ResourceParams));
712 }
713
714 if (pVeboxDiIecpCmdParams->pOsResStmmOutput)
715 {
716 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
717 ResourceParams.presResource = pVeboxDiIecpCmdParams->pOsResStmmOutput;
718 ResourceParams.dwOffset = pVeboxDiIecpCmdParams->StmmOutputSurfCtrl.Value;
719 ResourceParams.pdwCmd = & (cmd.DW8.Value);
720 ResourceParams.dwLocationInCmd = 8;
721 ResourceParams.bIsWritable = true;
722 ResourceParams.HwCommandType = MOS_VEBOX_DI_IECP;
723
724 MHW_CHK_STATUS(pfnAddResourceToCmd(
725 m_osInterface,
726 pCmdBuffer,
727 &ResourceParams));
728 }
729
730 if (pVeboxDiIecpCmdParams->pOsResDenoisedCurrOutput)
731 {
732 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
733 ResourceParams.presResource = pVeboxDiIecpCmdParams->pOsResDenoisedCurrOutput;
734 ResourceParams.dwOffset = pVeboxDiIecpCmdParams->DenoisedCurrOutputSurfCtrl.Value;
735 ResourceParams.pdwCmd = & (cmd.DW10.Value);
736 ResourceParams.dwLocationInCmd = 10;
737 ResourceParams.bIsWritable = true;
738 ResourceParams.HwCommandType = MOS_VEBOX_DI_IECP;
739
740 MHW_CHK_STATUS(pfnAddResourceToCmd(
741 m_osInterface,
742 pCmdBuffer,
743 &ResourceParams));
744 }
745
746 if (pVeboxDiIecpCmdParams->pOsResCurrOutput)
747 {
748 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
749 ResourceParams.presResource = pVeboxDiIecpCmdParams->pOsResCurrOutput;
750 ResourceParams.dwOffset = pVeboxDiIecpCmdParams->CurrOutputSurfCtrl.Value + pVeboxDiIecpCmdParams->dwCurrOutputSurfOffset;
751 ResourceParams.pdwCmd = & (cmd.DW12.Value);
752 ResourceParams.dwLocationInCmd = 12;
753 ResourceParams.bIsWritable = true;
754 ResourceParams.HwCommandType = MOS_VEBOX_DI_IECP;
755
756 MHW_CHK_STATUS(pfnAddResourceToCmd(
757 m_osInterface,
758 pCmdBuffer,
759 &ResourceParams));
760 }
761
762 if (pVeboxDiIecpCmdParams->pOsResPrevOutput)
763 {
764 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
765 ResourceParams.presResource = pVeboxDiIecpCmdParams->pOsResPrevOutput;
766 ResourceParams.dwOffset = pVeboxDiIecpCmdParams->PrevOutputSurfCtrl.Value;
767 ResourceParams.pdwCmd = & (cmd.DW14.Value);
768 ResourceParams.dwLocationInCmd = 14;
769 ResourceParams.bIsWritable = true;
770 ResourceParams.HwCommandType = MOS_VEBOX_DI_IECP;
771
772 MHW_CHK_STATUS(pfnAddResourceToCmd(
773 m_osInterface,
774 pCmdBuffer,
775 &ResourceParams));
776 }
777
778 if (pVeboxDiIecpCmdParams->pOsResStatisticsOutput)
779 {
780 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
781 ResourceParams.presResource = pVeboxDiIecpCmdParams->pOsResStatisticsOutput;
782 ResourceParams.dwOffset = pVeboxDiIecpCmdParams->StatisticsOutputSurfCtrl.Value;
783 ResourceParams.pdwCmd = & (cmd.DW16.Value);
784 ResourceParams.dwLocationInCmd = 16;
785 ResourceParams.bIsWritable = true;
786 ResourceParams.HwCommandType = MOS_VEBOX_DI_IECP;
787
788 MHW_CHK_STATUS(pfnAddResourceToCmd(
789 m_osInterface,
790 pCmdBuffer,
791 &ResourceParams));
792 }
793
794 if (pVeboxDiIecpCmdParams->pOsResAlphaOrVignette)
795 {
796 MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
797 ResourceParams.presResource = pVeboxDiIecpCmdParams->pOsResAlphaOrVignette;
798 ResourceParams.dwOffset = pVeboxDiIecpCmdParams->AlphaOrVignetteSurfCtrl.Value;
799 ResourceParams.pdwCmd = & (cmd.DW18.Value);
800 ResourceParams.dwLocationInCmd = 18;
801 ResourceParams.bIsWritable = true;
802 ResourceParams.HwCommandType = MOS_VEBOX_DI_IECP;
803
804 MHW_CHK_STATUS(pfnAddResourceToCmd(
805 m_osInterface,
806 pCmdBuffer,
807 &ResourceParams));
808 }
809
810 cmd.DW1.EndingX = pVeboxDiIecpCmdParams->dwEndingX;
811 cmd.DW1.StartingX = pVeboxDiIecpCmdParams->dwStartingX;
812
813 m_osInterface->pfnAddCommand(pCmdBuffer, &cmd, cmd.byteSize);
814
815 finish:
816 return eStatus;
817 }
818
AddVeboxDndiState(PMHW_VEBOX_DNDI_PARAMS pVeboxDndiParams)819 MOS_STATUS MhwVeboxInterfaceG8::AddVeboxDndiState(
820 PMHW_VEBOX_DNDI_PARAMS pVeboxDndiParams)
821 {
822 PMHW_VEBOX_HEAP pVeboxHeap;
823 uint32_t uiOffset;
824 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
825 mhw_vebox_g8_X::VEBOX_DNDI_STATE_CMD *pVeboxDndiState, VeboxDndiState;
826
827 MHW_CHK_NULL(pVeboxDndiParams);
828 MHW_CHK_NULL(m_veboxHeap);
829
830 pVeboxHeap = m_veboxHeap;
831 uiOffset = pVeboxHeap->uiCurState * pVeboxHeap->uiInstanceSize;
832 pVeboxDndiState = (mhw_vebox_g8_X::VEBOX_DNDI_STATE_CMD *)(pVeboxHeap->pLockedDriverResourceMem +
833 pVeboxHeap->uiDndiStateOffset +
834 uiOffset);
835
836 *pVeboxDndiState = VeboxDndiState;
837
838 pVeboxDndiState->DW0.DenoiseAsdThreshold =
839 pVeboxDndiParams->dwDenoiseASDThreshold;
840 pVeboxDndiState->DW0.DenoiseHistoryIncrease =
841 pVeboxDndiParams->dwDenoiseHistoryDelta;
842 pVeboxDndiState->DW0.DenoiseMaximumHistory =
843 pVeboxDndiParams->dwDenoiseMaximumHistory;
844 pVeboxDndiState->DW0.DenoiseStadThreshold =
845 pVeboxDndiParams->dwDenoiseSTADThreshold;
846 pVeboxDndiState->DW1.DenoiseThresholdForSumOfComplexityMeasure =
847 pVeboxDndiParams->dwDenoiseSCMThreshold;
848 pVeboxDndiState->DW1.DenoiseMovingPixelThreshold =
849 pVeboxDndiParams->dwDenoiseMPThreshold;
850 pVeboxDndiState->DW1.LowTemporalDifferenceThreshold =
851 pVeboxDndiParams->dwLTDThreshold;
852 pVeboxDndiState->DW1.TemporalDifferenceThreshold =
853 pVeboxDndiParams->dwTDThreshold;
854 pVeboxDndiState->DW2.GoodNeighborThreshold =
855 pVeboxDndiParams->dwGoodNeighborThreshold;
856 pVeboxDndiState->DW2.BlockNoiseEstimateNoiseThreshold =
857 ABSMAXABSMIN_THRESHOLD_DEFAULT_G8;
858 pVeboxDndiState->DW6.DnDiTopFirst =
859 pVeboxDndiParams->bDNDITopFirst;
860 pVeboxDndiState->DW6.ProgressiveDn =
861 pVeboxDndiParams->bProgressiveDN;
862 pVeboxDndiState->DW7.ProgressiveCadenceReconstructionFor1StFieldOfCurrentFrame =
863 pVeboxDndiParams->dwFMDFirstFieldCurrFrame;
864 pVeboxDndiState->DW7.ProgressiveCadenceReconstructionFor2NdFieldOfPreviousFrame =
865 pVeboxDndiParams->dwFMDSecondFieldPrevFrame;
866
867 // Chroma Denoise
868 pVeboxDndiState->DW8.ChromaLowTemporalDifferenceThreshold =
869 pVeboxDndiParams->dwChromaLTDThreshold;
870 pVeboxDndiState->DW8.ChromaTemporalDifferenceThreshold =
871 pVeboxDndiParams->dwChromaTDThreshold;
872 pVeboxDndiState->DW8.ChromaDenoiseStadThreshold =
873 pVeboxDndiParams->dwChromaSTADThreshold;
874 pVeboxDndiState->DW8.ChromaDenoiseEnable =
875 pVeboxDndiParams->bChromaDNEnable;
876
877 // Hot Pixel
878 pVeboxDndiState->DW9.HotPixelThreshold =
879 pVeboxDndiParams->dwHotPixelThreshold;
880 pVeboxDndiState->DW9.HotPixelCount =
881 pVeboxDndiParams->dwHotPixelCount;
882
883 pVeboxDndiState->DW1.StmmC2 = 2;
884 pVeboxDndiState->DW3.MaximumStmm = 150;
885 pVeboxDndiState->DW3.MultiplierForVecm = 30;
886 pVeboxDndiState->DW4.SdiDelta = 5;
887 pVeboxDndiState->DW4.SdiThreshold = 100;
888 pVeboxDndiState->DW4.StmmOutputShift = 5;
889 pVeboxDndiState->DW4.StmmShiftUp = 1;
890 pVeboxDndiState->DW4.MinimumStmm = 118;
891
892 pVeboxDndiState->DW5.FmdTemporalDifferenceThreshold = 175;
893 pVeboxDndiState->DW5.SdiFallbackMode2ConstantAngle2X1 = 37;
894 pVeboxDndiState->DW5.SdiFallbackMode1T2Constant = 100;
895 pVeboxDndiState->DW5.SdiFallbackMode1T1Constant = 50;
896
897 pVeboxDndiState->DW6.McdiEnable = 1;
898 pVeboxDndiState->DW6.FmdTearThreshold = 2;
899 pVeboxDndiState->DW6.Fmd2VerticalDifferenceThreshold = 100;
900 pVeboxDndiState->DW6.Fmd1VerticalDifferenceThreshold = 16;
901
902 MHW_ASSERT(pVeboxDndiState->DW6.Value & 0xFF);
903
904 finish:
905 return eStatus;
906 }
907
AddVeboxGamutState(PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams,PMHW_VEBOX_GAMUT_PARAMS pVeboxGamutParams)908 MOS_STATUS MhwVeboxInterfaceG8::AddVeboxGamutState(
909 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams,
910 PMHW_VEBOX_GAMUT_PARAMS pVeboxGamutParams)
911 {
912 PMHW_VEBOX_HEAP pVeboxHeap;
913 uint32_t uiOffset;
914 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
915
916 mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD *pIecpState;
917 mhw_vebox_g8_X::VEBOX_GAMUT_STATE_CMD *pGamutState, gamutCmd;
918 MHW_CHK_NULL(pVeboxGamutParams);
919 MHW_CHK_NULL(m_veboxHeap);
920
921 pVeboxHeap = m_veboxHeap;
922 uiOffset = pVeboxHeap->uiCurState * pVeboxHeap->uiInstanceSize;
923
924 pIecpState =
925 (mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD *)(pVeboxHeap->pLockedDriverResourceMem +
926 pVeboxHeap->uiIecpStateOffset +
927 uiOffset);
928 pGamutState =
929 (mhw_vebox_g8_X::VEBOX_GAMUT_STATE_CMD *)(pVeboxHeap->pLockedDriverResourceMem +
930 pVeboxHeap->uiGamutStateOffset +
931 uiOffset);
932 MHW_CHK_NULL(pIecpState);
933 MHW_CHK_NULL(pGamutState);
934
935 // Must initialize VeboxIecpState firstly, even if it is not used because GCE
936 // requires GlobalIECP enable bit to be turned on
937 if (!pVeboxIecpParams)
938 {
939 IecpStateInitialization(pIecpState);
940 }
941
942 // Initializte the GammatSate;
943 GamutStateInitialization(pGamutState);
944
945 if (pVeboxGamutParams->GCompMode != MHW_GAMUT_MODE_NONE)
946 {
947 if (pVeboxGamutParams->GCompMode == MHW_GAMUT_MODE_BASIC)
948 {
949 pGamutState->DW35.Fullrangemappingenable = false;
950
951 if (pVeboxGamutParams->GCompBasicMode == gamutCmd.GCC_BASICMODESELECTION_SCALINGFACTOR)
952 {
953 pGamutState->DW37.GccBasicmodeselection = gamutCmd.GCC_BASICMODESELECTION_SCALINGFACTOR;
954 pGamutState->DW37.Basicmodescalingfactor =
955 pVeboxGamutParams->iBasicModeScalingFactor;
956 }
957 }
958 else if (pVeboxGamutParams->GCompMode == MHW_GAMUT_MODE_ADVANCED)
959 {
960 pGamutState->DW35.Fullrangemappingenable = true;
961 pGamutState->DW35.D1Out = pVeboxGamutParams->iDout;
962 pGamutState->DW35.DOutDefault = pVeboxGamutParams->iDoutDefault;
963 pGamutState->DW35.DInDefault = pVeboxGamutParams->iDinDefault;
964 pGamutState->DW36.D1In = pVeboxGamutParams->iDin;
965 }
966
967 // Set Vertex Table if Gamut Compression is enabled
968 MhwVeboxInterfaceGeneric<mhw_vebox_g8_X>::AddVeboxVertexTable(pVeboxGamutParams->ColorSpace);
969 }
970
971 if (pVeboxGamutParams->GExpMode != MHW_GAMUT_MODE_NONE)
972 {
973 // Need to convert YUV input to RGB before GE
974 pIecpState->CscState.DW0.TransformEnable = true;
975 pIecpState->CscState.DW0.C0 = 1192;
976 pIecpState->CscState.DW1.C3 = 1192;
977 pIecpState->CscState.DW3.C6 = 1192;
978
979 pIecpState->CscState.DW5.OffsetIn1 = MOS_BITFIELD_VALUE((uint32_t)-64, 11);
980 pIecpState->CscState.DW5.OffsetOut1 = 0;
981 pIecpState->CscState.DW6.OffsetIn2 = MOS_BITFIELD_VALUE((uint32_t)-512, 11);
982 pIecpState->CscState.DW6.OffsetOut2 = 0;
983 pIecpState->CscState.DW7.OffsetIn3 = MOS_BITFIELD_VALUE((uint32_t)-512, 11);
984 pIecpState->CscState.DW7.OffsetOut3 = 0;
985
986 if (pVeboxGamutParams->ColorSpace == MHW_CSpace_BT601 ||
987 pVeboxGamutParams->ColorSpace == MHW_CSpace_xvYCC601 ||
988 pVeboxGamutParams->ColorSpace == MHW_CSpace_BT601_FullRange)
989 {
990 pIecpState->CscState.DW0.C1 = MOS_BITFIELD_VALUE((uint32_t)-2, 13);
991 pIecpState->CscState.DW1.C2 = 1634;
992
993 pIecpState->CscState.DW2.C4 = MOS_BITFIELD_VALUE((uint32_t)-401, 13);
994 pIecpState->CscState.DW2.C5 = MOS_BITFIELD_VALUE((uint32_t)-833, 13);
995
996 pIecpState->CscState.DW3.C7 = 2066;
997 pIecpState->CscState.DW4.C8 = MOS_BITFIELD_VALUE((uint32_t)-1, 13);
998 }
999 else if (pVeboxGamutParams->ColorSpace == MHW_CSpace_BT709 ||
1000 pVeboxGamutParams->ColorSpace == MHW_CSpace_xvYCC709 ||
1001 pVeboxGamutParams->ColorSpace == MHW_CSpace_BT709_FullRange)
1002 {
1003 pIecpState->CscState.DW0.C1 = MOS_BITFIELD_VALUE((uint32_t)-1, 13);
1004 pIecpState->CscState.DW1.C2 = 1835;
1005 pIecpState->CscState.DW2.C4 = MOS_BITFIELD_VALUE((uint32_t)-218, 13);
1006 pIecpState->CscState.DW2.C5 = MOS_BITFIELD_VALUE((uint32_t)-537, 13);
1007
1008 pIecpState->CscState.DW3.C7 = 2164;
1009 pIecpState->CscState.DW4.C8 = 1;
1010 }
1011 else
1012 {
1013 MHW_ASSERTMESSAGE("Unknown primary");
1014 }
1015
1016 if (pVeboxGamutParams->GExpMode == MHW_GAMUT_MODE_BASIC)
1017 {
1018 pGamutState->DW0.GlobalModeEnable = true;
1019 pGamutState->DW0.CmW = 1023; // Colorimetric accurate image
1020 }
1021 else if (pVeboxGamutParams->GExpMode == MHW_GAMUT_MODE_ADVANCED)
1022 {
1023 pGamutState->DW0.GlobalModeEnable = false;
1024 }
1025
1026 pGamutState->DW3.C0 = pVeboxGamutParams->Matrix[0][0];
1027 pGamutState->DW3.C1 = pVeboxGamutParams->Matrix[0][1];
1028 pGamutState->DW4.C2 = pVeboxGamutParams->Matrix[0][2];
1029 pGamutState->DW4.C3 = pVeboxGamutParams->Matrix[1][0];
1030 pGamutState->DW5.C4 = pVeboxGamutParams->Matrix[1][1];
1031 pGamutState->DW5.C5 = pVeboxGamutParams->Matrix[1][2];
1032 pGamutState->DW6.C6 = pVeboxGamutParams->Matrix[2][0];
1033 pGamutState->DW6.C7 = pVeboxGamutParams->Matrix[2][1];
1034 pGamutState->DW7.C8 = pVeboxGamutParams->Matrix[2][2];
1035 }
1036 else if (pVeboxGamutParams->bGammaCorr)
1037 {
1038 // Need to convert YUV input to RGB before Gamma Correction
1039 pIecpState->CscState.DW0.TransformEnable = true;
1040
1041 pIecpState->CscState.DW0.C0 = 1192;
1042 pIecpState->CscState.DW1.C3 = 1192;
1043 pIecpState->CscState.DW3.C6 = 1192;
1044
1045 pIecpState->CscState.DW5.OffsetIn1 = MOS_BITFIELD_VALUE((uint32_t)-64, 11);
1046 pIecpState->CscState.DW5.OffsetOut1 = 0;
1047 pIecpState->CscState.DW6.OffsetIn2 = MOS_BITFIELD_VALUE((uint32_t)-512, 11);
1048 pIecpState->CscState.DW6.OffsetOut2 = 0;
1049 pIecpState->CscState.DW7.OffsetIn3 = MOS_BITFIELD_VALUE((uint32_t)-512, 11);
1050 pIecpState->CscState.DW7.OffsetOut3 = 0;
1051
1052 if (pVeboxGamutParams->ColorSpace == MHW_CSpace_BT601 ||
1053 pVeboxGamutParams->ColorSpace == MHW_CSpace_xvYCC601 ||
1054 pVeboxGamutParams->ColorSpace == MHW_CSpace_BT601_FullRange)
1055 {
1056 pIecpState->CscState.DW0.C1 = MOS_BITFIELD_VALUE((uint32_t)-2, 13);
1057 pIecpState->CscState.DW1.C2 = 1634;
1058
1059 pIecpState->CscState.DW2.C4 = MOS_BITFIELD_VALUE((uint32_t)-401, 13);
1060 pIecpState->CscState.DW2.C5 = MOS_BITFIELD_VALUE((uint32_t)-833, 13);
1061
1062 pIecpState->CscState.DW3.C7 = 2066;
1063 pIecpState->CscState.DW4.C8 = MOS_BITFIELD_VALUE((uint32_t)-1, 13);
1064 }
1065 else if (pVeboxGamutParams->ColorSpace == MHW_CSpace_BT709 ||
1066 pVeboxGamutParams->ColorSpace == MHW_CSpace_xvYCC709 ||
1067 pVeboxGamutParams->ColorSpace == MHW_CSpace_BT709_FullRange)
1068 {
1069 pIecpState->CscState.DW0.C1 = MOS_BITFIELD_VALUE((uint32_t)-1, 13);
1070 pIecpState->CscState.DW1.C2 = 1835;
1071 pIecpState->CscState.DW2.C4 = MOS_BITFIELD_VALUE((uint32_t)-218, 13);
1072 pIecpState->CscState.DW2.C5 = MOS_BITFIELD_VALUE((uint32_t)-537, 13);
1073
1074 pIecpState->CscState.DW3.C7 = 2164;
1075 pIecpState->CscState.DW4.C8 = 1;
1076 }
1077 else
1078 {
1079 MHW_ASSERTMESSAGE("Unknown primary");
1080 }
1081
1082 pGamutState->DW0.GlobalModeEnable = true;
1083 pGamutState->DW0.CmW = 1023;
1084 pGamutState->DW3.C0 = 4096;
1085 pGamutState->DW3.C1 = 0;
1086 pGamutState->DW4.C2 = 0;
1087 pGamutState->DW4.C3 = 0;
1088 pGamutState->DW5.C4 = 4096;
1089 pGamutState->DW5.C5 = 0;
1090 pGamutState->DW6.C6 = 0;
1091 pGamutState->DW6.C7 = 0;
1092 pGamutState->DW7.C8 = 4096;
1093 pGamutState->DW32.OffsetInR = 0;
1094 pGamutState->DW32.OffsetInG = 0;
1095 pGamutState->DW33.OffsetInB = 0;
1096 pGamutState->DW33.OffsetOutB = 0;
1097 pGamutState->DW34.OffsetOutR = 0;
1098 pGamutState->DW34.OffsetOutG = 0;
1099
1100 if (pVeboxGamutParams->InputGammaValue == MHW_GAMMA_1P0)
1101 {
1102 pGamutState->DW20.PwlInvGammaPoint1 = 21;
1103 pGamutState->DW20.PwlInvGammaPoint2 = 43;
1104 pGamutState->DW20.PwlInvGammaPoint3 = 64;
1105 pGamutState->DW20.PwlInvGammaPoint4 = 85;
1106 pGamutState->DW21.PwlInvGammaPoint5 = 106;
1107 pGamutState->DW21.PwlInvGammaPoint6 = 128;
1108 pGamutState->DW21.PwlInvGammaPoint7 = 149;
1109 pGamutState->DW21.PwlInvGammaPoint8 = 170;
1110 pGamutState->DW22.PwlInvGammaPoint9 = 191;
1111 pGamutState->DW22.PwlInvGammaPoint10 = 213;
1112 pGamutState->DW22.PwlInvGammaPoint11 = 234;
1113 pGamutState->DW23.PwlInvGammaBias1 = 21;
1114 pGamutState->DW23.PwlInvGammaBias2 = 43;
1115 pGamutState->DW23.PwlInvGammaBias3 = 64;
1116 pGamutState->DW23.PwlInvGammaBias4 = 85;
1117 pGamutState->DW24.PwlInvGammaBias5 = 106;
1118 pGamutState->DW24.PwlInvGammaBias6 = 128;
1119 pGamutState->DW24.PwlInvGammaBias7 = 149;
1120 pGamutState->DW24.PwlInvGammaBias8 = 170;
1121 pGamutState->DW25.PwlInvGammaBias9 = 191;
1122 pGamutState->DW25.PwlInvGammaBias10 = 213;
1123 pGamutState->DW25.PwlInvGammaBias11 = 234;
1124 pGamutState->DW26.PwlInvGammaSlope0 = 256;
1125 pGamutState->DW26.PwlInvGammaSlope1 = 256;
1126 pGamutState->DW27.PwlInvGammaSlope2 = 256;
1127 pGamutState->DW27.PwlInvGammaSlope3 = 256;
1128 pGamutState->DW28.PwlInvGammaSlope4 = 256;
1129 pGamutState->DW28.PwlInvGammaSlope5 = 256;
1130 pGamutState->DW29.PwlInvGammaSlope6 = 256;
1131 pGamutState->DW29.PwlInvGammaSlope7 = 256;
1132 pGamutState->DW30.PwlInvGammaSlope8 = 256;
1133 pGamutState->DW30.PwlInvGammaSlope9 = 256;
1134 pGamutState->DW31.PwlInvGammaSlope10 = 256;
1135 pGamutState->DW31.PwlInvGammaSlope11 = 256;
1136 }
1137 else if (pVeboxGamutParams->InputGammaValue == MHW_GAMMA_2P2)
1138 {
1139 pGamutState->DW20.PwlInvGammaPoint1 = 40;
1140 pGamutState->DW20.PwlInvGammaPoint2 = 56;
1141 pGamutState->DW20.PwlInvGammaPoint3 = 80;
1142 pGamutState->DW20.PwlInvGammaPoint4 = 104;
1143 pGamutState->DW21.PwlInvGammaPoint5 = 128;
1144 pGamutState->DW21.PwlInvGammaPoint6 = 149;
1145 pGamutState->DW21.PwlInvGammaPoint7 = 170;
1146 pGamutState->DW21.PwlInvGammaPoint8 = 191;
1147 pGamutState->DW22.PwlInvGammaPoint9 = 207;
1148 pGamutState->DW22.PwlInvGammaPoint10 = 223;
1149 pGamutState->DW22.PwlInvGammaPoint11 = 239;
1150 pGamutState->DW23.PwlInvGammaBias1 = 4;
1151 pGamutState->DW23.PwlInvGammaBias2 = 9;
1152 pGamutState->DW23.PwlInvGammaBias3 = 20;
1153 pGamutState->DW23.PwlInvGammaBias4 = 35;
1154 pGamutState->DW24.PwlInvGammaBias5 = 55;
1155 pGamutState->DW24.PwlInvGammaBias6 = 78;
1156 pGamutState->DW24.PwlInvGammaBias7 = 105;
1157 pGamutState->DW24.PwlInvGammaBias8 = 135;
1158 pGamutState->DW25.PwlInvGammaBias9 = 161;
1159 pGamutState->DW25.PwlInvGammaBias10 = 190;
1160 pGamutState->DW25.PwlInvGammaBias11 = 221;
1161 pGamutState->DW26.PwlInvGammaSlope0 = 28;
1162 pGamutState->DW26.PwlInvGammaSlope1 = 76;
1163 pGamutState->DW27.PwlInvGammaSlope2 = 115;
1164 pGamutState->DW27.PwlInvGammaSlope3 = 165;
1165 pGamutState->DW28.PwlInvGammaSlope4 = 218;
1166 pGamutState->DW28.PwlInvGammaSlope5 = 270;
1167 pGamutState->DW29.PwlInvGammaSlope6 = 320;
1168 pGamutState->DW29.PwlInvGammaSlope7 = 372;
1169 pGamutState->DW30.PwlInvGammaSlope8 = 419;
1170 pGamutState->DW30.PwlInvGammaSlope9 = 459;
1171 pGamutState->DW31.PwlInvGammaSlope10 = 500;
1172 pGamutState->DW31.PwlInvGammaSlope11 = 542;
1173 }
1174 else if (pVeboxGamutParams->InputGammaValue == MHW_GAMMA_2P6)
1175 {
1176 pGamutState->DW20.PwlInvGammaPoint1 = 40;
1177 pGamutState->DW20.PwlInvGammaPoint2 = 56;
1178 pGamutState->DW20.PwlInvGammaPoint3 = 80;
1179 pGamutState->DW20.PwlInvGammaPoint4 = 104;
1180 pGamutState->DW21.PwlInvGammaPoint5 = 128;
1181 pGamutState->DW21.PwlInvGammaPoint6 = 149;
1182 pGamutState->DW21.PwlInvGammaPoint7 = 170;
1183 pGamutState->DW21.PwlInvGammaPoint8 = 191;
1184 pGamutState->DW22.PwlInvGammaPoint9 = 207;
1185 pGamutState->DW22.PwlInvGammaPoint10 = 223;
1186 pGamutState->DW22.PwlInvGammaPoint11 = 239;
1187 pGamutState->DW23.PwlInvGammaBias1 = 2;
1188 pGamutState->DW23.PwlInvGammaBias2 = 5;
1189 pGamutState->DW23.PwlInvGammaBias3 = 12;
1190 pGamutState->DW23.PwlInvGammaBias4 = 25;
1191 pGamutState->DW24.PwlInvGammaBias5 = 42;
1192 pGamutState->DW24.PwlInvGammaBias6 = 63;
1193 pGamutState->DW24.PwlInvGammaBias7 = 89;
1194 pGamutState->DW24.PwlInvGammaBias8 = 121;
1195 pGamutState->DW25.PwlInvGammaBias9 = 149;
1196 pGamutState->DW25.PwlInvGammaBias10 = 180;
1197 pGamutState->DW25.PwlInvGammaBias11 = 216;
1198 pGamutState->DW26.PwlInvGammaSlope0 = 13;
1199 pGamutState->DW26.PwlInvGammaSlope1 = 46;
1200 pGamutState->DW27.PwlInvGammaSlope2 = 80;
1201 pGamutState->DW27.PwlInvGammaSlope3 = 130;
1202 pGamutState->DW28.PwlInvGammaSlope4 = 188;
1203 pGamutState->DW28.PwlInvGammaSlope5 = 250;
1204 pGamutState->DW29.PwlInvGammaSlope6 = 314;
1205 pGamutState->DW29.PwlInvGammaSlope7 = 384;
1206 pGamutState->DW30.PwlInvGammaSlope8 = 449;
1207 pGamutState->DW30.PwlInvGammaSlope9 = 507;
1208 pGamutState->DW31.PwlInvGammaSlope10 = 569;
1209 pGamutState->DW31.PwlInvGammaSlope11 = 633;
1210 }
1211 else
1212 {
1213 MHW_ASSERTMESSAGE("Unknown InputGammaValue");
1214 }
1215
1216 if (pVeboxGamutParams->OutputGammaValue == MHW_GAMMA_1P0)
1217 {
1218 pGamutState->DW8.PwlGammaPoint1 = 21;
1219 pGamutState->DW8.PwlGammaPoint2 = 43;
1220 pGamutState->DW8.PwlGammaPoint3 = 64;
1221 pGamutState->DW8.PwlGammaPoint4 = 85;
1222 pGamutState->DW9.PwlGammaPoint5 = 106;
1223 pGamutState->DW9.PwlGammaPoint6 = 128;
1224 pGamutState->DW9.PwlGammaPoint7 = 149;
1225 pGamutState->DW9.PwlGammaPoint8 = 170;
1226 pGamutState->DW10.PwlGammaPoint9 = 191;
1227 pGamutState->DW10.PwlGammaPoint10 = 213;
1228 pGamutState->DW10.PwlGammaPoint11 = 234;
1229 pGamutState->DW11.PwlGammaBias1 = 21;
1230 pGamutState->DW11.PwlGammaBias2 = 43;
1231 pGamutState->DW11.PwlGammaBias3 = 64;
1232 pGamutState->DW11.PwlGammaBias4 = 85;
1233 pGamutState->DW12.PwlGammaBias5 = 106;
1234 pGamutState->DW12.PwlGammaBias6 = 128;
1235 pGamutState->DW12.PwlGammaBias7 = 149;
1236 pGamutState->DW12.PwlGammaBias8 = 170;
1237 pGamutState->DW13.PwlGammaBias9 = 191;
1238 pGamutState->DW13.PwlGammaBias10 = 213;
1239 pGamutState->DW13.PwlGammaBias11 = 234;
1240 pGamutState->DW14.PwlGammaSlope0 = 256;
1241 pGamutState->DW14.PwlGammaSlope1 = 256;
1242 pGamutState->DW15.PwlGammaSlope2 = 256;
1243 pGamutState->DW15.PwlGammaSlope3 = 256;
1244 pGamutState->DW16.PwlGammaSlope4 = 256;
1245 pGamutState->DW16.PwlGammaSlope5 = 256;
1246 pGamutState->DW17.PwlGammaSlope6 = 256;
1247 pGamutState->DW17.PwlGammaSlope7 = 256;
1248 pGamutState->DW18.PwlGammaSlope8 = 256;
1249 pGamutState->DW18.PwlGammaSlope9 = 256;
1250 pGamutState->DW19.PwlGammaSlope10 = 256;
1251 pGamutState->DW19.PwlGammaSlope11 = 256;
1252 }
1253 else if (pVeboxGamutParams->OutputGammaValue == MHW_GAMMA_2P2)
1254 {
1255 pGamutState->DW8.PwlGammaPoint1 = 4;
1256 pGamutState->DW8.PwlGammaPoint2 = 10;
1257 pGamutState->DW8.PwlGammaPoint3 = 16;
1258 pGamutState->DW8.PwlGammaPoint4 = 27;
1259 pGamutState->DW9.PwlGammaPoint5 = 44;
1260 pGamutState->DW9.PwlGammaPoint6 = 64;
1261 pGamutState->DW9.PwlGammaPoint7 = 96;
1262 pGamutState->DW9.PwlGammaPoint8 = 128;
1263 pGamutState->DW10.PwlGammaPoint9 = 159;
1264 pGamutState->DW10.PwlGammaPoint10 = 191;
1265 pGamutState->DW10.PwlGammaPoint11 = 223;
1266 pGamutState->DW11.PwlGammaBias1 = 39;
1267 pGamutState->DW11.PwlGammaBias2 = 58;
1268 pGamutState->DW11.PwlGammaBias3 = 72;
1269 pGamutState->DW11.PwlGammaBias4 = 91;
1270 pGamutState->DW12.PwlGammaBias5 = 115;
1271 pGamutState->DW12.PwlGammaBias6 = 136;
1272 pGamutState->DW12.PwlGammaBias7 = 163;
1273 pGamutState->DW12.PwlGammaBias8 = 186;
1274 pGamutState->DW13.PwlGammaBias9 = 206;
1275 pGamutState->DW13.PwlGammaBias10 = 224;
1276 pGamutState->DW13.PwlGammaBias11 = 240;
1277 pGamutState->DW14.PwlGammaSlope0 = 255;
1278 pGamutState->DW14.PwlGammaSlope1 = 2474;
1279 pGamutState->DW15.PwlGammaSlope2 = 852;
1280 pGamutState->DW15.PwlGammaSlope3 = 596;
1281 pGamutState->DW16.PwlGammaSlope4 = 455;
1282 pGamutState->DW16.PwlGammaSlope5 = 345;
1283 pGamutState->DW17.PwlGammaSlope6 = 273;
1284 pGamutState->DW17.PwlGammaSlope7 = 221;
1285 pGamutState->DW18.PwlGammaSlope8 = 183;
1286 pGamutState->DW18.PwlGammaSlope9 = 160;
1287 pGamutState->DW19.PwlGammaSlope10 = 143;
1288 pGamutState->DW19.PwlGammaSlope11 = 130;
1289 }
1290 else if (pVeboxGamutParams->OutputGammaValue == MHW_GAMMA_2P6)
1291 {
1292 pGamutState->DW8.PwlGammaPoint1 = 4;
1293 pGamutState->DW8.PwlGammaPoint2 = 10;
1294 pGamutState->DW8.PwlGammaPoint3 = 16;
1295 pGamutState->DW8.PwlGammaPoint4 = 27;
1296 pGamutState->DW9.PwlGammaPoint5 = 44;
1297 pGamutState->DW9.PwlGammaPoint6 = 64;
1298 pGamutState->DW9.PwlGammaPoint7 = 96;
1299 pGamutState->DW9.PwlGammaPoint8 = 128;
1300 pGamutState->DW10.PwlGammaPoint9 = 159;
1301 pGamutState->DW10.PwlGammaPoint10 = 191;
1302 pGamutState->DW10.PwlGammaPoint11 = 223;
1303 pGamutState->DW11.PwlGammaBias1 = 52;
1304 pGamutState->DW11.PwlGammaBias2 = 73;
1305 pGamutState->DW11.PwlGammaBias3 = 88;
1306 pGamutState->DW11.PwlGammaBias4 = 107;
1307 pGamutState->DW12.PwlGammaBias5 = 130;
1308 pGamutState->DW12.PwlGammaBias6 = 150;
1309 pGamutState->DW12.PwlGammaBias7 = 175;
1310 pGamutState->DW12.PwlGammaBias8 = 195;
1311 pGamutState->DW13.PwlGammaBias9 = 213;
1312 pGamutState->DW13.PwlGammaBias10 = 228;
1313 pGamutState->DW13.PwlGammaBias11 = 242;
1314 pGamutState->DW14.PwlGammaSlope0 = 3309;
1315 pGamutState->DW14.PwlGammaSlope1 = 932;
1316 pGamutState->DW15.PwlGammaSlope2 = 622;
1317 pGamutState->DW15.PwlGammaSlope3 = 459;
1318 pGamutState->DW16.PwlGammaSlope4 = 335;
1319 pGamutState->DW16.PwlGammaSlope5 = 257;
1320 pGamutState->DW17.PwlGammaSlope6 = 203;
1321 pGamutState->DW17.PwlGammaSlope7 = 164;
1322 pGamutState->DW18.PwlGammaSlope8 = 141;
1323 pGamutState->DW18.PwlGammaSlope9 = 124;
1324 pGamutState->DW19.PwlGammaSlope10 = 112;
1325 pGamutState->DW19.PwlGammaSlope11 = 103;
1326 }
1327 else
1328 {
1329 MHW_ASSERTMESSAGE("Unknown OutputGammaValue");
1330 }
1331 }
1332
1333 finish:
1334 return eStatus;
1335 }
1336
AddVeboxIecpState(PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams)1337 MOS_STATUS MhwVeboxInterfaceG8::AddVeboxIecpState(
1338 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams)
1339 {
1340 bool bEnableFECSC = false;
1341 PMHW_VEBOX_HEAP pVeboxHeap;
1342 uint32_t uiOffset;
1343 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
1344 mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD * pVeboxIecpState;
1345 mhw_vebox_g8_X::VEBOX_CAPTURE_PIPE_STATE_CMD *pVeboxCapPipeState, CapPipeStatecmd;
1346
1347 MHW_CHK_NULL(pVeboxIecpParams);
1348 MHW_CHK_NULL(m_veboxHeap);
1349
1350 pVeboxHeap = m_veboxHeap;
1351 uiOffset = pVeboxHeap->uiCurState * pVeboxHeap->uiInstanceSize;
1352 pVeboxIecpState = (mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD *)(pVeboxHeap->pLockedDriverResourceMem +
1353 pVeboxHeap->uiIecpStateOffset +
1354 uiOffset);
1355 MHW_CHK_NULL(pVeboxIecpState);
1356 IecpStateInitialization(pVeboxIecpState);
1357
1358 if (pVeboxIecpParams->ColorPipeParams.bActive)
1359 {
1360 // Enable STD/E (Skin Tone Detection/Enhancement)
1361 MhwVeboxInterfaceGeneric<mhw_vebox_g8_X>::SetVeboxIecpStateSTE(&pVeboxIecpState->StdSteState,
1362 &pVeboxIecpParams->ColorPipeParams);
1363
1364 // Enable ACE (Automatic Contrast Enhancement)
1365 if (pVeboxIecpParams->ColorPipeParams.bEnableACE)
1366 {
1367 pVeboxIecpState->AceState.DW0.AceEnable = true;
1368 pVeboxIecpState->AceState.DW0.FullImageHistogram = true;
1369 }
1370
1371 // Enable TCC (Total Color Control)
1372 if (pVeboxIecpParams->ColorPipeParams.bEnableTCC)
1373 {
1374 MhwVeboxInterfaceGeneric<mhw_vebox_g8_X>::SetVeboxIecpStateTCC(&pVeboxIecpState->TccState,
1375 &pVeboxIecpParams->ColorPipeParams);
1376 }
1377 }
1378
1379 if (pVeboxIecpParams->CapPipeParams.bActive)
1380 {
1381 // IECP needs to operate in YUV space
1382 if (pVeboxIecpParams->dstFormat == Format_NV12 ||
1383 pVeboxIecpParams->ProcAmpParams.bActive ||
1384 pVeboxIecpParams->ColorPipeParams.bActive)
1385 {
1386 bEnableFECSC = true;
1387 }
1388 else
1389 {
1390 bEnableFECSC = false;
1391 }
1392
1393 // Enable Front End CSC so that input to IECP will be in YUV color space
1394 if (bEnableFECSC)
1395 {
1396 SetVeboxIecpStateFecsc(&pVeboxIecpState->FrontEndCsc, pVeboxIecpParams);
1397 }
1398
1399 // Set Black Level Correction
1400 pVeboxIecpState->BlackLevelCorrectionState.DW0.BlackPointOffsetR = pVeboxIecpParams->CapPipeParams.BlackLevelParams.R;
1401 pVeboxIecpState->BlackLevelCorrectionState.DW1.BlackPointOffsetG = pVeboxIecpParams->CapPipeParams.BlackLevelParams.G0;
1402 pVeboxIecpState->BlackLevelCorrectionState.DW1.BlackPointOffsetB = pVeboxIecpParams->CapPipeParams.BlackLevelParams.B;
1403
1404 // Enable Color Correction Matrix
1405 if (pVeboxIecpParams->CapPipeParams.ColorCorrectionParams.bActive ||
1406 pVeboxIecpParams->CapPipeParams.WhiteBalanceParams.bActive)
1407 {
1408 SetVeboxIecpStateCcm(pVeboxIecpState, &pVeboxIecpParams->CapPipeParams, 4096);
1409 }
1410 }
1411
1412 // Enable Back End CSC for capture pipeline or Vebox output pipe
1413 if (pVeboxIecpParams->CapPipeParams.bActive ||
1414 pVeboxIecpParams->bCSCEnable)
1415 {
1416 SetVeboxIecpStateBecsc(
1417 pVeboxIecpState,
1418 pVeboxIecpParams,
1419 bEnableFECSC);
1420 }
1421
1422 // Enable ProcAmp
1423 if (pVeboxIecpParams->ProcAmpParams.bActive &&
1424 pVeboxIecpParams->ProcAmpParams.bEnabled)
1425 {
1426 MhwVeboxInterfaceGeneric<mhw_vebox_g8_X>::SetVeboxIecpStateProcAmp(
1427 &pVeboxIecpState->ProcampState,
1428 &pVeboxIecpParams->ProcAmpParams);
1429 }
1430
1431 pVeboxCapPipeState =
1432 (mhw_vebox_g8_X::VEBOX_CAPTURE_PIPE_STATE_CMD *)(pVeboxHeap->pLockedDriverResourceMem +
1433 pVeboxHeap->uiCapturePipeStateOffset +
1434 uiOffset);
1435 MHW_CHK_NULL(pVeboxCapPipeState);
1436 *pVeboxCapPipeState = CapPipeStatecmd;
1437
1438 finish:
1439 return eStatus;
1440 }
1441
SetVeboxIecpStateFecsc(mhw_vebox_g8_X::VEBOX_FRONT_END_CSC_STATE_CMD * pVeboxFecscState,PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams)1442 void MhwVeboxInterfaceG8::SetVeboxIecpStateFecsc(
1443 mhw_vebox_g8_X::VEBOX_FRONT_END_CSC_STATE_CMD *pVeboxFecscState,
1444 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams)
1445 {
1446 PMHW_CAPPIPE_PARAMS pCapPipeParams;
1447
1448 MHW_CHK_NULL_NO_STATUS_RETURN(pVeboxFecscState);
1449 MHW_CHK_NULL_NO_STATUS_RETURN(pVeboxIecpParams);
1450
1451 pCapPipeParams = &pVeboxIecpParams->CapPipeParams;
1452
1453 pVeboxFecscState->DW0.FfrontEndCScTransformEnable = true;
1454
1455 if (pCapPipeParams->FECSCParams.bActive)
1456 {
1457 // Coeff is S2.10, so multiply the floating value by 1024
1458 pVeboxFecscState->DW0.FecscC0TransformCoefficient = (uint32_t)(pCapPipeParams->FECSCParams.Matrix[0][0] * 1024);
1459 pVeboxFecscState->DW0.FecscC1TransformCoefficient = (uint32_t)(pCapPipeParams->FECSCParams.Matrix[0][1] * 1024);
1460 pVeboxFecscState->DW1.FecScC2TransformCoefficient = (uint32_t)(pCapPipeParams->FECSCParams.Matrix[0][2] * 1024);
1461 pVeboxFecscState->DW1.FecScC3TransformCoefficient = (uint32_t)(pCapPipeParams->FECSCParams.Matrix[1][0] * 1024);
1462 pVeboxFecscState->DW2.FecScC4TransformCoefficient = (uint32_t)(pCapPipeParams->FECSCParams.Matrix[1][1] * 1024);
1463 pVeboxFecscState->DW2.FecScC5TransformCoefficient = (uint32_t)(pCapPipeParams->FECSCParams.Matrix[1][2] * 1024);
1464 pVeboxFecscState->DW3.FecScC6TransformCoefficient = (uint32_t)(pCapPipeParams->FECSCParams.Matrix[2][0] * 1024);
1465 pVeboxFecscState->DW3.FecScC7TransformCoefficient = (uint32_t)(pCapPipeParams->FECSCParams.Matrix[2][1] * 1024);
1466 pVeboxFecscState->DW4.FecScC8TransformCoefficient = (uint32_t)(pCapPipeParams->FECSCParams.Matrix[2][2] * 1024);
1467 pVeboxFecscState->DW5.FecScOffsetIn1OffsetInForYR = (uint32_t)(pCapPipeParams->FECSCParams.PreOffset[0] * 1024);
1468 pVeboxFecscState->DW5.FecScOffsetOut1OffsetOutForYR = (uint32_t)(pCapPipeParams->FECSCParams.PostOffset[0] * 1024);
1469 pVeboxFecscState->DW6.FecScOffsetIn2OffsetInForUG = (uint32_t)(pCapPipeParams->FECSCParams.PreOffset[1] * 1024);
1470 pVeboxFecscState->DW6.FecScOffsetOut2OffsetOutForUG = (uint32_t)(pCapPipeParams->FECSCParams.PostOffset[1] * 1024);
1471 pVeboxFecscState->DW7.FecScOffsetIn3OffsetInForVB = (uint32_t)(pCapPipeParams->FECSCParams.PreOffset[2] * 1024);
1472 pVeboxFecscState->DW7.FecScOffsetOut3OffsetOutForVB = (uint32_t)(pCapPipeParams->FECSCParams.PostOffset[2] * 1024);
1473 }
1474 else if (pVeboxIecpParams->ColorSpace == MHW_CSpace_BT601)
1475 {
1476 pVeboxFecscState->DW0.FecscC0TransformCoefficient = 263;
1477 pVeboxFecscState->DW0.FecscC1TransformCoefficient = 516;
1478 pVeboxFecscState->DW1.FecScC2TransformCoefficient = 100;
1479 pVeboxFecscState->DW1.FecScC3TransformCoefficient = MOS_BITFIELD_VALUE((uint32_t)-152, 13);
1480 pVeboxFecscState->DW2.FecScC4TransformCoefficient = MOS_BITFIELD_VALUE((uint32_t)-298, 13);
1481 pVeboxFecscState->DW2.FecScC5TransformCoefficient = 450;
1482 pVeboxFecscState->DW3.FecScC6TransformCoefficient = 450;
1483 pVeboxFecscState->DW3.FecScC7TransformCoefficient = MOS_BITFIELD_VALUE((uint32_t)-377, 13);
1484 pVeboxFecscState->DW4.FecScC8TransformCoefficient = MOS_BITFIELD_VALUE((uint32_t)-73, 13);
1485
1486 pVeboxFecscState->DW5.FecScOffsetIn1OffsetInForYR = 0;
1487 pVeboxFecscState->DW5.FecScOffsetOut1OffsetOutForYR = 64;
1488 pVeboxFecscState->DW6.FecScOffsetIn2OffsetInForUG = 0;
1489 pVeboxFecscState->DW6.FecScOffsetOut2OffsetOutForUG = 512;
1490 pVeboxFecscState->DW7.FecScOffsetIn3OffsetInForVB = 0;
1491 pVeboxFecscState->DW7.FecScOffsetOut3OffsetOutForVB = 512;
1492 }
1493 else if (pVeboxIecpParams->ColorSpace == MHW_CSpace_BT709)
1494 {
1495 pVeboxFecscState->DW0.FecscC0TransformCoefficient = 187;
1496 pVeboxFecscState->DW0.FecscC1TransformCoefficient = 629;
1497 pVeboxFecscState->DW1.FecScC2TransformCoefficient = 63;
1498 pVeboxFecscState->DW1.FecScC3TransformCoefficient = MOS_BITFIELD_VALUE((uint32_t)-103, 13);
1499 pVeboxFecscState->DW2.FecScC4TransformCoefficient = MOS_BITFIELD_VALUE((uint32_t)-346, 13);
1500 pVeboxFecscState->DW2.FecScC5TransformCoefficient = 450;
1501 pVeboxFecscState->DW3.FecScC6TransformCoefficient = 450;
1502 pVeboxFecscState->DW3.FecScC7TransformCoefficient = MOS_BITFIELD_VALUE((uint32_t)-409, 13);
1503 pVeboxFecscState->DW4.FecScC8TransformCoefficient = MOS_BITFIELD_VALUE((uint32_t)-41, 13);
1504
1505 pVeboxFecscState->DW5.FecScOffsetIn1OffsetInForYR = 0;
1506 pVeboxFecscState->DW5.FecScOffsetOut1OffsetOutForYR = 64;
1507 pVeboxFecscState->DW6.FecScOffsetIn2OffsetInForUG = 0;
1508 pVeboxFecscState->DW6.FecScOffsetOut2OffsetOutForUG = 512;
1509 pVeboxFecscState->DW7.FecScOffsetIn3OffsetInForVB = 0;
1510 pVeboxFecscState->DW7.FecScOffsetOut3OffsetOutForVB = 512;
1511 }
1512 else
1513 {
1514 MHW_ASSERT(false);
1515 }
1516 }
1517
AddVeboxIecpAceState(PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams)1518 MOS_STATUS MhwVeboxInterfaceG8::AddVeboxIecpAceState(
1519 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams)
1520 {
1521 PMHW_ACE_PARAMS pAceParams;
1522 PMHW_VEBOX_HEAP pVeboxHeap;
1523 int32_t uiOffset;
1524 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
1525
1526 mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD *pVeboxIecpState;
1527
1528 MHW_CHK_NULL(pVeboxIecpParams);
1529 MHW_CHK_NULL(m_veboxHeap);
1530
1531 pVeboxHeap = m_veboxHeap;
1532 uiOffset = pVeboxHeap->uiCurState * pVeboxHeap->uiInstanceSize;
1533
1534 pVeboxIecpState = (mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD *)(pVeboxHeap->pLockedDriverResourceMem +
1535 pVeboxHeap->uiIecpStateOffset +
1536 uiOffset);
1537 MHW_CHK_NULL(pVeboxIecpState);
1538
1539 MhwVeboxInterfaceGeneric<mhw_vebox_g8_X>::SetVeboxAceLaceState(pVeboxIecpParams, pVeboxIecpState);
1540
1541 finish:
1542 return eStatus;
1543 }
1544
GetVeboxAce_FullImageHistogram(uint32_t * pFullImageHistogram)1545 MOS_STATUS MhwVeboxInterfaceG8::GetVeboxAce_FullImageHistogram(
1546 uint32_t *pFullImageHistogram)
1547 {
1548 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
1549 PMHW_VEBOX_HEAP pVeboxHeap;
1550 int32_t uiOffset;
1551
1552 mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD *pVeboxIecpState;
1553
1554 MHW_CHK_NULL(pFullImageHistogram);
1555 MHW_CHK_NULL(m_veboxHeap);
1556
1557 pVeboxHeap = m_veboxHeap;
1558 uiOffset = pVeboxHeap->uiCurState * pVeboxHeap->uiInstanceSize;
1559
1560 pVeboxIecpState = (mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD *)(pVeboxHeap->pLockedDriverResourceMem +
1561 pVeboxHeap->uiIecpStateOffset +
1562 uiOffset);
1563 MHW_CHK_NULL(pVeboxIecpState);
1564 *pFullImageHistogram = pVeboxIecpState->AceState.DW0.FullImageHistogram;
1565
1566 finish:
1567 return eStatus;
1568 }
1569
IecpStateInitialization(mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD * pVeboxIecpState)1570 void MhwVeboxInterfaceG8::IecpStateInitialization(
1571 mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD *pVeboxIecpState)
1572 {
1573 MHW_CHK_NULL_NO_STATUS_RETURN(pVeboxIecpState);
1574
1575 mhw_vebox_g8_X::VEBOX_IECP_STATE_CMD IecpState;
1576 *pVeboxIecpState = IecpState;
1577
1578 // Initialize the values to default for media driver.
1579 pVeboxIecpState->StdSteState.DW5.InvMarginVyl = 3300;
1580 pVeboxIecpState->StdSteState.DW5.InvSkinTypesMargin = 1638;
1581
1582 pVeboxIecpState->StdSteState.DW12.B3U = 140;
1583 pVeboxIecpState->StdSteState.DW15.Satp1 = 122;
1584 pVeboxIecpState->StdSteState.DW15.Satb1 = 1016;
1585 pVeboxIecpState->StdSteState.DW19.Hueb1 = 1016;
1586 pVeboxIecpState->StdSteState.DW27.Hues0Dark = 256;
1587 pVeboxIecpState->StdSteState.DW27.Hues1Dark = 0;
1588
1589 pVeboxIecpState->TccState.DW0.Satfactor1 = 160;
1590 pVeboxIecpState->TccState.DW0.Satfactor2 = 160;
1591 pVeboxIecpState->TccState.DW0.Satfactor3 = 160;
1592 pVeboxIecpState->TccState.DW1.Satfactor4 = 160;
1593 pVeboxIecpState->TccState.DW1.Satfactor5 = 160;
1594 pVeboxIecpState->TccState.DW1.Satfactor6 = 160;
1595
1596 pVeboxIecpState->AlphaAoiState.DW1.AoiMaxX = 0;
1597 pVeboxIecpState->AlphaAoiState.DW2.AoiMaxY = 0;
1598
1599 return;
1600 }
1601
GamutStateInitialization(mhw_vebox_g8_X::VEBOX_GAMUT_STATE_CMD * pGamutState)1602 void MhwVeboxInterfaceG8::GamutStateInitialization(
1603 mhw_vebox_g8_X::VEBOX_GAMUT_STATE_CMD *pGamutState)
1604 {
1605 MHW_CHK_NULL_NO_STATUS_RETURN(pGamutState);
1606
1607 mhw_vebox_g8_X::VEBOX_GAMUT_STATE_CMD cmd;
1608 *pGamutState = cmd;
1609
1610 pGamutState->DW1.AB = 26;
1611 pGamutState->DW1.AG = 26;
1612 pGamutState->DW1.CmS = 640;
1613
1614 pGamutState->DW2.RI = 128;
1615 pGamutState->DW2.CmI = 192;
1616 pGamutState->DW2.RS = 768;
1617
1618 pGamutState->DW3.C0 = 2792;
1619 pGamutState->DW3.C1 = 1141;
1620 pGamutState->DW4.C2 = 34;
1621 pGamutState->DW4.C3 = 71;
1622 pGamutState->DW5.C4 = 3663;
1623 pGamutState->DW5.C5 = MOS_BITFIELD_VALUE((uint32_t)-52, 15);
1624 pGamutState->DW6.C6 = MOS_BITFIELD_VALUE((uint32_t)-12, 15);
1625 pGamutState->DW6.C7 = 168;
1626 pGamutState->DW7.C8 = 3434;
1627
1628 pGamutState->DW14.PwlGammaSlope0 = 3328;
1629 pGamutState->DW14.PwlGammaSlope1 = 2560;
1630 pGamutState->DW15.PwlGammaSlope2 = 1280;
1631 pGamutState->DW15.PwlGammaSlope3 = 960;
1632 pGamutState->DW16.PwlGammaSlope4 = 658;
1633 pGamutState->DW16.PwlGammaSlope5 = 512;
1634 pGamutState->DW17.PwlGammaSlope6 = 368;
1635 pGamutState->DW17.PwlGammaSlope7 = 278;
1636 pGamutState->DW18.PwlGammaSlope8 = 215;
1637 pGamutState->DW18.PwlGammaSlope9 = 179;
1638 pGamutState->DW19.PwlGammaSlope10 = 151;
1639 pGamutState->DW19.PwlGammaSlope11 = 124;
1640
1641 pGamutState->DW26.PwlInvGammaSlope0 = 26;
1642 pGamutState->DW26.PwlInvGammaSlope1 = 72;
1643 pGamutState->DW27.PwlInvGammaSlope2 = 107;
1644 pGamutState->DW27.PwlInvGammaSlope3 = 151;
1645 pGamutState->DW28.PwlInvGammaSlope4 = 195;
1646 pGamutState->DW28.PwlInvGammaSlope5 = 243;
1647 pGamutState->DW29.PwlInvGammaSlope6 = 305;
1648 pGamutState->DW29.PwlInvGammaSlope7 = 337;
1649 pGamutState->DW30.PwlInvGammaSlope8 = 404;
1650 pGamutState->DW30.PwlInvGammaSlope9 = 445;
1651 pGamutState->DW31.PwlInvGammaSlope10 = 498;
1652 pGamutState->DW31.PwlInvGammaSlope11 = 555;
1653
1654 pGamutState->DW33.OffsetOutB = MOS_BITFIELD_VALUE((uint32_t)-1246, 15);
1655 pGamutState->DW34.OffsetOutR = MOS_BITFIELD_VALUE((uint32_t)-974, 15);
1656 pGamutState->DW34.OffsetOutG = MOS_BITFIELD_VALUE((uint32_t)-983, 15);
1657 }