1 /* 2 * Copyright (c) 2019-2020, 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 ~Av1Pipeline()54 virtual ~Av1Pipeline() {}; 55 56 Av1DecodeMode GetDecodeMode(); 57 58 bool FrameBasedDecodingInUse(); 59 TileBasedDecodingInuse()60 bool TileBasedDecodingInuse() {return m_forceTileBasedDecoding;} 61 62 DeclareDecodePacketId(av1DecodePacketId); 63 DeclareDecodePacketId(av1PictureSubPacketId); 64 DeclareDecodePacketId(av1TileSubPacketId); 65 66 protected: 67 //! 68 //! \brief Initialize the decode pipeline 69 //! \param [in] settings 70 //! Pointer to the initialize settings 71 //! \return MOS_STATUS 72 //! MOS_STATUS_SUCCESS if success, else fail reason 73 //! 74 virtual MOS_STATUS Initialize(void *settings) override; 75 76 //! 77 //! \brief Uninitialize the decode pipeline 78 //! \return MOS_STATUS 79 //! MOS_STATUS_SUCCESS if success, else fail reason 80 //! 81 virtual MOS_STATUS Uninitialize() override; 82 83 //! 84 //! \brief Prepare interal parameters, should be invoked for each frame 85 //! \param [in] params 86 //! Pointer to the input parameters 87 //! \return MOS_STATUS 88 //! MOS_STATUS_SUCCESS if success, else fail reason 89 //! 90 virtual MOS_STATUS Prepare(void *params) override; 91 92 //! 93 //! \brief User Feature Key Report 94 //! \return MOS_STATUS 95 //! MOS_STATUS_SUCCESS if success, else fail reason 96 //! 97 virtual MOS_STATUS UserFeatureReport() override; 98 99 //! 100 //! \brief Active decode packets 101 //! \return MOS_STATUS 102 //! MOS_STATUS_SUCCESS if success, else fail reason 103 //! 104 virtual MOS_STATUS ActivateDecodePackets(); 105 106 //! 107 //! \brief create media feature manager 108 //! \return MOS_STATUS 109 //! MOS_STATUS_SUCCESS if success, else fail reason 110 //! 111 virtual MOS_STATUS CreateFeatureManager() override; 112 113 //! 114 //! \brief Create sub packets 115 //! \param [in] codecSettings 116 //! Point to codechal settings 117 //! \return MOS_STATUS 118 //! MOS_STATUS_SUCCESS if success, else fail reason 119 //! 120 virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager &subPacketManager, CodechalSetting &codecSettings) override; 121 122 #if USE_CODECHAL_DEBUG_TOOL 123 //! \brief Dump the parameters 124 //! 125 //! \return MOS_STATUS 126 //! MOS_STATUS_SUCCESS if success, else fail reason 127 //! 128 MOS_STATUS DumpParams(Av1BasicFeature &basicFeature); 129 130 //! \brief Dump the picture parameters 131 //! 132 //! \param [in] picParams 133 //! Pointer to CodecAv1PicParams 134 //! 135 //! \return MOS_STATUS 136 //! MOS_STATUS_SUCCESS if success, else fail reason 137 //! 138 MOS_STATUS DumpPicParams(CodecAv1PicParams *picParams); 139 140 //! \brief Dump Tile Group parameters into file 141 //! 142 //! \param [in] tileParams 143 //! Pointer to CodecAv1TileParams 144 //! 145 //! \return MOS_STATUS 146 //! MOS_STATUS_SUCCESS if success, else fail reason 147 //! 148 MOS_STATUS DumpTileParams(CodecAv1TileParams *tileParams, uint32_t tileNum); 149 #endif 150 151 protected: 152 Av1DecodeMode m_decodeMode = baseDecodeMode; //!< Decode mode 153 uint16_t m_passNum = 1; //!< Decode pass number 154 bool m_isFirstTileInFrm = true; //!< First tile in the first frame 155 bool m_forceTileBasedDecoding = false; //!< Force tile based decoding 156 bool m_allowVirtualNodeReassign = false; //!< Whether allow virtual node reassign 157 158 MEDIA_CLASS_DEFINE_END(decode__Av1Pipeline) 159 }; 160 161 } 162 #endif // !__DECODE_AV1_PIPELINE_H__ 163