1 /* ****************************************************************************** *\
2 
3 Copyright (C) 2012-2020 Intel Corporation.  All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 - Redistributions of source code must retain the above copyright notice,
8 this list of conditions and the following disclaimer.
9 - Redistributions in binary form must reproduce the above copyright notice,
10 this list of conditions and the following disclaimer in the documentation
11 and/or other materials provided with the distribution.
12 - Neither the name of Intel Corporation nor the names of its contributors
13 may be used to endorse or promote products derived from this software
14 without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
17 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27 File Name: dump.h
28 
29 \* ****************************************************************************** */
30 
31 #ifndef DUMP_H_
32 #define DUMP_H_
33 
34 #include <string>
35 #include <sstream>
36 #include <iomanip>
37 #include <iterator>
38 #include <typeinfo>
39 #include "mfxstructures.h"
40 #include "mfxvideo.h"
41 #include "mfxplugin.h"
42 #include "mfxenc.h"
43 #include "mfxfei.h"
44 #include "mfxla.h"
45 #include "mfxvp8.h"
46 #include "mfxcamera.h"
47 #include "mfxjpeg.h"
48 #include "mfxmvc.h"
49 #include "mfxbrc.h"
50 
51 
52 
53 std::string pVoidToHexString(void* x);
54 std::string GetStatusString(mfxStatus sts);
55 std::string GetmfxIMPL(mfxIMPL impl);
56 std::string GetFourCC(mfxU32 fourcc);
57 std::string GetCodecIdString (mfxU32 id);
58 std::string GetIOPattern (mfxU32 io);
59 bool _IsBadReadPtr(void *ptr, size_t size);
60 
61 #define GET_ARRAY_SIZE(x) sizeof(x)/sizeof(x[0])
62 #define DUMP_RESERVED_ARRAY(r) dump_reserved_array(&(r[0]), GET_ARRAY_SIZE(r))
63 
64 #define DUMP_FIELD(_field) \
65     str += structName + "." #_field "=" + ToString(_struct._field) + "\n";
66 
67 #define DUMP_FIELD_RESERVED(_field) \
68     str += structName + "." #_field "[]=" + DUMP_RESERVED_ARRAY(_struct._field) + "\n";
69 
70     #define ToString( x )  static_cast< std::ostringstream const & >( \
71         ( std::ostringstream() << std::dec << x ) ).str()
72 
73     #define TimeToString( x ) static_cast< std::ostringstream const & >( \
74             ( std::ostringstream() << std::left << std::setw(4) << std::dec << x <<" msec") ).str()
75 
76     /*
77     #define ToHexFormatString( x ) static_cast< std::ostringstream const & >( \
78             ( std::ostringstream() << std::hex << x ) ).str()
79     */
80 
81     #define ToHexFormatString( x ) (static_cast< std::ostringstream const & >( \
82             ( std::ostringstream() << std::hex << pVoidToHexString((void*)x) ) ).str() )
83 /*
84 #define DEFINE_GET_TYPE(type) \
85     template<> \
86     inline const char* get_type<type>(){ return #type; };
87 */
88 
89 #define DEFINE_GET_TYPE(type) \
90     template<> \
91     const char* get_type<type>();
92 
93 #define DEFINE_GET_TYPE_DEF(type) \
94     template<> const char* DumpContext::get_type<type>(){ return #type; }
95 
96 #define DEFINE_DUMP_FUNCTION(type) \
97     std::string dump(const std::string structName, const type & var);
98 
99 enum eDumpContect {
100     DUMPCONTEXT_MFX,
101     DUMPCONTEXT_VPP,
102     DUMPCONTEXT_ALL,
103 };
104 
105 enum eDumpFormat {
106     DUMP_DEC,
107     DUMP_HEX
108 };
109 
110 class DumpContext
111 {
112 public:
113     eDumpContect context;
114 
DumpContext(void)115     DumpContext(void) {
116         context = DUMPCONTEXT_ALL;
117     };
~DumpContext(void)118     ~DumpContext(void) {};
119 
120     template<typename T>
121     inline std::string toString( T x, eDumpFormat format = DUMP_DEC){
122         return static_cast< std::ostringstream const & >(
123             ( std::ostringstream() << ((format == DUMP_DEC) ? std::dec : std::hex) << x )).str();
124     }
125 
126     const char* get_bufferid_str(mfxU32 bufferid);
127 
128     template<typename T>
dump_reserved_array(T * data,size_t size)129     std::string dump_reserved_array(T* data, size_t size)
130     {
131         std::stringstream result;
132 
133         result << "{ ";
134         for (size_t i = 0; i < size; ++i) {
135             result << data[i];
136             if (i < (size-1)) result << ", ";
137         }
138         result << " }";
139         return result.str();
140     }
141 
142     template<typename T0, typename T1>
dump_array_with_cast(T0 * data,size_t size)143     std::string dump_array_with_cast(T0* data, size_t size)
144     {
145         std::stringstream result;
146 
147         result << "{ ";
148         for (size_t i = 0; i < size; ++i) {
149             result << (T1)data[i];
150             if (i < (size - 1)) result << ", ";
151         }
152         result << " }";
153         return result.str();
154     }
155 
156     template<typename T>
dump_hex_array(T * data,size_t size)157     std::string dump_hex_array(T* data, size_t size)
158     {
159         std::stringstream result;
160         result << "{ "  << std::hex << std::uppercase;
161         for (size_t i = 0; i < size; ++i)
162             result << std::setw(sizeof(T) * 2) << std::setfill('0') << (mfxU64)data[i];
163         result << " }";
164         return result.str();
165     }
166     template<typename T, size_t N>
dump_hex_array(T (& data)[N])167     inline std::string dump_hex_array(T (&data)[N]) { return dump_hex_array(data, N); }
168 
169 
170     template<typename T>
get_type()171     inline const char* get_type(){ return typeid(T).name(); }
172 
173     template<typename T>
dump(const std::string structName,const T * _struct)174     std::string dump(const std::string structName, const T *_struct)
175     {
176         std::string str = get_type<T>();
177         str += "* " + structName + "=" + ToHexFormatString(_struct) + "\n";
178         if (_struct) str += dump("  " + structName, *_struct);
179         return str;
180     }
dump(const std::string structName,const void * _struct)181     std::string dump(const std::string structName, const void *_struct)
182     {
183         std::string str = "void";
184         str += "* " + structName + "=" + ToHexFormatString(_struct) + "\n";
185         return str;
186     }
187 
188     template<typename T>
dump_mfxExtParams(const std::string structName,const T & _struct)189     inline std::string dump_mfxExtParams(const std::string structName, const T& _struct)
190     {
191         std::string str;
192         std::string name;
193 
194         str += structName + ".NumExtParam=" + ToString(_struct.NumExtParam) + "\n";
195         str += structName + ".ExtParam=" + ToString(_struct.ExtParam) + "\n";
196 
197         if (_struct.ExtParam) {
198             for (mfxU16 i = 0; i < _struct.NumExtParam; ++i)
199             {
200                 if ((!_IsBadReadPtr(_struct.ExtParam, sizeof(mfxExtBuffer**))) && (!_IsBadReadPtr(_struct.ExtParam[i], sizeof(mfxExtBuffer*))))
201                 {
202                     name = structName + ".ExtParam[" + ToString(i) + "]";
203                     str += name + "=" + ToString(_struct.ExtParam[i]) + "\n";
204                     switch (_struct.ExtParam[i]->BufferId)
205                     {
206                         case MFX_EXTBUFF_CODING_OPTION:
207                             str += dump(name, *((mfxExtCodingOption*)_struct.ExtParam[i])) + "\n";
208                             break;
209                         case MFX_EXTBUFF_CODING_OPTION2:
210                             str += dump(name, *((mfxExtCodingOption2*)_struct.ExtParam[i])) + "\n";
211                             break;
212                         case MFX_EXTBUFF_CODING_OPTION3:
213                             str += dump(name, *((mfxExtCodingOption3*)_struct.ExtParam[i])) + "\n";
214                             break;
215                         case MFX_EXTBUFF_ENCODER_RESET_OPTION:
216                             str += dump(name, *((mfxExtEncoderResetOption*)_struct.ExtParam[i])) + "\n";
217                             break;
218                         case  MFX_EXTBUF_CAM_GAMMA_CORRECTION:
219                             str += dump(name, *((mfxExtCamGammaCorrection*)_struct.ExtParam[i])) + "\n";
220                             break;
221                         case  MFX_EXTBUF_CAM_WHITE_BALANCE:
222                             str += dump(name, *((mfxExtCamWhiteBalance*)_struct.ExtParam[i])) + "\n";
223                             break;
224                         case  MFX_EXTBUF_CAM_HOT_PIXEL_REMOVAL:
225                             str += dump(name, *((mfxExtCamHotPixelRemoval*)_struct.ExtParam[i])) + "\n";
226                             break;
227                         case  MFX_EXTBUF_CAM_BLACK_LEVEL_CORRECTION:
228                             str += dump(name, *((mfxExtCamBlackLevelCorrection*)_struct.ExtParam[i])) + "\n";
229                             break;
230                         case  MFX_EXTBUF_CAM_VIGNETTE_CORRECTION:
231                             str += dump(name, *((mfxExtCamVignetteCorrection*)_struct.ExtParam[i])) + "\n";
232                             break;
233                         case  MFX_EXTBUF_CAM_BAYER_DENOISE:
234                             str += dump(name, *((mfxExtCamBayerDenoise*)_struct.ExtParam[i])) + "\n";
235                             break;
236                         case  MFX_EXTBUF_CAM_COLOR_CORRECTION_3X3:
237                             str += dump(name, *((mfxExtCamColorCorrection3x3*)_struct.ExtParam[i])) + "\n";
238                             break;
239                         case  MFX_EXTBUF_CAM_PADDING:
240                             str += dump(name, *((mfxExtCamPadding*)_struct.ExtParam[i])) + "\n";
241                             break;
242                         case  MFX_EXTBUF_CAM_PIPECONTROL:
243                             str += dump(name, *((mfxExtCamPipeControl*)_struct.ExtParam[i])) + "\n";
244                             break;
245                         case  MFX_EXTBUF_CAM_FORWARD_GAMMA_CORRECTION:
246                             str += dump(name, *((mfxExtCamFwdGamma*)_struct.ExtParam[i])) + "\n";
247                             break;
248                         case  MFX_EXTBUF_CAM_LENS_GEOM_DIST_CORRECTION:
249                             str += dump(name, *((mfxExtCamLensGeomDistCorrection*)_struct.ExtParam[i])) + "\n";
250                             break;
251                         case  MFX_EXTBUF_CAM_TOTAL_COLOR_CONTROL:
252                             str += dump(name, *((mfxExtCamTotalColorControl*)_struct.ExtParam[i])) + "\n";
253                             break;
254                         case  MFX_EXTBUF_CAM_CSC_YUV_RGB:
255                             str += dump(name, *((mfxExtCamCscYuvRgb*)_struct.ExtParam[i])) + "\n";
256                             break;
257                         case  MFX_EXTBUFF_LOOKAHEAD_CTRL:
258                             str += dump(name, *((mfxExtLAControl*)_struct.ExtParam[i])) + "\n";
259                             break;
260                         case  MFX_EXTBUFF_LOOKAHEAD_STAT:
261                             str += dump(name, *((mfxExtLAFrameStatistics*)_struct.ExtParam[i])) + "\n";
262                             break;
263                         case  MFX_EXTBUFF_AVC_REFLIST_CTRL:
264                             str += dump(name, *((mfxExtAVCRefListCtrl*)_struct.ExtParam[i])) + "\n";
265                             break;
266                         case  MFX_EXTBUFF_AVC_TEMPORAL_LAYERS:
267                             str += dump(name, *((mfxExtAvcTemporalLayers*)_struct.ExtParam[i])) + "\n";
268                             break;
269                         case  MFX_EXTBUFF_ENCODED_FRAME_INFO:
270                             str += dump(name, *((mfxExtAVCEncodedFrameInfo*)_struct.ExtParam[i])) + "\n";
271                             break;
272                         case  MFX_EXTBUFF_AVC_REFLISTS:
273                             str += dump(name, *((mfxExtAVCRefLists*)_struct.ExtParam[i])) + "\n";
274                             break;
275                         case  MFX_EXTBUFF_JPEG_QT:
276                             str += dump(name, *((mfxExtJPEGQuantTables*)_struct.ExtParam[i])) + "\n";
277                             break;
278                         case  MFX_EXTBUFF_JPEG_HUFFMAN:
279                             str += dump(name, *((mfxExtJPEGHuffmanTables*)_struct.ExtParam[i])) + "\n";
280                             break;
281                         case  MFX_EXTBUFF_MVC_SEQ_DESC:
282                             str += dump(name, *((mfxExtMVCSeqDesc*)_struct.ExtParam[i])) + "\n";
283                             break;
284                         case  MFX_EXTBUFF_MVC_TARGET_VIEWS:
285                             str += dump(name, *((mfxExtMVCTargetViews*)_struct.ExtParam[i])) + "\n";
286                             break;
287                         case  MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION:
288                             str += dump(name, *((mfxExtOpaqueSurfaceAlloc*)_struct.ExtParam[i])) + "\n";
289                             break;
290                         case  MFX_EXTBUFF_VPP_DENOISE:
291                             str += dump(name, *((mfxExtVPPDenoise*)_struct.ExtParam[i])) + "\n";
292                             break;
293                         case  MFX_EXTBUFF_VPP_DETAIL:
294                             str += dump(name, *((mfxExtVPPDetail*)_struct.ExtParam[i])) + "\n";
295                             break;
296                         case  MFX_EXTBUFF_VPP_PROCAMP:
297                             str += dump(name, *((mfxExtVPPProcAmp*)_struct.ExtParam[i])) + "\n";
298                             break;
299                         case  MFX_EXTBUFF_CODING_OPTION_SPSPPS:
300                             str += dump(name, *((mfxExtCodingOptionSPSPPS*)_struct.ExtParam[i])) + "\n";
301                             break;
302                         case  MFX_EXTBUFF_VIDEO_SIGNAL_INFO:
303                             str += dump(name, *((mfxExtVideoSignalInfo*)_struct.ExtParam[i])) + "\n";
304                             break;
305                         case  MFX_EXTBUFF_VPP_DOUSE:
306                             str += dump(name, *((mfxExtVPPDoUse*)_struct.ExtParam[i])) + "\n";
307                             break;
308                         case  MFX_EXTBUFF_PICTURE_TIMING_SEI:
309                             str += dump(name, *((mfxExtPictureTimingSEI*)_struct.ExtParam[i])) + "\n";
310                             break;
311                         case  MFX_EXTBUFF_VPP_COMPOSITE:
312                             str += dump(name, *((mfxExtVPPComposite*)_struct.ExtParam[i])) + "\n";
313                             break;
314                         case  MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO:
315                             str += dump(name, *((mfxExtVPPVideoSignalInfo*)_struct.ExtParam[i])) + "\n";
316                             break;
317                         case  MFX_EXTBUFF_VPP_DEINTERLACING:
318                             str += dump(name, *((mfxExtVPPDeinterlacing*)_struct.ExtParam[i])) + "\n";
319                             break;
320                         case  MFX_EXTBUFF_HEVC_TILES:
321                             str += dump(name, *((mfxExtHEVCTiles*)_struct.ExtParam[i])) + "\n";
322                             break;
323                         case  MFX_EXTBUFF_HEVC_PARAM:
324                             str += dump(name, *((mfxExtHEVCParam*)_struct.ExtParam[i])) + "\n";
325                             break;
326                         case  MFX_EXTBUFF_HEVC_REGION:
327                             str += dump(name, *((mfxExtHEVCRegion*)_struct.ExtParam[i])) + "\n";
328                             break;
329                         case  MFX_EXTBUFF_DECODED_FRAME_INFO:
330                             str += dump(name, *((mfxExtDecodedFrameInfo*)_struct.ExtParam[i])) + "\n";
331                             break;
332                         case  MFX_EXTBUFF_TIME_CODE:
333                             str += dump(name, *((mfxExtTimeCode*)_struct.ExtParam[i])) + "\n";
334                             break;
335                         case  MFX_EXTBUFF_PRED_WEIGHT_TABLE:
336                             str += dump(name, *((mfxExtPredWeightTable*)_struct.ExtParam[i])) + "\n";
337                             break;
338                         case  MFX_EXTBUFF_ENCODER_CAPABILITY:
339                             str += dump(name, *((mfxExtEncoderCapability*)_struct.ExtParam[i])) + "\n";
340                             break;
341                         case  MFX_EXTBUFF_DIRTY_RECTANGLES:
342                             str += dump(name, *((mfxExtDirtyRect*)_struct.ExtParam[i])) + "\n";
343                             break;
344                         case  MFX_EXTBUFF_MOVING_RECTANGLES:
345                             str += dump(name, *((mfxExtMoveRect*)_struct.ExtParam[i])) + "\n";
346                             break;
347                         case  MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION:
348                             str += dump(name, *((mfxExtVPPFrameRateConversion*)_struct.ExtParam[i])) + "\n";
349                             break;
350                         case  MFX_EXTBUFF_VPP_IMAGE_STABILIZATION:
351                             str += dump(name, *((mfxExtVPPImageStab*)_struct.ExtParam[i])) + "\n";
352                             break;
353                         case  MFX_EXTBUFF_ENCODER_ROI:
354                             str += dump(name, *((mfxExtEncoderROI*)_struct.ExtParam[i])) + "\n";
355                             break;
356                         case  MFX_EXTBUFF_FEI_PARAM:
357                             str += dump(name, *((mfxExtFeiParam*)_struct.ExtParam[i])) + "\n";
358                             break;
359                         case  MFX_EXTBUFF_FEI_PREENC_CTRL:
360                             str += dump(name, *((mfxExtFeiPreEncCtrl*)_struct.ExtParam[i])) + "\n";
361                             break;
362                         case  MFX_EXTBUFF_FEI_PREENC_MV_PRED:
363                             str += dump(name, *((mfxExtFeiPreEncMVPredictors*)_struct.ExtParam[i])) + "\n";
364                             break;
365                         case  MFX_EXTBUFF_FEI_ENC_QP:
366                             str += dump(name, *((mfxExtFeiEncQP*)_struct.ExtParam[i])) + "\n";
367                             break;
368                         case  MFX_EXTBUFF_FEI_PREENC_MV:
369                             str += dump(name, *((mfxExtFeiPreEncMV*)_struct.ExtParam[i])) + "\n";
370                             break;
371                         case  MFX_EXTBUFF_FEI_PREENC_MB:
372                             str += dump(name, *((mfxExtFeiPreEncMBStat*)_struct.ExtParam[i])) + "\n";
373                             break;
374                         case  MFX_EXTBUFF_FEI_ENC_CTRL:
375                             str += dump(name, *((mfxExtFeiEncFrameCtrl*)_struct.ExtParam[i])) + "\n";
376                             break;
377                         case  MFX_EXTBUFF_FEI_ENC_MV_PRED:
378                             str += dump(name, *((mfxExtFeiEncMVPredictors*)_struct.ExtParam[i])) + "\n";
379                             break;
380                         case  MFX_EXTBUFF_FEI_ENC_MB:
381                             str += dump(name, *((mfxExtFeiEncMBCtrl*)_struct.ExtParam[i])) + "\n";
382                             break;
383                         case  MFX_EXTBUFF_FEI_ENC_MV:
384                             str += dump(name, *((mfxExtFeiEncMV*)_struct.ExtParam[i])) + "\n";
385                             break;
386                         case  MFX_EXTBUFF_FEI_ENC_MB_STAT:
387                             str += dump(name, *((mfxExtFeiEncMBStat*)_struct.ExtParam[i])) + "\n";
388                             break;
389                         case  MFX_EXTBUFF_FEI_PAK_CTRL:
390                             str += dump(name, *((mfxFeiPakMBCtrl*)_struct.ExtParam[i])) + "\n";
391                             break;
392                         case  MFX_EXTBUFF_FEI_SPS:
393                             str += dump(name, *((mfxExtFeiSPS*)_struct.ExtParam[i])) + "\n";
394                             break;
395                         case  MFX_EXTBUFF_FEI_PPS:
396                             str += dump(name, *((mfxExtFeiPPS*)_struct.ExtParam[i])) + "\n";
397                             break;
398                         case  MFX_EXTBUFF_FEI_SLICE:
399                             str += dump(name, *((mfxExtFeiSliceHeader*)_struct.ExtParam[i])) + "\n";
400                             break;
401                         case  MFX_EXTBUFF_CODING_OPTION_VPS:
402                             str += dump(name, *((mfxExtCodingOptionVPS*)_struct.ExtParam[i])) + "\n";
403                             break;
404                         case  MFX_EXTBUFF_VPP_ROTATION:
405                             str += dump(name, *(( mfxExtVPPRotation*)_struct.ExtParam[i])) + "\n";
406                             break;
407                         case  MFX_EXTBUFF_ENCODED_SLICES_INFO:
408                             str += dump(name, *((mfxExtEncodedSlicesInfo*)_struct.ExtParam[i])) + "\n";
409                             break;
410                         case  MFX_EXTBUFF_VPP_SCALING:
411                             str += dump(name, *((mfxExtVPPScaling*)_struct.ExtParam[i])) + "\n";
412                             break;
413                         case  MFX_EXTBUFF_FEI_CODING_OPTION:
414                             str += dump(name, *((mfxExtFeiCodingOption*)_struct.ExtParam[i])) + "\n";
415                             break;
416                         case MFX_EXTBUFF_FEI_DEC_STREAM_OUT:
417                             str += dump(name, *((mfxExtFeiDecStreamOut*)_struct.ExtParam[i])) + "\n";
418                             break;
419                         case MFX_EXTBUFF_FEI_REPACK_CTRL:
420                             str += dump(name, *((mfxExtFeiRepackCtrl*)_struct.ExtParam[i])) + "\n";
421                             break;
422 #if (MFX_VERSION >= 1025)
423                         case MFX_EXTBUFF_FEI_REPACK_STAT:
424                             str += dump(name, *((mfxExtFeiRepackStat*)_struct.ExtParam[i])) + "\n";
425                             break;
426 #endif
427                         case MFX_EXTBUFF_VPP_MIRRORING:
428                             str += dump(name, *((mfxExtVPPMirroring*)_struct.ExtParam[i])) + "\n";
429                             break;
430                         case MFX_EXTBUFF_MV_OVER_PIC_BOUNDARIES:
431                             str += dump(name, *((mfxExtMVOverPicBoundaries*)_struct.ExtParam[i])) + "\n";
432                             break;
433                         case MFX_EXTBUFF_VPP_COLORFILL:
434                             str += dump(name, *((mfxExtVPPColorFill*)_struct.ExtParam[i])) + "\n";
435                             break;
436                         case MFX_EXTBUFF_DEC_VIDEO_PROCESSING:
437                             str += dump(name, *((mfxExtDecVideoProcessing*)_struct.ExtParam[i])) + "\n";
438                             break;
439                         case MFX_EXTBUFF_BRC:
440                             str += dump(name, *((mfxExtBRC*)_struct.ExtParam[i])) + "\n";
441                             break;
442                         case MFX_EXTBUFF_MBQP:
443                             str += dump(name, *((mfxExtMBQP*)_struct.ExtParam[i])) + "\n";
444                             break;
445                         case MFX_EXTBUFF_ENCODER_IPCM_AREA:
446                             str += dump(name, *((mfxExtEncoderIPCMArea*)_struct.ExtParam[i])) + "\n";
447                             break;
448                         case MFX_EXTBUFF_INSERT_HEADERS:
449                             str += dump(name, *((mfxExtInsertHeaders*)_struct.ExtParam[i])) + "\n";
450                             break;
451 #if (MFX_VERSION >= 1025)
452                         case  MFX_EXTBUFF_DECODE_ERROR_REPORT:
453                             str += dump(name, *((mfxExtDecodeErrorReport*)_struct.ExtParam[i])) + "\n";
454                             break;
455                         case MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME:
456                             str += dump(name, *((mfxExtMasteringDisplayColourVolume*)_struct.ExtParam[i])) + "\n";
457                             break;
458                         case MFX_EXTBUFF_CONTENT_LIGHT_LEVEL_INFO:
459                             str += dump(name, *((mfxExtContentLightLevelInfo*)_struct.ExtParam[i])) + "\n";
460                             break;
461                         case MFX_EXTBUFF_MULTI_FRAME_PARAM:
462                             str += dump(name, *((mfxExtMultiFrameParam*)_struct.ExtParam[i])) + "\n";
463                             break;
464                         case MFX_EXTBUFF_MULTI_FRAME_CONTROL:
465                             str += dump(name, *((mfxExtMultiFrameControl*)_struct.ExtParam[i])) + "\n";
466                             break;
467                         case MFX_EXTBUFF_ENCODED_UNITS_INFO:
468                             str += dump(name, *((mfxExtEncodedUnitsInfo*)_struct.ExtParam[i])) + "\n";
469                             break;
470                         case MFX_EXTBUFF_VPP_COLOR_CONVERSION:
471                             str += dump(name, *((mfxExtColorConversion*)_struct.ExtParam[i])) + "\n";
472                             break;
473 #endif
474 #if (MFX_VERSION >= 1026)
475                         case MFX_EXTBUFF_VPP_MCTF:
476                             str += dump(name, *((mfxExtVppMctf*)_struct.ExtParam[i])) + "\n";
477                             break;
478 #endif
479 
480 #if (MFX_VERSION >= 1026)
481                         case MFX_EXTBUFF_VP9_SEGMENTATION:
482                             str += dump(name, *((mfxExtVP9Segmentation*)_struct.ExtParam[i])) + "\n";
483                             break;
484                         case MFX_EXTBUFF_VP9_TEMPORAL_LAYERS:
485                             str += dump(name, *((mfxExtVP9TemporalLayers*)_struct.ExtParam[i])) + "\n";
486                             break;
487                         case MFX_EXTBUFF_VP9_PARAM:
488                             str += dump(name, *((mfxExtVP9Param*)_struct.ExtParam[i])) + "\n";
489                             break;
490 #endif
491                         default:
492                             str += dump(name, *(_struct.ExtParam[i])) + "\n";
493                             break;
494                     };
495                 }
496                 else
497                 {
498                     str += "WARNING: Can't read from ExtParam[" + ToString(i) + "]!\n";
499                     return str;
500                 }
501 
502             }
503         }
504         return str;
505     }
506 
507     //mfxdefs
508     std::string dump_mfxU32(const std::string structName, mfxU32 u32);
509     std::string dump_mfxU64(const std::string structName, mfxU64 u64);
510     std::string dump_mfxHDL(const std::string structName, const mfxHDL *hdl);
511     std::string dump_mfxStatus(const std::string structName, mfxStatus status);
512 
513     //mfxcommon
514     DEFINE_DUMP_FUNCTION(mfxBitstream);
515     DEFINE_DUMP_FUNCTION(mfxExtBuffer);
516     DEFINE_DUMP_FUNCTION(mfxIMPL);
517     DEFINE_DUMP_FUNCTION(mfxInitParam);
518     DEFINE_DUMP_FUNCTION(mfxPriority);
519     DEFINE_DUMP_FUNCTION(mfxVersion);
520     DEFINE_DUMP_FUNCTION(mfxSyncPoint);
521     DEFINE_DUMP_FUNCTION(mfxExtThreadsParam);
522     DEFINE_DUMP_FUNCTION(mfxPlatform);
523 
524     //mfxenc
525     DEFINE_DUMP_FUNCTION(mfxENCInput);
526     DEFINE_DUMP_FUNCTION(mfxENCOutput);
527 
528     //mfxplugin
529     DEFINE_DUMP_FUNCTION(mfxPlugin);
530     DEFINE_DUMP_FUNCTION(mfxCoreParam);
531     DEFINE_DUMP_FUNCTION(mfxPluginParam);
532     DEFINE_DUMP_FUNCTION(mfxCoreInterface);
533 
534     //mfxstructures
535     DEFINE_DUMP_FUNCTION(mfxDecodeStat);
536     DEFINE_DUMP_FUNCTION(mfxEncodeCtrl);
537     DEFINE_DUMP_FUNCTION(mfxEncodeStat);
538     DEFINE_DUMP_FUNCTION(mfxExtCodingOption);
539     DEFINE_DUMP_FUNCTION(mfxExtCodingOption2);
540     DEFINE_DUMP_FUNCTION(mfxExtCodingOption3);
541     DEFINE_DUMP_FUNCTION(mfxExtEncoderResetOption);
542     DEFINE_DUMP_FUNCTION(mfxExtVppAuxData);
543     DEFINE_DUMP_FUNCTION(mfxFrameAllocRequest);
544     DEFINE_DUMP_FUNCTION(mfxFrameAllocResponse);
545     DEFINE_DUMP_FUNCTION(mfxFrameData);
546     DEFINE_DUMP_FUNCTION(mfxFrameId);
547     DEFINE_DUMP_FUNCTION(mfxFrameInfo);
548     DEFINE_DUMP_FUNCTION(mfxFrameSurface1);
549     DEFINE_DUMP_FUNCTION(mfxHandleType);
550     DEFINE_DUMP_FUNCTION(mfxInfoMFX);
551     DEFINE_DUMP_FUNCTION(mfxInfoVPP);
552     DEFINE_DUMP_FUNCTION(mfxPayload);
553     DEFINE_DUMP_FUNCTION(mfxSkipMode);
554     DEFINE_DUMP_FUNCTION(mfxVideoParam);
555     DEFINE_DUMP_FUNCTION(mfxVPPStat);
556     DEFINE_DUMP_FUNCTION(mfxExtVPPDoNotUse);
557     DEFINE_DUMP_FUNCTION(mfxExtAVCRefListCtrl);
558     DEFINE_DUMP_FUNCTION(mfxExtAvcTemporalLayers);
559     DEFINE_DUMP_FUNCTION(mfxExtAVCEncodedFrameInfo);
560     DEFINE_DUMP_FUNCTION(mfxExtAVCRefLists);
561     DEFINE_DUMP_FUNCTION(mfxExtOpaqueSurfaceAlloc);
562     DEFINE_DUMP_FUNCTION(mfxExtVPPDenoise);
563     DEFINE_DUMP_FUNCTION(mfxExtVPPDetail);
564     DEFINE_DUMP_FUNCTION(mfxExtVPPProcAmp);
565     DEFINE_DUMP_FUNCTION(mfxExtCodingOptionSPSPPS);
566     DEFINE_DUMP_FUNCTION(mfxExtVideoSignalInfo);
567     DEFINE_DUMP_FUNCTION(mfxExtVPPDoUse);
568     DEFINE_DUMP_FUNCTION(mfxExtPictureTimingSEI);
569     DEFINE_DUMP_FUNCTION(mfxVPPCompInputStream);
570     DEFINE_DUMP_FUNCTION(mfxExtVPPComposite);
571     DEFINE_DUMP_FUNCTION(mfxExtVPPVideoSignalInfo);
572     DEFINE_DUMP_FUNCTION(mfxExtVPPDeinterlacing);
573     DEFINE_DUMP_FUNCTION(mfxExtHEVCTiles);
574     DEFINE_DUMP_FUNCTION(mfxExtHEVCParam);
575     DEFINE_DUMP_FUNCTION(mfxExtHEVCRegion);
576     DEFINE_DUMP_FUNCTION(mfxExtDecodedFrameInfo);
577     DEFINE_DUMP_FUNCTION(mfxExtTimeCode);
578     DEFINE_DUMP_FUNCTION(mfxExtPredWeightTable);
579     DEFINE_DUMP_FUNCTION(mfxExtEncoderCapability);
580     DEFINE_DUMP_FUNCTION(mfxExtDirtyRect);
581     DEFINE_DUMP_FUNCTION(mfxExtMoveRect);
582     DEFINE_DUMP_FUNCTION(mfxExtVPPFrameRateConversion);
583     DEFINE_DUMP_FUNCTION(mfxExtVPPImageStab);
584     DEFINE_DUMP_FUNCTION(mfxExtEncoderROI);
585     DEFINE_DUMP_FUNCTION(mfxExtCodingOptionVPS);
586     DEFINE_DUMP_FUNCTION(mfxExtVPPRotation);
587     DEFINE_DUMP_FUNCTION(mfxExtEncodedSlicesInfo);
588     DEFINE_DUMP_FUNCTION(mfxExtVPPScaling);
589     DEFINE_DUMP_FUNCTION(mfxExtVPPMirroring);
590     DEFINE_DUMP_FUNCTION(mfxExtMVOverPicBoundaries);
591     DEFINE_DUMP_FUNCTION(mfxExtVPPColorFill);
592     DEFINE_DUMP_FUNCTION(mfxExtDecVideoProcessing);
593     DEFINE_DUMP_FUNCTION(mfxExtMBQP);
594     DEFINE_DUMP_FUNCTION(mfxExtEncoderIPCMArea);
595     DEFINE_DUMP_FUNCTION(mfxExtInsertHeaders);
596 #if (MFX_VERSION >= 1025)
597     DEFINE_DUMP_FUNCTION(mfxExtDecodeErrorReport);
598     DEFINE_DUMP_FUNCTION(mfxExtMasteringDisplayColourVolume);
599     DEFINE_DUMP_FUNCTION(mfxExtContentLightLevelInfo);
600     DEFINE_DUMP_FUNCTION(mfxExtMultiFrameParam);
601     DEFINE_DUMP_FUNCTION(mfxExtMultiFrameControl);
602     DEFINE_DUMP_FUNCTION(mfxExtEncodedUnitsInfo);
603     DEFINE_DUMP_FUNCTION(mfxExtColorConversion);
604 #endif
605 #if (MFX_VERSION >= 1026)
606     DEFINE_DUMP_FUNCTION(mfxExtVppMctf);
607 #endif
608 
609 #if (MFX_VERSION >= 1026)
610 
611     DEFINE_DUMP_FUNCTION(mfxVP9SegmentParam);
612     DEFINE_DUMP_FUNCTION(mfxExtVP9Segmentation);
613     DEFINE_DUMP_FUNCTION(mfxVP9TemporalLayer);
614     DEFINE_DUMP_FUNCTION(mfxExtVP9TemporalLayers);
615     DEFINE_DUMP_FUNCTION(mfxExtVP9Param);
616 #endif
617 
618 #if (MFX_VERSION >= 1034)
619     DEFINE_DUMP_FUNCTION(mfxExtAV1FilmGrainParam);
620 #endif
621 
622     //mfxsession
623     DEFINE_DUMP_FUNCTION(mfxSession);
624 
625     //mfxvideo
626     DEFINE_DUMP_FUNCTION(mfxBufferAllocator);
627     DEFINE_DUMP_FUNCTION(mfxFrameAllocator);
628 
629     //mfxla
630     DEFINE_DUMP_FUNCTION(mfxExtLAControl);
631     DEFINE_DUMP_FUNCTION(mfxExtLAControl::mfxStream);
632     DEFINE_DUMP_FUNCTION(mfxLAFrameInfo);
633     DEFINE_DUMP_FUNCTION(mfxExtLAFrameStatistics);
634 
635     //mfxfei
636     DEFINE_DUMP_FUNCTION(mfxExtFeiPreEncCtrl);
637     DEFINE_DUMP_FUNCTION(mfxExtFeiPreEncMVPredictors);
638     DEFINE_DUMP_FUNCTION(mfxExtFeiPreEncMV);
639     DEFINE_DUMP_FUNCTION(mfxExtFeiPreEncMBStat);
640     DEFINE_DUMP_FUNCTION(mfxExtFeiEncFrameCtrl);
641     DEFINE_DUMP_FUNCTION(mfxExtFeiEncMVPredictors);
642     DEFINE_DUMP_FUNCTION(mfxExtFeiEncMVPredictors::mfxExtFeiEncMVPredictorsMB);
643     DEFINE_DUMP_FUNCTION(mfxExtFeiEncQP);
644     DEFINE_DUMP_FUNCTION(mfxExtFeiEncMBCtrl);
645     DEFINE_DUMP_FUNCTION(mfxExtFeiEncMBCtrl::mfxExtFeiEncMBCtrlMB);
646     DEFINE_DUMP_FUNCTION(mfxExtFeiEncMV);
647     DEFINE_DUMP_FUNCTION(mfxExtFeiEncMBStat);
648     DEFINE_DUMP_FUNCTION(mfxExtFeiEncMBStat::mfxExtFeiEncMBStatMB);
649     DEFINE_DUMP_FUNCTION(mfxFeiPakMBCtrl);
650     DEFINE_DUMP_FUNCTION(mfxExtFeiPakMBCtrl);
651     DEFINE_DUMP_FUNCTION(mfxExtFeiRepackCtrl);
652 #if (MFX_VERSION >= 1025)
653     DEFINE_DUMP_FUNCTION(mfxExtFeiRepackStat);
654 #endif
655     DEFINE_DUMP_FUNCTION(mfxExtFeiParam);
656     DEFINE_DUMP_FUNCTION(mfxPAKInput);
657     DEFINE_DUMP_FUNCTION(mfxPAKOutput);
658     DEFINE_DUMP_FUNCTION(mfxExtFeiSPS);
659     DEFINE_DUMP_FUNCTION(mfxExtFeiPPS);
660     DEFINE_DUMP_FUNCTION(mfxExtFeiSliceHeader);
661     DEFINE_DUMP_FUNCTION(mfxExtFeiSliceHeader::mfxSlice);
662     DEFINE_DUMP_FUNCTION(mfxExtFeiCodingOption);
663     DEFINE_DUMP_FUNCTION(mfxExtFeiDecStreamOut);
664     DEFINE_DUMP_FUNCTION(mfxFeiDecStreamOutMBCtrl);
665 
666 
667     //mfxvp8
668     DEFINE_DUMP_FUNCTION(mfxExtVP8CodingOption)
669 
670     //mfxcamera
671     DEFINE_DUMP_FUNCTION(mfxExtCamGammaCorrection);
672     DEFINE_DUMP_FUNCTION(mfxExtCamWhiteBalance);
673     DEFINE_DUMP_FUNCTION(mfxExtCamHotPixelRemoval);
674     DEFINE_DUMP_FUNCTION(mfxExtCamBlackLevelCorrection);
675     DEFINE_DUMP_FUNCTION(mfxCamVignetteCorrectionParam);
676     DEFINE_DUMP_FUNCTION(mfxExtCamVignetteCorrection);
677     DEFINE_DUMP_FUNCTION(mfxExtCamBayerDenoise);
678     DEFINE_DUMP_FUNCTION(mfxExtCamColorCorrection3x3);
679     DEFINE_DUMP_FUNCTION(mfxExtCamPadding);
680     DEFINE_DUMP_FUNCTION(mfxExtCamPipeControl);
681     DEFINE_DUMP_FUNCTION(mfxCamFwdGammaSegment);
682     DEFINE_DUMP_FUNCTION(mfxExtCamFwdGamma);
683     DEFINE_DUMP_FUNCTION(mfxExtCamLensGeomDistCorrection);
684     DEFINE_DUMP_FUNCTION(mfxExtCamTotalColorControl);
685     DEFINE_DUMP_FUNCTION(mfxExtCamCscYuvRgb);
686 
687     //mfxjpeg
688     DEFINE_DUMP_FUNCTION(mfxExtJPEGQuantTables);
689     DEFINE_DUMP_FUNCTION(mfxExtJPEGHuffmanTables);
690 
691     //mfxmvc
692     DEFINE_DUMP_FUNCTION(mfxMVCViewDependency);
693     DEFINE_DUMP_FUNCTION(mfxMVCOperationPoint);
694     DEFINE_DUMP_FUNCTION(mfxExtMVCSeqDesc);
695     DEFINE_DUMP_FUNCTION(mfxExtMVCTargetViews);
696 
697     //mfxbrc
698     DEFINE_DUMP_FUNCTION(mfxExtBRC);
699     DEFINE_DUMP_FUNCTION(mfxBRCFrameParam);
700     DEFINE_DUMP_FUNCTION(mfxBRCFrameCtrl);
701     DEFINE_DUMP_FUNCTION(mfxBRCFrameStatus);
702 
703 #if (MFX_VERSION >= MFX_VERSION_NEXT)
704     //custom scaling matrices
705     DEFINE_DUMP_FUNCTION(mfxExtAVCScalingMatrix);
706 #endif
707 
708 #if (MFX_VERSION >= MFX_VERSION_NEXT)
709     //partial output
710     DEFINE_DUMP_FUNCTION(mfxExtPartialBitstreamParam);
711 #endif
712 };
713 #endif //DUMP_H_
714 
715