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_trellis.h
24 //! \brief    Defines the common interface for avc encode trellis feature
25 //!
26 #ifndef __ENCODE_AVC_TRELLIS_H__
27 #define __ENCODE_AVC_TRELLIS_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 AvcEncodeTrellis : public MediaFeature, public mhw::vdbox::vdenc::Itf::ParSetting, public mhw::vdbox::mfx::Itf::ParSetting
38 {
39 public:
40     AvcEncodeTrellis(MediaFeatureManager *featureManager,
41                      EncodeAllocator *allocator,
42                      CodechalHwInterfaceNext *hwInterface,
43                      void *constSettings);
44 
~AvcEncodeTrellis()45     ~AvcEncodeTrellis() {}
46 
47     //!
48     //! \brief  Update trellis feature related parameter
49     //! \param  [in] params
50     //!         Pointer to parameters
51     //! \return MOS_STATUS
52     //!         MOS_STATUS_SUCCESS if success, else fail reason
53     //!
54     MOS_STATUS Update(void *params) override;
55 
56     MHW_SETPAR_DECL_HDR(VDENC_AVC_IMG_STATE);
57 
58     MHW_SETPAR_DECL_HDR(MFX_AVC_IMG_STATE);
59 
60 protected:
61 
62     //!
63     //! \brief    Get Trellis Quantization mode/value enable or not.
64     //!
65     //! \param    [in] params
66     //!           Pointer to CODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS.
67     //! \param    [out] trellisQuantParams
68     //!           Pointer to CODECHAL_ENCODE_AVC_TQ_PARAMS, mode & value setup.
69     //!
70     //! \return   MOS_STATUS
71     //!           MOS_STATUS_SUCCESS if success, else fail reason
72     //!
73     virtual MOS_STATUS GetTrellisQuantization(
74         PCODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS params,
75         PCODECHAL_ENCODE_AVC_TQ_PARAMS       trellisQuantParams);
76 
77     MOS_STATUS UpdateTrellisParameters();
78 
79     AvcBasicFeature *m_basicFeature = nullptr;
80 
81     CODECHAL_ENCODE_AVC_TQ_PARAMS m_trellisQuantParams = {};    //!< Trellis Quantization params
82     uint32_t                      m_trellis            = false; //!< Trellis Number.
83 
84 MEDIA_CLASS_DEFINE_END(encode__AvcEncodeTrellis)
85 };
86 
87 }  // namespace encode
88 
89 #endif  // !__ENCODE_AVC_TRELLIS_H__
90