1 /*
2 * Copyright (c) 2019-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 //!
24 //! \file     encode_vp9_vdenc_const_settings.h
25 //! \brief    Defines the common interface for vp9 vdenc const settings
26 //! \details  The default setting is further sub-divided by platform type
27 //!           this file is for the base interface which is shared by all components.
28 //!
29 
30 #ifndef __ENCODE_VP9_VDENC_CONST_SETTINGS_H__
31 #define __ENCODE_VP9_VDENC_CONST_SETTINGS_H__
32 #include <stdint.h>
33 #include "codec_def_common_encode.h"
34 #include "media_class_trace.h"
35 #include "encode_const_settings.h"
36 #include "mos_defs.h"
37 #include "codec_def_encode_vp9.h"
38 #include "codec_def_encode.h"
39 namespace encode
40 {
41 struct Vp9VdencFeatureSettings : VdencFeatureSettings
42 {
43     uint32_t *NumMergeCandidateCu64x64 = nullptr;
44     uint32_t *NumMergeCandidateCu32x32 = nullptr;
45     uint32_t *NumMergeCandidateCu16x16 = nullptr;
46     uint32_t *NumMergeCandidateCu8x8   = nullptr;
47     uint8_t * NumImePredictors         = nullptr;
48 };
49 
50 class EncodeVp9VdencConstSettings : public VdencConstSettings
51 {
52 public:
53     //!
54     //! \brief  EncodeVp9VdencConstSettings constructor
55     //!
56     EncodeVp9VdencConstSettings();
57 
58     //!
59     //! \brief  EncodeVp9VdencConstSettings deconstructor
60     //!
~EncodeVp9VdencConstSettings()61     virtual ~EncodeVp9VdencConstSettings() {}
62 
63     //!
64     //! \brief  Prepare const settings
65     //! \return MOS_STATUS
66     //!         MOS_STATUS_SUCCESS if success, else fail reason
67     //!
68     virtual MOS_STATUS PrepareConstSettings() override;
69     virtual MOS_STATUS Update(void *params) override;
70 
71 protected:
72     //!
73     //! \brief  Prepare TU related settings
74     //! \return MOS_STATUS
75     //!         MOS_STATUS_SUCCESS if success, else fail reason
76     //!
77     virtual MOS_STATUS SetTUSettings() override;
78 
79     virtual MOS_STATUS SetVdencCmd1Settings() override;
80 
81     virtual MOS_STATUS SetVdencCmd2Settings() override;
82 
83     virtual MOS_STATUS SetBrcSettings() override;
84 
85 
86     static const uint32_t m_numMergeCandidateCu64x64[NUM_TARGET_USAGE_MODES + 1];
87     static const uint32_t m_numMergeCandidateCu32x32[NUM_TARGET_USAGE_MODES + 1];
88     static const uint32_t m_numMergeCandidateCu16x16[NUM_TARGET_USAGE_MODES + 1];
89     static const uint32_t m_numMergeCandidateCu8x8[NUM_TARGET_USAGE_MODES + 1];
90     static const uint8_t  m_numImePredictors[NUM_TARGET_USAGE_MODES + 1];
91 
92     PCODEC_VP9_ENCODE_SEQUENCE_PARAMS  m_vp9SeqParams = nullptr;
93     PCODEC_VP9_ENCODE_PIC_PARAMS      m_vp9PicParams = nullptr;
94     PCODEC_VP9_ENCODE_SEGMENT_PARAMS   m_vp9SegmentParams = nullptr;
95 
96 MEDIA_CLASS_DEFINE_END(encode__EncodeVp9VdencConstSettings)
97 };
98 
99 }  // namespace encode
100 #endif  // !__ENCODE_VP9_VDENC_CONST_SETTINGS_H__
101