1 /*
2 * Copyright (c) 2017, 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     codechal_debug_encode_par.h
24 //! \brief    Defines the debug interface shared by all of CodecHal for encode
25 //!           PAR file dump.
26 //!
27 
28 #ifndef __CODECHAL_DEBUG_ENCODE_PAR_H__
29 #define __CODECHAL_DEBUG_ENCODE_PAR_H__
30 
31 #include "codechal.h"
32 #include "codechal_debug.h"
33 #include "codechal_encoder_base.h"
34 
35 #if USE_CODECHAL_DEBUG_TOOL
36 
37 struct EncodeCommonPar
38 {
39     // DSParams
40     uint32_t                    mbFlatnessThreshold;
41 
42     // HME Params
43     uint8_t                     superCombineDist;
44     uint8_t                     meMethod;
45     bool                        superHME;
46     bool                        ultraHME;
47     bool                        streamInEnable;
48     uint8_t                     streamInL0FromNewRef;
49     uint8_t                     streamInL1FromNewRef;
50 };
51 
52 class CodechalDebugEncodePar
53 {
54 public:
55     //!
56     //! \brief    Constructor
57     //!
58     CodechalDebugEncodePar(CodechalEncoderState *encoder);
59 
60     //!
61     //! \brief    Destructor
62     //!
63     virtual ~CodechalDebugEncodePar();
64 
65     //!
66     //! \brief    Populate DS parameters
67     //!
68     //! \param    [in] *cmd
69     //!           pointer to curbe data
70     //!
71     //! \return   MOS_STATUS
72     //!           MOS_STATUS_SUCCESS if success
73     //!
PopulateDsParam(void * cmd)74     virtual MOS_STATUS PopulateDsParam(
75         void *cmd) { return MOS_STATUS_SUCCESS; }
76 
77     //!
78     //! \brief    Populate HME parameters
79     //!
80     //! \param    [in] is16xMeEnabled
81     //!           16x ME enabled flag
82     //! \param    [in] is32xMeEnabled
83     //!           32x ME enabled flag
84     //! \param    [in] meMethod
85     //!           ME method
86     //! \param    [in] *cmd
87     //!           pointer to curbe data
88     //!
89     //! \return   MOS_STATUS
90     //!           MOS_STATUS_SUCCESS if success
91     //!
PopulateHmeParam(bool is16xMeEnabled,bool is32xMeEnabled,uint8_t meMethod,void * curbe)92     virtual MOS_STATUS PopulateHmeParam(
93         bool    is16xMeEnabled,
94         bool    is32xMeEnabled,
95         uint8_t meMethod,
96         void    *curbe) { return MOS_STATUS_SUCCESS; }
97 
98     EncodeCommonPar *m_commonPar = nullptr;  //!< Pointer to common PAR;
99 
100     // Control flags
101     bool m_isConstDumped = false;  //!< Is const data dumped;
102 
103 protected:
104     //!
105     //! \brief    Initialize PAR file
106     //!
107     //! \return   MOS_STATUS
108     //!           MOS_STATUS_SUCCESS if success
109     //!
110     MOS_STATUS Initialize();
111 
112     //!
113     //! \brief    Destroy PAR file
114     //!
115     //! \return   MOS_STATUS
116     //!           MOS_STATUS_SUCCESS if success
117     //!
118     MOS_STATUS Destroy();
119 
120     CodechalEncoderState        *m_encoder = nullptr;                         //!< Pointer to ENCODER base class;
121     MOS_INTERFACE               *m_osInterface = nullptr;                     //!< OS interface
122     CodechalHwInterface         *m_hwInterface = nullptr;                     //!< HW interface
123     CodechalDebugInterface      *m_debugInterface = nullptr;                  //!< Debug interface
124 };
125 
126 #endif // USE_CODECHAL_DEBUG_TOOL
127 
128 #endif // __CODECHAL_DEBUG_ENCODE_PAR_H__
129