1 /*
2 * Copyright (c) 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_avc_vdenc_fullenc.h
24 //! \brief    Defines the common interface for avc vdenc fullenc encode features
25 //!
26 #ifndef __ENCODE_AVC_VDENC_FULLENC_H__
27 #define __ENCODE_AVC_VDENC_FULLENC_H__
28 
29 #include "media_feature.h"
30 #include "encode_allocator.h"
31 #include "encode_avc_basic_feature.h"
32 #include "encode_avc_vdenc_preenc.h"
33 #include "mhw_vdbox_vdenc_itf.h"
34 #if _MEDIA_RESERVED
35 #include "encode_avc_vdenc_fullenc_ext.h"
36 #endif // _MEDIA_RESERVED
37 
38 namespace encode
39 {
40 
41 class AvcVdencFullEnc : public MediaFeature, public mhw::vdbox::vdenc::Itf::ParSetting
42 {
43 public:
44     AvcVdencFullEnc(
45         MediaFeatureManager *featureManager,
46         EncodeAllocator *    allocator,
47         CodechalHwInterfaceNext *hwInterface,
48         void *               constSettings);
49 
50     virtual ~AvcVdencFullEnc();
51 
52     //!
53     //! \brief  Init full-enc basic features related parameter
54     //!
55     //! \param  [in] settings
56     //!         Pointer to settings
57     //!
58     //! \return MOS_STATUS
59     //!         MOS_STATUS_SUCCESS if success, else fail reason
60     //!
61     virtual MOS_STATUS Init(void *settings) override;
62 
63     //!
64     //! \brief  Update full-enc features related parameter
65     //!
66     //! \param  [in] params
67     //!         Pointer to parameters
68     //!
69     //! \return MOS_STATUS
70     //!         MOS_STATUS_SUCCESS if success, else fail reason
71     //!
72     virtual MOS_STATUS Update(void *params) override;
73 
74     MHW_SETPAR_DECL_HDR(VDENC_PIPE_MODE_SELECT);
75 
76     MHW_SETPAR_DECL_HDR(VDENC_PIPE_BUF_ADDR_STATE);
77 
78 protected:
79     MOS_STATUS ecodeAvcFullencFuntion0();
80     MOS_STATUS UpdateTrackedBufferParameters();
81     MOS_STATUS UpdatePreEncSize();
82 
83     PMOS_INTERFACE   m_osInterface  = nullptr;  //!< Os Inteface
84     AvcBasicFeature *m_basicFeature = nullptr;  //!< EncodeBasicFeature
85     EncodeAllocator *m_allocator    = nullptr;
86     AvcVdencPreEnc *m_preEncFeature = nullptr;
87 
88     PMOS_RESOURCE ecodeAvcFullencMember0 = nullptr;
89     PMOS_RESOURCE ecodeAvcFullencMember1 = nullptr;
90 
91     uint8_t  ecodeAvcFullencMember2 = 0;
92     uint8_t  ecodeAvcFullencMember3 = 0;
93     uint8_t  ecodeAvcFullencMember4 = 0;
94     uint32_t ecodeAvcFullencMember5 = 0;
95     uint8_t  ecodeAvcFullencMember6 = 0;
96     uint16_t ecodeAvcFullencMember7 = 0;
97     uint16_t ecodeAvcFullencMember8 = 0;
98     FILE *   m_pfile0               = nullptr;
99     FILE *   m_pfile1               = nullptr;
100 
101     std::string ecodeAvcFullencMember9  = "";
102     std::string ecodeAvcFullencMember10 = "";
103 
104     uint8_t ecodeAvcFullencMember11 = 0;
105 
106     uint32_t m_encodeMode = 0;
107 
108 MEDIA_CLASS_DEFINE_END(encode__AvcVdencFullEnc)
109 };
110 }  // namespace encode
111 
112 #endif  // !__ENCODE_AVC_VDENC_FULLENC_H__
113