| 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 | //! \file decode_mpeg2_pipeline.h |
| 24 | //! \brief Defines the interface for mpeg2 decode pipeline |
| 25 | //! |
| 26 | #ifndef __DECODE_MPEG2_PIPELINE_H__ |
| 27 | #define __DECODE_MPEG2_PIPELINE_H__ |
| 28 | |
| 29 | #include "decode_pipeline.h" |
| 30 | #include "decode_mpeg2_basic_feature.h" |
| 31 | |
| 32 | namespace decode { |
| 33 | |
| 34 | class Mpeg2Pipeline : public DecodePipeline |
| 35 | { |
| 36 | public: |
| 37 | |
| 38 | //! |
| 39 | //! \brief Mpeg2Pipeline constructor |
| 40 | //! \param [in] hwInterface |
| 41 | //! Pointer to CodechalHwInterface |
| 42 | //! \param [in] debugInterface |
| 43 | //! Pointer to CodechalDebugInterface |
| 44 | //! |
| 45 | Mpeg2Pipeline( |
| 46 | CodechalHwInterfaceNext *hwInterface, |
| 47 | CodechalDebugInterface* debugInterface); |
| 48 | |
| 49 | virtual ~Mpeg2Pipeline() {}; |
| 50 | //! |
| 51 | //! \brief Declare Regkeys in the scope of mpeg2 decode |
| 52 | //! \return MOS_STATUS |
| 53 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 54 | virtual MOS_STATUS InitUserSetting(MediaUserSettingSharedPtr userSettingPtr) override; |
| 55 | DeclareDecodePacketId(mpeg2DecodePacketId); |
| 56 | DeclareDecodePacketId(mpeg2PictureSubPacketId); |
| 57 | DeclareDecodePacketId(mpeg2SliceSubPacketId); |
| 58 | DeclareDecodePacketId(mpeg2MbSubPacketId); |
| 59 | DeclareDecodePacketId(mpeg2BsCopyPktId); |
| 60 | |
| 61 | protected: |
| 62 | //! |
| 63 | //! \brief Initialize the decode pipeline |
| 64 | //! \param [in] settings |
| 65 | //! Pointer to the initialize settings |
| 66 | //! \return MOS_STATUS |
| 67 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 68 | //! |
| 69 | virtual MOS_STATUS Initialize(void *settings) override; |
| 70 | |
| 71 | //! |
| 72 | //! \brief Prepare interal parameters, should be invoked for each frame |
| 73 | //! \param [in] params |
| 74 | //! Pointer to the input parameters |
| 75 | //! \return MOS_STATUS |
| 76 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 77 | //! |
| 78 | virtual MOS_STATUS Prepare(void *params) override; |
| 79 | |
| 80 | //! |
| 81 | //! \brief Uninitialize the decode pipeline |
| 82 | //! \return MOS_STATUS |
| 83 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 84 | //! |
| 85 | virtual MOS_STATUS Uninitialize() override; |
| 86 | |
| 87 | //! |
| 88 | //! \brief User Feature Key Report |
| 89 | //! \return MOS_STATUS |
| 90 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 91 | //! |
| 92 | virtual MOS_STATUS UserFeatureReport() override; |
| 93 | |
| 94 | //! |
| 95 | //! \brief Active decode packets |
| 96 | //! \return MOS_STATUS |
| 97 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 98 | //! |
| 99 | virtual MOS_STATUS ActivateDecodePackets(); |
| 100 | |
| 101 | //! |
| 102 | //! \brief create media feature manager |
| 103 | //! \return MOS_STATUS |
| 104 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 105 | //! |
| 106 | virtual MOS_STATUS CreateFeatureManager() override; |
| 107 | |
| 108 | //! |
| 109 | //! \brief Create sub packets |
| 110 | //! \param [in] codecSettings |
| 111 | //! Point to codechal settings |
| 112 | //! \return MOS_STATUS |
| 113 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 114 | //! |
| 115 | virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager& subPacketManager, CodechalSetting &codecSettings) override; |
| 116 | |
| 117 | //! |
| 118 | //! \brief Copy bitstream to local buffer |
| 119 | //! \details Copy bitstream to local buffer in MPEG2 decode driver |
| 120 | //! |
| 121 | //! \return MOS_STATUS |
| 122 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 123 | //! |
| 124 | MOS_STATUS CopyBitstreamBuffer(); |
| 125 | |
| 126 | //! |
| 127 | //! \brief Copy dummy slice to local buffer |
| 128 | //! \details Copy bitstream to local buffer in MPEG2 decode driver |
| 129 | //! |
| 130 | //! \return MOS_STATUS |
| 131 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 132 | //! |
| 133 | MOS_STATUS CopyDummyBitstream(); |
| 134 | |
| 135 | #if USE_CODECHAL_DEBUG_TOOL |
| 136 | MOS_STATUS DumpPicParams( |
| 137 | CodecDecodeMpeg2PicParams *picParams); |
| 138 | |
| 139 | MOS_STATUS DumpSliceParams( |
| 140 | CodecDecodeMpeg2SliceParams *sliceParams, |
| 141 | uint32_t numSlices); |
| 142 | |
| 143 | MOS_STATUS DumpMbParams( |
| 144 | CodecDecodeMpeg2MbParams *mbParams, |
| 145 | uint32_t numMbs); |
| 146 | |
| 147 | MOS_STATUS DumpIQParams( |
| 148 | CodecMpeg2IqMatrix *matrixData); |
| 149 | #endif |
| 150 | |
| 151 | protected: |
| 152 | |
| 153 | Mpeg2BasicFeature *m_basicFeature = nullptr; //!< Mpeg2 Basic Feature |
| 154 | HucCopyPktItf *m_mpeg2BsCopyPkt = nullptr; //!< Mpeg2 bitstream with HuC Copy |
| 155 | |
| 156 | MEDIA_CLASS_DEFINE_END(decode__Mpeg2Pipeline) |
| 157 | }; |
| 158 | |
| 159 | } |
| 160 | #endif // !__DECODE_MPEG2_PIPELINE_H__ |