1 /*
2 * Copyright (c) 2020-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_rounding.h
24 //! \brief    Defines the common interface for avc encode rounding feature
25 //!
26 #ifndef __ENCODE_AVC_ROUNDING_H__
27 #define __ENCODE_AVC_ROUNDING_H__
28 
29 #include "media_feature.h"
30 #include "encode_avc_basic_feature.h"
31 #include "mhw_vdbox_vdenc_itf.h"
32 #include "mhw_vdbox_mfx_itf.h"
33 
34 namespace encode
35 {
36 
37 class AvcEncodeRounding : public MediaFeature, public mhw::vdbox::vdenc::Itf::ParSetting, public mhw::vdbox::mfx::Itf::ParSetting
38 {
39 public:
40     AvcEncodeRounding(MediaFeatureManager *featureManager,
41                       EncodeAllocator *allocator,
42                       CodechalHwInterfaceNext *hwInterface,
43                       void *constSettings);
44 
~AvcEncodeRounding()45     virtual ~AvcEncodeRounding() {}
46 
47     virtual MOS_STATUS Update(void *params) override;
48 
49     //!
50     //! \brief    SetRounding params for AVC slice state
51     //!
52     //! \param    [out] sliceState
53     //!           Reference of AVC slice state
54     //!
55     //! \return   MOS_STATUS
56     //!           MOS_STATUS_SUCCESS if success, else fail reason
57     //!
58     MOS_STATUS SetRoundingParams(MHW_VDBOX_AVC_SLICE_STATE &sliceState) const;
59 
60     MHW_SETPAR_DECL_HDR(VDENC_AVC_SLICE_STATE);
61 
62     MHW_SETPAR_DECL_HDR(MFX_AVC_SLICE_STATE);
63 
64 protected:
65 
66     //!
67     //! \brief    Get intra/inter rounding value.
68     //!
69     //! \param    [out] sliceState
70     //!           Reference of AVC slice state
71     //!
72     //! \return   MOS_STATUS
73     //!           MOS_STATUS_SUCCESS if success, else fail reason
74     //!
75     virtual MOS_STATUS GetRounding(MHW_VDBOX_AVC_SLICE_STATE &sliceState) const;
76 
77     AvcBasicFeature *m_basicFeature = nullptr;                        //!< EncodeBasicFeature
78 
79     PCODECHAL_ENCODE_AVC_ROUNDING_PARAMS m_roundingParams = nullptr;  //!< Pointer to AVC rounding parameter
80 
81 MEDIA_CLASS_DEFINE_END(encode__AvcEncodeRounding)
82 };
83 
84 }  // namespace encode
85 
86 #endif  // !__ENCODE_AVC_ROUNDING_H__
87