1 /*
2 * Copyright (c) 2021-2024, 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_xe2_lpm_base.h
24 //! \brief    Defines the interface for jpeg decode pipeline
25 //!
26 #ifndef __DECODE_JPEG_PIPELINE_XE2_LPM_BASE_H__
27 #define __DECODE_JPEG_PIPELINE_XE2_LPM_BASE_H__
28 #include "decode_jpeg_pipeline.h"
29 #include "decode_jpeg_packet_xe2_lpm_base.h"
30 #include "decode_jpeg_downsampling_packet.h"
31 #include "decode_huc_packet_creator.h"
32 
33 namespace decode {
34 
35 class JpegDecodePktXe2_Lpm_Base;
36 class JpegPipelineXe2_Lpm_Base : public JpegPipeline, public HucPacketCreator
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     JpegPipelineXe2_Lpm_Base(
47         CodechalHwInterfaceNext    *hwInterface,
48         CodechalDebugInterface *debugInterface);
49 
~JpegPipelineXe2_Lpm_Base()50     virtual ~JpegPipelineXe2_Lpm_Base(){};
51 
52     virtual MOS_STATUS Init(void *settings) override;
53 
54     //!
55     //! \brief  Prepare interal parameters, should be invoked for each frame
56     //! \param  [in] params
57     //!         Pointer to the input parameters
58     //! \return MOS_STATUS
59     //!         MOS_STATUS_SUCCESS if success, else fail reason
60     //!
61     virtual MOS_STATUS Prepare(void *params) final;
62 
63     //!
64     //! \brief  Finish the execution for each frame
65     //! \return MOS_STATUS
66     //!         MOS_STATUS_SUCCESS if success, else fail reason
67     //!
68     virtual MOS_STATUS Execute() final;
69 
70     virtual MOS_STATUS GetStatusReport(void *status, uint16_t numStatus) override;
71 
72     uint32_t GetCompletedReport();
73 
74     virtual MOS_STATUS Destroy() override;
75 
76 protected:
77     virtual MOS_STATUS Initialize(void *settings) override;
78     virtual MOS_STATUS Uninitialize() override;
79 
80     //!
81     //! \brief  User Feature Key Report
82     //! \return MOS_STATUS
83     //!         MOS_STATUS_SUCCESS if success, else fail reason
84     //!
85     virtual MOS_STATUS UserFeatureReport() override;
86 
87     //!
88     //! \brief  Create sub packets
89     //! \param  [in] codecSettings
90     //!         Point to codechal settings
91     //! \return MOS_STATUS
92     //!         MOS_STATUS_SUCCESS if success, else fail reason
93     //!
94     virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager& subPacketManager, CodechalSetting &codecSettings) override;
95 
96 #ifdef _MMC_SUPPORTED
97     //!
98     //! \brief    Initialize MMC state
99     //!
100     //! \return   MOS_STATUS
101     //!           MOS_STATUS_SUCCESS if success
102     //!
103     virtual MOS_STATUS InitMmcState();
104 #endif
105 
106     //!
107     //! \brief  Initialize media context for decode pipeline
108     //! \return MOS_STATUS
109     //!         MOS_STATUS_SUCCESS if success, else fail reason
110     //!
111     MOS_STATUS InitContext();
112 
113 #if USE_CODECHAL_DEBUG_TOOL
114     //!
115     //! \brief    Dump the parameters
116     //! \param  [in] basicFeature
117     //!         Reference to JpegBasicFeature
118     //! \return   MOS_STATUS
119     //!           MOS_STATUS_SUCCESS if success, else fail reason
120     //!
121     MOS_STATUS DumpParams(JpegBasicFeature &basicFeature);
122 #endif
123 
124 private:
125     JpegDecodePktXe2_Lpm_Base *m_jpegDecodePkt = nullptr;
126 
127 MEDIA_CLASS_DEFINE_END(decode__JpegPipelineXe2_Lpm_Base)
128 };
129 
130 }
131 #endif // !__DECODE_JPEG_PIPELINE_XE2_LPM_BASE_H__
132