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