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_jpeg_pipeline_m12.h
24 //! \brief    Defines the interface for jpeg decode pipeline
25 //!
26 #ifndef __DECODE_JPEG_PIPELINE_M12_H__
27 #define __DECODE_JPEG_PIPELINE_M12_H__
28 #include "decode_jpeg_pipeline.h"
29 #include "decode_jpeg_packet_m12.h"
30 #include "decode_jpeg_downsampling_packet.h"
31 #include "decode_huc_packet_creator_g12.h"
32 
33 namespace decode {
34 
35 class JpegPipelineM12 : public JpegPipeline, public HucPacketCreatorG12
36 {
37 public:
38     //!
39     //! \brief  DecodePipeline constructor
40     //! \param  [in] hwInterface
41     //!         Pointer to CodechalHwInterface
42     //! \param  [in] debugInterface
43     //!         Pointer to CodechalDebugInterface
44     //!
45     JpegPipelineM12(
46         CodechalHwInterface    *hwInterface,
47         CodechalDebugInterface *debugInterface);
48 
~JpegPipelineM12()49     virtual ~JpegPipelineM12() {};
50 
51     virtual MOS_STATUS Init(void *settings) override;
52 
53     //!
54     //! \brief  Prepare interal parameters, should be invoked for each frame
55     //! \param  [in] params
56     //!         Pointer to the input parameters
57     //! \return MOS_STATUS
58     //!         MOS_STATUS_SUCCESS if success, else fail reason
59     //!
60     virtual MOS_STATUS Prepare(void *params) final;
61 
62     //!
63     //! \brief  Finish the execution for each frame
64     //! \return MOS_STATUS
65     //!         MOS_STATUS_SUCCESS if success, else fail reason
66     //!
67     virtual MOS_STATUS Execute() final;
68 
69     virtual MOS_STATUS GetStatusReport(void *status, uint16_t numStatus) override;
70 
71     uint32_t GetCompletedReport();
72 
73     virtual MOS_STATUS Destroy() override;
74 
75     //!
76     //! \brief  Create post sub packets
77     //! \param  [in] subPipelineManager
78     //! \return MOS_STATUS
79     //!         MOS_STATUS_SUCCESS if success, else fail reason
80     //!
81     virtual MOS_STATUS CreatePostSubPipeLines(DecodeSubPipelineManager &subPipelineManager) override;
82     //!
83     //! \brief  Create pre sub packets
84     //! \param  [in] subPipelineManager
85     //! \return MOS_STATUS
86     //!         MOS_STATUS_SUCCESS if success, else fail reason
87     //!
88     virtual MOS_STATUS CreatePreSubPipeLines(DecodeSubPipelineManager &subPipelineManager) override;
89     virtual MOS_STATUS CreateFeatureManager() override;
90 
91 protected:
92     virtual MOS_STATUS Initialize(void *settings) override;
93     virtual MOS_STATUS Uninitialize() override;
94 
95     //!
96     //! \brief  User Feature Key Report
97     //! \return MOS_STATUS
98     //!         MOS_STATUS_SUCCESS if success, else fail reason
99     //!
100     virtual MOS_STATUS UserFeatureReport() override;
101 
102     //!
103     //! \brief  Create sub packets
104     //! \param  [in] codecSettings
105     //!         Point to codechal settings
106     //! \return MOS_STATUS
107     //!         MOS_STATUS_SUCCESS if success, else fail reason
108     //!
109     virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager& subPacketManager, CodechalSetting &codecSettings) override;
110 
111 #ifdef _MMC_SUPPORTED
112     //!
113     //! \brief    Initialize MMC state
114     //!
115     //! \return   MOS_STATUS
116     //!           MOS_STATUS_SUCCESS if success
117     //!
118     virtual MOS_STATUS InitMmcState();
119 #endif
120 
121     //!
122     //! \brief  Initialize media context for decode pipeline
123     //! \return MOS_STATUS
124     //!         MOS_STATUS_SUCCESS if success, else fail reason
125     //!
126     MOS_STATUS InitContext();
127 
128 #if USE_CODECHAL_DEBUG_TOOL
129     //!
130     //! \brief    Dump the parameters
131     //! \param  [in] basicFeature
132     //!         Reference to JpegBasicFeature
133     //! \return   MOS_STATUS
134     //!           MOS_STATUS_SUCCESS if success, else fail reason
135     //!
136     MOS_STATUS DumpParams(JpegBasicFeature &basicFeature);
137 #endif
138 
139 private:
140     JpegDecodePktM12 *m_jpegDecodePkt = nullptr;
141     CodechalHwInterface *m_hwInterface   = nullptr;
142 MEDIA_CLASS_DEFINE_END(decode__JpegPipelineM12)
143 };
144 
145 }
146 #endif // !__DECODE_JPEG_PIPELINE_M12_H__
147