Debian Codegraph @

media_softlet/agnostic/common/shared/media_debug_utils.h

raw
1 /*
2 * Copyright (c) 2020-2025, 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 media_debug_utils.h
24 //! \brief Defines the debug interface utilities shared by all of Media.
25 //! \details The debug interface dumps output from Media based on in input config file.
26 //!
27 #ifndef __MEDIA_DEBUG_UTILS_H__
28 #define __MEDIA_DEBUG_UTILS_H__
29
30 #if USE_MEDIA_DEBUG_TOOL
31 #include <string>
32 #include <map>
33 #include <vector>
34 #include "mos_defs.h"
35 #include "media_class_trace.h"
36
37 namespace MediaDbgAttr
38 {
39 //Common Attr
40 static const char *attrDumpBufferInBinary = "DumpBufferInBinary";
41 static const char *attrDumpToThreadFolder = "DumpToThreadFolder";
42 static const char *attrDumpCmdBufInBinary = "DumpCmdBufInBinary";
43 static const char *attrEnableFastDump = "EnableFastDump";
44 static const char *attrFastDumpAllowDataLoss = "FastDumpAllowDataLoss";
45 static const char *attrFastDumpRenderCpyEn = "FastDumpRenderCpyEn";
46 static const char *attrFastDumpVeCpyEn = "FastDumpVeCpyEn";
47 static const char *attrFastDumpBltCpyEn = "FastDumpBltCpyEn";
48
49 //Codec Attr
50 static const char *attrPicParams = "PicParams";
51 static const char *attrSubsetsParams = "SubsetsParams";
52 static const char *attrFeiPicParams = "FeiPicParams";
53 static const char *attrMvcExtPicParams = "MvcExtPicParams";
54 static const char *attrSegmentParams = "SegmentParams";
55 static const char *attrSlcParams = "SlcParams";
56 static const char *attrMbParams = "MbParams";
57 static const char *attrIqParams = "IqParams";
58 static const char *attrSeqParams = "SeqParams";
59 static const char *attrVuiParams = "VuiParams";
60 static const char *attrDecodeBitstream = "DecodeBitstream"; // Decode Bitstream
61 static const char *attrBitstream = "Bitstream"; // Encode Bitstream
62 static const char *attrStreamOut = "StreamOut";
63 static const char *attrStreamIn = "StreamIn";
64 static const char *attrResidualDifference = "ResidualDifference";
65 static const char *attrDeblocking = "Deblocking";
66 static const char *attrMvData = "MvData";
67 static const char *attrVc1Bitplane = "Vc1Bitplane";
68 static const char *attrCoefProb = "CoefProb";
69 static const char *attrSegId = "SegId";
70 static const char *attrHucRegions = "HucRegions";
71 static const char *attrHuCDmem = "HucDmem";
72 static const char *attrCmdBufferMfx = "CmdBufferMfx";
73 static const char *attr2ndLvlBatchMfx = "2ndLvlBatchMfx";
74 static const char *attrSurfaceInfo = "SurfaceInfo";
75 static const char *attrDelayForDumpOutput = "DelayForDumpOutput";
76 static const char *attrDecodeOutputSurface = "DecodeOutputSurface";
77 static const char *attrDecodeCompSurface = "DumpCompressedSurface";
78 static const char *attrDecodeAuxSurface = "DumpAuxsurface";
79 static const char *attrDecodeBltOutput = "DumpBltOutput";
80 static const char *attrSfcOutputSurface = "SfcOutputSurface";
81 static const char *attrSfcBuffers = "SfcBuffers";
82 static const char *attrDecodeReferenceSurfaces = "DecodeReferenceSurfaces"; // Decode Reference Surfaces
83 static const char *attrReferenceSurfaces = "ReferenceSurfaces"; // Encode Reference Surfaces
84 static const char *attrEncodeRawInputSurface = "EncodeRawInputSurface";
85 static const char *attrReconstructedSurface = "ReconstructedSurface";
86 static const char *attrPakInput = "PakInput";
87 static const char *attrPakOutput = "PakOutput";
88 static const char *attrUpsamlingInput = "UpsamplingInput";
89 static const char *attrResidualSurface = "ResidualSurface";
90 static const char *attrStCoeff = "StCoeff";
91 static const char *attrCoeffPredCs = "CoeffPredCs";
92 static const char *attrMbRecord = "MbRecord";
93 static const char *attrOverwriteCommands = "OverwriteCommands";
94 static const char *attrHuffmanTbl = "HuffmanTbl";
95 static const char *attrScanParams = "ScanParams";
96 static const char *attrDriverUltDump = "DriverUltDump";
97 static const char *attrGranularCRCDump = "GranularCRCDump";
98
99 static const char *attrDumpEncodePar = "DumpEncodePar";
100 static const char *attrForceCmdDumpLvl = "ForceCmdDumpLvl";
101 static const char *attrForceCurbeDumpLvl = "ForceCurbeDumpLvl";
102 static const char *attrForceYUVDumpWithMemcpy = "ForceYUVDumpWithMemcpy";
103 static const char *attrDisableSwizzleForDumps = "DisableSwizzleForDumps";
104 static const char *attrVdencOutput = "VdencOutput";
105 static const char *attrDecodeProcParams = "DecodeProcParams";
106 static const char *attrFrameState = "FrameState";
107 static const char *attrCUStreamout = "CUStreamout";
108 static const char *attrBrcPakStats = "BrcPakStats";
109 static const char *attrImageState = "ImageState";
110 static const char *attrSliceSizeStreamout = "SliceSizeStreamout";
111 static const char *attrCoeffProb = "PakHwCoeffProbs";
112 static const char *attrStatusReport = "StatusReport";
113 static const char *attrPakObjStreamout = "PakObjStreamOut";
114 static const char *attrTileBasedStats = "TileBasedStats";
115 static const char *attrROISurface = "ROIInput";
116 static const char *attrHuCStitchDataBuf = "HuCStitchDataBuffer";
117 static const char *attrInitSWScoreboard = "InitSWScoreboard";
118 static const char *attrSfcHistogram = "SfcHistogram";
119 static const char *attrFilmGrain = "FilmGrain";
120 static const char *attrQualityReport = "QualityReport";
121 static const char *attrAqmHistogram = "AqmHistogram";
122
123 static const char *attrAlfData = "AlfData";
124 static const char *attrLmcsData = "LmcsData";
125 static const char *attrTileParams = "TileParams";
126 static const char *attrSubpicParams = "SubpicParams";
127 static const char *attrSliceStruct = "SliceStruct";
128 static const char *attrRplStruct = "RplStruct";
129
130 static const char *attrMvDumpOfTest = "MvDumpOfTest"; //For Of test purpose only
131
132 // MD5 attributes
133 static const char *attrMD5HashEnable = "MD5HasEnable";
134 static const char *attrMD5FlushInterval = "MD5FlushInterval";
135 static const char *attrMD5PicWidth = "MD5PicWidth";
136 static const char *attrMD5PicHeight = "MD5PicHeight";
137 // kernel attributes
138 static const char *attrDsh = "DSH";
139 static const char *attrIsh = "ISH";
140 static const char *attrSsh = "SSH";
141 static const char *attrCurbe = "Curbe";
142 static const char *attrCmdBuffer = "CmdBuffer";
143 static const char *attr2ndLvlBatch = "2ndLvlBath";
144 static const char *attrInput = "Input";
145 static const char *attrOutput = "Output";
146 };
147
148 namespace MediaDbgFieldType
149 {
150 static const char *topField = "_Top";
151 static const char *botField = "_Bot";
152 static const char *frame = "_Frame";
153 }; // namespace MediaDbgFieldType
154
155 namespace MediaDbgExtType
156 {
157 static const char *dat = ".dat";
158 static const char *txt = ".txt";
159 static const char *par = ".par";
160 static const char *y = ".Y";
161 static const char *uv = ".UV";
162 static const char *yuv = ".yuv";
163 static const char *yuy2 = ".yuy2";
164 static const char *uyvy = ".uyvy";
165 }; // namespace MediaDbgExtType
166
167 namespace MediaDbgSurfaceType
168 {
169 static const char *yuv444 = "_yuv444";
170 static const char *yuv411 = "_yuv411";
171 static const char *yuv420 = "_yuv420";
172 static const char *yuv400 = "_yuv400";
173 static const char *yuv422h2y = "_yuv422h_2y";
174 static const char *yuv422v2y = "_yuv422v_2y";
175 static const char *yuv422h4y = "_yuv422h_4y";
176 static const char *yuv422v4y = "_yuv422v_4y";
177 static const char *yuy2422 = "_yuy2422";
178 static const char *uyvy422 = "_uyvy422";
179 };
180
181 namespace MediaDbgBufferType
182 {
183 static const char *bufCmd = "CmdBuf";
184 static const char *buf2ndLvl = "2ndLvl";
185 static const char *bufCurbe = "Curbe";
186 static const char *bufISH = "ISH";
187 static const char *bufDSH = "DSH";
188 static const char *bufSSH = "SSH";
189 static const char *bufSeqParams = "SeqParams";
190 static const char *bufPicParams = "PicParams";
191 static const char *bufSlcParams = "SlcParams";
192 static const char *bufSubsetsParams = "SubsetsParams";
193 static const char *bufVuiParams = "VuiParams";
194 static const char *bufBitstream = "Bitstream";
195 static const char *bufFeiPicParams = "FeiPicParams";
196 static const char *bufMadRead = "MADRead";
197 static const char *bufMadWrite = "MADWrite";
198 static const char *bufSegmentParams = "SegmentParams";
199 static const char *bufIqParams = "IqParams";
200 static const char *bufHuffmanTbl = "HuffmanTbl";
201 static const char *bufScanParams = "ScanParams";
202 static const char *bufMvcPicParams = "MvcPicParams";
203 static const char *bufMbParams = "MbParams";
204 static const char *bufDecProcParams = "DecProcParams";
205 static const char *bufHucRegion = "HucRegion";
206 static const char *bufHucDmem = "HucDmem";
207 static const char *bufEncodePar = "EncodePar";
208 static const char *bufAlfData = "AlfData";
209 static const char *bufLmcsData = "LmcsData";
210 static const char *bufTileParams = "TileParams";
211 static const char *bufSubpicParams = "SubpicParams";
212 static const char *bufSliceStruct = "SliceStruct";
213 static const char *bufRplStruct = "RplStruct";
214 }; // namespace MediaDbgBufferType
215
216 //------------------------------------------------------------------------------
217 // Macros specific to MOS_OS_SUBCOMP_DEBUG sub-comp
218 //------------------------------------------------------------------------------
219 #define MEDIA_DEBUG_ASSERT(_expr) \
220 MOS_ASSERT(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _expr)
221
222 #define MEDIA_DEBUG_ASSERTMESSAGE(_message, ...) \
223 MOS_ASSERTMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
224
225 #define MEDIA_DEBUG_WARNINGMESSAGE(_message, ...) \
226 MOS_WARNINGMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
227
228 #define MEDIA_DEBUG_NORMALMESSAGE(_message, ...) \
229 MOS_NORMALMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
230
231 #define MEDIA_DEBUG_VERBOSEMESSAGE(_message, ...) \
232 MOS_VERBOSEMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
233
234 #define MEDIA_DEBUG_FUNCTION_ENTER \
235 MOS_FUNCTION_ENTER(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF)
236
237 #define MEDIA_DEBUG_CHK_STATUS(_stmt) \
238 MOS_CHK_STATUS_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _stmt)
239
240 #define MEDIA_DEBUG_CHK_STATUS_MESSAGE(_stmt, _message, ...) \
241 MOS_CHK_STATUS_MESSAGE_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _stmt, _message, ##__VA_ARGS__)
242
243 #define MEDIA_DEBUG_CHK_NULL(_ptr) \
244 MOS_CHK_NULL_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr)
245
246 #define MEDIA_DEBUG_CHK_NULL_NO_STATUS(_ptr) \
247 MOS_CHK_NULL_NO_STATUS_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr)
248
249 #define MEDIA_DEBUG_CODECHAL_DUMP_OUTPUT_FOLDER "\\codechaldump\\"
250 #define MEDIA_DEBUG_VPHAL_DUMP_OUTPUT_FOLDER "\\vphaldump\\"
251
252 #endif //USE_MEDIA_DEBUG_TOOL
253 #endif /* __MEDIA_DEBUG_UTILS_H__ */