1 /*
2 * Copyright (c) 2020, 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_avc_vdenc_feature_manager.h
24 //! \brief    Defines the common interface for avc vdenc feature manager
25 //! \details  The encode feature manager is further sub-divided by codec type
26 //!           this file is for the base interface which is shared by all components.
27 //!
28 #ifndef __ENCODE_AVC_VDENC_FEATURE_MANAGER_H__
29 #define __ENCODE_AVC_VDENC_FEATURE_MANAGER_H__
30 
31 #include "media_feature_manager.h"
32 #include "encode_feature_manager.h"
33 #include "codec_hw_next.h"
34 #include "encode_recycle_resource.h"
35 #include "encode_tracked_buffer.h"
36 #include "codec_def_encode_avc.h"
37 #include "media_copy_wrapper.h"
38 
39 namespace encode
40 {
41 
42 class EncodeAvcVdencFeatureManager : public EncodeFeatureManager
43 {
44 public:
45     //!
46     //! \brief  EncodeAvcVdencFeatureManager constructor
47     //! \param  [in] allocator
48     //!         Pointer to EncodeAllocator
49     //! \param  [in] hwInterface
50     //!         Pointer to CodechalHwInterface
51     //! \param  [in] trackedBuf
52     //!         Pointer to TrackedBuffer
53     //! \param  [in] recycleBuf
54     //!         Pointer to RecycleResource
55     //!
EncodeAvcVdencFeatureManager(EncodeAllocator * allocator,CodechalHwInterfaceNext * hwInterface,TrackedBuffer * trackedBuf,RecycleResource * recycleBuf,MediaCopyWrapper * mediaCopyWrapper)56      EncodeAvcVdencFeatureManager(EncodeAllocator *allocator,
57                                   CodechalHwInterfaceNext *hwInterface,
58                                   TrackedBuffer       *trackedBuf,
59                                   RecycleResource     *recycleBuf,
60                                   MediaCopyWrapper    *mediaCopyWrapper) :
61                                   m_allocator(allocator),
62                                   m_hwInterface(hwInterface),
63                                   m_recycleResource(recycleBuf),
64                                   m_trackedBuf(trackedBuf),
65                                   m_mediaCopyWrapper(mediaCopyWrapper) {}
66 
67     //!
68     //! \brief  EncodeAvcVdencFeatureManager deconstructor
69     //!
~EncodeAvcVdencFeatureManager()70     virtual ~EncodeAvcVdencFeatureManager() {}
71 
72     //!
73     //! \brief  Check the conflict between features
74     //! \param  [in] params
75     //!         encode parameters
76     //! \return MOS_STATUS
77     //!         MOS_STATUS_SUCCESS if success, else fail reason
78     //!
79     virtual MOS_STATUS CheckFeatures(void *params) override;
80 
81 protected:
82     //!
83     //! \brief  Map target usage
84     //! \return MOS_STATUS
85     //!         MOS_STATUS_SUCCESS if success, else fail reason
86     //!
87     virtual MOS_STATUS MapTargetUsage(uint8_t &targetUsage);
88 
89 protected:
90 
91     MOS_STATUS ValidatePassNum(
92         PCODEC_AVC_ENCODE_SEQUENCE_PARAMS avcSeqParams,
93         PCODEC_AVC_ENCODE_PIC_PARAMS avcPicParams);
94 
95     EncodeAllocator     *m_allocator = nullptr;
96     CodechalHwInterfaceNext *m_hwInterface = nullptr;
97     RecycleResource     *m_recycleResource = nullptr;
98     TrackedBuffer       *m_trackedBuf = nullptr;
99     MediaCopyWrapper    *m_mediaCopyWrapper = nullptr;
100 
101 MEDIA_CLASS_DEFINE_END(encode__EncodeAvcVdencFeatureManager)
102 };
103 
104 }
105 #endif // !__ENCODE_AVC_VDENC_FEATURE_MANAGER_H__
106