1 /*
2 * Copyright (c) 2022, 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_av1_vdenc_fullenc.h
24 //! \brief    Defines for vdenc full-enc feature
25 //!
26 #ifndef __ENCODE_AV1_VDENC_FULLENC_H__
27 #define __ENCODE_AV1_VDENC_FULLENC_H__
28 
29 #include "media_feature.h"
30 #include "encode_allocator.h"
31 #include "mhw_vdbox_vdenc_itf.h"
32 #include "encode_av1_vdenc_feature_manager.h"
33 #include "encode_av1_vdenc_preenc.h"
34 #if _MEDIA_RESERVED
35 #include "encode_av1_vdenc_fullenc_ext.h"
36 #endif
37 
38 namespace encode
39 {
40     class Av1VdencFullEnc : public MediaFeature, public mhw::vdbox::vdenc::Itf::ParSetting
41     {
42     public:
43         Av1VdencFullEnc(
44             MediaFeatureManager *featureManager,
45             EncodeAllocator *allocator,
46             CodechalHwInterfaceNext *hwInterface,
47             void *constSettings);
48 
49         virtual ~Av1VdencFullEnc();
50 
51         //!
52         //! \brief  Init full-enc basic features related parameter
53         //!
54         //! \param  [in] settings
55         //!         Pointer to settings
56         //!
57         //! \return MOS_STATUS
58         //!         MOS_STATUS_SUCCESS if success, else fail reason
59         //!
60         MOS_STATUS Init(void *settings) override;
61 
62         //!
63         //! \brief  Update full-enc features related parameter
64         //!
65         //! \param  [in] params
66         //!         Pointer to parameters
67         //!
68         //! \return MOS_STATUS
69         //!         MOS_STATUS_SUCCESS if success, else fail reason
70         //!
71         MOS_STATUS Update(void *params) override;
72 #if USE_CODECHAL_DEBUG_TOOL
73         MOS_STATUS EncodeFullencFuntion1();
74 #endif
75         MHW_SETPAR_DECL_HDR(VDENC_PIPE_MODE_SELECT);
76 
77         MHW_SETPAR_DECL_HDR(VDENC_PIPE_BUF_ADDR_STATE);
78 
79     protected:
80         PMOS_INTERFACE      m_osInterface    = nullptr;           //!< Os Inteface
81         EncodeBasicFeature  *m_basicFeature  = nullptr;         //!< EncodeBasicFeature
82         Av1VdencPreEnc     *m_preEncFeature = nullptr;
83 
84         PMOS_RESOURCE       EncodeFullencMember0 = nullptr;
85         PMOS_RESOURCE       EncodeFullencMember1 = nullptr;
86 
87         uint32_t m_encodeMode = 0;
88 
89         uint8_t  EncodeFullencMember2 = 0;
90         uint8_t  EncodeFullencMember3 = 0;
91         uint8_t  EncodeFullencMember4 = 0;
92         uint32_t EncodeFullencMember5 = 0;
93 
94         EncodeAllocator *m_allocator = nullptr;
95 
96         MOS_STATUS UpdateTrackedBufferParameters();
97         MOS_STATUS UpdatePreEncSize();
98 #if USE_CODECHAL_DEBUG_TOOL
99         FILE *pfile0 = nullptr;
100         FILE *pfile1 = nullptr;
101 #endif
102     MEDIA_CLASS_DEFINE_END(encode__Av1VdencFullEnc)
103     };
104 
105 }  // namespace encode
106 
107 #endif  // !__ENCODE_AV1_VDENC_FULLENC_H__
108 
109