1 /*
2 * Copyright (c) 2018-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_hevc_pipeline_m12.h
24 //! \brief    Defines the interface for hevc decode pipeline
25 //!
26 #ifndef __DECODE_HEVC_PIPELINE_M12_H__
27 #define __DECODE_HEVC_PIPELINE_M12_H__
28 
29 #include "decode_hevc_pipeline.h"
30 #include "codec_def_decode_hevc.h"
31 #include "decode_hevc_packet_long_m12.h"
32 #include "decode_huc_packet_creator_g12.h"
33 
34 namespace decode {
35 
36 class HevcPipelineM12 : public HevcPipeline, public HucPacketCreatorG12
37 {
38 public:
39     //!
40     //! \brief  DecodePipeline constructor
41     //! \param  [in] hwInterface
42     //!         Pointer to CodechalHwInterface
43     //! \param  [in] debugInterface
44     //!         Pointer to CodechalDebugInterface
45     //!
46     HevcPipelineM12(CodechalHwInterface *hwInterface, CodechalDebugInterface *debugInterface);
47 
~HevcPipelineM12()48     virtual ~HevcPipelineM12() {};
49 
50     virtual MOS_STATUS Init(void *settings) override;
51 
52     //!
53     //! \brief  Prepare interal parameters, should be invoked for each frame
54     //! \param  [in] params
55     //!         Pointer to the input parameters
56     //! \return MOS_STATUS
57     //!         MOS_STATUS_SUCCESS if success, else fail reason
58     //!
59     virtual MOS_STATUS Prepare(void *params) final;
60 
61     //!
62     //! \brief  Finish the execution for each frame
63     //! \return MOS_STATUS
64     //!         MOS_STATUS_SUCCESS if success, else fail reason
65     //!
66     virtual MOS_STATUS Execute() final;
67 
68     virtual MOS_STATUS GetStatusReport(void *status, uint16_t numStatus) override;
69 
70     virtual MOS_STATUS Destroy() override;
71 
72     virtual MOS_STATUS CreateFeatureManager() override;
73 
74     uint32_t GetCompletedReport();
75 
76     //!
77     //! \brief  Create post sub packets
78     //! \param  [in] subPipelineManager
79     //! \return MOS_STATUS
80     //!         MOS_STATUS_SUCCESS if success, else fail reason
81     //!
82     virtual MOS_STATUS CreatePostSubPipeLines(DecodeSubPipelineManager &subPipelineManager) override;
83 
84     //!
85     //! \brief  Create pre sub packets
86     //! \param  [in] subPipelineManager
87     //! \return MOS_STATUS
88     //!         MOS_STATUS_SUCCESS if success, else fail reason
89     //!
90     virtual MOS_STATUS CreatePreSubPipeLines(DecodeSubPipelineManager &subPipelineManager) override;
91 
92 protected:
93     virtual MOS_STATUS Initialize(void *settings) override;
94     virtual MOS_STATUS Uninitialize() override;
95 
96     //!
97     //! \brief  User Feature Key Report
98     //! \return MOS_STATUS
99     //!         MOS_STATUS_SUCCESS if success, else fail reason
100     //!
101     virtual MOS_STATUS UserFeatureReport() override;
102 
103     //!
104     //! \brief  Create sub packets
105     //! \param  [in] codecSettings
106     //!         Point to codechal settings
107     //! \return MOS_STATUS
108     //!         MOS_STATUS_SUCCESS if success, else fail reason
109     //!
110     virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager& subPacketManager, CodechalSetting &codecSettings) override;
111 
112     //!
113     //! \brief  Initialize scalability option
114     //! \param  [in] basicFeature
115     //!         Hevc decode basic feature
116     //! \return MOS_STATUS
117     //!         MOS_STATUS_SUCCESS if success, else fail reason
118     //!
119     MOS_STATUS InitScalabOption(HevcBasicFeature &basicFeature);
120 
121     //!
122     //! \brief  Allocate resource for Hevc decode
123     //! \return MOS_STATUS
124     //!         MOS_STATUS_SUCCESS if success, else fail reason
125     //!
126     MOS_STATUS AllocateResources(HevcBasicFeature &basicFeature);
127 
128     virtual MOS_STATUS InitContexOption(HevcScalabilityPars &scalPars) override;
129 
130 #if (_DEBUG || _RELEASE_INTERNAL)
131     //!
132     //! \brief  Earlier stop for hw error status
133     //! \param  [in] status
134     //!         Status report from HW
135     //! \return MOS_STATUS
136     //!         MOS_STATUS_SUCCESS if success, else fail reason
137     //!
138     virtual MOS_STATUS HwStatusCheck(const DecodeStatusMfx &status) override;
139 #endif
140 
141 #ifdef _MMC_SUPPORTED
142     //!
143     //! \brief    Initialize MMC state
144     //!
145     //! \return   MOS_STATUS
146     //!           MOS_STATUS_SUCCESS if success
147     //!
148     virtual MOS_STATUS InitMmcState();
149 #endif
150 
151 #if USE_CODECHAL_DEBUG_TOOL
152     //!
153     //! \brief    Dump the parameters
154     //! \param  [in] basicFeature
155     //!         Reference to HevcBasicFeature
156     //! \return   MOS_STATUS
157     //!           MOS_STATUS_SUCCESS if success, else fail reason
158     //!
159     MOS_STATUS DumpParams(HevcBasicFeature &basicFeature);
160 
161     //! \brief    Dump the second level batch buffer
162     //!
163     //! \return   MOS_STATUS
164     //!           MOS_STATUS_SUCCESS if success, else fail reason
165     //!
166     virtual MOS_STATUS DumpSecondLevelBatchBuffer() override;
167 #endif
168 
169 private:
170     HevcDecodeLongPktM12 *m_hevcDecodePktLong = nullptr;
171     CodechalHwInterface  *m_hwInterface       = nullptr;
172     MEDIA_CLASS_DEFINE_END(decode__HevcPipelineM12)
173 };
174 
175 }
176 #endif // !__DECODE_HEVC_PIPELINE_M12_H__
177