| 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 encode_vp9_pipeline.h |
| 24 | //! \brief Defines the interface for vp9 encode pipeline |
| 25 | //! |
| 26 | #ifndef __ENCODE_VP9_PIPELINE_H__ |
| 27 | #define __ENCODE_VP9_PIPELINE_H__ |
| 28 | #include "encode_pipeline.h" |
| 29 | #include "encode_vp9_basic_feature.h" |
| 30 | #include "media_vp9_feature_defs.h" |
| 31 | |
| 32 | namespace encode { |
| 33 | |
| 34 | class Vp9Pipeline : public EncodePipeline |
| 35 | { |
| 36 | public: |
| 37 | //! |
| 38 | //! \brief Vp9Pipeline constructor |
| 39 | //! \param [in] hwInterface |
| 40 | //! Pointer to CodechalHwInterface |
| 41 | //! \param [in] debugInterface |
| 42 | //! Pointer to CodechalDebugInterface |
| 43 | //! |
| 44 | Vp9Pipeline( |
| 45 | CodechalHwInterfaceNext * hwInterface, |
| 46 | CodechalDebugInterface *debugInterface); |
| 47 | |
| 48 | //! |
| 49 | //! \brief Vp9Pipeline destructor |
| 50 | //! |
| 51 | virtual ~Vp9Pipeline() {} |
| 52 | |
| 53 | //! |
| 54 | //! \brief Prepare internal parameters, should be invoked for each frame |
| 55 | //! \param [in] params |
| 56 | //! Pointer to the input parameters |
| 57 | //! \return MOS_STATUS |
| 58 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 59 | //! |
| 60 | virtual MOS_STATUS Prepare(void *params) override; |
| 61 | |
| 62 | protected: |
| 63 | //! |
| 64 | //! \brief Initialize the VP9 encode pipeline |
| 65 | //! \param [in] settings |
| 66 | //! Pointer to the initialize settings |
| 67 | //! \return MOS_STATUS |
| 68 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 69 | //! |
| 70 | virtual MOS_STATUS Initialize(void *settings) override; |
| 71 | |
| 72 | //! |
| 73 | //! \brief Uninitialize the VP9 encode pipeline |
| 74 | //! \return MOS_STATUS |
| 75 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 76 | //! |
| 77 | virtual MOS_STATUS Uninitialize() override; |
| 78 | |
| 79 | //! |
| 80 | //! \brief Report User Settings |
| 81 | //! \return MOS_STATUS |
| 82 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 83 | //! |
| 84 | MOS_STATUS ReportUserSettingValue(const std::string &valueName, |
| 85 | const MediaUserSetting::Value & value, |
| 86 | const MediaUserSetting::Group & group); |
| 87 | |
| 88 | //! |
| 89 | //! \brief Declare User Settings |
| 90 | //! \return MOS_STATUS |
| 91 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 92 | //! |
| 93 | MOS_STATUS DeclareUserSettingKeyValue(const std::string &valueName, |
| 94 | const MediaUserSetting::Group & group, |
| 95 | const MediaUserSetting::Value & defaultValue, |
| 96 | bool isReportKey); |
| 97 | |
| 98 | //! |
| 99 | //! \brief User Feature Key Report |
| 100 | //! \return MOS_STATUS |
| 101 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 102 | //! |
| 103 | virtual MOS_STATUS UserFeatureReport() override; |
| 104 | |
| 105 | //! |
| 106 | //! \brief Create buffer tracker, the derived class can overload it if |
| 107 | //! requires different buffer count |
| 108 | //! \return MOS_STATUS |
| 109 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 110 | //! |
| 111 | virtual MOS_STATUS CreateBufferTracker() override; |
| 112 | |
| 113 | //! |
| 114 | //! \brief Create status report |
| 115 | //! \return MOS_STATUS |
| 116 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 117 | //! |
| 118 | virtual MOS_STATUS CreateStatusReport() override; |
| 119 | |
| 120 | virtual MOS_STATUS InitUserSetting(MediaUserSettingSharedPtr userSettingPtr) override; |
| 121 | |
| 122 | #if USE_CODECHAL_DEBUG_TOOL |
| 123 | //! \brief Dump the segment parameters |
| 124 | //! |
| 125 | //! \brief [in] segmentParams |
| 126 | //! Pointer to CODEC_VP9_ENCODE_SEGMENT_PARAMS |
| 127 | //! |
| 128 | //! \return MOS_STATUS |
| 129 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 130 | MOS_STATUS DumpSegmentParams( |
| 131 | const CODEC_VP9_ENCODE_SEGMENT_PARAMS *segmentParams); |
| 132 | |
| 133 | //! \brief Dump the sequence parameters |
| 134 | //! |
| 135 | //! \brief [in] seqParams |
| 136 | //! Pointer to CODEC_VP9_ENCODE_SEQUENCE_PARAMS |
| 137 | //! |
| 138 | //! \return MOS_STATUS |
| 139 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 140 | MOS_STATUS DumpSeqParams( |
| 141 | const CODEC_VP9_ENCODE_SEQUENCE_PARAMS *seqParams); |
| 142 | |
| 143 | //! \brief Dump the picture parameters |
| 144 | //! |
| 145 | //! \brief [in] picParams |
| 146 | //! Pointer to CODEC_VP9_ENCODE_PIC_PARAMS |
| 147 | //! |
| 148 | //! \return MOS_STATUS |
| 149 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 150 | MOS_STATUS DumpPicParams( |
| 151 | const CODEC_VP9_ENCODE_PIC_PARAMS *picParams); |
| 152 | #endif |
| 153 | |
| 154 | enum PacketIds |
| 155 | { |
| 156 | HucBrcInit = CONSTRUCTPACKETID(PACKET_COMPONENT_ENCODE, PACKET_SUBCOMPONENT_VP9, 0), |
| 157 | HucBrcUpdate, |
| 158 | Vp9VdencPacket, |
| 159 | Vp9PakIntegrate, |
| 160 | Vp9HucProb, |
| 161 | Vp9HucSuperFrame, |
| 162 | Vp9DynamicScal |
| 163 | }; |
| 164 | |
| 165 | MEDIA_CLASS_DEFINE_END(encode__Vp9Pipeline) |
| 166 | }; |
| 167 | |
| 168 | } |
| 169 | #endif // !__ENCODE_VP9_PIPELINE_H__ |