1 /*
2 * Copyright (c) 2020-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     encode_vp9_cqp.h
24 //! \brief    Defines the common interface for vp9 encode cqp features
25 //!
26 #ifndef __ENCODE_VP9_CQP_H__
27 #define __ENCODE_VP9_CQP_H__
28 
29 #include "encode_vp9_basic_feature.h"
30 
31 namespace encode
32 {
33 
34 class Vp9EncodeCqp : public MediaFeature, public mhw::vdbox::hcp::Itf::ParSetting
35 {
36 public:
37     //!
38     //! \brief  Vp9EncodeCqp feature constructor
39     //!
40     //! \param  [in] featureManager
41     //!         Pointer to MediaFeatureManager
42     //! \param  [in] allocator
43     //!         Pointer to EncodeAllocator
44     //! \param  [in] hwInterface
45     //!         Pointer to CodechalHwInterface
46     //! \param  [in] constSettings
47     //!         Pointer to const settings
48     //!
49     Vp9EncodeCqp(
50         MediaFeatureManager *featureManager,
51         EncodeAllocator *    allocator,
52         CodechalHwInterfaceNext *hwInterface,
53         void *               constSettings);
54 
55     //!
56     //! \brief  Vp9EncodeCqp feature destructor
57     //!
~Vp9EncodeCqp()58     virtual ~Vp9EncodeCqp() {}
59 
60     //!
61     //! \brief  Init CQP basic features related parameter
62     //! \param  [in] settings
63     //!         Pointer to settings
64     //! \return MOS_STATUS
65     //!         MOS_STATUS_SUCCESS if success, else fail reason
66     //!
67     MOS_STATUS Init(void *settings) override;
68 
69     //!
70     //! \brief  Update CQP basic features related parameter
71     //! \param  [in] params
72     //!         Pointer to parameters
73     //! \return MOS_STATUS
74     //!         MOS_STATUS_SUCCESS if success, else fail reason
75     //!
76     MOS_STATUS Update(void *params) override;
77 
78     //!
79     //! \brief MHW parameters declaration
80     //!
81     MHW_SETPAR_DECL_HDR(HCP_PIPE_MODE_SELECT);
82     MHW_SETPAR_DECL_HDR(HCP_PIPE_BUF_ADDR_STATE);
83 
84 protected:
85 
86     //! \brief  Allocate feature related resources
87     //! \return MOS_STATUS
88     //!         MOS_STATUS_SUCCESS if success, else fail reason
89     //!
90     MOS_STATUS AllocateResources() override;
91 
92     EncodeAllocator *     m_allocator    = nullptr;
93     Vp9BasicFeature *     m_basicFeature = nullptr;
94 
95     // Deblocking
96     MOS_RESOURCE m_resDeblockingFilterLineBuffer       = {0};  //!< Deblocking filter line buffer
97     MOS_RESOURCE m_resDeblockingFilterTileLineBuffer   = {0};  //!< Deblocking filter tile line buffer
98     MOS_RESOURCE m_resDeblockingFilterTileColumnBuffer = {0};  //!< Deblocking filter tile column buffer
99 
100 MEDIA_CLASS_DEFINE_END(encode__Vp9EncodeCqp)
101 };
102 
103 }  // namespace encode
104 
105 #endif  // __ENCODE_VP9_CQP_H__