Debian Codegraph @

media_softlet/agnostic/common/codec/hal/dec/avc/pipeline/decode_avc_pipeline.h

raw
1 /*
2 * Copyright (c) 2018-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_avc_pipeline.h
24 //! \brief Defines the interface for avc decode pipeline
25 //!
26 #ifndef __DECODE_AVC_PIPELINE_H__
27 #define __DECODE_AVC_PIPELINE_H__
28
29 #include "decode_pipeline.h"
30 #include "decode_avc_basic_feature.h"
31
32 #if (_DEBUG || _RELEASE_INTERNAL)
33 #include "decode_avc_debug_packet.h"
34 #endif
35
36 namespace decode {
37
38 class AvcPipeline : public DecodePipeline
39 {
40 public:
41 enum AvcDecodeMode
42 {
43 baseDecodeMode, //!< Legacy decode mode with single pipe
44 };
45
46 //!
47 //! \brief AvcPipeline constructor
48 //! \param [in] hwInterface
49 //! Pointer to CodechalHwInterface
50 //! \param [in] debugInterface
51 //! Pointer to CodechalDebugInterface
52 //!
53 AvcPipeline(
54 CodechalHwInterfaceNext *hwInterface,
55 CodechalDebugInterface* debugInterface);
56
57 //!
58 //! \brief Return if short format decode in use
59 //! \return bool
60 //! True if short format in use, else false
61 //!
62 bool IsShortFormat();
63
64 bool m_intelEntrypointInUse = false; //!< Indicate it is Intel-specific Format
65
66 virtual ~AvcPipeline() {};
67
68 AvcDecodeMode GetDecodeMode();
69 //!
70 //! \brief Declare Regkeys in the scope of avc decode
71 //! \return MOS_STATUS
72 //! MOS_STATUS_SUCCESS if success, else fail reason
73 virtual MOS_STATUS InitUserSetting(MediaUserSettingSharedPtr userSettingPtr) override;
74
75 //!
76 //! \brief Set decode short/long format during runtime.
77 //! \return MOS_STATUS
78 //! MOS_STATUS_SUCCESS if success, else fail reason
79 //!
80 virtual MOS_STATUS SetDecodeFormat(bool isShortFormat) override;
81
82 DeclareDecodePacketId(avcDecodePacketId);
83 DeclareDecodePacketId(avcPictureSubPacketId);
84 DeclareDecodePacketId(avcSliceSubPacketId);
85 DeclareDecodePacketId(avcFormatMonoPicPktId);
86 DeclareDecodePacketId(avcDecodeAqmId);
87 #if (_DEBUG || _RELEASE_INTERNAL)
88 DeclareDecodePacketId(avcDebugSubPacketId);
89 #endif
90
91 protected:
92 //!
93 //! \brief Initialize the decode pipeline
94 //! \param [in] settings
95 //! Pointer to the initialize settings
96 //! \return MOS_STATUS
97 //! MOS_STATUS_SUCCESS if success, else fail reason
98 //!
99 virtual MOS_STATUS Initialize(void *settings) override;
100
101 //!
102 //! \brief Prepare interal parameters, should be invoked for each frame
103 //! \param [in] params
104 //! Pointer to the input parameters
105 //! \return MOS_STATUS
106 //! MOS_STATUS_SUCCESS if success, else fail reason
107 //!
108 virtual MOS_STATUS Prepare(void *params) override;
109
110 //!
111 //! \brief Uninitialize the decode pipeline
112 //! \return MOS_STATUS
113 //! MOS_STATUS_SUCCESS if success, else fail reason
114 //!
115 virtual MOS_STATUS Uninitialize() override;
116
117 //!
118 //! \brief User Feature Key Report
119 //! \return MOS_STATUS
120 //! MOS_STATUS_SUCCESS if success, else fail reason
121 //!
122 virtual MOS_STATUS UserFeatureReport() override;
123
124 //!
125 //! \brief Active decode packets
126 //! \return MOS_STATUS
127 //! MOS_STATUS_SUCCESS if success, else fail reason
128 //!
129 virtual MOS_STATUS ActivateDecodePackets();
130
131 //!
132 //! \brief create media feature manager
133 //! \return MOS_STATUS
134 //! MOS_STATUS_SUCCESS if success, else fail reason
135 //!
136 virtual MOS_STATUS CreateFeatureManager() override;
137
138 //!
139 //! \brief Create sub packets
140 //! \param [in] codecSettings
141 //! Point to codechal settings
142 //! \return MOS_STATUS
143 //! MOS_STATUS_SUCCESS if success, else fail reason
144 //!
145 virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager& subPacketManager, CodechalSetting &codecSettings) override;
146
147 //!
148 //! \brief Copy decode dest surface to downsampling input surface if
149 //! a explicit copy needed for non downsampling platforms
150 //! \return MOS_STATUS
151 //! MOS_STATUS_SUCCESS if success, else fail reason
152 //!
153 MOS_STATUS HandleRefOnlySurfaces();
154
155 #if USE_CODECHAL_DEBUG_TOOL
156 MOS_STATUS DumpPicParams(
157 PCODEC_AVC_PIC_PARAMS picParams);
158
159 MOS_STATUS DumpSliceParams(
160 PCODEC_AVC_SLICE_PARAMS sliceParams,
161 uint32_t numSlices,
162 bool shortFormatInUse);
163
164 MOS_STATUS DumpIQParams(
165 PCODEC_AVC_IQ_MATRIX_PARAMS iqParams);
166 #endif
167
168 protected:
169
170 bool m_shortFormatInUse = false; //!< Indicate it is Short Format
171 AvcDecodeMode m_decodeMode = baseDecodeMode; //!< Decode mode
172 HucCopyPktItf *m_formatMonoPicPkt = nullptr; //!< Format Avc Mono Chroma with HuC Copy
173 AvcBasicFeature *m_basicFeature = nullptr; //!< Avc Basic Feature
174 bool m_allowVirtualNodeReassign = false; //!< Whether allow virtual node reassign
175 MEDIA_CLASS_DEFINE_END(decode__AvcPipeline)
176 };
177
178 }
179 #endif // !__DECODE_AVC_PIPELINE_H__