Debian Codegraph @

media_softlet/agnostic/common/codec/hal/enc/hevc/features/encode_hevc_cqp.h

raw
1 /*
2 * Copyright (c) 2018, 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 encode_hevc_cqp.h
24 //! \brief Defines the common interface for hevc encode cqp features
25 //!
26 #ifndef __ENCODE_HEVC_CQP_H__
27 #define __ENCODE_HEVC_CQP_H__
28
29 #include "media_feature.h"
30 #include "encode_allocator.h"
31 #include "codec_hw_next.h"
32 #include "encode_basic_feature.h"
33
34 namespace encode
35 {
36 class HevcEncodeCqp : public MediaFeature, public mhw::vdbox::hcp::Itf::ParSetting
37 {
38 public:
39 HevcEncodeCqp(MediaFeatureManager *featureManager, EncodeAllocator *allocator, CodechalHwInterfaceNext *hwInterface, void *constSettings);
40
41 ~HevcEncodeCqp() {}
42
43 //!
44 //! \brief Init cqp basic features related parameter
45 //! \param [in] settings
46 //! Pointer to settings
47 //! \return MOS_STATUS
48 //! MOS_STATUS_SUCCESS if success, else fail reason
49 //!
50 MOS_STATUS Init(void *settings) override;
51
52 //!
53 //! \brief Update cqp basic features related parameter
54 //! \param [in] params
55 //! Pointer to parameters
56 //! \return MOS_STATUS
57 //! MOS_STATUS_SUCCESS if success, else fail reason
58 //!
59 MOS_STATUS Update(void *params) override;
60
61 //!
62 //! \brief Check if RDOQ enabled
63 //!
64 //! \return bool
65 //! true if rdoq enabled, else rdoq disabled.
66 //!
67 bool IsRDOQEnabled() { return m_rdoqEnable; }
68
69 void SetRDOQ(bool rdoqEnabled) { m_rdoqEnable = rdoqEnabled; }
70
71 MHW_SETPAR_DECL_HDR(HCP_PIC_STATE);
72
73 MHW_SETPAR_DECL_HDR(HCP_PIPE_MODE_SELECT);
74
75 MHW_SETPAR_DECL_HDR(HCP_PIPE_BUF_ADDR_STATE);
76
77 MHW_SETPAR_DECL_HDR(HCP_SLICE_STATE);
78
79 protected:
80
81 //! \brief Allocate feature related resources
82 //! \return MOS_STATUS
83 //! MOS_STATUS_SUCCESS if success, else fail reason
84 //!
85 MOS_STATUS AllocateResources() override;
86
87 //! \brief set feature refer to const settings.
88 //! \return MOS_STATUS
89 //! MOS_STATUS_SUCCESS if success, else fail reason
90 //!
91 MOS_STATUS SetConstSettings() override;
92
93 //!
94 //! \brief Verify slice SAO state
95 //!
96 //! \return MOS_STATUS
97 //! MOS_STATUS_SUCCESS if success, else fail reason
98 //!
99 MOS_STATUS VerifySliceSAOState();
100
101 virtual void UpdateRDOQCfg();
102
103 EncodeAllocator *m_allocator = nullptr;
104 EncodeBasicFeature *m_basicFeature = nullptr; //!< EncodeBasicFeature
105 MOS_CONTEXT_HANDLE m_mosCtx = nullptr;
106
107 std::shared_ptr<mhw::vdbox::hcp::Itf> m_hcpItf = nullptr;
108
109 static const uint8_t m_hevcSAOStreamoutSizePerLCU = 16;
110
111 int m_picQPY = 0;
112 int m_slcQP = 0;
113
114 //Deblocking
115 bool m_SliceDeblockingFilterDisabled = false;
116 uint32_t m_SliceTcOffsetDiv2 = 0;
117 uint32_t m_SliceBettaOffsetDiv2 = 0;
118 PMOS_RESOURCE m_resDeblockingFilterTileRowStoreScratchBuffer = nullptr; //!< De-blocking filter tile row store Scratch data buffer
119 PMOS_RESOURCE m_resDeblockingFilterColumnRowStoreScratchBuffer = nullptr; //!< De-blocking filter column row Store scratch data buffer
120 PMOS_RESOURCE m_resDeblockingFilterRowStoreScratchBuffer = nullptr; //!< Handle of De-block row store surface
121
122 //SAO
123 bool m_saoEnable = false;
124 PMOS_RESOURCE m_resSAOLineBuffer = nullptr; //!< SAO line data buffer
125 PMOS_RESOURCE m_resSAOTileLineBuffer = nullptr; //!< SAO tile line data buffer
126 PMOS_RESOURCE m_resSAOTileColumnBuffer = nullptr; //!< SAO tile column data buffer
127 PMOS_RESOURCE m_resSAOStreamOutBuffer = nullptr; //!< SAO stream-out buffer
128 MOS_RESOURCE m_vdencSAORowStoreBuffer = { 0 }; //!< SAO RowStore buffer
129
130 //TransformSkip
131 bool m_transformSkipEnable = false;
132
133 //RDOQ
134 bool m_rdoqEnable = false;
135 uint32_t m_rdoqIntraTuThreshold = 0;
136 #if (_DEBUG || _RELEASE_INTERNAL)
137 bool m_rdoqIntraTuOverride = false; //!< Override RDOQ intra TU or not
138 bool m_rdoqIntraTuDisableOverride = false; //!< Override RDOQ intra TU disable
139 uint16_t m_rdoqIntraTuThresholdOverride = 0; //!< Override RDOQ intra TU threshold
140 #endif
141
142 MEDIA_CLASS_DEFINE_END(encode__HevcEncodeCqp)
143 };
144
145 } // namespace encode
146
147 #endif // !__ENCODE_HEVC_CQP_H__