| 1 |
/* |
| 2 |
* Copyright (c) 2017, 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 cm_vebox_rt.h |
| 24 |
//! \brief Contains CmVeboxRT declarations. |
| 25 |
//! |
| 26 |
|
| 27 |
#ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMVEBOXRT_H_ |
| 28 |
#define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMVEBOXRT_H_ |
| 29 |
|
| 30 |
#include "cm_vebox.h" |
| 31 |
#include "cm_hal_vebox.h" |
| 32 |
|
| 33 |
namespace CMRT_UMD |
| 34 |
{ |
| 35 |
class CmDeviceRT; |
| 36 |
class CmSurface2DRT; |
| 37 |
class CmVeboxData; |
| 38 |
|
| 39 |
//! \brief CmVebox is the inheritance class of CmVebox_base. All the vebox |
| 40 |
//! operation go through this class API. |
| 41 |
|
| 42 |
class CmVeboxRT: public CmVebox |
| 43 |
{ |
| 44 |
public: |
| 45 |
static int32_t Create(CmDeviceRT *device, |
| 46 |
uint32_t index, |
| 47 |
CmVeboxRT* &cmVebox); |
| 48 |
|
| 49 |
static int32_t Destroy(CmVeboxRT* &cmVebox); |
| 50 |
|
| 51 |
//! \brief Set vebox state |
| 52 |
//! \details Pass user defined vebox state to vebox class member |
| 53 |
//! m_veboxState |
| 54 |
//! \param [in] veboxState |
| 55 |
//! CM_VEBOX_STATE |
| 56 |
//! \returns CM_SUCCESS |
| 57 |
CM_RT_API int32_t SetState(CM_VEBOX_STATE &veboxState); |
| 58 |
|
| 59 |
//! \brief Set current frame input surface |
| 60 |
//! \details Bind the CM surface to current frame input surface in the vebox class |
| 61 |
//! \param [in] surface |
| 62 |
//! CmSurface2D |
| 63 |
//! \retval CM_SUCCESS if the surface index is less than max index number |
| 64 |
//! \retval CM_FAILURE if the surface index is larger or equal to max index |
| 65 |
//! number |
| 66 |
CM_RT_API int32_t SetCurFrameInputSurface(CmSurface2D *surface); |
| 67 |
|
| 68 |
//! \brief Set current frame input surface control bits |
| 69 |
//! \details Pass user defined current frame input surface control bits to vebox |
| 70 |
//! member, later,the control bit will control memory object state and |
| 71 |
//! compression etc |
| 72 |
//! \param [in] ctrlBits |
| 73 |
//! control bit value |
| 74 |
//! \retval CM_SUCCESS if surface index is less than max index number |
| 75 |
//! \retval CM_FAILURE if surface index is equal or larger than max index number |
| 76 |
CM_RT_API int32_t |
| 77 |
SetCurFrameInputSurfaceControlBits(const uint16_t ctrlBits); |
| 78 |
|
| 79 |
//! \brief Set previous frame input surface |
| 80 |
//! \details Bind the CM surface to previous frame input surface in the vebox class |
| 81 |
//! \param [in] surface |
| 82 |
//! CmSurface2D |
| 83 |
//! \retval CM_SUCCESS if the surface index is less than max index number |
| 84 |
//! \retval CM_FAILURE if the surface index is larger or equal to max index |
| 85 |
//! number |
| 86 |
CM_RT_API int32_t SetPrevFrameInputSurface(CmSurface2D *surface); |
| 87 |
|
| 88 |
//! \brief Set previous frame input surface control bits |
| 89 |
//! \details Pass user defined previous frame input surface control bits to vebox |
| 90 |
//! member, durine enqueue, the control bit will pass to vebox command to |
| 91 |
//! control memory object state and compression etc |
| 92 |
//! \param [in] ctrlBits |
| 93 |
//! control bit value |
| 94 |
//! \retval CM_SUCCESS if surface index is less than max index number |
| 95 |
//! \retval CM_FAILURE if surface index is equal or larger than max index number |
| 96 |
CM_RT_API int32_t SetPrevFrameInputSurfaceControlBits( |
| 97 |
const uint16_t ctrlBits); |
| 98 |
|
| 99 |
//! \brief Set STMM frame input surface |
| 100 |
//! \details Bind the CM surface to STMM input surface in the vebox class |
| 101 |
//! \param [in] surface |
| 102 |
//! CmSurface2D |
| 103 |
//! \retval CM_SUCCESS if the surface index is less than max index number |
| 104 |
//! \retval CM_FAILURE if the surface index is larger or equal to max index |
| 105 |
//! number |
| 106 |
CM_RT_API int32_t SetSTMMInputSurface(CmSurface2D *surface); |
| 107 |
|
| 108 |
//! \brief Set STMM frame input surface control bits |
| 109 |
//! \details Pass User defined STMM Input frame surface control bits to vebox member, |
| 110 |
//! during enqueue, the control bit will pass to vebox command to control |
| 111 |
//! memory object state and compression etc |
| 112 |
//! \param [in] ctrlBits |
| 113 |
//! control bit value |
| 114 |
//! \retval CM_SUCCESS if surface index is less than max index number |
| 115 |
//! \retval CM_FAILURE if surface index is equal or larger than max index number |
| 116 |
CM_RT_API int32_t SetSTMMInputSurfaceControlBits(const uint16_t ctrlBits); |
| 117 |
|
| 118 |
//! \brief Set STMM frame output surface |
| 119 |
//! \details Bind the CM surface to STMM output surface in the vebox class |
| 120 |
//! \param [in] surface |
| 121 |
//! CmSurface2D |
| 122 |
//! \retval CM_SUCCESS if the surface index is less than max index number |
| 123 |
//! \retval CM_FAILURE if the surface index is larger or equal to max index |
| 124 |
//! number |
| 125 |
CM_RT_API int32_t SetSTMMOutputSurface(CmSurface2D *surface); |
| 126 |
|
| 127 |
//! \brief Set STMM output frame surface control bits |
| 128 |
//! \details Pass User defined STMM Output frame surface control bits to vebox member, |
| 129 |
//! during enqueue, the control bit will pass to vebox command to control |
| 130 |
//! memory object state and compression etc |
| 131 |
//! \param [in] ctrlBits |
| 132 |
//! control bit value |
| 133 |
//! \retval CM_SUCCESS if surface index is less than max index number |
| 134 |
//! \retval CM_FAILURE if surface index is equal or larger than max index number |
| 135 |
CM_RT_API int32_t SetSTMMOutputSurfaceControlBits(const uint16_t ctrlBits); |
| 136 |
|
| 137 |
//! \brief Set Denoised current frame output surface |
| 138 |
//! \details Bind the CM surface to denoised current frame output surface in the vebox class |
| 139 |
//! \param [in] surface |
| 140 |
//! CmSurface2D |
| 141 |
//! \retval CM_SUCCESS if the surface index is less than max index number |
| 142 |
//! \retval CM_FAILURE if the surface index is larger or equal to max index |
| 143 |
//! number |
| 144 |
CM_RT_API int32_t SetDenoisedCurFrameOutputSurface(CmSurface2D *surface); |
| 145 |
|
| 146 |
//! \brief Set denoised current output frame surface control bits |
| 147 |
//! \details Pass user defined denoised current output frame surface control bits |
| 148 |
//! to vebox member, during euqueue, the control bit will pass to vebox |
| 149 |
//! command to control memory object state and compression etc |
| 150 |
//! \param [in] ctrlBits |
| 151 |
//! control bit value |
| 152 |
//! \retval CM_SUCCESS if surface index is less than max index number |
| 153 |
//! \retval CM_FAILURE if surface index is equal or larger than max index number |
| 154 |
CM_RT_API int32_t |
| 155 |
SetDenoisedCurOutputSurfaceControlBits(const uint16_t ctrlBits); |
| 156 |
|
| 157 |
//! \brief set current frame output surface |
| 158 |
//! \details Bind the CM surface to current frame output surface in the vebox class |
| 159 |
//! \param [in] surface |
| 160 |
//! CmSurface2D |
| 161 |
//! \retval CM_SUCCESS if the surface index is less than max index number |
| 162 |
//! \retval CM_FAILURE if the surface index is larger or equal to max index |
| 163 |
//! number |
| 164 |
CM_RT_API int32_t SetCurFrameOutputSurface(CmSurface2D *surface); |
| 165 |
|
| 166 |
//! \brief Set current frame output surface control bits |
| 167 |
//! \details Pass user defined current frame output surface control bits to vebox |
| 168 |
//! member, during enqueue, the control bit will pass to vebox command to |
| 169 |
//! control memory object state and compression etc |
| 170 |
//! \param [in] ctrlBits |
| 171 |
//! control bit value |
| 172 |
//! \retval CM_SUCCESS if surface index is less than max index number |
| 173 |
//! \retval CM_FAILURE if surface index is equal or larger than max index number |
| 174 |
CM_RT_API int32_t |
| 175 |
SetCurFrameOutputSurfaceControlBits(const uint16_t ctrlBits); |
| 176 |
|
| 177 |
//! \brief Set previous frame output surface |
| 178 |
//! \details Bind the CM surface to previous frame output surface in the vebox class |
| 179 |
//! \param [in] surface |
| 180 |
//! CmSurface2D |
| 181 |
//! \retval CM_SUCCESS if the surface index is less than max index number |
| 182 |
//! \retval CM_FAILURE if the surface index is larger or equal to max index |
| 183 |
//! number |
| 184 |
CM_RT_API int32_t SetPrevFrameOutputSurface(CmSurface2D *surface); |
| 185 |
|
| 186 |
//! \brief Set previous frame output surface control bits |
| 187 |
//! \details Pass user defined previous frame output surface control bits to vebox |
| 188 |
//! member, during enqueue, the control bit will pass to vebox command to |
| 189 |
//! control memory object state and compression etc |
| 190 |
//! \param [in] ctrlBits |
| 191 |
//! control bit value |
| 192 |
//! \retval CM_SUCCESS if surface index is less than max index number |
| 193 |
//! \retval CM_FAILURE if surface index is equal or larger than max index number |
| 194 |
CM_RT_API int32_t |
| 195 |
SetPrevFrameOutputSurfaceControlBits(const uint16_t ctrlBits); |
| 196 |
|
| 197 |
//! \brief Set statistics output surface |
| 198 |
//! \details Bind the CM surface to statistics output surface in the vebox class |
| 199 |
//! \param [in] surface |
| 200 |
//! CmSurface2D |
| 201 |
//! \retval CM_SUCCESS if the surface index is less than max index number |
| 202 |
//! \retval CM_FAILURE if the surface index is larger or equal to max index |
| 203 |
//! number |
| 204 |
CM_RT_API int32_t SetStatisticsOutputSurface(CmSurface2D *surface); |
| 205 |
|
| 206 |
//! \brief Set statistics output surface control bits |
| 207 |
//! \details Pass user defined statistics output surface control bits to vebox |
| 208 |
//! member, during euqueue, the control bit will pass to vebox command |
| 209 |
//! to control memory object state and compression etc |
| 210 |
//! \param [in] ctrlBits |
| 211 |
//! control bit value |
| 212 |
//! \retval CM_SUCCESS if surface index is less than max index number |
| 213 |
//! \retval CM_FAILURE if surface index is equal or larger than max index number |
| 214 |
CM_RT_API int32_t |
| 215 |
SetStatisticsOutputSurfaceControlBits(const uint16_t ctrlBits); |
| 216 |
|
| 217 |
//! \brief Set vebox parameter. |
| 218 |
//! \details Pass pointer of the parameter buffer to vebox class member |
| 219 |
//! m_paramBuffer. Later on, during the enqueue stage, the |
| 220 |
//! parameter in the buffer will be bonded to the VEBOX command for |
| 221 |
//! processing. |
| 222 |
//! \param [in] paramBuffer |
| 223 |
//! CmBufferUP which contains all the vebox parameter. |
| 224 |
//! \returns CM_SUCCESS. |
| 225 |
CM_RT_API int32_t SetParam(CmBufferUP *paramBuffer); |
| 226 |
|
| 227 |
int32_t GetSurface(uint32_t surfUsage, CmSurface2DRT *&surface); |
| 228 |
|
| 229 |
virtual uint32_t GetIndexInVeboxArray(); |
| 230 |
|
| 231 |
CM_VEBOX_STATE GetState(); |
| 232 |
|
| 233 |
CmBufferUP *GetParam(); |
| 234 |
|
| 235 |
uint16_t GetSurfaceControlBits(uint32_t usage); |
| 236 |
|
| 237 |
protected: |
| 238 |
CmVeboxRT(CmDeviceRT *device, uint32_t index); |
| 239 |
|
| 240 |
~CmVeboxRT(); |
| 241 |
|
| 242 |
int32_t Initialize(); |
| 243 |
|
| 244 |
int32_t SetSurfaceInternal(VEBOX_SURF_USAGE surfUsage, CmSurface2D *surface); |
| 245 |
|
| 246 |
int32_t SetSurfaceControlBitsInternal(VEBOX_SURF_USAGE surfUsage, |
| 247 |
const uint16_t ctrlBits); |
| 248 |
|
| 249 |
CmDeviceRT *m_device; |
| 250 |
uint32_t m_maxSurfaceIndex; |
| 251 |
CM_VEBOX_STATE m_veboxState; |
| 252 |
CmBufferUP *m_paramBuffer; |
| 253 |
CmSurface2DRT *m_surface2D[VEBOX_MAX_SURFACE_COUNT]; |
| 254 |
uint16_t m_surfaceCtrlBits[VEBOX_MAX_SURFACE_COUNT]; |
| 255 |
uint32_t m_indexInVeboxArray; |
| 256 |
|
| 257 |
private: |
| 258 |
CmVeboxRT(const CmVeboxRT& other); |
| 259 |
CmVeboxRT& operator=(const CmVeboxRT& other); |
| 260 |
}; |
| 261 |
}; //namespace |
| 262 |
|
| 263 |
#endif // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMVEBOXRT_H_ |