1 /* 2 * Copyright (c) 2022, 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 //! 24 //! \file encode_preenc_const_settings.h 25 //! \brief Defines the common interface for preenc const settings 26 //! \details The default setting is further sub-divided by platform type 27 //! this file is for the base interface which is shared by all components. 28 //! 29 30 #ifndef __ENCODE_PREENC_CONST_SETTINGS_H__ 31 #define __ENCODE_PREENC_CONST_SETTINGS_H__ 32 33 #include <array> 34 #include <vector> 35 #include <functional> 36 #include "mos_defs.h" 37 #include "media_class_trace.h" 38 #include "mhw_vdbox_vdenc_cmdpar.h" 39 #include "codec_def_encode_hevc.h" 40 #include "encode_preenc_defs.h" 41 42 namespace encode 43 { 44 struct PreEncFeatureSettings 45 { 46 std::array< 47 std::array< 48 std::array< 49 std::array< 50 std::array<uint8_t, 51 2>, 52 2>, 53 2>, 54 2>, 55 4> 56 transformSkipCoeffsTable{}; 57 58 std::array<uint16_t, 52> transformSkipLambdaTable{}; 59 60 std::array< 61 std::array< 62 std::array< 63 std::array<uint16_t, 64 52>, 65 2>, 66 2>, 67 2> 68 rdoqLamdas8bits{}; 69 70 std::array< 71 std::array< 72 std::array< 73 std::array<uint16_t, 74 64>, 75 2>, 76 2>, 77 2> 78 rdoqLamdas10bits{}; 79 80 std::array< 81 std::array< 82 std::array< 83 std::array<uint16_t, 84 76>, 85 2>, 86 2>, 87 2> 88 rdoqLamdas12bits{}; 89 90 std::vector< 91 std::function< 92 MOS_STATUS(mhw::vdbox::vdenc::_MHW_PAR_T(VDENC_CMD1) & par, bool isLowDelay, CODEC_PRE_ENC_PARAMS preEncConfig)> > 93 vdencCmd1Settings; 94 95 std::vector< 96 std::function< 97 MOS_STATUS(mhw::vdbox::vdenc::_MHW_PAR_T(VDENC_CMD2) & par, bool isLowDelay, CODEC_PRE_ENC_PARAMS preEncConfig)> > 98 vdencCmd2Settings; 99 }; 100 101 102 class EncodePreEncConstSettings 103 { 104 public: 105 106 //! 107 //! \brief EncodePreEncConstSettings constructor 108 //! 109 EncodePreEncConstSettings(); 110 111 //! 112 //! \brief EncodePreEncConstSettings destructor 113 //! 114 virtual ~EncodePreEncConstSettings(); 115 116 MOS_STATUS PrepareConstSettings(); 117 118 MOS_STATUS SetVdencCmd1Settings(); 119 120 virtual MOS_STATUS SetVdencCmd2Settings(); 121 122 MOS_STATUS SetCommonSettings(); 123 GetConstSettings()124 void *GetConstSettings() { return m_featureSetting; }; 125 126 protected: 127 PreEncFeatureSettings *m_featureSetting = nullptr; 128 129 MEDIA_CLASS_DEFINE_END(encode__EncodePreEncConstSettings) 130 }; 131 132 #define PREENC_VDENC_CMD1_LAMBDA() [&](mhw::vdbox::vdenc::_MHW_PAR_T(VDENC_CMD1) & par, bool isLowDelay, CODEC_PRE_ENC_PARAMS preEncConfig) -> MOS_STATUS 133 #define PREENC_VDENC_CMD2_LAMBDA() [&](mhw::vdbox::vdenc::_MHW_PAR_T(VDENC_CMD2) & par, bool isLowDelay, CODEC_PRE_ENC_PARAMS preEncConfig) -> MOS_STATUS 134 135 } 136 #endif // !__ENCODE_PREENC_CONST_SETTINGS_H__ 137 138