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 //!
24 //! \file     encode_av1_vdenc_feature_manager.h
25 //! \brief    Defines the common interface for av1 vdenc feature manager
26 //! \details  The encode feature manager is further sub-divided by codec type
27 //!           this file is for the base interface which is shared by all components.
28 //!
29 
30 #ifndef __ENCODE_AV1_VDENC_FEATURE_MANAGER_H__
31 #define __ENCODE_AV1_VDENC_FEATURE_MANAGER_H__
32 #include <vector>
33 #include "media_feature_manager.h"
34 #include "encode_feature_manager.h"
35 #include "encode_av1_basic_feature.h"
36 #include "encode_av1_tile.h"
37 #include "encode_av1_segmentation.h"
38 #include "encode_av1_brc.h"
39 #include "encode_recycle_resource.h"
40 #include "encode_av1_vdenc_feature_defs.h"
41 
42 namespace encode
43 {
44 class EncodeAv1VdencFeatureManager : public EncodeFeatureManager
45 {
46 
47 public:
48     //!
49     //! \brief  EncodeAv1VdencFeatureManager constructor
50     //! \param  [in] allocator
51     //!         Pointer to EncodeAllocator
52     //! \param  [in] hwInterface
53     //!         Pointer to CodechalHwInterface
54     //! \param  [in] trackedBuf
55     //!         Pointer to TrackedBuffer
56     //! \param  [in] recycleBuf
57     //!         Pointer to RecycleResource
58     //!
EncodeAv1VdencFeatureManager(EncodeAllocator * allocator,CodechalHwInterfaceNext * hwInterface,TrackedBuffer * trackedBuf,RecycleResource * recycleBuf)59      EncodeAv1VdencFeatureManager(EncodeAllocator *allocator,
60                              CodechalHwInterfaceNext *hwInterface,
61                              TrackedBuffer       *trackedBuf,
62                              RecycleResource     *recycleBuf):
63                              m_allocator(allocator),
64                              m_hwInterface(hwInterface),
65                              m_recycleResource(recycleBuf),
66                              m_trackedBuf(trackedBuf){};
67 
68     //!
69     //! \brief  EncodeAv1VdencFeatureManager deconstructor
70     //!
~EncodeAv1VdencFeatureManager()71     virtual ~EncodeAv1VdencFeatureManager() {}
72 
73     //!
74     //! \brief  Check the conflict between features
75     //! \param  [in] params
76     //!         encode parameters
77     //! \return MOS_STATUS
78     //!         MOS_STATUS_SUCCESS if success, else fail reason
79     //!
80     virtual MOS_STATUS CheckFeatures(void *params) override;
81 
82 protected:
83 
84     //!
85     //! \brief  Create feature const settings
86     //! \return MOS_STATUS
87     //!         MOS_STATUS_SUCCESS if success, else fail reason
88     //!
89     virtual MOS_STATUS CreateConstSettings() override;
90 
91     //!
92     //! \brief  Create features
93     //! \param  [in] constsettings
94     //!         feature const settings
95     //! \return MOS_STATUS
96     //!         MOS_STATUS_SUCCESS if success, else fail reason
97     //!
98     virtual MOS_STATUS CreateFeatures(void *constSettings) override;
99 
100     //!
101     //! \brief  Map target usage
102     //! \return MOS_STATUS
103     //!         MOS_STATUS_SUCCESS if success, else fail reason
104     //!
105     virtual MOS_STATUS MapTargetUsage(uint8_t &targetUsage);
106 
107     virtual MOS_STATUS SetPassNum(PCODEC_AV1_ENCODE_SEQUENCE_PARAMS av1SeqParams);
108     EncodeAllocator *m_allocator = nullptr;
109 
110     CodechalHwInterfaceNext *m_hwInterface = nullptr;
111     RecycleResource         *m_recycleResource = nullptr;
112     TrackedBuffer           *m_trackedBuf = nullptr;
113 
114 MEDIA_CLASS_DEFINE_END(encode__EncodeAv1VdencFeatureManager)
115 };
116 
117 
118 }
119 #endif // !__ENCODE_AV1_VDENC_FEATURE_MANAGER_H__
120