xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/common/vp/hal/vphal_render_hdr_base.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2010-2020, 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      vphal_render_hdr_base.h
24 //! \brief     Unified VP HAL HDR definitions
25 //!
26 //!
27 //! \file     vphal_render_hdr_base.h
28 //! \brief    Common interface and structure used in HDR
29 //! \details  Common interface and structure used in HDR which are platform independent
30 //!
31 #ifndef __VPHAL_RENDER_HDR_BASE_H__
32 #define __VPHAL_RENDER_HDR_BASE_H__
33 
34 #include "mos_os.h"
35 #include "vphal.h"
36 #include "vphal_render_renderstate.h"
37 #include "vpkrnheader.h"
38 
39 #if __cplusplus
40 extern "C"
41 {
42 #endif // __cplusplus
43 
44 #define VPHAL_MAX_HDR_INPUT_LAYER  8
45 #define VPHAL_MAX_HDR_OUTPUT_LAYER 1
46 
47 #define VPHAL_HDR_SAMPLER_STATE_NUM    16
48 #define VPHAL_HDR_SAMPLER8X8_TABLE_NUM 2
49 
50 #define VPHAL_HDR_EOTF_1DLUT_POINT_NUMBER 256
51 #define VPHAL_HDR_OETF_1DLUT_POINT_NUMBER 256
52 #define VPHAL_HDR_OETF_1DLUT_WIDTH        16
53 #define VPHAL_HDR_OETF_1DLUT_HEIGHT       16
54 
55 #define HDR_STAGES_CONFIG_TABLE_SIZE      32
56 
57 #define IS_HDR_SURFACE(surface)    \
58     ((surface)->pHDRParams &&      \
59     (((surface)->pHDRParams->EOTF == VPHAL_HDR_EOTF_SMPTE_ST2084) || IS_RGB64_FLOAT_FORMAT((surface)->Format)))
60 
61 #define IS_SDR_SURFACE(surface)             \
62     ((surface)->pHDRParams == nullptr ||       \
63     (((surface)->pHDRParams->EOTF == VPHAL_HDR_EOTF_TRADITIONAL_GAMMA_SDR) && !IS_RGB64_FLOAT_FORMAT((surface)->Format)))
64 
65 //!
66 //! \brief    Hdr kernel ID
67 //!
68 #define KERNEL_HDR_MANDATORY    0
69 #define KERNEL_HDR_PREPROCESS   4
70 #define KERNEL_HDR_MAX          5
71 
72 typedef union _HDRCaseID
73 {
74     uint32_t    index;
75     struct {
76         uint32_t    InputXDR : 1;  // SDR or HDR
77         uint32_t    InputGamut : 1;  // 709 or 2020 primaries
78         uint32_t    OutputXDR : 1;
79         uint32_t    OutputGamut : 1;
80         uint32_t    OutputLinear : 1;  // fp16 output
81         uint32_t    Reserved : 27;
82     };
83 } HDRCaseID;
84 
85 //!
86 //! \brief Hdr stages enable flag
87 //!
88 typedef union _HDRStageEnables
89 {
90     uint16_t    value;
91     struct {
92         uint16_t    PriorCSCEnable : 1;
93         uint16_t    EOTFEnable : 1;
94         uint16_t    CCMEnable : 1;
95         uint16_t    PWLFEnable : 1;
96         uint16_t    CCMExt1Enable : 1;
97         uint16_t    GamutClamp1Enable : 1;
98         uint16_t    CCMExt2Enable : 1;
99         uint16_t    GamutClamp2Enable : 1;
100         uint16_t    OETFEnable : 1;
101         uint16_t    PostCSCEnable : 1;
102         uint16_t    Reserved : 6;
103     };
104 } HDRStageEnables, *PHDRStageEnables;
105 
106 //!
107 //! \brief HDR Render data populated for every BLT call
108 //!
109 typedef struct _VPHAL_HDR_RENDER_DATA
110 {
111     VPHAL_HDR_PARAMS                HDRParams;                           //!< HDR parameters
112     PVPHAL_IEF_PARAMS               pIEFParams;                          //!< IEF parameters
113     float                           fPrimaryLayerScaleX;                 //!< Primary layer scaling ratio
114     float                           fPrimaryLayerScaleY;                 //!< Primary layer scaling ratio
115     MOS_FORMAT                      PrimaryLayerFormat;                  //!< Primary Layer Format
116     VPHAL_PERFTAG                   PerfTag;                             //!< Performance tag
117     PRENDERHAL_MEDIA_STATE          pMediaState;                         //!< Pointer to media state
118     MHW_SAMPLER_STATE_PARAM         SamplerStateParams[VPHAL_HDR_SAMPLER_STATE_NUM];       //!< Sampler State
119     PMHW_AVS_PARAMS                 pAVSParameters[VPHAL_HDR_SAMPLER8X8_TABLE_NUM];        //!< AVS parameters
120     MHW_VFE_SCOREBOARD              ScoreboardParams;                    //!< Scoreboard Parameters
121     int32_t                         iBlocksX;                            //!< Block numbers in X direction
122     int32_t                         iBlocksY;                            //!< Block numbers in Y direction
123     int32_t                         iBindingTable;                       //!< Current binding table index
124     int32_t                         iMediaID;                            //!< Current media ID
125     PCRENDERHAL_KERNEL_PARAM        pKernelParam[KERNEL_HDR_MAX];        //!< Kernel Parameters
126     Kdll_CacheEntry                 KernelEntry[KERNEL_HDR_MAX];         //!< Kernel Entry
127     int32_t                         iCurbeLength;                        //!< The length of curbe data
128     int32_t                         iCurbeOffset;                        //!< The offset of curbe data
129 } VPHAL_HDR_RENDER_DATA, *PVPHAL_HDR_RENDER_DATA;
130 
131 //!
132 //! \brief VPHAL HDR State
133 //!
134 typedef struct _VPHAL_HDR_STATE *PVPHAL_HDR_STATE;
135 typedef struct _VPHAL_HDR_STATE
136 {
137     PMOS_INTERFACE                  pOsInterface;                   //!< Os Interface
138     PRENDERHAL_INTERFACE            pRenderHal;                     //!< Render Interface
139     MEDIA_FEATURE_TABLE             *pSkuTable;                     //!< SKU table
140     Kdll_KernelCache                *pKernelCache;                  //!< Kernel cache
141     PVPHAL_SURFACE                  pSrcSurf[VPHAL_MAX_HDR_INPUT_LAYER];                        //!< Source surface
142     PVPHAL_SURFACE                  pTargetSurf[VPHAL_MAX_HDR_OUTPUT_LAYER];                    //!< Output surface
143     RENDERHAL_SURFACE               RenderHalSrcSurf[VPHAL_MAX_HDR_INPUT_LAYER];                //!< Source surface
144     RENDERHAL_SURFACE               RenderHalTargetSurf[VPHAL_MAX_HDR_OUTPUT_LAYER];            //!< Output surface
145     MHW_AVS_PARAMS                  AVSParameters[VPHAL_HDR_SAMPLER8X8_TABLE_NUM];              //!< AVS for configure Sampler
146     MHW_SAMPLER_AVS_TABLE_PARAM     mhwSamplerAvsTableParam[VPHAL_HDR_SAMPLER8X8_TABLE_NUM];    //!< params for AVS scaling 8x8 table
147 
148     PVPHAL_RNDR_PERF_DATA           pPerfData;                      //!< For performance profiling
149     VPHAL_HDR_CACHE_CNTL            SurfMemObjCtl;                  //!< Cache attributes
150     PRENDERHAL_KERNEL_PARAM         pKernelParamTable;              //!< Poniter to kernel Parameter table
151     VphalFeatureReport              Reporting;                      //!< HDR Mode Reporting
152     bool                            bDisableRender;                 //!< For validation purpose
153     bool                            bBypassHdrKernelPath;           //!< For bypassing Hdr kernel path
154     bool                            bNullHwRenderHdr;               //!< Null rendering flag for HDR function
155     bool                            bSplitFrame;                    //!< Split Frame flag for iTouch 5ms requirement
156     uint32_t                        uiSplitFramePortions = 1;       //!< Split Frame flag
157     bool                            bForceSplitFrame     = false;
158 
159     uint32_t                        uSourceCount;                                               //!< Number of sources
160     uint32_t                        uTargetCount;                                               //!< Number of targets
161     uint32_t                        uSourceBindingTableIndex[VPHAL_MAX_HDR_INPUT_LAYER];        //!< Binding Table Index
162     uint32_t                        uTargetBindingTableIndex[VPHAL_MAX_HDR_OUTPUT_LAYER];       //!< Binding Table Index
163     uint32_t                        dwSurfaceWidth;                                             //!< Record the input surface width of last HDR render
164     uint32_t                        dwSurfaceHeight;                                            //!< Record the input surface height of last HDR render
165     PVPHAL_COLORFILL_PARAMS         pColorFillParams;                                           //!< ColorFill - BG only
166 
167     VPHAL_HDR_LUT_MODE              LUTMode[VPHAL_MAX_HDR_INPUT_LAYER];         //!< LUT Mode
168     VPHAL_HDR_LUT_MODE              GlobalLutMode;                              //!< Global LUT mode control for debugging purpose
169 
170     uint32_t                        dwOetfSurfaceWidth;             //!< Gamma 1D LUT surface
171     uint32_t                        dwOetfSurfaceHeight;            //!< Gamma 1D LUT surface
172     uint32_t                        dwUpdateMask;                   //!< Coefficients Update Mask
173 
174     VPHAL_SURFACE                   OETF1DLUTSurface[VPHAL_MAX_HDR_INPUT_LAYER];        //!< OETF 1D LUT surface
175     VPHAL_SURFACE                   CoeffSurface;                                       //!< CSC CCM Coeff surface
176 
177     RENDERHAL_SURFACE               RenderHalOETF1DLUTSurface[VPHAL_MAX_HDR_INPUT_LAYER];       //!< OETF 1D LUT surface
178     RENDERHAL_SURFACE               RenderHalCoeffSurface;                                      //!< CSC CCM Coeff surface
179 
180     uint16_t                        OetfTraditionalGamma[VPHAL_HDR_OETF_1DLUT_POINT_NUMBER]; //!< EOTF 1D LUT traditional gamma
181     uint16_t                        OetfSmpteSt2084[VPHAL_HDR_OETF_1DLUT_POINT_NUMBER];      //!< EOTF 1D LUT SMPTE ST2084
182     uint16_t                        OetfsRgb[VPHAL_HDR_OETF_1DLUT_POINT_NUMBER];             //!< EOTF 1D LUT sRGB
183 
184     uint8_t*                        pInput3DLUT;                                             //!< Input 3DLUT address for GPU generate 3DLUT
185 
186     const uint16_t                  *pHDRStageConfigTable;
187 
188     HDRStageEnables                 StageEnableFlags[VPHAL_MAX_HDR_INPUT_LAYER];
189 
190     VPHAL_GAMMA_TYPE                EOTFGamma[VPHAL_MAX_HDR_INPUT_LAYER]; //!< EOTF
191     VPHAL_GAMMA_TYPE                OETFGamma[VPHAL_MAX_HDR_INPUT_LAYER]; //!< OETF
192     VPHAL_HDR_MODE                  HdrMode[VPHAL_MAX_HDR_INPUT_LAYER];   //!< Hdr Mode
193     VPHAL_HDR_CCM_TYPE              CCM[VPHAL_MAX_HDR_INPUT_LAYER];       //!< CCM Mode
194     VPHAL_HDR_CCM_TYPE              CCMExt1[VPHAL_MAX_HDR_INPUT_LAYER];   //!< CCM Ext1 Mode
195     VPHAL_HDR_CCM_TYPE              CCMExt2[VPHAL_MAX_HDR_INPUT_LAYER];   //!< CCM Ext2 Mode
196     VPHAL_HDR_CSC_TYPE              PriorCSC[VPHAL_MAX_HDR_INPUT_LAYER];  //!< Prior CSC Mode
197     VPHAL_HDR_CSC_TYPE              PostCSC[VPHAL_MAX_HDR_INPUT_LAYER];   //!< Post CSC Mode
198 
199     VPHAL_HDR_PARAMS                HDRLastFrameSourceParams[VPHAL_MAX_HDR_INPUT_LAYER];
200     VPHAL_HDR_PARAMS                HDRLastFrameTargetParams;
201 
202     STATUS_TABLE_UPDATE_PARAMS      StatusTableUpdateParams;                   //!< Status table, Video Pre-Processing Only
203 
204     bool                            bFtrComputeWalker;
205     bool                            bVeboxpreprocessed;                   //!< Marked as following VEBOX pre-render, with TCC/IEF preprocessed
206     bool                            bNeed3DSampler;                       //!< indicate whether 3D should neede by force considering AVS removal etc.
207 
208     MOS_STATUS(*pfnInitialize) (
209         PVPHAL_HDR_STATE            pHdrState,
210         const VphalSettings         *pSettings,
211         Kdll_State                  *pKernelDllState);
212 
213     MOS_STATUS(*pfnDestroy) (
214         PVPHAL_HDR_STATE            pHdrState);
215 
216     MOS_STATUS(*pfnRender) (
217         PVPHAL_HDR_STATE            pHdrState,
218         PVPHAL_RENDER_PARAMS        pRenderParams);
219 
220     MOS_STATUS(*pfnFreeResources) (
221         PVPHAL_HDR_STATE            pHdrState);
222 
223     MOS_STATUS(*pfnAllocateResources) (
224         PVPHAL_HDR_STATE            pHdrState);
225 
226     MOS_STATUS(*pfnIsInputFormatSupported) (
227         PVPHAL_SURFACE              pSrcSurface,
228         bool*                       pBeSupported);
229 
230     MOS_STATUS(*pfnIsOutputFormatSupported) (
231         PVPHAL_SURFACE              pTargetSurface,
232         bool*                       pBeSupported);
233 
234     MOS_STATUS(*pfnSetupSurfaceStates) (
235         PVPHAL_HDR_STATE            pHdrState,
236         PVPHAL_HDR_RENDER_DATA      pRenderData);
237 
238     MOS_STATUS(*pfnSetupPreSurfaceStates) (
239         PVPHAL_HDR_STATE            pHdrState,
240         PVPHAL_HDR_RENDER_DATA      pRenderData);
241 
242     MOS_STATUS(*pfnGetKernelParam) (
243         uint32_t                    HdrKernelID,
244         int32_t*                    pKUIDOut,
245         int32_t*                    pKDTIndexOut);
246 
247     MOS_STATUS(*pfnLoadStaticData) (
248         PVPHAL_HDR_STATE            pHdrState,
249         PVPHAL_HDR_RENDER_DATA      pRenderData,
250         int32_t*                    piCurbeOffsetOut);
251 
252     MOS_STATUS(*pfnLoadPreStaticData) (
253         PVPHAL_HDR_STATE            pHdrState,
254         PVPHAL_HDR_RENDER_DATA      pRenderData,
255         int32_t*                    piCurbeOffsetOut);
256 
257     MOS_STATUS(*pfnIsNeeded)(
258         VphalRenderer               *pRenderer,
259         bool*                       pBeNeeded);
260 
261     MOS_STATUS(*pfnInitAVSParams) (PMHW_AVS_PARAMS pAVS_Params);
262 
263     MOS_STATUS(*pfnSetSamplerAvsTable) (
264         PRENDERHAL_INTERFACE            pRenderHal,
265         PMHW_SAMPLER_STATE_PARAM        pSamplerStateParams,
266         PMHW_AVS_PARAMS                 pAvsParams,
267         MOS_FORMAT                      SrcFormat,
268         float                           fScaleX,
269         float                           fScaleY,
270         uint32_t                        dwChromaSiting);
271 
272     MOS_STATUS(*pfnSetSamplerStates) (
273         PVPHAL_HDR_STATE            pHdrState,
274         PVPHAL_HDR_RENDER_DATA      pRenderData);
275 
276     MOS_STATUS(*pfnSetIefStates) (
277         PVPHAL_HDR_STATE            pHdrState,
278         PVPHAL_HDR_RENDER_DATA      pRenderData,
279         PMHW_SAMPLER_STATE_PARAM    pSamplerStateParams);
280 
281     MOS_STATUS(*pfnInitOETF1DLUT) (
282         PVPHAL_HDR_STATE pHdrState,
283         int32_t          iIndex,
284         PVPHAL_SURFACE   pOETF1DLUTSurface);
285 
286     MOS_STATUS(*pfnInitCoeff) (
287         PVPHAL_HDR_STATE pHdrState,
288         PVPHAL_SURFACE   pCoeffSurface);
289 
290     MOS_STATUS(*pfnInitPWLFCoeff) (
291         PVPHAL_HDR_STATE pHdrState,
292         PVPHAL_SURFACE   pPWLFCoeffSurface);
293 
294     void(*pfnDestoryAVSParams) (PMHW_AVS_PARAMS pAVS_Params);
295 
296     MOS_STATUS(*pfnGetSplitFramePortion) (
297         PVPHAL_HDR_STATE pHdrState);
298 
299     MOS_STATUS(*pfnSetupPreprocessSurfaceStates) (
300         PVPHAL_HDR_STATE            pHdrState,
301         PVPHAL_HDR_RENDER_DATA      pRenderData);
302 
303     MOS_STATUS(*pfnLoadPreProcessStaticData) (
304         PVPHAL_HDR_STATE            pHdrState,
305         PVPHAL_HDR_RENDER_DATA      pRenderData,
306         int32_t*                    piCurbeOffsetOut);
307 
308 } VPHAL_HDR_STATE, *PVPHAL_HDR_STATE;
309 
310 //!
311 //! \brief    Set up HDR Render Data
312 //! \details  Set up HDR render data, including kernel information, input surface's block size
313 //! \param    PVPHAL_HDR_STATE pHdrState
314 //!           [in] Pointer to HDR state
315 //! \param    PVPHAL_HDR_RENDER_DATA pRenderData
316 //!           [out] Pointer to HDR render data
317 //! \param    int32_t iKUID
318 //!           [in] Kernel unique ID
319 //! \param    int32_t iKDTIndex
320 //            [in] KDT index.
321 //! \return   MOS_STATUS
322 //!           MOS_STATUS_SUCCESS if successful, otherwise failed
323 //!
324 MOS_STATUS VpHal_HdrSetupRenderData(
325     PVPHAL_HDR_STATE        pHdrState,
326     PVPHAL_HDR_RENDER_DATA  pRenderData,
327     int32_t                 iKUID,
328     int32_t                 iKDTIndex);
329 
330 //!
331 //! \brief    Hdr init renderer interface
332 //! \details  Initializes the Hdr interface
333 //! \param    PVPHAL_HDR_STATE pHdrState
334 //!           [in] Pointer to Hdr state
335 //! \param    PVPHAL_HW_INTERFACE pHwInterface
336 //!           [in] Pointer to RenderHal interface
337 //! \return   void
338 //!
339 MOS_STATUS VpHal_HdrInitInterface(
340     PVPHAL_HDR_STATE          pHdrState,
341     PRENDERHAL_INTERFACE      pRenderHal);
342 
343 //!
344 //! \brief    Update per layer pipeline states and return update mask for each layer
345 //! \details  Update per layer pipeline states and return update mask for each layer
346 //! \param    PVPHAL_HDR_STATE pHdrStatee
347 //!           [in] Pointer to HDR state
348 //! \param    uint32_t* pdwUpdateMask
349 //!           [out] Pointer to update mask
350 //! \return   MOS_STATUS
351 //!
352 MOS_STATUS VpHal_HdrUpdatePerLayerPipelineStates(
353     PVPHAL_HDR_STATE pHdrState,
354     uint32_t*        pdwUpdateMask);
355 
356 //! \brief    Setup media walker command for HDR
357 //! \details  Setup media walker command for HDR
358 //! \param    PVPHAL_HDR_STATE pHdrState
359 //!           [in] Pointer to HDR state
360 //! \param    PVPHAL_HDR_RENDER_DATA pRenderData
361 //!           [in] Pointer to render data
362 //! \param    PMHW_WALKER_PARAMS pWalkerParams
363 //!           [out] Pointer to media walker parameters
364 //! \param    int32_t iKDTIndex
365 //            [in] KDT index.
366 //! \param    uint32_t uiPortionIndex
367 //            [in] Frame split portion index.
368 //! \return   MOS_STATUS
369 //!
370 MOS_STATUS VpHal_HdrSetupWalkerObject(
371     PVPHAL_HDR_STATE          pHdrState,
372     PVPHAL_HDR_RENDER_DATA    pRenderData,
373     PMHW_WALKER_PARAMS        pWalkerParams,
374     int32_t                   iKDTIndex,
375     uint32_t                  uiPortionIndex);
376 
377 //!
378 //! \brief    Render GpGpu Walker Buffer
379 //! \details  Render GpGpu Walker Buffer, fill Walker static data fields and set walker
380 //!           cmd params
381 //! \param    [in] pHdrState
382 //!           Pointer to HdrState
383 //! \param    [in] pRenderingData
384 //!           Pointer to Rendering Data
385 //! \param    [in] pWalkerParams
386 //!           Pointer to Walker parameters
387 //! \return   MOS_STATUS
388 //!           Return MOS_STATUS_SUCCESS if successful, otherwise false
389 //!
390 MOS_STATUS Vphal_HdrSetupComputeWalker(
391     PVPHAL_HDR_STATE                pHdrState,
392     PVPHAL_HDR_RENDER_DATA          pRenderData,
393     PMHW_GPGPU_WALKER_PARAMS        pWalkerParams);
394 
395 //! \brief    Perform Rendering HDR step
396 //! \details  Check whether HDR is needed. When it's needed, perform HDR
397 //!           operation
398 //! \param    [in,out] pRenderer
399 //!           VPHAL renderer pointer
400 //! \param    [in,out] pRenderParams
401 //!           Pointer to VPHAL render parameter
402 //! \param    [in,out] pRenderPassData
403 //!           Pointer to the VPHAL render pass data
404 //! \return   MOS_STATUS
405 //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
406 //!
407 MOS_STATUS VpHal_RndrRenderHDR(
408     VphalRenderer           *pRenderer,
409     PVPHAL_RENDER_PARAMS    pRenderParams,
410     RenderpassData          *pRenderPassData);
411 
412 //!
413 //! \brief    Check if HDR path is needed
414 //! \details  Check if HDR path is needed
415 //! \param    [in] pRenderer
416 //!           VPHAL renderer pointer
417 //! \param    [in] pRenderParams
418 //!           Pointer to VPHAL render parameter
419 //! \param    [in] pRenderPassData
420 //!           Pointer to VPHAL render pass data
421 //! \return   bool
422 //!
423 bool VpHal_RndrIsHdrPathNeeded(
424     VphalRenderer           *pRenderer,
425     PVPHAL_RENDER_PARAMS    pRenderParams,
426     RenderpassData          *pRenderPassData);
427 
428 //!
429 //! \brief    Checks to see if HDR is needed and supported
430 //! \details  Checks to see if HDR is needed and supported
431 //! \param    pRenderer
432 //            [in] Pointer to VphalRenderer
433 //! \param    pBeNeeded
434 //!           [out] 1 Needed 0 not Needed
435 //! \return   MOS_STATUS
436 //!           MOS_STATUS_SUCCESS if successful, otherwise failed
437 //!
438 MOS_STATUS VpHal_HdrIsNeeded(
439     VphalRenderer         *pRenderer,
440     bool*                  pBeNeeded);
441 
442 //!
443 //! \brief    HDR preprocess
444 //! \details  Launch HDR pre process kernel to render hdr coefficients surface
445 //! \param    PVPHAL_HDR_STATE pHdrState
446 //!           [in] Poniter to HDR state
447 //! \param    PVPHAL_RENDER_PARAMS pRenderParams
448 //!           [in,out] Pointer to Render parameters
449 //! \return   MOS_STATUS
450 //!           MOS_STATUS_SUCCESS if successful, otherwise failed
451 //!
452 MOS_STATUS VpHal_HdrPreprocess(
453     PVPHAL_HDR_STATE        pHdrState,
454     PVPHAL_RENDER_PARAMS    pRenderParams);
455 
456 //!
457 //! \brief    Calculate Yuv To Rgb Matrix
458 //! \details  Calculate Yuv To Rgb Matrix
459 //! \param    VPHAL_CSPACE src
460 //!           [in] Source color space
461 //! \param    VPHAL_CSPACE dst
462 //!           [in] Dest color space
463 //! \param    float* pTransferMatrix
464 //!           [in] Pointer to input transfer matrix
465 //! \param    float* pOutMatrix
466 //!           [out] Pointer to output transfer matrix for curbe
467 //! \return   MOS_STATUS
468 //!
469 MOS_STATUS VpHal_HdrCalcYuvToRgbMatrix(
470     VPHAL_CSPACE    src,
471     VPHAL_CSPACE    dst,
472     float*          pTransferMatrix,
473     float*          pOutMatrix);
474 
475 //!
476 //! \brief    Calculate Rgb To Yuv Matrix
477 //! \details  Calculate Rgb To Yuv Matrix
478 //! \param    VPHAL_CSPACE src
479 //!           [in] Source color space
480 //! \param    VPHAL_CSPACE dst
481 //!           [in] Dest color space
482 //! \param    float* pTransferMatrix
483 //!           [in] Pointer to input transfer matrix
484 //! \param    float* pOutMatrix
485 //!           [out] Pointer to output transfer matrix for curbe
486 //! \return   MOS_STATUS
487 //!
488 MOS_STATUS VpHal_HdrCalcRgbToYuvMatrix(
489     VPHAL_CSPACE    src,
490     VPHAL_CSPACE    dst,
491     float*          pTransferMatrix,
492     float*          pOutMatrix);
493 
494 //!
495 //! \brief    Calculate CCM Matrix
496 //! \details  Calculate CCM Matrix
497 //! \param    float* pTransferMatrix
498 //!           [in] Pointer to input transfer matrix
499 //! \param    float* pOutMatrix
500 //!           [out] Pointer to output transfer matrix for curbe
501 //! \return   MOS_STATUS
502 //!
503 MOS_STATUS VpHal_HdrCalcCCMMatrix(
504     float*          pTransferMatrix,
505     float*          pOutMatrix);
506 
507 //!
508 //! \brief    Calculate CCM Matrix with Monitor Gamut
509 //! \details  Calculate CCM Matrix with Monitor Gamut
510 //! \param    VPHAL_HDR_CCM_TYPE CCMType
511 //!           [in] CCM type
512 //! \param    PVPHAL_HDR_PARAMS pTarget
513 //!           [in] Pointer to output surface
514 //! \param    float TempMatrix
515 //!           [in] Array of temp matrix
516 //! \return   MOS_STATUS
517 //!
518 void VpHal_CalculateCCMWithMonitorGamut(
519     VPHAL_HDR_CCM_TYPE  CCMType,
520     PVPHAL_HDR_PARAMS   pTarget,
521     float TempMatrix[12]);
522 #if __cplusplus
523 }
524 #endif // __cplusplus
525 #endif // __VPHAL_RENDER_HDR_BASE_H__
526