1 /*
2 * Copyright (c) 2023, 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_fastpass.h
24 //! \brief    Defines the common interface for encode avc Xe2_HPM+ basic feature
25 //!
26 #ifndef __ENCODE_AVC_VDENC_FASTPASS_H__
27 #define __ENCODE_AVC_VDENC_FASTPASS_H__
28 
29 #include "media_feature.h"
30 #include "encode_allocator.h"
31 #include "encode_basic_feature.h"
32 #include "mhw_vdbox_vdenc_itf.h"
33 #include "encode_avc_basic_feature.h"
34 #include "encode_avc_vdenc_const_settings.h"
35 
36 namespace encode
37 {
38 
39 class AvcVdencFastPass : public MediaFeature, public mhw::vdbox::vdenc::Itf::ParSetting, public mhw::vdbox::mfx::Itf::ParSetting
40 {
41 public:
42     AvcVdencFastPass(MediaFeatureManager *featureManager,
43                       EncodeAllocator *allocator,
44                       CodechalHwInterfaceNext *hwInterface,
45                       void *constSettings);
46 
~AvcVdencFastPass()47     virtual ~AvcVdencFastPass() {}
48 
49     //!
50     //! \brief  Update encode parameter
51     //! \param  [in] params
52     //!         Pointer to parameters
53     //! \return MOS_STATUS
54     //!         MOS_STATUS_SUCCESS if success, else fail reason
55     //!
56     virtual MOS_STATUS Update(void *params) override;
57 
58     MHW_SETPAR_DECL_HDR(VDENC_PIPE_MODE_SELECT);
59 
60     MHW_SETPAR_DECL_HDR(VDENC_REF_SURFACE_STATE);
61 
62     MHW_SETPAR_DECL_HDR(VDENC_AVC_IMG_STATE);
63 
64     MHW_SETPAR_DECL_HDR(VDENC_WALKER_STATE);
65 
66     MHW_SETPAR_DECL_HDR(MFX_AVC_IMG_STATE);
67 
68     MHW_SETPAR_DECL_HDR(MFX_AVC_SLICE_STATE);
69 
70     MHW_SETPAR_DECL_HDR(VDENC_DS_REF_SURFACE_STATE);
71 
72     MHW_SETPAR_DECL_HDR(VDENC_CMD3);
73 
74 protected:
75     PMOS_INTERFACE m_osInterface              = nullptr;  //!< Os Inteface
76     MOS_RESOURCE   m_vdencRecDownScaledBuffer = {};
77     uint32_t       m_dsWidth                  = 0;
78     uint32_t       m_dsHeight                 = 0;
79 
80     uint8_t m_fastPassShiftIndex     = 0;      //!< shift index for fast pass encode
81     uint8_t m_fastPassDownScaleType  = 0;      //!< downscaleType for fast pass encode
82 
83     AvcBasicFeature *m_basicFeature = nullptr;  //!< AvcBasicFeature
84     AvcVdencCMD3ConstSettings m_CMD3Settings;
85 
86 MEDIA_CLASS_DEFINE_END(encode__AvcVdencFastPass)
87 };
88 
89 }  // namespace encode
90 
91 #endif  // !__ENCODE_AVC_VDENC_FASTPASS_H__