Debian Codegraph @

media_softlet/agnostic/common/codec/hal/codechal_oca_debug.h

raw
1 /*
2 * Copyright (c) 2022, 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_oca_debug.h
24 //! \brief Defines the oca debug interface shared by codec only.
25 //! \details The debug interface dumps output from Media based on in input config file.
26 //!
27 #ifndef __CODEC_OCA_DEBUG_H__
28 #define __CODEC_OCA_DEBUG_H__
29
30 #include "codec_def_decode_avc.h"
31 #include "codec_def_decode_hevc.h"
32
33 #define CODECHAL_OCA_DECODE_MAX_SLICE_NUM 100
34
35 struct CODECHAL_OCA_LOG_HEADER
36 {
37 uint32_t size; //!< Size of valid data occupied, which is used when filling OCA buffer
38 uint32_t allocSize;
39 };
40
41 struct CODECHAL_OCA_DECODE_HEADER
42 {
43 CODECHAL_OCA_LOG_HEADER Header;
44 MOS_COMPONENT Component; //!< DDI component
45 uint32_t numSlices;
46 bool shortFormatInUse; //HEVC only
47 };
48
49 struct CODECHAL_OCA_DECODE_AVC_PIC_PARAM
50 {
51 struct
52 {
53 bool bValid;
54 CODEC_AVC_PIC_PARAMS params;
55 } picParams;
56 };
57
58 struct CODECHAL_OCA_DECODE_AVC_SLICE_PARAM
59 {
60 bool bValid;
61 struct
62 {
63 uint32_t slice_data_size; //!< Number of bytes in the bitstream buffer for this slice.
64 uint32_t slice_data_offset; //!< The offset to the NAL start code for this slice.
65 // Long format specific
66 uint16_t slice_data_bit_offset; //!< Bit offset from NAL start code to the beginning of slice data.
67 uint16_t first_mb_in_slice; //!< Same as AVC syntax element.
68 uint16_t NumMbsForSlice; //!< Number of MBs in the bitstream associated with this slice.
69 uint8_t slice_type; //!< Same as AVC syntax element.
70 uint8_t direct_spatial_mv_pred_flag; //!< Same as AVC syntax element.
71 uint8_t num_ref_idx_l0_active_minus1; //!< Same as AVC syntax element.
72 uint8_t num_ref_idx_l1_active_minus1; //!< Same as AVC syntax element.
73 uint8_t cabac_init_idc; //!< Same as AVC syntax element.
74 char slice_qp_delta; //!< Same as AVC syntax element.
75 uint8_t disable_deblocking_filter_idc; //!< Same as AVC syntax element.
76 char slice_alpha_c0_offset_div2; //!< Same as AVC syntax element.
77 char slice_beta_offset_div2; //!< Same as AVC syntax element.
78 uint16_t slice_id; //!< Same as AVC syntax element.
79 uint16_t first_mb_in_next_slice;
80 } sliceParams;
81 };
82
83 struct CODECHAL_OCA_DECODE_HEVC_PIC_PARAM
84 {
85 struct
86 {
87 bool bValid;
88 CODEC_HEVC_PIC_PARAMS params;
89 } picParams;
90
91 struct
92 {
93 bool bValid;
94 CODEC_HEVC_EXT_PIC_PARAMS params;
95 } extPicParams;
96
97 struct
98 {
99 bool bValid;
100 CODEC_HEVC_SCC_PIC_PARAMS params;
101 } sccPicParams;
102 };
103
104 struct CODECHAL_OCA_DECODE_HEVC_SLICE_PARAM
105 {
106 bool bValid;
107 struct
108 {
109 uint32_t slice_data_size;
110 uint32_t slice_data_offset;
111 uint16_t NumEmuPrevnBytesInSliceHdr;
112 uint32_t ByteOffsetToSliceData;
113 struct
114 {
115 uint32_t LastSliceOfPic : 1; //!< Specifies if current slice is the last slice of picture.
116 uint32_t dependent_slice_segment_flag : 1; //!< Same as HEVC syntax element
117 uint32_t slice_type : 2; //!< Same as HEVC syntax element
118 uint32_t color_plane_id : 2; //!< Same as HEVC syntax element
119 uint32_t slice_sao_luma_flag : 1; //!< Same as HEVC syntax element
120 uint32_t slice_sao_chroma_flag : 1; //!< Same as HEVC syntax element
121 uint32_t mvd_l1_zero_flag : 1; //!< Same as HEVC syntax element
122 uint32_t cabac_init_flag : 1; //!< Same as HEVC syntax element
123 uint32_t slice_temporal_mvp_enabled_flag : 1; //!< Same as HEVC syntax element
124 uint32_t slice_deblocking_filter_disabled_flag : 1; //!< Same as HEVC syntax element
125 uint32_t collocated_from_l0_flag : 1; //!< Same as HEVC syntax element
126 uint32_t slice_loop_filter_across_slices_enabled_flag : 1; //!< Same as HEVC syntax element
127 uint32_t reserved : 18; //!< Value is used for alignemnt and has no meaning, set to 0.
128 }LongSliceFlags;
129 uint8_t collocated_ref_idx;
130 uint8_t num_ref_idx_l0_active_minus1;
131 uint8_t num_ref_idx_l1_active_minus1;
132 } sliceParams;
133 };
134
135 class CodechalOcaDumper
136 {
137 public:
138 CodechalOcaDumper();
139 virtual ~CodechalOcaDumper();
140
141 void AllocateBufferSize(uint32_t allocSize);
142
143 void SetAvcDecodeParam(
144 PCODEC_AVC_PIC_PARAMS picParams,
145 PCODEC_AVC_SLICE_PARAMS sliceParams,
146 uint32_t numSlices);
147
148 void SetHevcDecodeParam(
149 PCODEC_HEVC_PIC_PARAMS picParams,
150 PCODEC_HEVC_EXT_PIC_PARAMS extPicParams,
151 PCODEC_HEVC_SCC_PIC_PARAMS sccPicParams,
152 PCODEC_HEVC_SLICE_PARAMS sliceParams,
153 PCODEC_HEVC_EXT_SLICE_PARAMS extSliceParams,
154 uint32_t numSlices,
155 bool shortFormatInUse);
156
157 CODECHAL_OCA_DECODE_HEADER *GetDecodeParam()
158 {
159 return m_pOcaDecodeParam;
160 }
161
162 static void Delete(void *&p);
163
164 public:
165 CODECHAL_OCA_DECODE_HEADER *m_pOcaDecodeParam = nullptr;
166 MEDIA_CLASS_DEFINE_END(CodechalOcaDumper)
167 };
168
169 #endif /* __MEDIA_OCA_DEBUG_H__ */