Debian Codegraph @

media_softlet/agnostic/common/codec/hal/dec/shared/features/decode_basic_feature.h

raw
1 /*
2 * Copyright (c) 2019, 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_basic_feature.h
24 //! \brief Defines the common interface for decode badic feature
25 //! \details The decode basic feature interface is further sub-divided by codec standard,
26 //! this file is for the base interface which is shared by all codecs.
27 //!
28 #ifndef __DECODE_BASIC_FEATURE_H__
29 #define __DECODE_BASIC_FEATURE_H__
30
31 #include "codec_def_decode.h"
32 #include "decode_allocator.h"
33 #include "media_feature.h"
34 #include "codec_hw_next.h"
35 #include "codechal_setting.h"
36
37 namespace decode {
38
39 class DecodeBasicFeature: public MediaFeature
40 {
41 public:
42 DecodeBasicFeature(DecodeAllocator *allocator, void *hwInterface, PMOS_INTERFACE osInterface);
43 virtual ~DecodeBasicFeature();
44
45 //!
46 //! \brief Init decode basic parameter
47 //! \param [in] setting
48 //! Pointer to CodechalSetting
49 //! \return MOS_STATUS
50 //! MOS_STATUS_SUCCESS if success, else fail reason
51 //!
52 virtual MOS_STATUS Init(void *setting);
53
54 //!
55 //! \brief Update decode basic feature
56 //! \param [in] params
57 //! Pointer to DecoderParams
58 //! \return MOS_STATUS
59 //! MOS_STATUS_SUCCESS if success, else fail reason
60 //!
61 virtual MOS_STATUS Update(void *params);
62
63 //!
64 //! \brief Update decode dest surface
65 //! \param [in] destSurface
66 //! Decode render target from DDI
67 //! \return MOS_STATUS
68 //! MOS_STATUS_SUCCESS if success, else fail reason
69 //!
70 MOS_STATUS UpdateDestSurface(MOS_SURFACE &destSurface);
71
72 //!
73 //! \brief Set MMC state
74 //! \param [in] isMmcEnabled
75 //! Flag to indicate if the MMC is enabled
76 //! \return MOS_STATUS
77 //! MOS_STATUS_SUCCESS if success, else fail reason
78 //!
79 MOS_STATUS SetMmcState(bool isMmcEnabled)
80 {
81 m_isMmcEnabled = isMmcEnabled;
82 return MOS_STATUS_SUCCESS;
83 }
84
85 //!
86 //! \brief Get MMC state
87 //! \return bool
88 //! Return true if MMC enabled
89 //!
90 bool IsMmcEnabled()
91 {
92 return m_isMmcEnabled;
93 }
94
95 uint32_t m_width = 0; //!< Frame width in luma samples
96 uint32_t m_height = 0; //!< Frame height in luma samples
97 uint16_t m_picWidthInMb = 0; //!< Picture Width in MB width count
98 uint16_t m_picHeightInMb = 0; //!< Picture Height in MB height count
99
100 uint32_t m_frameNum = 0; //!< Frame number, inc by each codec pipeline
101 bool m_secondField = false; //!< Indicates if current field is second field(bottom field)
102 uint16_t m_pictureCodingType = 0; //!< I, P, B or mixed frame
103
104 CODEC_PICTURE m_curRenderPic = {0}; //!< picture information of current render target
105
106 CODECHAL_STANDARD m_standard = CODECHAL_UNDEFINED; //!< Decode standard
107 CODECHAL_MODE m_mode = CODECHAL_UNSUPPORTED_MODE; //!< Decode mode
108 CODECHAL_FUNCTION m_codecFunction = CODECHAL_FUNCTION_INVALID; //!< Decode function
109
110 HCP_CHROMA_FORMAT_IDC m_chromaFormat = HCP_CHROMA_FORMAT_YUV420; //!< Chroma format(420, 422 etc)
111 uint8_t m_bitDepth = 8; //!< Bit depth
112 bool m_is10Bit = false;
113
114 uint32_t m_numSlices = 0; //!< [VLD mode] Number of slices to be decoded
115
116 MOS_SURFACE m_destSurface; //!< Decode render target
117
118 MOS_BUFFER m_resDataBuffer; //!< Decode input bitstream
119 uint32_t m_dataOffset = 0;
120 uint32_t m_dataSize = 0; //!< Size of the bitstream required on this picture
121 PMOS_SURFACE m_refFrameSurface = nullptr; //!< Handle of reference frame surface
122 uint32_t m_refSurfaceNum = 0; //!< Number of reference frame surface
123
124 bool m_reportFrameCrc = false; //!< Flag to indicate if report frame CRC
125
126 bool m_disableDecodeSyncLock = false; //!< Indicates if decode sync lock is disabled
127
128 bool m_setMarkerEnabled = false; //!< [SetMarker] Indicates whether or not SetMarker is enabled
129 PMOS_RESOURCE m_presSetMarker = nullptr; //!< [SetMarker] Resource for SetMarker
130
131 bool m_useDummyReference = false; //!< Indicates if use dummy reference
132 MOS_SURFACE m_dummyReference; //!< Dummy reference surface
133 CODECHAL_DUMMY_REFERENCE_STATUS m_dummyReferenceStatus = CODECHAL_DUMMY_REFERENCE_INVALID; //!< Indicate the status of dummy reference
134 constexpr static uint8_t m_invalidFrameIndex = 0xff; //!< Invalid frame index
135 constexpr static uint8_t m_maxFrameIndex = CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC; //!< Max frame index
136
137 protected:
138 //!
139 //! \brief Set required bitstream size by each codec
140 //! \param [in] requiredSize
141 //! required size for current frame
142 //! \return MOS_STATUS
143 //! MOS_STATUS_SUCCESS if success, else fail reason
144 //!
145 virtual MOS_STATUS SetRequiredBitstreamSize(uint32_t requiredSize) = 0;
146
147 void * m_hwInterface = nullptr;
148 DecodeAllocator * m_allocator = nullptr;
149 PMOS_INTERFACE m_osInterface = nullptr;
150
151 bool m_isMmcEnabled = false; //!< Indicate MMC enabled for current picture
152
153 MEDIA_CLASS_DEFINE_END(decode__DecodeBasicFeature)
154 };
155
156 }//decode
157
158 #endif // !__DECODE_BASIC_FEATURE_H__