1 /*
2 * Copyright (c) 2021, 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_m12.h
24 //! \brief    Defines the interface for mpeg2 decode pipeline
25 //!
26 #ifndef __DECODE_MPEG2_PIPELINE_M12_H__
27 #define __DECODE_MPEG2_PIPELINE_M12_H__
28 #include "decode_mpeg2_pipeline.h"
29 #include "decode_mpeg2_packet_m12.h"
30 #include "decode_huc_packet_creator_g12.h"
31 
32 namespace decode {
33 
34 class Mpeg2PipelineM12 : public Mpeg2Pipeline, public HucPacketCreatorG12
35 {
36 public:
37     //!
38     //! \brief  DecodePipeline constructor
39     //! \param  [in] hwInterface
40     //!         Pointer to CodechalHwInterface
41     //! \param  [in] debugInterface
42     //!         Pointer to CodechalDebugInterface
43     //!
44     Mpeg2PipelineM12(
45         CodechalHwInterface    *hwInterface,
46         CodechalDebugInterface *debugInterface);
47 
~Mpeg2PipelineM12()48     virtual ~Mpeg2PipelineM12() {};
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     uint32_t GetCompletedReport();
71 
72     virtual MOS_STATUS Destroy() override;
73 
74     //!
75     //! \brief  Create post sub packets
76     //! \param  [in] subPipelineManager
77     //! \return MOS_STATUS
78     //!         MOS_STATUS_SUCCESS if success, else fail reason
79     //!
80     virtual MOS_STATUS CreatePostSubPipeLines(DecodeSubPipelineManager &subPipelineManager) override;
81     //!
82     //! \brief  Create pre sub packets
83     //! \param  [in] subPipelineManager
84     //! \return MOS_STATUS
85     //!         MOS_STATUS_SUCCESS if success, else fail reason
86     //!
87     virtual MOS_STATUS CreatePreSubPipeLines(DecodeSubPipelineManager &subPipelineManager) override;
88     virtual MOS_STATUS CreateFeatureManager() override;
89 
90 protected:
91     virtual MOS_STATUS Initialize(void *settings) override;
92     virtual MOS_STATUS Uninitialize() override;
93 
94     //!
95     //! \brief  User Feature Key Report
96     //! \return MOS_STATUS
97     //!         MOS_STATUS_SUCCESS if success, else fail reason
98     //!
99     virtual MOS_STATUS UserFeatureReport() override;
100 
101     //!
102     //! \brief  Create sub packets
103     //! \param  [in] codecSettings
104     //!         Point to codechal settings
105     //! \return MOS_STATUS
106     //!         MOS_STATUS_SUCCESS if success, else fail reason
107     //!
108     virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager& subPacketManager, CodechalSetting &codecSettings) override;
109 
110 #ifdef _MMC_SUPPORTED
111     //!
112     //! \brief    Initialize MMC state
113     //!
114     //! \return   MOS_STATUS
115     //!           MOS_STATUS_SUCCESS if success
116     //!
117     virtual MOS_STATUS InitMmcState();
118 #endif
119 
120     //!
121     //! \brief  Initialize media context for decode pipeline
122     //! \return MOS_STATUS
123     //!         MOS_STATUS_SUCCESS if success, else fail reason
124     //!
125     MOS_STATUS InitContext();
126 
127 #if USE_CODECHAL_DEBUG_TOOL
128     //!
129     //! \brief    Dump the parameters
130     //! \param  [in] basicFeature
131     //!         Reference to Mpeg2BasicFeature
132     //! \return   MOS_STATUS
133     //!           MOS_STATUS_SUCCESS if success, else fail reason
134     //!
135     MOS_STATUS DumpParams(Mpeg2BasicFeature &basicFeature);
136 #endif
137 
138 private:
139     Mpeg2DecodePktM12 *m_mpeg2DecodePkt = nullptr;
140     CodechalHwInterface *m_hwInterface    = nullptr;
141 MEDIA_CLASS_DEFINE_END(decode__Mpeg2PipelineM12)
142 };
143 
144 }
145 #endif // !__DECODE_MPEG2_PIPELINE_M12_H__
146