| 1 |
/* |
| 2 |
* Copyright (c) 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 codechal_encode_vp8_g11.h |
| 24 |
//! \brief VP8 dual-pipe encoder for GEN11 platform. |
| 25 |
//! |
| 26 |
|
| 27 |
#ifndef __CODECHAL_ENCODE_VP8_G11_H__ |
| 28 |
#define __CODECHAL_ENCODE_VP8_G11_H__ |
| 29 |
|
| 30 |
#include "codechal_encode_vp8.h" |
| 31 |
#include "codechal_encode_sw_scoreboard_g11.h" |
| 32 |
|
| 33 |
class CodechalEncodeVp8G11 : public CodechalEncodeVp8 |
| 34 |
{ |
| 35 |
public: |
| 36 |
//! |
| 37 |
//! \brief Constructor |
| 38 |
//! |
| 39 |
CodechalEncodeVp8G11( |
| 40 |
CodechalHwInterface* hwInterface, |
| 41 |
CodechalDebugInterface* debugInterface, |
| 42 |
PCODECHAL_STANDARD_INFO standardInfo); |
| 43 |
|
| 44 |
//! |
| 45 |
//! \brief Destructor |
| 46 |
//! |
| 47 |
~CodechalEncodeVp8G11() {}; |
| 48 |
|
| 49 |
void FreeResources() override; |
| 50 |
|
| 51 |
MOS_STATUS Initialize(CodechalSetting * codecHalSettings) override; |
| 52 |
|
| 53 |
void ResizeOnResChange() override; |
| 54 |
MOS_STATUS ExecuteKernelFunctions() override; |
| 55 |
|
| 56 |
protected: |
| 57 |
CodechalEncodeSwScoreboard* m_swScoreboardState = nullptr; //!< pointer to SW scoreboard init state. |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
MOS_STATUS InitKernelStateHelper(struct CodechalEncodeVp8InitKernelStateParams* params); |
| 62 |
|
| 63 |
MOS_STATUS InitKernelState() override; |
| 64 |
|
| 65 |
//! |
| 66 |
//! \brief Initialize kernel state for ME |
| 67 |
//! |
| 68 |
//! \return MOS_STATUS |
| 69 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 70 |
//! |
| 71 |
MOS_STATUS InitKernelStateMe(); |
| 72 |
|
| 73 |
//! |
| 74 |
//! \brief Initialize kernel state for MBENC |
| 75 |
//! |
| 76 |
//! \return MOS_STATUS |
| 77 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 78 |
//! |
| 79 |
MOS_STATUS InitKernelStateMbEnc(); |
| 80 |
|
| 81 |
//! |
| 82 |
//! \brief Initialize kernel state for BRC |
| 83 |
//! |
| 84 |
//! \return MOS_STATUS |
| 85 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 86 |
//! |
| 87 |
MOS_STATUS InitKernelStateBrc(); |
| 88 |
|
| 89 |
//! |
| 90 |
//! \brief Initialize kernel state for MPU |
| 91 |
//! |
| 92 |
//! \return MOS_STATUS |
| 93 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 94 |
//! |
| 95 |
MOS_STATUS InitKernelStateMpu(); |
| 96 |
|
| 97 |
//! |
| 98 |
//! \brief Initialize kernel state for TPU |
| 99 |
//! |
| 100 |
//! \return MOS_STATUS |
| 101 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 102 |
//! |
| 103 |
MOS_STATUS InitKernelStateTpu(); |
| 104 |
|
| 105 |
//! |
| 106 |
//! \brief Initialize kernel state for swScoreBoard |
| 107 |
//! |
| 108 |
//! \return MOS_STATUS |
| 109 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 110 |
//! |
| 111 |
MOS_STATUS InitKernelStateSwScoreboard(); |
| 112 |
|
| 113 |
|
| 114 |
MOS_STATUS InitMpuTpuBuffer() override; |
| 115 |
|
| 116 |
//! |
| 117 |
//! \brief Calculate Max Level Ratio For Temporal Layers |
| 118 |
//! |
| 119 |
//! \param [in] framesPer100Sec |
| 120 |
//! Pointer to uint32_t |
| 121 |
//! \param [in] targetBitRate |
| 122 |
//! Pointer to uint32_t |
| 123 |
//! \param [in] numTemporalLayersMinus1 |
| 124 |
//! Temporal layers minus1 number |
| 125 |
//! \param [in] tempBitRate |
| 126 |
//! Pointer to uint32_t |
| 127 |
//! |
| 128 |
//! \return MOS_STATUS |
| 129 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 130 |
//! |
| 131 |
MOS_STATUS CalMaxLevelRatioForTL( |
| 132 |
uint16_t *framesPer100Sec, |
| 133 |
uint32_t *targetBitRate, |
| 134 |
uint32_t numTemporalLayersMinus1, |
| 135 |
uint32_t *tempBitRate); |
| 136 |
|
| 137 |
MOS_STATUS SendMbEncSurfaces( |
| 138 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 139 |
struct CodechalVp8MbencSurfaceParams* params) override; |
| 140 |
|
| 141 |
MOS_STATUS IntrDistKernel(); |
| 142 |
MOS_STATUS SetIntrDistCurbe(struct CodechalVp8MbencCurbeParams* params); |
| 143 |
MOS_STATUS SendIntrDistSurfaces( |
| 144 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 145 |
struct CodechalVp8MbencSurfaceParams* params); |
| 146 |
|
| 147 |
MOS_STATUS InitBrcConstantBuffer(struct CodechalVp8InitBrcConstantBufferParams* params) override; |
| 148 |
|
| 149 |
MOS_STATUS InitBrcDistortionBuffer() override; |
| 150 |
|
| 151 |
MOS_STATUS KeyFrameUpdateMpuTpuBuffer(struct CodechalVp8UpdateMpuTpuBufferParams* params) override; |
| 152 |
|
| 153 |
MOS_STATUS InitMBEncConstantBuffer( |
| 154 |
struct CodechalVp8InitMbencConstantBufferParams* params) override; |
| 155 |
|
| 156 |
MOS_STATUS SetBrcInitResetCurbe(struct CodechalVp8BrcInitResetCurbeParams* params) override; |
| 157 |
|
| 158 |
MOS_STATUS SetBrcUpdateCurbe(struct CodechalVp8BrcUpdateCurbeParams* params) override; |
| 159 |
|
| 160 |
MOS_STATUS SetMbEncCurbe(struct CodechalVp8MbencCurbeParams* params) override; |
| 161 |
|
| 162 |
MOS_STATUS SetMeCurbe(struct CodechalVp8MeCurbeParams* params) override; |
| 163 |
|
| 164 |
MOS_STATUS SetMpuCurbe(struct CodechalVp8MpuCurbeParams* params) override; |
| 165 |
|
| 166 |
MOS_STATUS SetTpuCurbe(struct CodechalVp8TpuCurbeParams* params) override; |
| 167 |
|
| 168 |
MOS_STATUS SendBrcInitResetSurfaces( |
| 169 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 170 |
struct CodechalVp8BrcInitResetSurfaceParams* params) override; |
| 171 |
|
| 172 |
MOS_STATUS SendMpuSurfaces( |
| 173 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 174 |
struct CodechalVp8MpuSurfaceParams* params) override; |
| 175 |
|
| 176 |
//! |
| 177 |
//! \brief Get Header and Size of Kernel |
| 178 |
//! |
| 179 |
//! \param [in] binary |
| 180 |
//! Pointer to void |
| 181 |
//! \param [in] operation |
| 182 |
//! Type of encode operation |
| 183 |
//! \param [in] krnStateIdx |
| 184 |
//! Index of Kernel State |
| 185 |
//! \param [in] krnHeader |
| 186 |
//! Pointer to void |
| 187 |
//! \param [in] krnSize |
| 188 |
//! Pointer to the kernel size |
| 189 |
//! |
| 190 |
//! \return MOS_STATUS |
| 191 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 192 |
//! |
| 193 |
static MOS_STATUS GetKernelHeaderAndSize( |
| 194 |
void *binary, |
| 195 |
EncOperation operation, |
| 196 |
uint32_t krnStateIdx, |
| 197 |
void *krnHeader, |
| 198 |
uint32_t *krnSize); |
| 199 |
}; |
| 200 |
|
| 201 |
#endif //__CODECHAL_ENC_VP8_MODS_G10_H__ |