| 1 |
/* |
| 2 |
* Copyright (c) 2018-2024, 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 encode_hevc_pipeline.h |
| 24 |
//! \brief Defines the interface for hevc encode pipeline |
| 25 |
//! |
| 26 |
#include "encode_hevc_pipeline.h" |
| 27 |
#include "encode_utils.h" |
| 28 |
#include "encode_hevc_basic_feature.h" |
| 29 |
|
| 30 |
namespace encode { |
| 31 |
|
| 32 |
HevcPipeline::HevcPipeline( |
| 33 |
CodechalHwInterfaceNext * hwInterface, |
| 34 |
CodechalDebugInterface *debugInterface) |
| 35 |
: EncodePipeline(hwInterface, debugInterface) |
| 36 |
{ |
| 37 |
} |
| 38 |
|
| 39 |
MOS_STATUS HevcPipeline::Initialize(void *settings) |
| 40 |
{ |
| 41 |
ENCODE_FUNC_CALL(); |
| 42 |
ENCODE_CHK_STATUS_RETURN(EncodePipeline::Initialize(settings)); |
| 43 |
|
| 44 |
#if MHW_HWCMDPARSER_ENABLED |
| 45 |
mhw::HwcmdParser::InitInstance(m_osInterface, mhw::HwcmdParser::AddOnMode::HEVCe); |
| 46 |
#endif |
| 47 |
|
| 48 |
return MOS_STATUS_SUCCESS; |
| 49 |
} |
| 50 |
|
| 51 |
MOS_STATUS HevcPipeline::Uninitialize() |
| 52 |
{ |
| 53 |
ENCODE_FUNC_CALL(); |
| 54 |
return EncodePipeline::Uninitialize(); |
| 55 |
} |
| 56 |
|
| 57 |
MOS_STATUS HevcPipeline::UserFeatureReport() |
| 58 |
{ |
| 59 |
ENCODE_FUNC_CALL(); |
| 60 |
ENCODE_CHK_STATUS_RETURN(EncodePipeline::UserFeatureReport()); |
| 61 |
|
| 62 |
ReportUserSetting( |
| 63 |
m_userSettingPtr, |
| 64 |
"HEVC Encode Mode", |
| 65 |
m_codecFunction, |
| 66 |
MediaUserSetting::Group::Sequence); |
| 67 |
|
| 68 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 69 |
ReportUserSettingForDebug( |
| 70 |
m_userSettingPtr, |
| 71 |
__MEDIA_USER_FEATURE_VALUE_SIM_IN_USE, |
| 72 |
m_osInterface->bSimIsActive, |
| 73 |
MediaUserSetting::Group::Device); |
| 74 |
#endif |
| 75 |
|
| 76 |
return MOS_STATUS_SUCCESS; |
| 77 |
} |
| 78 |
|
| 79 |
MOS_STATUS HevcPipeline::Prepare(void *params) |
| 80 |
{ |
| 81 |
ENCODE_FUNC_CALL(); |
| 82 |
|
| 83 |
ENCODE_CHK_STATUS_RETURN(EncodePipeline::Prepare(params)); |
| 84 |
|
| 85 |
auto basicFeature = dynamic_cast<HevcBasicFeature*>(m_featureManager->GetFeature(FeatureIDs::basicFeature)); |
| 86 |
ENCODE_CHK_NULL_RETURN(basicFeature); |
| 87 |
|
| 88 |
CODECHAL_DEBUG_TOOL |
| 89 |
( |
| 90 |
m_debugInterface->m_currPic = basicFeature->m_currOriginalPic; |
| 91 |
m_debugInterface->m_bufferDumpFrameNum = basicFeature->m_frameNum; |
| 92 |
m_debugInterface->m_frameType = basicFeature->m_pictureCodingType; |
| 93 |
|
| 94 |
if (basicFeature->m_newSeq) { |
| 95 |
ENCODE_CHK_STATUS_RETURN(DumpSeqParams( |
| 96 |
basicFeature->m_hevcSeqParams)); |
| 97 |
} |
| 98 |
|
| 99 |
ENCODE_CHK_STATUS_RETURN(DumpPicParams( |
| 100 |
basicFeature->m_hevcPicParams)); |
| 101 |
|
| 102 |
for (uint32_t i = 0; i < basicFeature->m_numSlices; i++) { |
| 103 |
ENCODE_CHK_STATUS_RETURN(DumpSliceParams( |
| 104 |
&basicFeature->m_hevcSliceParams[i], |
| 105 |
basicFeature->m_hevcPicParams)); |
| 106 |
} |
| 107 |
) |
| 108 |
|
| 109 |
#if MHW_HWCMDPARSER_ENABLED |
| 110 |
{ |
| 111 |
char frameType; |
| 112 |
switch (basicFeature->m_hevcPicParams->CodingType) |
| 113 |
{ |
| 114 |
case I_TYPE: |
| 115 |
frameType = 'I'; |
| 116 |
break; |
| 117 |
case P_TYPE: |
| 118 |
frameType = 'P'; |
| 119 |
break; |
| 120 |
case B_TYPE: |
| 121 |
frameType = basicFeature->m_hevcSeqParams->LowDelayMode ? 'G' : 'B'; |
| 122 |
break; |
| 123 |
} |
| 124 |
|
| 125 |
auto instance = mhw::HwcmdParser::GetInstance(); |
| 126 |
if (instance) |
| 127 |
{ |
| 128 |
instance->Update(frameType, (void *)m_featureManager); |
| 129 |
} |
| 130 |
} |
| 131 |
#endif |
| 132 |
|
| 133 |
return MOS_STATUS_SUCCESS; |
| 134 |
} |
| 135 |
|
| 136 |
MOS_STATUS HevcPipeline::CreateBufferTracker() |
| 137 |
{ |
| 138 |
return MOS_STATUS_SUCCESS; |
| 139 |
} |
| 140 |
|
| 141 |
MOS_STATUS HevcPipeline::CreateStatusReport() |
| 142 |
{ |
| 143 |
return MOS_STATUS_SUCCESS; |
| 144 |
} |
| 145 |
|
| 146 |
#if USE_CODECHAL_DEBUG_TOOL |
| 147 |
MOS_STATUS HevcPipeline::DumpSeqParams( |
| 148 |
const CODEC_HEVC_ENCODE_SEQUENCE_PARAMS *seqParams) |
| 149 |
{ |
| 150 |
ENCODE_FUNC_CALL(); |
| 151 |
ENCODE_CHK_NULL_RETURN(m_debugInterface); |
| 152 |
|
| 153 |
if (!m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrSeqParams)) |
| 154 |
{ |
| 155 |
return MOS_STATUS_SUCCESS; |
| 156 |
} |
| 157 |
|
| 158 |
CODECHAL_DEBUG_CHK_NULL(seqParams); |
| 159 |
|
| 160 |
std::ostringstream oss; |
| 161 |
oss.setf(std::ios::showbase | std::ios::uppercase); |
| 162 |
|
| 163 |
oss << "# DDI Parameters:" << std::endl; |
| 164 |
oss << "wFrameWidthInMinCbMinus1 = " << +seqParams->wFrameWidthInMinCbMinus1 << std::endl; |
| 165 |
oss << "wFrameHeightInMinCbMinus1 = " << +seqParams->wFrameHeightInMinCbMinus1 << std::endl; |
| 166 |
oss << "general_profile_idc = " << +seqParams->general_profile_idc << std::endl; |
| 167 |
oss << "Level = " << +seqParams->Level << std::endl; |
| 168 |
oss << "general_tier_flag = " << +seqParams->general_tier_flag << std::endl; |
| 169 |
oss << "GopPicSize = " << +seqParams->GopPicSize << std::endl; |
| 170 |
oss << "GopRefDist = " << +seqParams->GopRefDist << std::endl; |
| 171 |
oss << "GopOptFlag = " << +seqParams->GopOptFlag << std::endl; |
| 172 |
oss << "TargetUsage = " << +seqParams->TargetUsage << std::endl; |
| 173 |
oss << "RateControlMethod = " << +seqParams->RateControlMethod << std::endl; |
| 174 |
oss << "TargetBitRate = " << +seqParams->TargetBitRate << std::endl; |
| 175 |
oss << "MaxBitRate = " << +seqParams->MaxBitRate << std::endl; |
| 176 |
oss << "MinBitRate = " << +seqParams->MinBitRate << std::endl; |
| 177 |
oss << "FramesRate.Numerator = " << +seqParams->FrameRate.Numerator << std::endl; |
| 178 |
oss << "FramesRate.Denominator = " << +seqParams->FrameRate.Denominator << std::endl; |
| 179 |
oss << "InitVBVBufferFullnessInBit = " << +seqParams->InitVBVBufferFullnessInBit << std::endl; |
| 180 |
oss << "VBVBufferSizeInBit = " << +seqParams->VBVBufferSizeInBit << std::endl; |
| 181 |
oss << "bResetBRC = " << +seqParams->bResetBRC << std::endl; |
| 182 |
oss << "GlobalSearch = " << +seqParams->GlobalSearch << std::endl; |
| 183 |
oss << "LocalSearch = " << +seqParams->LocalSearch << std::endl; |
| 184 |
oss << "EarlySkip = " << +seqParams->EarlySkip << std::endl; |
| 185 |
oss << "MBBRC = " << +seqParams->MBBRC << std::endl; |
| 186 |
oss << "ParallelBRC = " << +seqParams->ParallelBRC << std::endl; |
| 187 |
oss << "SliceSizeControl = " << +seqParams->SliceSizeControl << std::endl; |
| 188 |
oss << "SourceFormat = " << +seqParams->SourceFormat << std::endl; |
| 189 |
oss << "SourceBitDepth = " << +seqParams->SourceBitDepth << std::endl; |
| 190 |
oss << "QpAdjustment = " << +seqParams->QpAdjustment << std::endl; |
| 191 |
oss << "ROIValueInDeltaQP = " << +seqParams->ROIValueInDeltaQP << std::endl; |
| 192 |
oss << "NumB = " << +seqParams->NumOfBInGop[0] << std::endl; |
| 193 |
oss << "NumB1 = " << +seqParams->NumOfBInGop[1] << std::endl; |
| 194 |
oss << "NumB2 = " << +seqParams->NumOfBInGop[2] << std::endl; |
| 195 |
oss << "HierarchicalFlag = " << +seqParams->HierarchicalFlag << std::endl; |
| 196 |
oss << "UserMaxIFrameSize = " << +seqParams->UserMaxIFrameSize << std::endl; |
| 197 |
oss << "UserMaxPBFrameSize = " << +seqParams->UserMaxPBFrameSize << std::endl; |
| 198 |
oss << "ICQQualityFactor = " << +seqParams->ICQQualityFactor << std::endl; |
| 199 |
oss << "scaling_list_enable_flag = " << +seqParams->scaling_list_enable_flag << std::endl; |
| 200 |
oss << "sps_temporal_mvp_enable_flag = " << +seqParams->sps_temporal_mvp_enable_flag << std::endl; |
| 201 |
oss << "strong_intra_smoothing_enable_flag = " << +seqParams->strong_intra_smoothing_enable_flag << std::endl; |
| 202 |
oss << "amp_enabled_flag = " << +seqParams->amp_enabled_flag << std::endl; |
| 203 |
oss << "SAO_enabled_flag = " << +seqParams->SAO_enabled_flag << std::endl; |
| 204 |
oss << "pcm_enabled_flag = " << +seqParams->pcm_enabled_flag << std::endl; |
| 205 |
oss << "pcm_loop_filter_disable_flag = " << +seqParams->pcm_loop_filter_disable_flag << std::endl; |
| 206 |
oss << "chroma_format_idc = " << +seqParams->chroma_format_idc << std::endl; |
| 207 |
oss << "separate_colour_plane_flag = " << +seqParams->separate_colour_plane_flag << std::endl; |
| 208 |
oss << "log2_max_coding_block_size_minus3 = " << +seqParams->log2_max_coding_block_size_minus3 << std::endl; |
| 209 |
oss << "log2_min_coding_block_size_minus3 = " << +seqParams->log2_min_coding_block_size_minus3 << std::endl; |
| 210 |
oss << "log2_max_transform_block_size_minus2 = " << +seqParams->log2_max_transform_block_size_minus2 << std::endl; |
| 211 |
oss << "log2_min_transform_block_size_minus2 = " << +seqParams->log2_min_transform_block_size_minus2 << std::endl; |
| 212 |
oss << "max_transform_hierarchy_depth_intra = " << +seqParams->max_transform_hierarchy_depth_intra << std::endl; |
| 213 |
oss << "max_transform_hierarchy_depth_inter = " << +seqParams->max_transform_hierarchy_depth_inter << std::endl; |
| 214 |
oss << "log2_min_PCM_cb_size_minus3 = " << +seqParams->log2_min_PCM_cb_size_minus3 << std::endl; |
| 215 |
oss << "log2_max_PCM_cb_size_minus3 = " << +seqParams->log2_max_PCM_cb_size_minus3 << std::endl; |
| 216 |
oss << "bit_depth_luma_minus8 = " << +seqParams->bit_depth_luma_minus8 << std::endl; |
| 217 |
oss << "bit_depth_chroma_minus8 = " << +seqParams->bit_depth_chroma_minus8 << std::endl; |
| 218 |
oss << "pcm_sample_bit_depth_luma_minus1 = " << +seqParams->pcm_sample_bit_depth_luma_minus1 << std::endl; |
| 219 |
oss << "pcm_sample_bit_depth_chroma_minus1 = " << +seqParams->pcm_sample_bit_depth_chroma_minus1 << std::endl; |
| 220 |
oss << "Video Surveillance Mode = " << +seqParams->bVideoSurveillance << std::endl; |
| 221 |
oss << "ScenarioInfo = " << +seqParams->ScenarioInfo << std::endl; |
| 222 |
oss << "Frame Size Tolerance = " << +seqParams->FrameSizeTolerance << std::endl; |
| 223 |
oss << "palette_mode_enabled_flag = " << +seqParams->palette_mode_enabled_flag << std::endl; |
| 224 |
oss << "RGBInputStudioRange = " << +seqParams->RGBInputStudioRange << std::endl; |
| 225 |
oss << "ConvertedYUVStudioRange = " << +seqParams->ConvertedYUVStudioRange << std::endl; |
| 226 |
oss << "InputColorSpace = " << +seqParams->InputColorSpace << std::endl; |
| 227 |
oss << "Look Ahead Depth = " << +seqParams->LookaheadDepth << std::endl; |
| 228 |
oss << "Look Ahead Phase = " << +seqParams->bLookAheadPhase << std::endl; |
| 229 |
|
| 230 |
const char *fileName = m_debugInterface->CreateFileName( |
| 231 |
"_DDIEnc", |
| 232 |
CodechalDbgBufferType::bufSeqParams, |
| 233 |
CodechalDbgExtType::txt); |
| 234 |
|
| 235 |
std::ofstream ofs(fileName, std::ios::out); |
| 236 |
ofs << oss.str(); |
| 237 |
ofs.close(); |
| 238 |
|
| 239 |
if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrDriverUltDump)) |
| 240 |
{ |
| 241 |
if (!m_debugInterface->m_ddiFileName.empty()) |
| 242 |
{ |
| 243 |
std::ofstream ofs(m_debugInterface->m_ddiFileName, std::ios::app); |
| 244 |
ofs << "SeqParamFile" |
| 245 |
<< " = \"" << m_debugInterface->m_fileName << "\"" << std::endl; |
| 246 |
ofs.close(); |
| 247 |
} |
| 248 |
} |
| 249 |
|
| 250 |
return MOS_STATUS_SUCCESS; |
| 251 |
} |
| 252 |
|
| 253 |
MOS_STATUS HevcPipeline::DumpPicParams( |
| 254 |
const CODEC_HEVC_ENCODE_PICTURE_PARAMS *picParams) |
| 255 |
{ |
| 256 |
ENCODE_FUNC_CALL(); |
| 257 |
ENCODE_CHK_NULL_RETURN(m_debugInterface); |
| 258 |
|
| 259 |
if (!m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrPicParams)) |
| 260 |
{ |
| 261 |
return MOS_STATUS_SUCCESS; |
| 262 |
} |
| 263 |
|
| 264 |
CODECHAL_DEBUG_CHK_NULL(picParams); |
| 265 |
|
| 266 |
std::ostringstream oss; |
| 267 |
oss.setf(std::ios::showbase | std::ios::uppercase); |
| 268 |
|
| 269 |
oss << "# DDI Parameters:" << std::endl; |
| 270 |
oss << "CurrOriginalPic = " << +picParams->CurrOriginalPic.FrameIdx << std::endl; |
| 271 |
oss << "CurrReconstructedPic = " << +picParams->CurrReconstructedPic.FrameIdx << std::endl; |
| 272 |
oss << "CollocatedRefPicIndex = " << +picParams->CollocatedRefPicIndex << std::endl; |
| 273 |
|
| 274 |
for (uint16_t i = 0; i < CODEC_MAX_NUM_REF_FRAME_HEVC; ++i) |
| 275 |
{ |
| 276 |
oss << "RefFrameList[" << +i << "] = " << +picParams->RefFrameList[i].FrameIdx << std::endl; |
| 277 |
} |
| 278 |
|
| 279 |
oss << "CurrPicOrderCnt = " << +picParams->CurrPicOrderCnt << std::endl; |
| 280 |
|
| 281 |
for (uint16_t i = 0; i < CODEC_MAX_NUM_REF_FRAME_HEVC; ++i) |
| 282 |
{ |
| 283 |
oss << "RefFramePOCList[" << +i << "] = " << +picParams->RefFramePOCList[i] << std::endl; |
| 284 |
} |
| 285 |
|
| 286 |
oss << "CodingType = " << +picParams->CodingType << std::endl; |
| 287 |
oss << "HierarchLevelPlus1 = " << +picParams->HierarchLevelPlus1 << std::endl; |
| 288 |
oss << "NumSlices = " << +picParams->NumSlices << std::endl; |
| 289 |
oss << "tiles_enabled_flag = " << +picParams->tiles_enabled_flag << std::endl; |
| 290 |
|
| 291 |
if (picParams->tiles_enabled_flag) |
| 292 |
{ |
| 293 |
oss << "num_tile_columns = " << +picParams->num_tile_columns_minus1 + 1 << std::endl; |
| 294 |
for (uint32_t i = 0; i <= picParams->num_tile_columns_minus1; i++) |
| 295 |
{ |
| 296 |
oss << "tile_column_width[" << +i << "] = " << +picParams->tile_column_width[i] << std::endl; |
| 297 |
} |
| 298 |
oss << "num_tile_rows = " << +picParams->num_tile_rows_minus1 + 1 << std::endl; |
| 299 |
for (uint32_t i = 0; i <= picParams->num_tile_rows_minus1; i++) |
| 300 |
{ |
| 301 |
oss << "tile_row_height[" << +i << "] = " << +picParams->tile_row_height[i] << std::endl; |
| 302 |
} |
| 303 |
} |
| 304 |
|
| 305 |
oss << "entropy_coding_sync_enabled_flag = " << +picParams->entropy_coding_sync_enabled_flag << std::endl; |
| 306 |
oss << "sign_data_hiding_flag = " << +picParams->sign_data_hiding_flag << std::endl; |
| 307 |
oss << "constrained_intra_pred_flag = " << +picParams->constrained_intra_pred_flag << std::endl; |
| 308 |
oss << "transform_skip_enabled_flag = " << +picParams->transform_skip_enabled_flag << std::endl; |
| 309 |
oss << "transquant_bypass_enabled_flag = " << +picParams->transquant_bypass_enabled_flag << std::endl; |
| 310 |
oss << "cu_qp_delta_enabled_flag = " << +picParams->cu_qp_delta_enabled_flag << std::endl; |
| 311 |
oss << "weighted_pred_flag = " << +picParams->weighted_pred_flag << std::endl; |
| 312 |
oss << "weighted_bipred_flag = " << +picParams->weighted_bipred_flag << std::endl; |
| 313 |
oss << "bEnableGPUWeightedPrediction = " << +picParams->bEnableGPUWeightedPrediction << std::endl; |
| 314 |
oss << "loop_filter_across_slices_flag = " << +picParams->loop_filter_across_slices_flag << std::endl; |
| 315 |
oss << "loop_filter_across_tiles_flag = " << +picParams->loop_filter_across_tiles_flag << std::endl; |
| 316 |
oss << "scaling_list_data_present_flag = " << +picParams->scaling_list_data_present_flag << std::endl; |
| 317 |
oss << "dependent_slice_segments_enabled_flag = " << +picParams->dependent_slice_segments_enabled_flag << std::endl; |
| 318 |
oss << "bLastPicInSeq = " << +picParams->bLastPicInSeq << std::endl; |
| 319 |
oss << "bLastPicInStream = " << +picParams->bLastPicInStream << std::endl; |
| 320 |
oss << "bUseRawPicForRef = " << +picParams->bUseRawPicForRef << std::endl; |
| 321 |
oss << "bEmulationByteInsertion = " << +picParams->bEmulationByteInsertion << std::endl; |
| 322 |
oss << "bEnableRollingIntraRefresh = " << +picParams->bEnableRollingIntraRefresh << std::endl; |
| 323 |
oss << "BRCPrecision = " << +picParams->BRCPrecision << std::endl; |
| 324 |
oss << "bScreenContent = " << +picParams->bScreenContent << std::endl; |
| 325 |
oss << "QpY = " << +picParams->QpY << std::endl; |
| 326 |
oss << "diff_cu_qp_delta_depth = " << +picParams->diff_cu_qp_delta_depth << std::endl; |
| 327 |
oss << "pps_cb_qp_offset = " << +picParams->pps_cb_qp_offset << std::endl; |
| 328 |
oss << "pps_cr_qp_offset = " << +picParams->pps_cr_qp_offset << std::endl; |
| 329 |
oss << "num_tile_columns_minus1 = " << +picParams->num_tile_columns_minus1 << std::endl; |
| 330 |
oss << "num_tile_rows_minus1 = " << +picParams->num_tile_rows_minus1 << std::endl; |
| 331 |
oss << "log2_parallel_merge_level_minus2 = " << +picParams->log2_parallel_merge_level_minus2 << std::endl; |
| 332 |
oss << "num_ref_idx_l0_default_active_minus1 = " << +picParams->num_ref_idx_l0_default_active_minus1 << std::endl; |
| 333 |
oss << "num_ref_idx_l1_default_active_minus1 = " << +picParams->num_ref_idx_l1_default_active_minus1 << std::endl; |
| 334 |
oss << "LcuMaxBitsizeAllowed = " << +picParams->LcuMaxBitsizeAllowed << std::endl; |
| 335 |
oss << "IntraInsertionLocation = " << +picParams->IntraInsertionLocation << std::endl; |
| 336 |
oss << "IntraInsertionSize = " << +picParams->IntraInsertionSize << std::endl; |
| 337 |
oss << "QpDeltaForInsertedIntra = " << +picParams->QpDeltaForInsertedIntra << std::endl; |
| 338 |
oss << "StatusReportFeedbackNumber = " << +picParams->StatusReportFeedbackNumber << std::endl; |
| 339 |
oss << "slice_pic_parameter_set_id = " << +picParams->slice_pic_parameter_set_id << std::endl; |
| 340 |
oss << "nal_unit_type = " << +picParams->nal_unit_type << std::endl; |
| 341 |
oss << "MaxSliceSizeInBytes = " << +picParams->MaxSliceSizeInBytes << std::endl; |
| 342 |
oss << "NumROI = " << +picParams->NumROI << std::endl; |
| 343 |
|
| 344 |
for (uint8_t i = 0; i < 16; ++i) |
| 345 |
{ |
| 346 |
oss << "ROI[" << +i << "] = "; |
| 347 |
oss << picParams->ROI[i].Top << " "; |
| 348 |
oss << picParams->ROI[i].Bottom << " "; |
| 349 |
oss << picParams->ROI[i].Left << " "; |
| 350 |
oss << picParams->ROI[i].Right << " "; |
| 351 |
oss << +picParams->ROI[i].PriorityLevelOrDQp << std::endl; |
| 352 |
} |
| 353 |
oss << "MaxDeltaQp = " << +picParams->MaxDeltaQp << std::endl; |
| 354 |
oss << "MinDeltaQp = " << +picParams->MinDeltaQp << std::endl; |
| 355 |
oss << "NumDirtyRects = " << +picParams->NumDirtyRects << std::endl; |
| 356 |
|
| 357 |
if ((picParams->NumDirtyRects > 0) && picParams->pDirtyRect) |
| 358 |
{ |
| 359 |
for (uint16_t i = 0; i < picParams->NumDirtyRects; i++) |
| 360 |
{ |
| 361 |
oss << "pDirtyRect[" << +i << "].Bottom = " << +picParams->pDirtyRect[i].Bottom << std::endl; |
| 362 |
oss << "pDirtyRect[" << +i << "].Top = " << +picParams->pDirtyRect[i].Top << std::endl; |
| 363 |
oss << "pDirtyRect[" << +i << "].Left = " << +picParams->pDirtyRect[i].Left << std::endl; |
| 364 |
oss << "pDirtyRect[" << +i << "].Right = " << +picParams->pDirtyRect[i].Right << std::endl; |
| 365 |
} |
| 366 |
} |
| 367 |
|
| 368 |
oss << "TargetFrameSize = " << +picParams->TargetFrameSize << std::endl; |
| 369 |
oss << "pps_curr_pic_ref_enabled_flag = " << +picParams->pps_curr_pic_ref_enabled_flag << std::endl; |
| 370 |
|
| 371 |
const char *fileName = m_debugInterface->CreateFileName( |
| 372 |
"_DDIEnc", |
| 373 |
CodechalDbgBufferType::bufPicParams, |
| 374 |
CodechalDbgExtType::txt); |
| 375 |
|
| 376 |
std::ofstream ofs(fileName, std::ios::out); |
| 377 |
ofs << oss.str(); |
| 378 |
ofs.close(); |
| 379 |
|
| 380 |
if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrDriverUltDump)) |
| 381 |
{ |
| 382 |
if (!m_debugInterface->m_ddiFileName.empty()) |
| 383 |
{ |
| 384 |
std::ofstream ofs(m_debugInterface->m_ddiFileName, std::ios::app); |
| 385 |
ofs << "PicNum" |
| 386 |
<< " = \"" << m_debugInterface->m_bufferDumpFrameNum << "\"" << std::endl; |
| 387 |
ofs << "PicParamFile" |
| 388 |
<< " = \"" << m_debugInterface->m_fileName << "\"" << std::endl; |
| 389 |
ofs.close(); |
| 390 |
} |
| 391 |
} |
| 392 |
|
| 393 |
return MOS_STATUS_SUCCESS; |
| 394 |
} |
| 395 |
|
| 396 |
MOS_STATUS HevcPipeline::DumpSliceParams( |
| 397 |
const CODEC_HEVC_ENCODE_SLICE_PARAMS * sliceParams, |
| 398 |
const CODEC_HEVC_ENCODE_PICTURE_PARAMS *picParams) |
| 399 |
{ |
| 400 |
ENCODE_FUNC_CALL(); |
| 401 |
|
| 402 |
ENCODE_CHK_NULL_RETURN(m_debugInterface); |
| 403 |
|
| 404 |
if (!m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrSlcParams)) |
| 405 |
{ |
| 406 |
return MOS_STATUS_SUCCESS; |
| 407 |
} |
| 408 |
|
| 409 |
CODECHAL_DEBUG_CHK_NULL(sliceParams); |
| 410 |
|
| 411 |
m_debugInterface->m_sliceId = sliceParams->slice_id; // set here for constructing debug file name |
| 412 |
|
| 413 |
std::ostringstream oss; |
| 414 |
oss.setf(std::ios::showbase | std::ios::uppercase); |
| 415 |
|
| 416 |
oss << "# DDI Parameters:" << std::endl; |
| 417 |
oss << "slice_segment_address = " << +sliceParams->slice_segment_address << std::endl; |
| 418 |
oss << "NumLCUsInSlice = " << +sliceParams->NumLCUsInSlice << std::endl; |
| 419 |
|
| 420 |
// RefPicList (2 x CODEC_MAX_NUM_REF_FRAME_HEVC) |
| 421 |
for (uint8_t i = 0; i < 2; ++i) |
| 422 |
{ |
| 423 |
for (uint8_t j = 0; j < CODEC_MAX_NUM_REF_FRAME_HEVC; ++j) |
| 424 |
{ |
| 425 |
oss << "RefPicList[" << +i << "][" << +j << "] = " << +sliceParams->RefPicList[i][j].PicEntry << std::endl; |
| 426 |
} |
| 427 |
} |
| 428 |
|
| 429 |
oss << "num_ref_idx_l0_active_minus1 = " << +sliceParams->num_ref_idx_l0_active_minus1 << std::endl; |
| 430 |
oss << "num_ref_idx_l1_active_minus1 = " << +sliceParams->num_ref_idx_l1_active_minus1 << std::endl; |
| 431 |
oss << "bLastSliceOfPic = " << +sliceParams->bLastSliceOfPic << std::endl; |
| 432 |
oss << "dependent_slice_segment_flag = " << +sliceParams->dependent_slice_segment_flag << std::endl; |
| 433 |
oss << "slice_temporal_mvp_enable_flag = " << +sliceParams->slice_temporal_mvp_enable_flag << std::endl; |
| 434 |
oss << "slice_type = " << +sliceParams->slice_type << std::endl; |
| 435 |
oss << "slice_sao_luma_flag = " << +sliceParams->slice_sao_luma_flag << std::endl; |
| 436 |
oss << "slice_sao_chroma_flag = " << +sliceParams->slice_sao_chroma_flag << std::endl; |
| 437 |
oss << "mvd_l1_zero_flag = " << +sliceParams->mvd_l1_zero_flag << std::endl; |
| 438 |
oss << "cabac_init_flag = " << +sliceParams->cabac_init_flag << std::endl; |
| 439 |
oss << "slice_deblocking_filter_disable_flag = " << +sliceParams->slice_deblocking_filter_disable_flag << std::endl; |
| 440 |
oss << "collocated_from_l0_flag = " << +sliceParams->collocated_from_l0_flag << std::endl; |
| 441 |
oss << "slice_qp_delta = " << +sliceParams->slice_qp_delta << std::endl; |
| 442 |
oss << "slice_cb_qp_offset = " << +sliceParams->slice_cb_qp_offset << std::endl; |
| 443 |
oss << "slice_cr_qp_offset = " << +sliceParams->slice_cr_qp_offset << std::endl; |
| 444 |
oss << "beta_offset_div2 = " << +sliceParams->beta_offset_div2 << std::endl; |
| 445 |
oss << "tc_offset_div2 = " << +sliceParams->tc_offset_div2 << std::endl; |
| 446 |
oss << "luma_log2_weight_denom = " << +sliceParams->luma_log2_weight_denom << std::endl; |
| 447 |
oss << "delta_chroma_log2_weight_denom = " << +sliceParams->delta_chroma_log2_weight_denom << std::endl; |
| 448 |
|
| 449 |
for (uint8_t i = 0; i < 2; ++i) |
| 450 |
{ |
| 451 |
for (uint8_t j = 0; j < CODEC_MAX_NUM_REF_FRAME_HEVC; ++j) |
| 452 |
{ |
| 453 |
oss << "luma_offset[" << +i << "][" << +j << "] = " << +sliceParams->luma_offset[i][j] << std::endl; |
| 454 |
|
| 455 |
oss << "delta_luma_weight[" << +i << "][" << +j << "] = " << +sliceParams->delta_luma_weight[i][j] << std::endl; |
| 456 |
} |
| 457 |
} |
| 458 |
|
| 459 |
for (uint8_t i = 0; i < 2; ++i) |
| 460 |
{ |
| 461 |
for (uint8_t j = 0; j < CODEC_MAX_NUM_REF_FRAME_HEVC; ++j) |
| 462 |
{ |
| 463 |
for (uint8_t k = 0; k < 2; ++k) |
| 464 |
{ |
| 465 |
oss << "chroma_offset[" << +i << "][" << +j << "][" << +k << "] = " << +sliceParams->chroma_offset[i][j][k] << std::endl; |
| 466 |
oss << "delta_chroma_weight[" << +i << "][" << +j << "][" << +k << "] = " << +sliceParams->delta_chroma_weight[i][j][k] << std::endl; |
| 467 |
} |
| 468 |
} |
| 469 |
} |
| 470 |
|
| 471 |
oss << "PredWeightTableBitOffset = " << +sliceParams->PredWeightTableBitOffset << std::endl; |
| 472 |
oss << "PredWeightTableBitLength = " << +sliceParams->PredWeightTableBitLength << std::endl; |
| 473 |
oss << "MaxNumMergeCand = " << +sliceParams->MaxNumMergeCand << std::endl; |
| 474 |
oss << "slice_id = " << +sliceParams->slice_id << std::endl; |
| 475 |
oss << "SliceHeaderByteOffset = " << +sliceParams->SliceHeaderByteOffset << std::endl; |
| 476 |
oss << "BitLengthSliceHeaderStartingPortion = " << +sliceParams->BitLengthSliceHeaderStartingPortion << std::endl; |
| 477 |
oss << "SliceSAOFlagBitOffset = " << +sliceParams->SliceSAOFlagBitOffset << std::endl; |
| 478 |
|
| 479 |
const char *fileName = m_debugInterface->CreateFileName( |
| 480 |
"_DDIEnc", |
| 481 |
CodechalDbgBufferType::bufSlcParams, |
| 482 |
CodechalDbgExtType::txt); |
| 483 |
|
| 484 |
std::ofstream ofs(fileName, std::ios::out); |
| 485 |
ofs << oss.str(); |
| 486 |
ofs.close(); |
| 487 |
|
| 488 |
if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrDriverUltDump)) |
| 489 |
{ |
| 490 |
if (!m_debugInterface->m_ddiFileName.empty()) |
| 491 |
{ |
| 492 |
std::ofstream ofs(m_debugInterface->m_ddiFileName, std::ios::app); |
| 493 |
ofs << "SlcParamFile" |
| 494 |
<< " = \"" << m_debugInterface->m_fileName << "\"" << std::endl; |
| 495 |
ofs.close(); |
| 496 |
} |
| 497 |
} |
| 498 |
|
| 499 |
return MOS_STATUS_SUCCESS; |
| 500 |
} |
| 501 |
#endif |
| 502 |
|
| 503 |
} |