| 1 | /* |
| 2 | * Copyright (c) 2019-2025, 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 decode_av1_pipeline.h |
| 24 | //! \brief Defines the interface for av1 decode pipeline |
| 25 | //! |
| 26 | #ifndef __DECODE_AV1_PIPELINE_H__ |
| 27 | #define __DECODE_AV1_PIPELINE_H__ |
| 28 | |
| 29 | #include "decode_pipeline.h" |
| 30 | #include "decode_av1_basic_feature.h" |
| 31 | |
| 32 | namespace decode { |
| 33 | |
| 34 | class Av1Pipeline : public DecodePipeline |
| 35 | { |
| 36 | public: |
| 37 | enum Av1DecodeMode |
| 38 | { |
| 39 | baseDecodeMode, //!< Legacy decode mode with single pipe |
| 40 | realTileDecodeMode, //!< Real tile decode mode |
| 41 | }; |
| 42 | |
| 43 | //! |
| 44 | //! \brief Av1Pipeline constructor |
| 45 | //! \param [in] hwInterface |
| 46 | //! Pointer to CodechalHwInterface |
| 47 | //! \param [in] debugInterface |
| 48 | //! Pointer to CodechalDebugInterface |
| 49 | //! |
| 50 | Av1Pipeline( |
| 51 | CodechalHwInterfaceNext* hwInterface, |
| 52 | CodechalDebugInterface *debugInterface); |
| 53 | |
| 54 | virtual ~Av1Pipeline() {}; |
| 55 | |
| 56 | Av1DecodeMode GetDecodeMode(); |
| 57 | |
| 58 | bool FrameBasedDecodingInUse(); |
| 59 | |
| 60 | bool TileBasedDecodingInuse() {return m_forceTileBasedDecoding;} |
| 61 | |
| 62 | DeclareDecodePacketId(av1DecodePacketId); |
| 63 | DeclareDecodePacketId(av1PictureSubPacketId); |
| 64 | DeclareDecodePacketId(av1TileSubPacketId); |
| 65 | DeclareDecodePacketId(av1DecodeAqmId); |
| 66 | DeclareDecodePacketId(av1DebugSubPacketId); |
| 67 | //! |
| 68 | //! \brief Declare Regkeys in the scope of av1 decode |
| 69 | //! \return MOS_STATUS |
| 70 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 71 | virtual MOS_STATUS InitUserSetting(MediaUserSettingSharedPtr userSettingPtr) override; |
| 72 | |
| 73 | protected: |
| 74 | //! |
| 75 | //! \brief Initialize the decode pipeline |
| 76 | //! \param [in] settings |
| 77 | //! Pointer to the initialize settings |
| 78 | //! \return MOS_STATUS |
| 79 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 80 | //! |
| 81 | virtual MOS_STATUS Initialize(void *settings) override; |
| 82 | |
| 83 | //! |
| 84 | //! \brief Uninitialize the decode pipeline |
| 85 | //! \return MOS_STATUS |
| 86 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 87 | //! |
| 88 | virtual MOS_STATUS Uninitialize() override; |
| 89 | |
| 90 | //! |
| 91 | //! \brief Prepare interal parameters, should be invoked for each frame |
| 92 | //! \param [in] params |
| 93 | //! Pointer to the input parameters |
| 94 | //! \return MOS_STATUS |
| 95 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 96 | //! |
| 97 | virtual MOS_STATUS Prepare(void *params) override; |
| 98 | |
| 99 | //! |
| 100 | //! \brief User Feature Key Report |
| 101 | //! \return MOS_STATUS |
| 102 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 103 | //! |
| 104 | virtual MOS_STATUS UserFeatureReport() override; |
| 105 | |
| 106 | //! |
| 107 | //! \brief Active decode packets |
| 108 | //! \return MOS_STATUS |
| 109 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 110 | //! |
| 111 | virtual MOS_STATUS ActivateDecodePackets(); |
| 112 | |
| 113 | //! |
| 114 | //! \brief create media feature manager |
| 115 | //! \return MOS_STATUS |
| 116 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 117 | //! |
| 118 | virtual MOS_STATUS CreateFeatureManager() override; |
| 119 | |
| 120 | //! |
| 121 | //! \brief Create sub packets |
| 122 | //! \param [in] codecSettings |
| 123 | //! Point to codechal settings |
| 124 | //! \return MOS_STATUS |
| 125 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 126 | //! |
| 127 | virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager &subPacketManager, CodechalSetting &codecSettings) override; |
| 128 | |
| 129 | #if USE_CODECHAL_DEBUG_TOOL |
| 130 | //! \brief Dump the parameters |
| 131 | //! |
| 132 | //! \return MOS_STATUS |
| 133 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 134 | //! |
| 135 | MOS_STATUS DumpParams(Av1BasicFeature &basicFeature); |
| 136 | |
| 137 | //! \brief Dump the picture parameters |
| 138 | //! |
| 139 | //! \param [in] picParams |
| 140 | //! Pointer to CodecAv1PicParams |
| 141 | //! |
| 142 | //! \return MOS_STATUS |
| 143 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 144 | //! |
| 145 | MOS_STATUS DumpPicParams(CodecAv1PicParams *picParams); |
| 146 | |
| 147 | //! \brief Dump Tile Group parameters into file |
| 148 | //! |
| 149 | //! \param [in] tileParams |
| 150 | //! Pointer to CodecAv1TileParams |
| 151 | //! |
| 152 | //! \return MOS_STATUS |
| 153 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 154 | //! |
| 155 | MOS_STATUS DumpTileParams(CodecAv1TileParams *tileParams, uint32_t tileNum); |
| 156 | #endif |
| 157 | |
| 158 | protected: |
| 159 | Av1DecodeMode m_decodeMode = baseDecodeMode; //!< Decode mode |
| 160 | uint16_t m_passNum = 1; //!< Decode pass number |
| 161 | bool m_isFirstTileInFrm = true; //!< First tile in the first frame |
| 162 | bool m_forceTileBasedDecoding = false; //!< Force tile based decoding |
| 163 | bool m_allowVirtualNodeReassign = false; //!< Whether allow virtual node reassign |
| 164 | |
| 165 | MEDIA_CLASS_DEFINE_END(decode__Av1Pipeline) |
| 166 | }; |
| 167 | |
| 168 | } |
| 169 | #endif // !__DECODE_AV1_PIPELINE_H__ |