Debian Codegraph @

media_softlet/agnostic/common/codec/hal/dec/vvc/pipeline/decode_vvc_pipeline.cpp

raw
1 /*
2 * Copyright (c) 2021-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 decode_vvc_pipeline.cpp
24 //! \brief Defines the interface for vvc decode pipeline
25 //!
26 #include "decode_vvc_pipeline.h"
27 #include "decode_utils.h"
28 #include "codechal_debug.h"
29 #include "decode_vvc_feature_manager.h"
30 #include "decode_vvc_packet.h"
31 #include "decode_mem_compression.h"
32 #include "media_debug_fast_dump.h"
33 #include "decode_vvc_debug_packet.h"
34
35 namespace decode
36 {
37 VvcPipeline::VvcPipeline(
38 CodechalHwInterfaceNext * hwInterface,
39 CodechalDebugInterface *debugInterface)
40 : DecodePipeline(hwInterface, debugInterface)
41 {
42 m_hwInterface = hwInterface;
43 }
44
45 MOS_STATUS VvcPipeline::InitContext()
46 {
47 DECODE_FUNC_CALL();
48
49 DECODE_CHK_NULL(m_basicFeature);
50
51 DecodeScalabilityPars scalPars;
52 MOS_ZeroMemory(&scalPars, sizeof(scalPars));
53 scalPars.disableScalability = true;
54 scalPars.enableVE = MOS_VE_SUPPORTED(m_osInterface);
55 scalPars.usingSlimVdbox = false;
56 scalPars.numVdbox = m_numVdbox;
57
58 m_mediaContext->SwitchContext(VdboxDecodeFunc, &scalPars, &m_scalability);
59 DECODE_CHK_NULL(m_scalability);
60
61 m_decodeContext = m_osInterface->pfnGetGpuContext(m_osInterface);
62 m_decodeContextHandle = m_osInterface->CurrentGpuContextHandle;
63
64 m_passNum = (uint16_t)m_basicFeature->m_numSlices;
65 m_basicFeature->m_curSlice = 0;
66 m_scalability->SetPassNumber(m_passNum);
67
68 return MOS_STATUS_SUCCESS;
69 }
70
71 MOS_STATUS VvcPipeline::ActivateDecodePackets()
72 {
73 DECODE_FUNC_CALL();
74 if (m_basicFeature->m_shortFormatInUse)
75 {
76 DECODE_CHK_STATUS(ActivatePacket(DecodePacketId(this, vvcDecodeS2LPktId), false, 0, 0));
77 }
78
79 for (uint16_t curPass = 0; curPass < GetPassNum(); curPass++)
80 {
81 DECODE_CHK_STATUS(ActivatePacket(DecodePacketId(this, vvcDecodePacketId), false, curPass, 0));
82 }
83
84 return MOS_STATUS_SUCCESS;
85 }
86
87 MOS_STATUS VvcPipeline::Prepare(void *params)
88 {
89 DECODE_FUNC_CALL();
90
91 DECODE_CHK_NULL(params);
92 DECODE_CHK_NULL(m_basicFeature);
93
94 DecodePipelineParams *pipelineParams = (DecodePipelineParams *)params;
95 m_pipeMode = pipelineParams->m_pipeMode;
96
97 PERF_UTILITY_AUTO((__FUNCTION__ + std::to_string((int)m_pipeMode)).c_str(), PERF_DECODE, PERF_LEVEL_HAL);
98
99 if (IsFirstProcessPipe(*pipelineParams))
100 {
101 DECODE_CHK_STATUS(DecodePipeline::Prepare(params));
102 }
103
104 DECODE_CHK_STATUS(m_preSubPipeline->Prepare(*pipelineParams));
105 DECODE_CHK_STATUS(m_postSubPipeline->Prepare(*pipelineParams));
106
107 if (m_pipeMode == decodePipeModeProcess)
108 {
109 if (IsCompleteBitstream())
110 {
111 CODECHAL_DEBUG_TOOL(DECODE_CHK_STATUS(DumpParams(*m_basicFeature)));
112
113 DecodeStatusParameters inputParameters = {};
114 MOS_ZeroMemory(&inputParameters, sizeof(DecodeStatusParameters));
115 inputParameters.statusReportFeedbackNumber = m_basicFeature->m_vvcPicParams->m_statusReportFeedbackNumber;
116 inputParameters.codecFunction = m_basicFeature->m_codecFunction;
117 inputParameters.picWidthInMb = m_basicFeature->m_picWidthInMb;
118 inputParameters.pictureCodingType = m_basicFeature->m_pictureCodingType;
119 inputParameters.currOriginalPic = m_basicFeature->m_curRenderPic;
120 inputParameters.currDecodedPicRes = m_basicFeature->m_destSurface.OsResource;
121 inputParameters.numUsedVdbox = m_numVdbox;
122 m_allocator->UpdateResoreceUsageType(&inputParameters.currDecodedPicRes, resourceOutputPicture);
123 m_statusReport->Init(&inputParameters);
124 }
125 }
126
127 return MOS_STATUS_SUCCESS;
128 }
129
130 MOS_STATUS VvcPipeline::Execute()
131 {
132 DECODE_FUNC_CALL();
133
134 PERF_UTILITY_AUTO((__FUNCTION__ + std::to_string((int)m_pipeMode)).c_str(), PERF_DECODE, PERF_LEVEL_HAL);
135
136 if (m_pipeMode == decodePipeModeBegin)
137 {
138 return MOS_STATUS_SUCCESS;
139 }
140
141 DECODE_CHK_NULL(m_basicFeature);
142 DECODE_CHK_NULL(m_basicFeature->m_vvcPicParams);
143
144 if (m_pipeMode == decodePipeModeProcess)
145 {
146 DECODE_CHK_STATUS(m_preSubPipeline->Execute());
147
148 if (IsCompleteBitstream())
149 {
150 AllocateResources(*m_basicFeature);
151 DECODE_CHK_STATUS(InitContext());
152 DECODE_CHK_STATUS(ActivateDecodePackets());
153 DECODE_CHK_STATUS(ExecuteActivePackets());
154 }
155
156 DECODE_CHK_STATUS(m_postSubPipeline->Execute());
157 }
158 else if (m_pipeMode == decodePipeModeEnd)
159 {
160 DECODE_CHK_NULL(m_basicFeature);
161 CODECHAL_DEBUG_TOOL(
162 m_debugInterface->m_bufferDumpFrameNum = m_basicFeature->m_frameNum;
163 DECODE_CHK_STATUS(m_debugInterface->DumpYUVSurface(
164 &m_basicFeature->m_destSurface,
165 CodechalDbgAttr::attrDecodeOutputSurface,
166 "DstSurf"));)
167
168 CODECHAL_DEBUG_TOOL(
169 PMHW_BATCH_BUFFER batchBuffer = m_vvcDecodePkt->GetPictureLvlBB();
170 DECODE_CHK_NULL(batchBuffer);
171 batchBuffer->iLastCurrent = batchBuffer->iSize;
172 batchBuffer->dwOffset = 0;
173 DECODE_CHK_STATUS(m_debugInterface->Dump2ndLvlBatch(
174 batchBuffer,
175 CODECHAL_NUM_MEDIA_STATES,
176 "VVC_DEC_Pic"));)
177
178 if (m_basicFeature->m_shortFormatInUse) // Is Short Format In Use
179 {
180 CODECHAL_DEBUG_TOOL(
181 PMHW_BATCH_BUFFER batchBuffer = GetSliceLvlCmdBuffer();
182 DECODE_CHK_NULL(batchBuffer);
183 batchBuffer->iLastCurrent = batchBuffer->iSize;
184 batchBuffer->dwOffset = 0;
185 DECODE_CHK_STATUS(m_debugInterface->Dump2ndLvlBatch(
186 batchBuffer,
187 CODECHAL_NUM_MEDIA_STATES,
188 "VVC_DEC_Slice"));)
189 CODECHAL_DEBUG_TOOL(
190 PMHW_BATCH_BUFFER pbatchBuffer = GetTileLvlCmdBuffer();
191 DECODE_CHK_NULL(pbatchBuffer);
192 pbatchBuffer->iLastCurrent = pbatchBuffer->iSize;
193 pbatchBuffer->dwOffset = 0;
194 DECODE_CHK_STATUS(m_debugInterface->Dump2ndLvlBatch(
195 pbatchBuffer,
196 CODECHAL_NUM_MEDIA_STATES,
197 "VVC_DEC_Tile"));)
198 }
199
200 #if (_DEBUG || _RELEASE_INTERNAL)
201 DECODE_CHK_STATUS(StatusCheck());
202 #endif
203
204 // Only update user features for the first frame.
205 if (m_basicFeature->m_frameNum == 0)
206 {
207 DECODE_CHK_STATUS(UserFeatureReport());
208 }
209
210 DecodeFrameIndex++;
211 m_basicFeature->m_frameNum = DecodeFrameIndex;
212
213 DECODE_CHK_STATUS(m_statusReport->Reset());
214 }
215
216 return MOS_STATUS_SUCCESS;
217 }
218
219 MOS_STATUS VvcPipeline::GetStatusReport(void *status, uint16_t numStatus)
220 {
221 DECODE_FUNC_CALL();
222
223 m_statusReport->GetReport(numStatus, status);
224
225 return MOS_STATUS_SUCCESS;
226 }
227
228 uint32_t VvcPipeline::GetCompletedReport()
229 {
230 DECODE_FUNC_CALL();
231
232 uint32_t completedCount = m_statusReport->GetCompletedCount();
233 uint32_t reportedCount = m_statusReport->GetReportedCount();
234
235 if (reportedCount > completedCount)
236 {
237 DECODE_ASSERTMESSAGE("No report available at all");
238 return 0;
239 }
240 else
241 {
242 uint32_t availableCount = completedCount - reportedCount;
243 return availableCount;
244 }
245 }
246
247 MOS_STATUS VvcPipeline::Destroy()
248 {
249 DECODE_FUNC_CALL();
250
251 Uninitialize();
252
253 return MOS_STATUS_SUCCESS;
254 }
255
256 MOS_STATUS VvcPipeline::Initialize(void *settings)
257 {
258 DECODE_FUNC_CALL();
259 DECODE_CHK_STATUS(DecodePipeline::Initialize(settings));
260 m_basicFeature = dynamic_cast<VvcBasicFeature*>(m_featureManager->GetFeature(FeatureIDs::basicFeature));
261 DECODE_CHK_NULL(m_basicFeature);
262
263 DECODE_CHK_STATUS(InitMmcState());
264
265 return MOS_STATUS_SUCCESS;
266 }
267
268 MOS_STATUS VvcPipeline::Uninitialize()
269 {
270 DECODE_FUNC_CALL();
271
272 for (auto pair : m_packetList)
273 {
274 pair.second->Destroy();
275 }
276
277 if (m_mmcState != nullptr)
278 {
279 MOS_Delete(m_mmcState);
280 }
281
282 if (m_allocator && m_basicFeature->m_shortFormatInUse && m_sliceLevelBBArray)
283 {
284 DECODE_CHK_STATUS(m_allocator->Destroy(m_sliceLevelBBArray));
285 }
286 if (m_allocator && m_basicFeature->m_shortFormatInUse && m_tileLevelBBArray)
287 {
288 DECODE_CHK_STATUS(m_allocator->Destroy(m_tileLevelBBArray));
289 }
290
291
292 return DecodePipeline::Uninitialize();
293 }
294
295 MOS_STATUS VvcPipeline::UserFeatureReport()
296 {
297 DECODE_FUNC_CALL();
298 DECODE_CHK_STATUS(DecodePipeline::UserFeatureReport());
299
300 CODECHAL_DEBUG_TOOL(
301 if (m_mmcState != nullptr){
302 m_mmcState->UpdateUserFeatureKey(&(m_basicFeature->m_destSurface));
303 })
304
305 return MOS_STATUS_SUCCESS;
306 }
307
308 MOS_STATUS VvcPipeline::CreateSubPackets(DecodeSubPacketManager &subPacketManager, CodechalSetting &codecSettings)
309 {
310 DECODE_CHK_STATUS(DecodePipeline::CreateSubPackets(subPacketManager, codecSettings));
311
312 VvcDecodePicPkt *pictureDecodePkt = MOS_New(VvcDecodePicPkt, this, m_hwInterface);
313 DECODE_CHK_NULL(pictureDecodePkt);
314 DECODE_CHK_STATUS(subPacketManager.Register(
315 DecodePacketId(this, vvcPictureSubPacketId), *pictureDecodePkt));
316
317 VvcDecodeSlicePkt *sliceDecodePkt = MOS_New(VvcDecodeSlicePkt, this, m_hwInterface);
318 DECODE_CHK_NULL(sliceDecodePkt);
319 DECODE_CHK_STATUS(subPacketManager.Register(
320 DecodePacketId(this, vvcSliceSubPacketId), *sliceDecodePkt));
321
322 DECODE_CHK_STATUS(RegisterCpSubPacket(subPacketManager));
323
324 return MOS_STATUS_SUCCESS;
325 }
326
327 MOS_STATUS VvcPipeline::RegisterCpSubPacket(DecodeSubPacketManager &subPacketManager)
328 {
329 if (m_decodecp != nullptr)
330 {
331 auto feature = dynamic_cast<VvcBasicFeature *>(m_featureManager->GetFeature(FeatureIDs::basicFeature));
332 DECODE_CHK_NULL(feature);
333 DecodeSubPacket *cpSubPkt = (DecodeSubPacket *)m_decodecp->CreateDecodeCpIndSubPkt((DecodePipeline *)this, feature->m_mode, m_hwInterface);
334 DECODE_CHK_NULL(cpSubPkt);
335 DECODE_CHK_STATUS(subPacketManager.Register(
336 DecodePacketId(this, vvcCpSubPacketId), *cpSubPkt));
337 }
338
339 return MOS_STATUS_SUCCESS;
340 }
341
342 MOS_STATUS VvcPipeline::InitMmcState()
343 {
344 DECODE_CHK_NULL(m_hwInterface);
345 DECODE_CHK_NULL(m_basicFeature);
346
347 m_mmcState = MOS_New(DecodeMemComp, m_hwInterface);
348 DECODE_CHK_NULL(m_mmcState);
349 DECODE_CHK_STATUS(m_basicFeature->SetMmcState(m_mmcState->IsMmcEnabled()));
350
351 return MOS_STATUS_SUCCESS;
352 }
353
354 MOS_STATUS VvcPipeline::AllocateResources(VvcBasicFeature &basicFeature)
355 {
356 DECODE_FUNC_CALL();
357 uint32_t vvcpSliceCommandsSize = 0;
358 uint32_t vvcpSlicePatchListSize = 0;
359 uint32_t vvcpTileCommandsSize = 0;
360 uint32_t vvcpTilePatchListSize = 0;
361
362 DECODE_CHK_NULL(m_hwInterface);
363 CodechalHwInterfaceNext *hwInterface = dynamic_cast<CodechalHwInterfaceNext *>(m_hwInterface);
364 DECODE_CHK_NULL(hwInterface);
365 DECODE_CHK_STATUS(hwInterface->GetVvcpPrimitiveCommandSize(
366 basicFeature.m_mode, &vvcpSliceCommandsSize, &vvcpSlicePatchListSize, &vvcpTileCommandsSize, &vvcpTilePatchListSize));
367 DECODE_CHK_STATUS(hwInterface->GetVvcpSliceLvlCmdSize(&vvcpSliceCommandsSize));
368 uint32_t size = MOS_ALIGN_CEIL(vvcpSliceCommandsSize, 64) * basicFeature.m_numSlices;
369 m_sliceLvlBufSize = MOS_ALIGN_CEIL(vvcpSliceCommandsSize, 64);
370
371 // In VVC short format decode, second level command buffer is programmed by Huc, so not need lock it.
372 if (m_basicFeature->m_shortFormatInUse)
373 {
374 //Slice Level BB Array Allocation
375 if (m_sliceLevelBBArray == nullptr)
376 {
377 m_sliceLevelBBArray = m_allocator->AllocateBatchBufferArray(
378 size, 1, CODEC_VVC_BUFFER_ARRAY_SIZE, true, notLockableVideoMem);
379 DECODE_CHK_NULL(m_sliceLevelBBArray);
380 PMHW_BATCH_BUFFER &batchBuf = m_sliceLevelBBArray->Fetch();
381 DECODE_CHK_NULL(batchBuf);
382 }
383 else
384 {
385 PMHW_BATCH_BUFFER &batchBuf = m_sliceLevelBBArray->Fetch();
386 DECODE_CHK_NULL(batchBuf);
387 DECODE_CHK_STATUS(m_allocator->Resize(
388 batchBuf, size, 1, notLockableVideoMem));
389 }
390
391 //Tile Level BB Array Allocation
392 uint32_t tileLvlCmdSize = 0;
393 if (!m_basicFeature->m_vvcPicParams->m_ppsFlags.m_fields.m_ppsRectSliceFlag) // Raster Scan Mode
394 {
395 tileLvlCmdSize = vvcpTileCommandsSize * vvcMaxTileRowNum;
396 }
397 else //Rect Scan Mode
398 {
399 tileLvlCmdSize = (m_basicFeature->m_numSlices + m_basicFeature->m_tileCols * m_basicFeature->m_tileRows) * vvcpTileCommandsSize;
400 }
401 tileLvlCmdSize = MOS_ALIGN_CEIL(tileLvlCmdSize, 64);
402 m_tileLvlBufSize = tileLvlCmdSize;
403 if (m_tileLevelBBArray == nullptr)
404 {
405 m_tileLevelBBArray = m_allocator->AllocateBatchBufferArray(tileLvlCmdSize, 1, CODEC_VVC_BUFFER_ARRAY_SIZE, true, notLockableVideoMem);
406 PMHW_BATCH_BUFFER&BatchBuf = m_tileLevelBBArray->Fetch();
407 DECODE_CHK_NULL(BatchBuf);
408 }
409 else
410 {
411 PMHW_BATCH_BUFFER &batchBuf = m_tileLevelBBArray->Fetch();
412 DECODE_CHK_NULL(batchBuf);
413 DECODE_CHK_STATUS(m_allocator->Resize(
414 batchBuf, tileLvlCmdSize, 1, notLockableVideoMem));
415 }
416
417 }
418
419 return MOS_STATUS_SUCCESS;
420 }
421
422 MHW_BATCH_BUFFER *VvcPipeline::GetSliceLvlCmdBuffer()
423 {
424 if (m_sliceLevelBBArray == nullptr)
425 {
426 return nullptr;
427 }
428 return m_sliceLevelBBArray->Peek();
429 }
430
431 MHW_BATCH_BUFFER *VvcPipeline::GetTileLvlCmdBuffer()
432 {
433 if (m_tileLevelBBArray == nullptr)
434 {
435 return nullptr;
436 }
437 return m_tileLevelBBArray->Peek();
438 }
439
440 #if USE_CODECHAL_DEBUG_TOOL
441 MOS_STATUS VvcPipeline::DumpParams(VvcBasicFeature &basicFeature)
442 {
443 m_debugInterface->m_bufferDumpFrameNum = basicFeature.m_frameNum;
444
445 DECODE_CHK_STATUS(DumpPicParams(basicFeature.m_vvcPicParams, basicFeature.m_shortFormatInUse));
446 DECODE_CHK_STATUS(DumpApsAlfData(basicFeature.m_alfApsArray, vvcMaxAlfNum));
447 DECODE_CHK_STATUS(DumpApsLmcsData(basicFeature.m_lmcsApsArray, vvcMaxLmcsNum));
448 DECODE_CHK_STATUS(DumpApsQuantMatrix(basicFeature.m_scalingListArray, vvcMaxScalingMatrixNum));
449 DECODE_CHK_STATUS(DumpTileParams(basicFeature.m_tileParams, basicFeature.m_vvcPicParams->m_ppsNumExpTileColumnsMinus1 + basicFeature.m_vvcPicParams->m_ppsNumExpTileRowsMinus1 + 2));
450 DECODE_CHK_STATUS(DumpSubpicParams(basicFeature.m_subPicParams, (basicFeature.m_vvcPicParams->m_spsFlags0.m_fields.m_spsSubpicInfoPresentFlag && basicFeature.m_vvcPicParams->m_spsNumSubpicsMinus1 > 0)? (basicFeature.m_vvcPicParams->m_spsNumSubpicsMinus1+1) : 0));
451 DECODE_CHK_STATUS(DumpSliceStructParams(basicFeature.m_sliceStructParams, ((basicFeature.m_vvcPicParams->m_ppsFlags.m_fields.m_ppsRectSliceFlag && basicFeature.m_vvcPicParams->m_numSliceStructsMinus1 > 0))? (basicFeature.m_vvcPicParams->m_numSliceStructsMinus1 + 1) : 0));
452 DECODE_CHK_STATUS(DumpRplStructParams(basicFeature.m_rplParams, basicFeature.m_vvcPicParams->m_numRefPicListStructs, basicFeature.m_shortFormatInUse));
453 DECODE_CHK_STATUS(DumpSliceParams(basicFeature.m_vvcSliceParams, basicFeature.m_numSlices, basicFeature.m_shortFormatInUse));
454 DECODE_CHK_STATUS(DumpBitstream(&basicFeature.m_resDataBuffer.OsResource, basicFeature.m_dataSize, 0));
455
456 return MOS_STATUS_SUCCESS;
457 }
458
459 MOS_STATUS VvcPipeline::DumpPicParams(
460 CodecVvcPicParams *picParams,
461 bool shortFormatInUse)
462 {
463 CODECHAL_DEBUG_FUNCTION_ENTER;
464
465 if (picParams == nullptr)
466 {
467 return MOS_STATUS_SUCCESS;
468 }
469
470 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrPicParams))
471 {
472 const char *fileName = m_debugInterface->CreateFileName(
473 "_DEC",
474 CodechalDbgBufferType::bufPicParams,
475 CodechalDbgExtType::txt);
476
477 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrEnableFastDump))
478 {
479 MediaDebugFastDump::Dump(
480 (uint8_t *)picParams,
481 fileName,
482 sizeof(CodecVvcPicParams),
483 0);
484 }
485 else
486 {
487 DumpDecodeVvcPicParams(picParams, fileName, shortFormatInUse);
488 }
489 }
490
491 return MOS_STATUS_SUCCESS;
492 }
493
494 MOS_STATUS VvcPipeline::DumpApsAlfData(
495 CodecVvcAlfData *alfDataBuf,
496 uint32_t numAlf)
497 {
498 CODECHAL_DEBUG_FUNCTION_ENTER;
499
500 if (alfDataBuf == nullptr)
501 {
502 return MOS_STATUS_SUCCESS;
503 }
504
505 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrAlfData))
506 {
507 const char *fileName = m_debugInterface->CreateFileName(
508 "_DEC",
509 CodechalDbgBufferType::bufAlfData,
510 CodechalDbgExtType::txt);
511
512 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrEnableFastDump))
513 {
514 MediaDebugFastDump::Dump(
515 (uint8_t *)alfDataBuf,
516 fileName,
517 sizeof(CodecVvcAlfData) * numAlf,
518 0);
519 }
520 else
521 {
522 DumpDecodeVvcAlfParams(alfDataBuf, numAlf, fileName);
523 }
524 }
525
526 return MOS_STATUS_SUCCESS;
527 }
528
529 MOS_STATUS VvcPipeline::DumpApsLmcsData(
530 CodecVvcLmcsData *lmcsDataBuf,
531 uint32_t numLmcs)
532 {
533 CODECHAL_DEBUG_FUNCTION_ENTER;
534
535 if (lmcsDataBuf == nullptr)
536 {
537 return MOS_STATUS_SUCCESS;
538 }
539
540 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrLmcsData))
541 {
542 const char *fileName = m_debugInterface->CreateFileName(
543 "_DEC",
544 CodechalDbgBufferType::bufLmcsData,
545 CodechalDbgExtType::txt);
546
547 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrEnableFastDump))
548 {
549 MediaDebugFastDump::Dump(
550 (uint8_t *)lmcsDataBuf,
551 fileName,
552 sizeof(CodecVvcLmcsData) * numLmcs,
553 0);
554 }
555 else
556 {
557 DumpDecodeVvcLmcsParams(lmcsDataBuf, numLmcs, fileName);
558 }
559 }
560
561 return MOS_STATUS_SUCCESS;
562 }
563
564 MOS_STATUS VvcPipeline::DumpApsQuantMatrix(
565 CodecVvcQmData *quantMatrixBuf,
566 uint32_t numScalingList)
567 {
568 CODECHAL_DEBUG_FUNCTION_ENTER;
569
570 if (quantMatrixBuf == nullptr)
571 {
572 return MOS_STATUS_SUCCESS;
573 }
574
575 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrIqParams))
576 {
577 const char *fileName = m_debugInterface->CreateFileName(
578 "_DEC",
579 CodechalDbgBufferType::bufIqParams,
580 CodechalDbgExtType::txt);
581
582 if(m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrEnableFastDump))
583 {
584 MediaDebugFastDump::Dump(
585 (uint8_t *)quantMatrixBuf,
586 fileName,
587 sizeof(CodecVvcQmData) * numScalingList,
588 0);
589 }
590 else
591 {
592 DumpDecodeVvcIqParams(quantMatrixBuf, numScalingList, fileName);
593 }
594 }
595
596 return MOS_STATUS_SUCCESS;
597 }
598
599 MOS_STATUS VvcPipeline::DumpTileParams(
600 CodecVvcTileParam *tileParams,
601 uint32_t numElements)
602 {
603 CODECHAL_DEBUG_FUNCTION_ENTER;
604
605 if (tileParams == nullptr)
606 {
607 return MOS_STATUS_SUCCESS;
608 }
609
610 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrTileParams))
611 {
612 const char *fileName = m_debugInterface->CreateFileName(
613 "_DEC",
614 CodechalDbgBufferType::bufTileParams,
615 CodechalDbgExtType::txt);
616
617 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrEnableFastDump))
618 {
619 MediaDebugFastDump::Dump(
620 (uint8_t *)tileParams,
621 fileName,
622 sizeof(CodecVvcTileParam) * numElements,
623 0);
624 }
625 else
626 {
627 DumpDecodeVvcTileParams(tileParams, numElements, fileName);
628 }
629 }
630
631 return MOS_STATUS_SUCCESS;
632 }
633
634 MOS_STATUS VvcPipeline::DumpSubpicParams(
635 CodecVvcSubpicParam *subpicParamsBuf,
636 uint32_t numSubpics)
637 {
638 CODECHAL_DEBUG_FUNCTION_ENTER;
639
640 if (subpicParamsBuf == nullptr)
641 {
642 return MOS_STATUS_SUCCESS;
643 }
644
645 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrSubpicParams))
646 {
647 const char *fileName = m_debugInterface->CreateFileName(
648 "_DEC",
649 CodechalDbgBufferType::bufSubpicParams,
650 CodechalDbgExtType::txt);
651
652 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrEnableFastDump))
653 {
654 MediaDebugFastDump::Dump(
655 (uint8_t *)subpicParamsBuf,
656 fileName,
657 sizeof(CodecVvcSubpicParam) * numSubpics,
658 0);
659 }
660 else
661 {
662 DumpDecodeVvcSubpicParams(subpicParamsBuf, numSubpics, fileName);
663 }
664 }
665
666 return MOS_STATUS_SUCCESS;
667 }
668
669 MOS_STATUS VvcPipeline::DumpSliceStructParams(
670 CodecVvcSliceStructure *sliceStructParamsBuf,
671 uint32_t numSlcStruct)
672 {
673 CODECHAL_DEBUG_FUNCTION_ENTER;
674
675 if (sliceStructParamsBuf == nullptr)
676 {
677 return MOS_STATUS_SUCCESS;
678 }
679
680 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrSliceStruct))
681 {
682 const char *fileName = m_debugInterface->CreateFileName(
683 "_DEC",
684 CodechalDbgBufferType::bufSliceStruct,
685 CodechalDbgExtType::txt);
686
687 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrEnableFastDump))
688 {
689 MediaDebugFastDump::Dump(
690 (uint8_t *)sliceStructParamsBuf,
691 fileName,
692 sizeof(CodecVvcSliceStructure) * numSlcStruct,
693 0);
694 }
695 else
696 {
697 DumpDecodeVvcSliceStructureParams(sliceStructParamsBuf, numSlcStruct, fileName);
698 }
699 }
700
701 return MOS_STATUS_SUCCESS;
702 }
703
704 MOS_STATUS VvcPipeline::DumpRplStructParams(
705 CodecVvcRplStructure *rplParams,
706 uint32_t numRpls,
707 bool shortFormatInUse)
708 {
709 CODECHAL_DEBUG_FUNCTION_ENTER;
710
711 if (rplParams == nullptr)
712 {
713 return MOS_STATUS_SUCCESS;
714 }
715
716 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrRplStruct))
717 {
718 const char *fileName = m_debugInterface->CreateFileName(
719 "_DEC",
720 CodechalDbgBufferType::bufRplStruct,
721 CodechalDbgExtType::txt);
722
723 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrEnableFastDump))
724 {
725 MediaDebugFastDump::Dump(
726 (uint8_t *)rplParams,
727 fileName,
728 sizeof(CodecVvcRplStructure) * numRpls,
729 0);
730 }
731 else
732 {
733 DumpDecodeVvcRplStructureParams(rplParams, numRpls, fileName);
734 }
735 }
736
737 return MOS_STATUS_SUCCESS;
738 }
739
740 MOS_STATUS VvcPipeline::DumpSliceParams(
741 CodecVvcSliceParams* sliceParams,
742 uint32_t numSlices,
743 bool shortFormatInUse)
744 {
745 CODECHAL_DEBUG_FUNCTION_ENTER;
746
747 if (sliceParams == nullptr)
748 {
749 return MOS_STATUS_SUCCESS;
750 }
751
752 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrSlcParams))
753 {
754 const char *fileName = m_debugInterface->CreateFileName(
755 "_DEC",
756 CodechalDbgBufferType::bufSlcParams,
757 CodechalDbgExtType::txt);
758
759 if (m_debugInterface->DumpIsEnabled(CodechalDbgAttr::attrEnableFastDump))
760 {
761 MediaDebugFastDump::Dump(
762 (uint8_t *)sliceParams,
763 fileName,
764 sizeof(CodecVvcSliceParams) * numSlices,
765 0);
766 }
767 else
768 {
769 DumpDecodeVvcSliceParams(sliceParams, numSlices, fileName, shortFormatInUse);
770 }
771 }
772
773 return MOS_STATUS_SUCCESS;
774 }
775
776 void DumpDecodeVvcPicParams(CodecVvcPicParams *picParams, std::string fileName, bool shortFormatInUse)
777 {
778 std::ostringstream oss;
779 oss.setf(std::ios::showbase | std::ios::uppercase);
780
781 // SPS info
782 oss << "spsPicWidthMaxInLumaSamples: " << +picParams->m_spsPicWidthMaxInLumaSamples << std::endl;
783 oss << "spsPicHeightMaxInLumaSamples: " << +picParams->m_spsPicHeightMaxInLumaSamples << std::endl;
784
785 oss << "spsNumSubpicsMinus1: " << +picParams->m_spsNumSubpicsMinus1 << std::endl;
786 oss << "spsSubpicIdLenMinus1: " << +picParams->m_spsSubpicIdLenMinus1 << std::endl;
787 oss << "spsChromaFormatIdc: " << +picParams->m_spsChromaFormatIdc << std::endl;
788 oss << "spsBitdepthMinus8: " << +picParams->m_spsBitdepthMinus8 << std::endl;
789 oss << "spsLog2CtuSizeMinus5: " << +picParams->m_spsLog2CtuSizeMinus5 << std::endl;
790 oss << "spsLog2MaxPicOrderCntLsbMinus4: " << +picParams->m_spsLog2MaxPicOrderCntLsbMinus4 << std::endl;
791 oss << "spsLog2MinLumaCodingBlockSizeMinus2: " << +picParams->m_spsLog2MinLumaCodingBlockSizeMinus2 << std::endl;
792 oss << "spsPocMsbCycleLenMinus1: " << +picParams->m_spsPocMsbCycleLenMinus1 << std::endl;
793 oss << "numExtraPhBits: " << +picParams->m_numExtraPhBits << std::endl;
794 oss << "numExtraShBits: " << +picParams->m_numExtraShBits << std::endl;
795 oss << "spsLog2TransformSkipMaxSizeMinus2: " << +picParams->m_spsLog2TransformSkipMaxSizeMinus2 << std::endl;
796
797 for (auto i = 0; i < 3; i++)
798 {
799 for (auto j = 0; j < 76; j++)
800 {
801 oss << "chromaQpTable[" << +i << "][" << +j << "]: " << +picParams->m_chromaQpTable[i][j] << std::endl;
802 }
803 }
804
805 for (auto i = 0; i < 2; i++)
806 {
807 oss << "spsNumRefPicLists[" << +i << "]: " << +picParams->m_spsNumRefPicLists[i] << std::endl;
808 }
809 oss << "spsSixMinusMaxNumMergeCand: " << +picParams->m_spsSixMinusMaxNumMergeCand << std::endl;
810 oss << "spsFiveMinusMaxNumSubblockMergeCand: " << +picParams->m_spsFiveMinusMaxNumSubblockMergeCand << std::endl;
811 oss << "spsMaxNumMergeCandMinusMaxNumGpmCand: " << +picParams->m_spsMaxNumMergeCandMinusMaxNumGpmCand << std::endl;
812 oss << "spsLog2ParallelMergeLevelMinus2: " << +picParams->m_spsLog2ParallelMergeLevelMinus2 << std::endl;
813 oss << "spsMinQpPrimeTs: " << +picParams->m_spsMinQpPrimeTs << std::endl;
814 oss << "spsSixMinusMaxNumIbcMergeCand: " << +picParams->m_spsSixMinusMaxNumIbcMergeCand << std::endl;
815 oss << "spsNumLadfIntervalsMinus2: " << +picParams->m_spsNumLadfIntervalsMinus2 << std::endl;
816 oss << "spsLadfLowestIntervalQpOffset: " << +picParams->m_spsLadfLowestIntervalQpOffset << std::endl;
817 for (auto i = 0; i < 4; i++)
818 {
819 oss << "spsLadfQpOffset[" << +i << "]: " << +picParams->m_spsLadfQpOffset[i] << std::endl;
820 }
821 for (auto i = 0; i < 4; i++)
822 {
823 oss << "spsLadfDeltaThresholdMinus1[" << +i << "]: " << +picParams->m_spsLadfDeltaThresholdMinus1[i] << std::endl;
824 }
825
826 oss << "spsFlags0 value: " << +picParams->m_spsFlags0.m_value << std::endl;
827 oss << "spsSubpicInfoPresentFlag: " << +picParams->m_spsFlags0.m_fields.m_spsSubpicInfoPresentFlag << std::endl;
828 oss << "spsIndependentSubpicsFlag: " << +picParams->m_spsFlags0.m_fields.m_spsIndependentSubpicsFlag << std::endl;
829 oss << "spsSubpicSameSizeFlag: " << +picParams->m_spsFlags0.m_fields.m_spsSubpicSameSizeFlag << std::endl;
830 oss << "spsEntropyCodingSyncEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsEntropyCodingSyncEnabledFlag << std::endl;
831 oss << "spsEntryPointOffsetsPresentFlag: " << +picParams->m_spsFlags0.m_fields.m_spsEntryPointOffsetsPresentFlag << std::endl;
832 oss << "spsPocMsbCycleFlag: " << +picParams->m_spsFlags0.m_fields.m_spsPocMsbCycleFlag << std::endl;
833 oss << "spsPartitionConstraintsOverrideEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsPartitionConstraintsOverrideEnabledFlag << std::endl;
834 oss << "spsQtbttDualTreeIntraFlag: " << +picParams->m_spsFlags0.m_fields.m_spsQtbttDualTreeIntraFlag << std::endl;
835 oss << "spsMaxLumaTransformSize64Flag: " << +picParams->m_spsFlags0.m_fields.m_spsMaxLumaTransformSize64Flag << std::endl;
836 oss << "spsTransformSkipEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsTransformSkipEnabledFlag << std::endl;
837 oss << "spsBdpcmEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsBdpcmEnabledFlag << std::endl;
838 oss << "spsMtsEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsMtsEnabledFlag << std::endl;
839 oss << "spsExplicitMtsIntraEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsExplicitMtsIntraEnabledFlag << std::endl;
840 oss << "spsExplicitMtsInterEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsExplicitMtsInterEnabledFlag << std::endl;
841 oss << "spsLfnstEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsLfnstEnabledFlag << std::endl;
842 oss << "spsJointCbcrEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsJointCbcrEnabledFlag << std::endl;
843 oss << "spsSameQpTableForChromaFlag: " << +picParams->m_spsFlags0.m_fields.m_spsSameQpTableForChromaFlag << std::endl;
844 oss << "spsSaoEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsSaoEnabledFlag << std::endl;
845 oss << "spsAlfEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsAlfEnabledFlag << std::endl;
846 oss << "spsCcalfEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsCcalfEnabledFlag << std::endl;
847 oss << "spsLmcsEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsLmcsEnabledFlag << std::endl;
848 oss << "spsLongTermRefPicsFlag: " << +picParams->m_spsFlags0.m_fields.m_spsLongTermRefPicsFlag << std::endl;
849 oss << "spsInterLayerPredictionEnabledFlag: " << +picParams->m_spsFlags0.m_fields.m_spsInterLayerPredictionEnabledFlag << std::endl;
850 oss << "spsIdrRplPresentFlag: " << +picParams->m_spsFlags0.m_fields.m_spsIdrRplPresentFlag << std::endl;
851
852 oss << "spsFlags1 value: " << +picParams->m_spsFlags1.m_value << std::endl;
853 oss << "spsTemporalMvpEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsTemporalMvpEnabledFlag << std::endl;
854 oss << "spsSbtmvpEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsSbtmvpEnabledFlag << std::endl;
855 oss << "spsAmvrEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsAmvrEnabledFlag << std::endl;
856 oss << "spsBdofEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsBdofEnabledFlag << std::endl;
857 oss << "spsBdofControlPresentInPhFlag: " << +picParams->m_spsFlags1.m_fields.m_spsBdofControlPresentInPhFlag << std::endl;
858 oss << "spsSmvdEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsSmvdEnabledFlag << std::endl;
859 oss << "spsDmvrEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsDmvrEnabledFlag << std::endl;
860 oss << "spsDmvrControlPresentInPhFlag: " << +picParams->m_spsFlags1.m_fields.m_spsDmvrControlPresentInPhFlag << std::endl;
861 oss << "spsMmvdEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsMmvdEnabledFlag << std::endl;
862 oss << "spsMmvdFullpelOnlyEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsMmvdFullpelOnlyEnabledFlag << std::endl;
863 oss << "spsSbtEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsSbtEnabledFlag << std::endl;
864 oss << "spsAffineEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsAffineEnabledFlag << std::endl;
865 oss << "sps6paramAffineEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_sps6paramAffineEnabledFlag << std::endl;
866 oss << "spsAffineAmvrEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsAffineAmvrEnabledFlag << std::endl;
867 oss << "spsAffineProfEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsAffineProfEnabledFlag << std::endl;
868 oss << "spsProfControlPresentInPhFlag: " << +picParams->m_spsFlags1.m_fields.m_spsProfControlPresentInPhFlag << std::endl;
869 oss << "spsBcwEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsBcwEnabledFlag << std::endl;
870 oss << "spsCiipEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsCiipEnabledFlag << std::endl;
871 oss << "spsGpmEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsGpmEnabledFlag << std::endl;
872 oss << "spsIspEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsIspEnabledFlag << std::endl;
873 oss << "spsMrlEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsMrlEnabledFlag << std::endl;
874 oss << "spsMipEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsMipEnabledFlag << std::endl;
875 oss << "spsCclmEnabledFlag: " << +picParams->m_spsFlags1.m_fields.m_spsCclmEnabledFlag << std::endl;
876 oss << "spsChromaHorizontalCollocatedFlag: " << +picParams->m_spsFlags1.m_fields.m_spsChromaHorizontalCollocatedFlag << std::endl;
877 oss << "spsChromaVerticalCollocatedFlag: " << +picParams->m_spsFlags1.m_fields.m_spsChromaVerticalCollocatedFlag << std::endl;
878
879 oss << "spsFlags2 value: " << +picParams->m_spsFlags2.m_value << std::endl;
880 oss << "spsPaletteEnabledFlag: " << +picParams->m_spsFlags2.m_fields.m_spsPaletteEnabledFlag << std::endl;
881 oss << "spsActEnabledFlag: " << +picParams->m_spsFlags2.m_fields.m_spsActEnabledFlag << std::endl;
882 oss << "spsIbcEnabledFlag: " << +picParams->m_spsFlags2.m_fields.m_spsIbcEnabledFlag << std::endl;
883 oss << "spsLadfEnabledFlag: " << +picParams->m_spsFlags2.m_fields.m_spsLadfEnabledFlag << std::endl;
884 oss << "spsExplicitScalingListEnabledFlag: " << +picParams->m_spsFlags2.m_fields.m_spsExplicitScalingListEnabledFlag << std::endl;
885 oss << "spsScalingMatrixForLfnstDisabledFlag: " << +picParams->m_spsFlags2.m_fields.m_spsScalingMatrixForLfnstDisabledFlag << std::endl;
886 oss << "spsScalingMatrixForAlternativeColourSpaceDisabledFlag: " << +picParams->m_spsFlags2.m_fields.m_spsScalingMatrixForAlternativeColourSpaceDisabledFlag << std::endl;
887 oss << "spsScalingMatrixDesignatedColourSpaceFlag: " << +picParams->m_spsFlags2.m_fields.m_spsScalingMatrixDesignatedColourSpaceFlag << std::endl;
888 oss << "spsDepQuantEnabledFlag: " << +picParams->m_spsFlags2.m_fields.m_spsDepQuantEnabledFlag << std::endl;
889 oss << "spsSignDataHidingEnabledFlag: " << +picParams->m_spsFlags2.m_fields.m_spsSignDataHidingEnabledFlag << std::endl;
890 oss << "spsVirtualBoundariesEnabledFlag: " << +picParams->m_spsFlags2.m_fields.m_spsVirtualBoundariesEnabledFlag << std::endl;
891 oss << "spsVirtualBoundariesPresentFlag: " << +picParams->m_spsFlags2.m_fields.m_spsVirtualBoundariesPresentFlag << std::endl;
892 oss << "spsWeightedPredFlag: " << +picParams->m_spsFlags2.m_fields.m_spsWeightedPredFlag << std::endl;
893 oss << "spsWeightedBipredFlag: " << +picParams->m_spsFlags2.m_fields.m_spsWeightedBipredFlag << std::endl;
894
895 // PPS info
896 oss << "ppsPicWidthInLumaSamples: " << +picParams->m_ppsPicWidthInLumaSamples << std::endl;
897 oss << "ppsPicHeightInLumaSamples: " << +picParams->m_ppsPicHeightInLumaSamples << std::endl;
898 oss << "numVerVirtualBoundaries: " << +picParams->m_numVerVirtualBoundaries << std::endl;
899 oss << "numHorVirtualBoundaries: " << +picParams->m_numHorVirtualBoundaries << std::endl;
900 for (auto i = 0; i < 3; i++)
901 {
902 oss << "virtualBoundaryPosX[" << +i << "]: " << +picParams->m_virtualBoundaryPosX[i] << std::endl;
903 }
904 for (auto i = 0; i < 3; i++)
905 {
906 oss << "virtualBoundaryPosY[" << +i << "]: " << +picParams->m_virtualBoundaryPosY[i] << std::endl;
907 }
908
909 oss << "ppsScalingWinLeftOffset: " << +picParams->m_ppsScalingWinLeftOffset << std::endl;
910 oss << "ppsScalingWinRightOffset: " << +picParams->m_ppsScalingWinRightOffset << std::endl;
911 oss << "ppsScalingWinTopOffset: " << +picParams->m_ppsScalingWinTopOffset << std::endl;
912 oss << "ppsScalingWinBottomOffset: " << +picParams->m_ppsScalingWinBottomOffset << std::endl;
913
914 oss << "ppsNumExpTileColumnsMinus1: " << +picParams->m_ppsNumExpTileColumnsMinus1 << std::endl;
915 oss << "ppsNumExpTileRowsMinus1: " << +picParams->m_ppsNumExpTileRowsMinus1 << std::endl;
916 oss << "ppsNumSlicesInPicMinus1: " << +picParams->m_ppsNumSlicesInPicMinus1 << std::endl;
917 for (auto i = 0; i < 2; i++)
918 {
919 oss << "ppsNumRefIdxDefaultActiveMinus1[" << +i << "]: " << +picParams->m_ppsNumRefIdxDefaultActiveMinus1[i] << std::endl;
920 }
921 oss << "ppsPicWidthMinusWraparoundOffset: " << +picParams->m_ppsPicWidthMinusWraparoundOffset << std::endl;
922 oss << "ppsInitQpMinus26: " << +picParams->m_ppsInitQpMinus26 << std::endl;
923 oss << "ppsCbQpOffset: " << +picParams->m_ppsCbQpOffset << std::endl;
924 oss << "ppsCrQpOffset: " << +picParams->m_ppsCrQpOffset << std::endl;
925 oss << "ppsJointCbcrQpOffsetValue: " << +picParams->m_ppsJointCbcrQpOffsetValue << std::endl;
926 oss << "ppsChromaQpOffsetListLenMinus1: " << +picParams->m_ppsChromaQpOffsetListLenMinus1 << std::endl;
927 for (auto i = 0; i < 6; i++)
928 {
929 oss << "ppsCbQpOffsetList[" << +i << "]: " << +picParams->m_ppsCbQpOffsetList[i] << std::endl;
930 }
931 for (auto i = 0; i < 6; i++)
932 {
933 oss << "ppsCrQpOffsetList[" << +i << "]: " << +picParams->m_ppsCrQpOffsetList[i] << std::endl;
934 }
935 for (auto i = 0; i < 6; i++)
936 {
937 oss << "ppsJointCbcrQpOffsetList[" << +i << "]: " << +picParams->m_ppsJointCbcrQpOffsetList[i] << std::endl;
938 }
939
940 oss << "numScalingMatrixBuffers: " << +picParams->m_numScalingMatrixBuffers << std::endl;
941 oss << "numAlfBuffers: " << +picParams->m_numAlfBuffers << std::endl;
942 oss << "numLmcsBuffers: " << +picParams->m_numLmcsBuffers << std::endl;
943 oss << "numRefPicListStructs: " << +picParams->m_numRefPicListStructs << std::endl;
944 oss << "numSliceStructsMinus1: " << +picParams->m_numSliceStructsMinus1 << std::endl;
945
946 oss << "ppsFlags value: " << +picParams->m_ppsFlags.m_value << std::endl;
947 oss << "ppsOutputFlagPresentFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsOutputFlagPresentFlag << std::endl;
948 oss << "ppsLoopFilterAcrossTilesEnabledFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsLoopFilterAcrossTilesEnabledFlag << std::endl;
949 oss << "ppsRectSliceFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsRectSliceFlag << std::endl;
950 oss << "ppsSingleSlicePerSubpicFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsSingleSlicePerSubpicFlag << std::endl;
951 oss << "ppsLoopFilterAcrossSlicesEnabledFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsLoopFilterAcrossSlicesEnabledFlag << std::endl;
952 oss << "ppsCabacInitPresentFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsCabacInitPresentFlag << std::endl;
953 oss << "ppsRpl1IdxPresentFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsRpl1IdxPresentFlag << std::endl;
954 oss << "ppsWeightedPredFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsWeightedPredFlag << std::endl;
955 oss << "ppsWeightedBipredFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsWeightedBipredFlag << std::endl;
956 oss << "ppsRefWraparoundEnabledFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsRefWraparoundEnabledFlag << std::endl;
957 oss << "ppsCuQpDeltaEnabledFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsCuQpDeltaEnabledFlag << std::endl;
958 oss << "ppsChroma_toolOffsetsPresentFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsChroma_toolOffsetsPresentFlag << std::endl;
959 oss << "ppsSliceChromaQpOffsetsPresentFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsSliceChromaQpOffsetsPresentFlag << std::endl;
960 oss << "ppsCuChromaQpOffsetListEnabledFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsCuChromaQpOffsetListEnabledFlag << std::endl;
961 oss << "ppsDeblockingFilterOverrideEnabledFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsDeblockingFilterOverrideEnabledFlag << std::endl;
962 oss << "ppsDeblockingFilterDisabledFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsDeblockingFilterDisabledFlag << std::endl;
963 oss << "ppsDbfInfoInPhFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsDbfInfoInPhFlag << std::endl;
964 oss << "ppsRplInfoInPhFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsRplInfoInPhFlag << std::endl;
965 oss << "ppsSaoInfoInPhFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsSaoInfoInPhFlag << std::endl;
966 oss << "ppsAlfInfoInPhFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsAlfInfoInPhFlag << std::endl;
967 oss << "ppsWpInfoInPhFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsWpInfoInPhFlag << std::endl;
968 oss << "ppsQpDeltaInfoInPhFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsQpDeltaInfoInPhFlag << std::endl;
969 oss << "ppsPictureHeaderExtensionPresentFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsPictureHeaderExtensionPresentFlag << std::endl;
970 oss << "ppsSliceHeaderExtensionPresentFlag: " << +picParams->m_ppsFlags.m_fields.m_ppsSliceHeaderExtensionPresentFlag << std::endl;
971
972 // PH info
973 oss << "phNumAlfApsIdsLuma: " << +picParams->m_phNumAlfApsIdsLuma << std::endl;
974 for (auto i = 0; i < 7; i++)
975 {
976 oss << "phAlfApsIdLuma[" << +i << "]: " << +picParams->m_phAlfApsIdLuma[i] << std::endl;
977 }
978 oss << "phAlfApsIdChroma: " << +picParams->m_phAlfApsIdChroma << std::endl;
979 oss << "phAlfCcCbApsId: " << +picParams->m_phAlfCcCbApsId << std::endl;
980 oss << "phAlfCcCrApsId: " << +picParams->m_phAlfCcCrApsId << std::endl;
981 oss << "phLmcsApsId: " << +picParams->m_phLmcsApsId << std::endl;
982 oss << "phScalingListApsId: " << +picParams->m_phScalingListApsId << std::endl;
983 oss << "phLog2DiffMinQtMinCbIntraSliceLuma: " << +picParams->m_phLog2DiffMinQtMinCbIntraSliceLuma << std::endl;
984 oss << "phMaxMtt_hierarchyDepthIntraSliceLuma: " << +picParams->m_phMaxMtt_hierarchyDepthIntraSliceLuma << std::endl;
985 oss << "phLog2DiffMaxBtMinQtIntraSliceLuma: " << +picParams->m_phLog2DiffMaxBtMinQtIntraSliceLuma << std::endl;
986 oss << "phLog2DiffMax_ttMinQtIntraSliceLuma: " << +picParams->m_phLog2DiffMax_ttMinQtIntraSliceLuma << std::endl;
987 oss << "phLog2DiffMinQtMinCbIntraSliceChroma: " << +picParams->m_phLog2DiffMinQtMinCbIntraSliceChroma << std::endl;
988 oss << "phMaxMtt_hierarchyDepthIntraSliceChroma: " << +picParams->m_phMaxMtt_hierarchyDepthIntraSliceChroma << std::endl;
989 oss << "phLog2DiffMaxBtMinQtIntraSliceChroma: " << +picParams->m_phLog2DiffMaxBtMinQtIntraSliceChroma << std::endl;
990 oss << "phLog2DiffMax_ttMinQtIntraSliceChroma: " << +picParams->m_phLog2DiffMax_ttMinQtIntraSliceChroma << std::endl;
991 oss << "phCuQpDeltaSubdivIntraSlice: " << +picParams->m_phCuQpDeltaSubdivIntraSlice << std::endl;
992 oss << "phCuChromaQpOffsetSubdivIntraSlice: " << +picParams->m_phCuChromaQpOffsetSubdivIntraSlice << std::endl;
993 oss << "phLog2DiffMinQtMinCbInterSlice: " << +picParams->m_phLog2DiffMinQtMinCbInterSlice << std::endl;
994 oss << "phMaxMtt_hierarchyDepthInterSlice: " << +picParams->m_phMaxMtt_hierarchyDepthInterSlice << std::endl;
995 oss << "phLog2DiffMaxBtMinQtInterSlice: " << +picParams->m_phLog2DiffMaxBtMinQtInterSlice << std::endl;
996 oss << "phLog2DiffMax_ttMinQtInterSlice: " << +picParams->m_phLog2DiffMax_ttMinQtInterSlice << std::endl;
997 oss << "phCuQpDeltaSubdivInterSlice: " << +picParams->m_phCuQpDeltaSubdivInterSlice << std::endl;
998 oss << "phCuChromaQpOffsetSubdivInterSlice: " << +picParams->m_phCuChromaQpOffsetSubdivInterSlice << std::endl;
999 oss << "phCollocatedRefIdx: " << +picParams->m_phCollocatedRefIdx << std::endl;
1000 oss << "phQpDelta: " << +picParams->m_phQpDelta << std::endl;
1001 oss << "phLumaBetaOffsetDiv2: " << +picParams->m_phLumaBetaOffsetDiv2 << std::endl;
1002 oss << "phLumaTcOffsetDiv2: " << +picParams->m_phLumaTcOffsetDiv2 << std::endl;
1003 oss << "phCbBetaOffsetDiv2: " << +picParams->m_phCbBetaOffsetDiv2 << std::endl;
1004 oss << "phCbTcOffsetDiv2: " << +picParams->m_phCbTcOffsetDiv2 << std::endl;
1005 oss << "phCrBetaOffsetDiv2: " << +picParams->m_phCrBetaOffsetDiv2 << std::endl;
1006 oss << "phCrTcOffsetDiv2: " << +picParams->m_phCrTcOffsetDiv2 << std::endl;
1007
1008 // weighted prediction info
1009 oss << "lumaLog2WeightDenom: " << +picParams->m_wpInfo.m_lumaLog2WeightDenom << std::endl;
1010 oss << "deltaChromaLog2WeightDenom: " << +picParams->m_wpInfo.m_deltaChromaLog2WeightDenom << std::endl;
1011 oss << "numL0Weights: " << +picParams->m_wpInfo.m_numL0Weights << std::endl;
1012 for (auto i = 0; i < 15; i++)
1013 {
1014 oss << "lumaWeightL0Flag[" << +i << "]: " << +picParams->m_wpInfo.m_lumaWeightL0Flag[i] << std::endl;
1015 }
1016 for (auto i = 0; i < 15; i++)
1017 {
1018 oss << "chromaWeightL0Flag[" << +i << "]: " << +picParams->m_wpInfo.m_chromaWeightL0Flag[i] << std::endl;
1019 }
1020 for (auto i = 0; i < 15; i++)
1021 {
1022 oss << "deltaLumaWeightL0[" << +i << "]: " << +picParams->m_wpInfo.m_deltaLumaWeightL0[i] << std::endl;
1023 }
1024 for (auto i = 0; i < 15; i++)
1025 {
1026 oss << "lumaOffsetL0[" << +i << "]: " << +picParams->m_wpInfo.m_lumaOffsetL0[i] << std::endl;
1027 }
1028 for (auto i = 0; i < 15; i++)
1029 {
1030 for (auto j = 0; j < 2; j++)
1031 {
1032 oss << "deltaChromaWeightL0[" << +i << "][" << +j << "]: " << +picParams->m_wpInfo.m_deltaChromaWeightL0[i][j] << std::endl;
1033 }
1034 }
1035 for (auto i = 0; i < 15; i++)
1036 {
1037 for (auto j = 0; j < 2; j++)
1038 {
1039 oss << "deltaChromaOffsetL0[" << +i << "][" << +j << "]: " << +picParams->m_wpInfo.m_deltaChromaOffsetL0[i][j] << std::endl;
1040 }
1041 }
1042 oss << "numL1Weights: " << +picParams->m_wpInfo.m_numL1Weights << std::endl;
1043 for (auto i = 0; i < 15; i++)
1044 {
1045 oss << "lumaWeightL1Flag[" << +i << "]: " << +picParams->m_wpInfo.m_lumaWeightL1Flag[i] << std::endl;
1046 }
1047 for (auto i = 0; i < 15; i++)
1048 {
1049 oss << "chromaWeightL1Flag[" << +i << "]: " << +picParams->m_wpInfo.m_chromaWeightL1Flag[i] << std::endl;
1050 }
1051 for (auto i = 0; i < 15; i++)
1052 {
1053 oss << "deltaLumaWeightL1[" << +i << "]: " << +picParams->m_wpInfo.m_deltaLumaWeightL1[i] << std::endl;
1054 }
1055 for (auto i = 0; i < 15; i++)
1056 {
1057 oss << "lumaOffsetL1[" << +i << "]: " << +picParams->m_wpInfo.m_lumaOffsetL1[i] << std::endl;
1058 }
1059 for (auto i = 0; i < 15; i++)
1060 {
1061 for (auto j = 0; j < 2; j++)
1062 {
1063 oss << "deltaChromaWeightL1[" << +i << "][" << +j << "]: " << +picParams->m_wpInfo.m_deltaChromaWeightL1[i][j] << std::endl;
1064 }
1065 }
1066 for (auto i = 0; i < 15; i++)
1067 {
1068 for (auto j = 0; j < 2; j++)
1069 {
1070 oss << "deltaChromaOffsetL1[" << +i << "][" << +j << "]: " << +picParams->m_wpInfo.m_deltaChromaOffsetL1[i][j] << std::endl;
1071 }
1072 }
1073
1074 oss << "phFlags value: " << +picParams->m_phFlags.m_value << std::endl;
1075 oss << "phNonRefPicFlag: " << +picParams->m_phFlags.m_fields.m_phNonRefPicFlag << std::endl;
1076 oss << "phInterSliceAllowedFlag: " << +picParams->m_phFlags.m_fields.m_phInterSliceAllowedFlag << std::endl;
1077 oss << "phAlfEnabledFlag: " << +picParams->m_phFlags.m_fields.m_phAlfEnabledFlag << std::endl;
1078 oss << "phAlfCbEnabledFlag: " << +picParams->m_phFlags.m_fields.m_phAlfCbEnabledFlag << std::endl;
1079 oss << "phAlfCrEnabledFlag: " << +picParams->m_phFlags.m_fields.m_phAlfCrEnabledFlag << std::endl;
1080 oss << "phAlfCcCbEnabledFlag: " << +picParams->m_phFlags.m_fields.m_phAlfCcCbEnabledFlag << std::endl;
1081 oss << "phAlfCcCrEnabledFlag: " << +picParams->m_phFlags.m_fields.m_phAlfCcCrEnabledFlag << std::endl;
1082 oss << "phLmcsEnabledFlag: " << +picParams->m_phFlags.m_fields.m_phLmcsEnabledFlag << std::endl;
1083 oss << "phChromaResidualScaleFlag: " << +picParams->m_phFlags.m_fields.m_phChromaResidualScaleFlag << std::endl;
1084 oss << "phExplicitScalingListEnabledFlag: " << +picParams->m_phFlags.m_fields.m_phExplicitScalingListEnabledFlag << std::endl;
1085 oss << "phVirtualBoundariesPresentFlag: " << +picParams->m_phFlags.m_fields.m_phVirtualBoundariesPresentFlag << std::endl;
1086 oss << "phTemporalMvpEnabledFlag: " << +picParams->m_phFlags.m_fields.m_phTemporalMvpEnabledFlag << std::endl;
1087 oss << "numRefEntries0RplIdx0LargerThan0: " << +picParams->m_phFlags.m_fields.m_numRefEntries0RplIdx0LargerThan0 << std::endl;
1088 oss << "numRefEntries1RplIdx1LargerThan0: " << +picParams->m_phFlags.m_fields.m_numRefEntries1RplIdx1LargerThan0 << std::endl;
1089 oss << "phCollocatedFromL0Flag: " << +picParams->m_phFlags.m_fields.m_phCollocatedFromL0Flag << std::endl;
1090 oss << "phMmvdFullpelOnlyFlag: " << +picParams->m_phFlags.m_fields.m_phMmvdFullpelOnlyFlag << std::endl;
1091 oss << "phMvdL1ZeroFlag: " << +picParams->m_phFlags.m_fields.m_phMvdL1ZeroFlag << std::endl;
1092 oss << "phBdofDisabledFlag: " << +picParams->m_phFlags.m_fields.m_phBdofDisabledFlag << std::endl;
1093 oss << "phDmvrDisabledFlag: " << +picParams->m_phFlags.m_fields.m_phDmvrDisabledFlag << std::endl;
1094 oss << "phProfDisabledFlag: " << +picParams->m_phFlags.m_fields.m_phProfDisabledFlag << std::endl;
1095 oss << "phJointCbcrSignFlag: " << +picParams->m_phFlags.m_fields.m_phJointCbcrSignFlag << std::endl;
1096 oss << "phSaoLumaEnabledFlag: " << +picParams->m_phFlags.m_fields.m_phSaoLumaEnabledFlag << std::endl;
1097 oss << "phSaoChromaEnabledFlag: " << +picParams->m_phFlags.m_fields.m_phSaoChromaEnabledFlag << std::endl;
1098 oss << "phDeblockingFilterDisabledFlag: " << +picParams->m_phFlags.m_fields.m_phDeblockingFilterDisabledFlag << std::endl;
1099
1100 // reference lists
1101 oss << "CurrPic FrameIdx: " << +picParams->m_currPic.FrameIdx << std::endl;
1102 oss << "picOrderCntVal: " << +picParams->m_picOrderCntVal << std::endl;
1103 for (auto i = 0; i < 15; i++)
1104 {
1105 oss << "refFramePocList[" << +i << "]: " << +picParams->m_refFramePocList[i] << std::endl;
1106 }
1107 for (auto i = 0; i < 15; i++)
1108 {
1109 oss << "refFrameList[" << +i << "] FrameIdx: " << +picParams->m_refFrameList[i].FrameIdx << std::endl;
1110 }
1111 for (auto i = 0; i < 2; i++)
1112 {
1113 for (auto j = 0; j < 15; j++)
1114 {
1115 oss << "refPicList[" << +i << "][" << +j << "] FrameIdx: " << +picParams->m_refPicList[i][j].FrameIdx << std::endl;
1116 }
1117 }
1118
1119 oss << "picMiscFlags value: " << +picParams->m_picMiscFlags.m_value << std::endl;
1120 oss << "intraPicFlag: " << +picParams->m_picMiscFlags.m_fields.m_intraPicFlag << std::endl;
1121
1122 oss << "statusReportFeedbackNumber: " << +picParams->m_statusReportFeedbackNumber << std::endl;
1123
1124 // multilayer
1125 if (shortFormatInUse)
1126 {
1127 for (auto i = 0; i < 15; i++)
1128 {
1129 oss << "refFrameListNuhLayerId[" << +i << "]: " << +picParams->m_refFrameListNuhLayerId[i] << std::endl;
1130 }
1131 oss << "nuhLayerId: " << +picParams->m_nuhLayerId << std::endl;
1132 oss << "vpsMaxLayersMinus1: " << +picParams->m_vpsMaxLayersMinus1 << std::endl;
1133 for (auto i = 0; i < 56; i++)
1134 {
1135 oss << "vpsLayerId[" << +i << "]: " << +picParams->m_vpsLayerId[i] << std::endl;
1136 }
1137 for (auto i = 0; i < 56; i++)
1138 {
1139 for (auto j = 0; j < 7; j++)
1140 {
1141 oss << "vpsDirectRefLayerFlag[" << +i << "][" << +j << "]: " << +picParams->m_vpsDirectRefLayerFlag[i][j] << std::endl;
1142 }
1143 }
1144 }
1145
1146 std::ofstream ofs(fileName, std::ios::out);
1147 ofs << oss.str();
1148 ofs.close();
1149 }
1150
1151 void DumpDecodeVvcAlfParams(CodecVvcAlfData *alfDataBuf, uint32_t numAlf, std::string fileName)
1152 {
1153 CodecVvcAlfData *alfData = nullptr;
1154
1155 std::ostringstream oss;
1156 oss.setf(std::ios::showbase | std::ios::uppercase);
1157
1158 for (uint16_t j = 0; j < numAlf; j++)
1159 {
1160 alfData = &alfDataBuf[j];
1161 oss << "====================================================================================================" << std::endl;
1162 oss << "Data for APS ALF number = " << +j << std::endl;
1163 oss << "apsAdaptationParameterSetId: " << +alfData->m_apsAdaptationParameterSetId << std::endl;
1164 oss << "alfLumaNumFiltersSignalledMinus1: " << +alfData->m_alfLumaNumFiltersSignalledMinus1 << std::endl;
1165 for (auto i = 0; i < 25; i++)
1166 {
1167 oss << "alfLumaCoeffDeltaIdx[" << +i << "]: " << +alfData->m_alfLumaCoeffDeltaIdx[i] << std::endl;
1168 }
1169 for (auto i = 0; i < 25; i++)
1170 {
1171 for (auto j = 0; j < 12; j++)
1172 {
1173 oss << "alfCoeffL[" << +i << "][" << +j << "]: " << +alfData->m_alfCoeffL[i][j] << std::endl;
1174 }
1175 }
1176 for (auto i = 0; i < 25; i++)
1177 {
1178 for (auto j = 0; j < 12; j++)
1179 {
1180 oss << "alfLumaClipIdx[" << +i << "][" << +j << "]: " << +alfData->m_alfLumaClipIdx[i][j] << std::endl;
1181 }
1182 }
1183 oss << "alfChromaNumAltFiltersMinus1: " << +alfData->m_alfChromaNumAltFiltersMinus1 << std::endl;
1184 for (auto i = 0; i < 8; i++)
1185 {
1186 for (auto j = 0; j < 6; j++)
1187 {
1188 oss << "alfCoeffC[" << +i << "][" << +j << "]: " << +alfData->m_alfCoeffC[i][j] << std::endl;
1189 }
1190 }
1191 for (auto i = 0; i < 8; i++)
1192 {
1193 for (auto j = 0; j < 6; j++)
1194 {
1195 oss << "alfChromaClipIdx[" << +i << "][" << +j << "]: " << +alfData->m_alfChromaClipIdx[i][j] << std::endl;
1196 }
1197 }
1198 oss << "alfCcCbFiltersSignalledMinus1: " << +alfData->m_alfCcCbFiltersSignalledMinus1 << std::endl;
1199 for (auto i = 0; i < 4; i++)
1200 {
1201 for (auto j = 0; j < 7; j++)
1202 {
1203 oss << "CcAlfApsCoeffCb[" << +i << "][" << +j << "]: " << +alfData->m_ccAlfApsCoeffCb[i][j] << std::endl;
1204 }
1205 }
1206 oss << "alfCcCrFiltersSignalledMinus1: " << +alfData->m_alfCcCrFiltersSignalledMinus1 << std::endl;
1207 for (auto i = 0; i < 4; i++)
1208 {
1209 for (auto j = 0; j < 7; j++)
1210 {
1211 oss << "CcAlfApsCoeffCr[" << +i << "][" << +j << "]: " << +alfData->m_ccAlfApsCoeffCr[i][j] << std::endl;
1212 }
1213 }
1214
1215 oss << "alfFlags value: " << +alfData->m_alfFlags.m_value << std::endl;
1216 oss << "alfLumaFilterSignalFlag: " << +alfData->m_alfFlags.m_fields.m_alfLumaFilterSignalFlag << std::endl;
1217 oss << "alfChromaFilterSignalFlag: " << +alfData->m_alfFlags.m_fields.m_alfChromaFilterSignalFlag << std::endl;
1218 oss << "alfCcCbFilterSignalFlag: " << +alfData->m_alfFlags.m_fields.m_alfCcCbFilterSignalFlag << std::endl;
1219 oss << "alfCcCrFilterSignalFlag: " << +alfData->m_alfFlags.m_fields.m_alfCcCrFilterSignalFlag << std::endl;
1220 oss << "alfLumaClipFlag: " << +alfData->m_alfFlags.m_fields.m_alfLumaClipFlag << std::endl;
1221 oss << "alfChromaClipFlag: " << +alfData->m_alfFlags.m_fields.m_alfChromaClipFlag << std::endl;
1222 }
1223
1224 std::ofstream ofs(fileName, std::ios::out);
1225 ofs << oss.str();
1226 ofs.close();
1227 }
1228
1229 void DumpDecodeVvcLmcsParams(CodecVvcLmcsData *lmcsDataBuf, uint32_t numLmcs, std::string fileName)
1230 {
1231 CodecVvcLmcsData *lmcsData = nullptr;
1232
1233 std::ostringstream oss;
1234 oss.setf(std::ios::showbase | std::ios::uppercase);
1235
1236 for (uint16_t j = 0; j < numLmcs; j++)
1237 {
1238 lmcsData = &lmcsDataBuf[j];
1239 oss << "====================================================================================================" << std::endl;
1240 oss << "Data for APS LMCS number = " << +j << std::endl;
1241 oss << "apsAdaptationParameterSetId: " << +lmcsData->m_apsAdaptationParameterSetId << std::endl;
1242 oss << "lmcsMinBinIdx: " << +lmcsData->m_lmcsMinBinIdx << std::endl;
1243 oss << "lmcsDeltaMaxBinIdx: " << +lmcsData->m_lmcsDeltaMaxBinIdx << std::endl;
1244 for (auto i = 0; i < 16; i++)
1245 {
1246 oss << "lmcsDeltaCW[" << +i << "]: " << +lmcsData->m_lmcsDeltaCW[i] << std::endl;
1247 }
1248 oss << "lmcsDeltaCrs: " << +lmcsData->m_lmcsDeltaCrs << std::endl;
1249 }
1250
1251 std::ofstream ofs(fileName, std::ios::out);
1252 ofs << oss.str();
1253 ofs.close();
1254 }
1255
1256 void DumpDecodeVvcIqParams(CodecVvcQmData *quantMatrixBuf, uint32_t numScalingList, std::string fileName)
1257 {
1258 CodecVvcQmData *quantMatrix = nullptr;
1259
1260 std::ostringstream oss;
1261 oss.setf(std::ios::showbase | std::ios::uppercase);
1262
1263 for (uint16_t j = 0; j < numScalingList; j++)
1264 {
1265 quantMatrix = &quantMatrixBuf[j];
1266 oss << "====================================================================================================" << std::endl;
1267 oss << "Data for APS Scaling List number = " << +j << std::endl;
1268 oss << "apsAdaptationParameterSetId: " << +quantMatrix->m_apsAdaptationParameterSetId << std::endl;
1269 for (auto i = 0; i < 14; i++)
1270 {
1271 oss << "scalingMatrixDCRec[" << +i << "]: " << +quantMatrix->m_scalingMatrixDCRec[i] << std::endl;
1272 }
1273 for (auto i = 0; i < 2; i++)
1274 {
1275 for (auto j = 0; j < 2; j++)
1276 {
1277 for (auto k = 0; k < 2; k++)
1278 {
1279 oss << "scalingMatrixRec2x2[" << +i << "][" << +j << "][" << +k << "]: " << +quantMatrix->m_scalingMatrixRec2x2[i][j][k] << std::endl;
1280 }
1281 }
1282 }
1283 for (auto i = 0; i < 6; i++)
1284 {
1285 for (auto j = 0; j < 4; j++)
1286 {
1287 for (auto k = 0; k < 4; k++)
1288 {
1289 oss << "scalingMatrixRec4x4[" << +i << "][" << +j << "][" << +k << "]: " << +quantMatrix->m_scalingMatrixRec4x4[i][j][k] << std::endl;
1290 }
1291 }
1292 }
1293 for (auto i = 0; i < 20; i++)
1294 {
1295 for (auto j = 0; j < 8; j++)
1296 {
1297 for (auto k = 0; k < 8; k++)
1298 {
1299 oss << "scalingMatrixRec8x8[" << +i << "][" << +j << "][" << +k << "]: " << +quantMatrix->m_scalingMatrixRec8x8[i][j][k] << std::endl;
1300 }
1301 }
1302 }
1303 }
1304
1305 std::ofstream ofs(fileName, std::ios::out);
1306 ofs << oss.str();
1307 ofs.close();
1308 }
1309
1310 void DumpDecodeVvcTileParams(CodecVvcTileParam *tileParams, uint32_t numElements, std::string fileName)
1311 {
1312 CodecVvcTileParam *element = nullptr;
1313
1314 std::ostringstream oss;
1315 oss.setf(std::ios::showbase | std::ios::uppercase);
1316
1317 for (uint16_t j = 0; j < numElements; j++)
1318 {
1319 element = &tileParams[j];
1320 oss << "====================================================================================================" << std::endl;
1321 oss << "Data for Tile Params element = " << +j << std::endl;
1322 oss << "tileDimension: " << +element->m_tileDimension << std::endl;
1323 }
1324
1325 std::ofstream ofs(fileName, std::ios::out);
1326 ofs << oss.str();
1327 ofs.close();
1328 }
1329
1330 void DumpDecodeVvcSubpicParams(CodecVvcSubpicParam *subpicParamsBuf, uint32_t numSubpics, std::string fileName)
1331 {
1332 CodecVvcSubpicParam *subpicParams = nullptr;
1333
1334 std::ostringstream oss;
1335 oss.setf(std::ios::showbase | std::ios::uppercase);
1336
1337 for (uint16_t j = 0; j < numSubpics; j++)
1338 {
1339 subpicParams = &subpicParamsBuf[j];
1340 oss << "====================================================================================================" << std::endl;
1341 oss << "Data for SubPic Params number = " << +j << std::endl;
1342 oss << "spsSubpicCtuTopLeftX: " << +subpicParams->m_spsSubpicCtuTopLeftX << std::endl;
1343 oss << "spsSubpicCtuTopLeftY: " << +subpicParams->m_spsSubpicCtuTopLeftY << std::endl;
1344 oss << "spsSubpicWidthMinus1: " << +subpicParams->m_spsSubpicWidthMinus1 << std::endl;
1345 oss << "spsSubpicHeightMinus1: " << +subpicParams->m_spsSubpicHeightMinus1 << std::endl;
1346 oss << "subpicIdVal: " << +subpicParams->m_subpicIdVal << std::endl;
1347
1348 oss << "subPicFlags value: " << +subpicParams->m_subPicFlags.m_value << std::endl;
1349 oss << "spsSubpicTreatedAsPicFlag: " << +subpicParams->m_subPicFlags.m_fields.m_spsSubpicTreatedAsPicFlag << std::endl;
1350 oss << "spsLoopFilterAcrossSubpicEnabledFlag: " << +subpicParams->m_subPicFlags.m_fields.m_spsLoopFilterAcrossSubpicEnabledFlag << std::endl;
1351
1352 //Additional params, miss m_sliceIdx pointer
1353 oss << "endCtbX: " << +subpicParams->m_endCtbX << std::endl;
1354 oss << "endCtbY: " << +subpicParams->m_endCtbY << std::endl;
1355 oss << "numSlices: " << +subpicParams->m_numSlices << std::endl;
1356 }
1357
1358 std::ofstream ofs(fileName, std::ios::out);
1359 ofs << oss.str();
1360 ofs.close();
1361 }
1362
1363 void DumpDecodeVvcSliceStructureParams(CodecVvcSliceStructure *sliceStructParamsBuf, uint32_t numSlcStruct, std::string fileName)
1364 {
1365 CodecVvcSliceStructure *sliceStructParams = nullptr;
1366
1367 std::ostringstream oss;
1368 oss.setf(std::ios::showbase | std::ios::uppercase);
1369
1370 for (uint16_t j = 0; j < numSlcStruct; j++)
1371 {
1372 sliceStructParams = &sliceStructParamsBuf[j];
1373 oss << "====================================================================================================" << std::endl;
1374 oss << "Data for Slice Struct Params number = " << +j << std::endl;
1375 oss << "sliceTopLeftTileIdx: " << +sliceStructParams->m_sliceTopLeftTileIdx << std::endl;
1376 oss << "ppsSliceWidthInTilesMinus1: " << +sliceStructParams->m_ppsSliceWidthInTilesMinus1 << std::endl;
1377 oss << "ppsSliceHeightInTilesMinus1: " << +sliceStructParams->m_ppsSliceHeightInTilesMinus1 << std::endl;
1378 oss << "ppsExpSliceHeightInCtusMinus1: " << +sliceStructParams->m_ppsExpSliceHeightInCtusMinus1 << std::endl;
1379 }
1380
1381 std::ofstream ofs(fileName, std::ios::out);
1382 ofs << oss.str();
1383 ofs.close();
1384 }
1385
1386 void DumpDecodeVvcRplStructureParams(CodecVvcRplStructure *rplParams, uint32_t numRpls, std::string fileName)
1387 {
1388 CodecVvcRplStructure *rplStructParams = nullptr;
1389
1390 std::ostringstream oss;
1391 oss.setf(std::ios::showbase | std::ios::uppercase);
1392
1393 for (uint16_t j = 0; j < numRpls; j++)
1394 {
1395 rplStructParams = &rplParams[j];
1396 oss << "====================================================================================================" << std::endl;
1397 oss << "Data for RPL Params number = " << +j << std::endl;
1398 oss << "listIdx: " << +rplStructParams->m_listIdx << std::endl;
1399 oss << "rplsIdx: " << +rplStructParams->m_rplsIdx << std::endl;
1400 oss << "numRefEntries: " << +rplStructParams->m_numRefEntries << std::endl;
1401 oss << "ltrpInHeaderFlag: " << +rplStructParams->m_ltrpInHeaderFlag << std::endl;
1402 for (auto i = 0; i < 29; i++)
1403 {
1404 oss << "stRefPicFlag[" << +i << "]: " << +rplStructParams->m_stRefPicFlag[i] << std::endl;
1405 }
1406 for (auto i = 0; i < 29; i++)
1407 {
1408 oss << "DeltaPocSt[" << +i << "]: " << +rplStructParams->m_deltaPocSt[i] << std::endl;
1409 }
1410 for (auto i = 0; i < 29; i++)
1411 {
1412 oss << "rplsPocLsbLt[" << +i << "]: " << +rplStructParams->m_rplsPocLsbLt[i] << std::endl;
1413 }
1414 for (auto i = 0; i < 29; i++)
1415 {
1416 oss << "interLayerRefPicFlag[" << +i << "]: " << +rplStructParams->m_interLayerRefPicFlag[i] << std::endl;
1417 }
1418 for (auto i = 0; i < 29; i++)
1419 {
1420 oss << "ilrpIdx[" << +i << "]: " << +rplStructParams->m_ilrpIdx[i] << std::endl;
1421 }
1422 }
1423
1424 std::ofstream ofs(fileName, std::ios::out);
1425 ofs << oss.str();
1426 ofs.close();
1427 }
1428
1429 void DumpDecodeVvcSliceParams(CodecVvcSliceParams *sliceParams, uint32_t numSlices, std::string fileName, bool shortFormatInUse)
1430 {
1431 CodecVvcSliceParams *vvcSliceControl = nullptr;
1432
1433 std::ostringstream oss;
1434 oss.setf(std::ios::showbase | std::ios::uppercase);
1435
1436 for (uint16_t j = 0; j < numSlices; j++)
1437 {
1438 vvcSliceControl = &sliceParams[j];
1439 oss << "====================================================================================================" << std::endl;
1440 oss << "Data for Slice number = " << +j << std::endl;
1441 oss << "bSNALunitDataLocation: " << +vvcSliceControl->m_bSNALunitDataLocation << std::endl;
1442 oss << "sliceBytesInBuffer: " << +vvcSliceControl->m_sliceBytesInBuffer << std::endl;
1443 oss << "wBadSliceChopping: " << +vvcSliceControl->m_wBadSliceChopping << std::endl;
1444
1445 if (!shortFormatInUse)
1446 {
1447 oss << "shSubpicId: " << +vvcSliceControl->m_shSubpicId << std::endl;
1448 oss << "shSliceAddress: " << +vvcSliceControl->m_shSliceAddress << std::endl;
1449 oss << "shNumTilesInSliceMinus1: " << +vvcSliceControl->m_shNumTilesInSliceMinus1 << std::endl;
1450 oss << "shSliceType: " << +vvcSliceControl->m_shSliceType << std::endl;
1451 oss << "shNumAlfApsIdsLuma: " << +vvcSliceControl->m_shNumAlfApsIdsLuma << std::endl;
1452 for (auto i = 0; i < 7; i++)
1453 {
1454 oss << "shAlfApsIdLuma[" << +i << "]: " << +vvcSliceControl->m_shAlfApsIdLuma[i] << std::endl;
1455 }
1456 oss << "shAlfApsIdChroma: " << +vvcSliceControl->m_shAlfApsIdChroma << std::endl;
1457 oss << "shAlfCcCbApsId: " << +vvcSliceControl->m_shAlfCcCbApsId << std::endl;
1458 oss << "shAlfCcCrApsId: " << +vvcSliceControl->m_shAlfCcCrApsId << std::endl;
1459 for (auto i = 0; i < 2; i++)
1460 {
1461 oss << "numRefIdxActive[" << +i << "]: " << +vvcSliceControl->m_numRefIdxActive[i] << std::endl;
1462 }
1463 oss << "shCollocatedRefIdx: " << +vvcSliceControl->m_shCollocatedRefIdx << std::endl;
1464 oss << "sliceQpY: " << +vvcSliceControl->m_sliceQpY << std::endl;
1465 oss << "shCbQpOffset: " << +vvcSliceControl->m_shCbQpOffset << std::endl;
1466 oss << "shCrQpOffset: " << +vvcSliceControl->m_shCrQpOffset << std::endl;
1467 oss << "shJointCbcrQpOffset: " << +vvcSliceControl->m_shJointCbcrQpOffset << std::endl;
1468 oss << "shLumaBetaOffsetDiv2: " << +vvcSliceControl->m_shLumaBetaOffsetDiv2 << std::endl;
1469 oss << "shLumaTcOffsetDiv2: " << +vvcSliceControl->m_shLumaTcOffsetDiv2 << std::endl;
1470 oss << "shCbBetaOffsetDiv2: " << +vvcSliceControl->m_shCbBetaOffsetDiv2 << std::endl;
1471 oss << "shCbTcOffsetDiv2: " << +vvcSliceControl->m_shCbTcOffsetDiv2 << std::endl;
1472 oss << "shCrBetaOffsetDiv2: " << +vvcSliceControl->m_shCrBetaOffsetDiv2 << std::endl;
1473 oss << "shCrTcOffsetDiv2: " << +vvcSliceControl->m_shCrTcOffsetDiv2 << std::endl;
1474
1475 oss << "byteOffsetToSliceData: " << +vvcSliceControl->m_byteOffsetToSliceData << std::endl;
1476 oss << "numEntryPoints: " << +vvcSliceControl->m_numEntryPoints << std::endl;
1477
1478 for (auto i = 0; i < 2; i++)
1479 {
1480 for (auto j = 0; j < 15; j++)
1481 {
1482 oss << "refPicList[" << +i << "][" << +j << "] FrameIdx: " << +vvcSliceControl->m_refPicList[i][j].FrameIdx << std::endl;
1483 }
1484 }
1485 oss << "lumaLog2WeightDenom: " << +vvcSliceControl->m_wpInfo.m_lumaLog2WeightDenom << std::endl;
1486 oss << "deltaChromaLog2WeightDenom: " << +vvcSliceControl->m_wpInfo.m_deltaChromaLog2WeightDenom << std::endl;
1487 oss << "numL0Weights: " << +vvcSliceControl->m_wpInfo.m_numL0Weights << std::endl;
1488 for (auto i = 0; i < 15; i++)
1489 {
1490 oss << "lumaWeightL0Flag[" << +i << "]: " << +vvcSliceControl->m_wpInfo.m_lumaWeightL0Flag[i] << std::endl;
1491 }
1492 for (auto i = 0; i < 15; i++)
1493 {
1494 oss << "chromaWeightL0Flag[" << +i << "]: " << +vvcSliceControl->m_wpInfo.m_chromaWeightL0Flag[i] << std::endl;
1495 }
1496 for (auto i = 0; i < 15; i++)
1497 {
1498 oss << "deltaLumaWeightL0[" << +i << "]: " << +vvcSliceControl->m_wpInfo.m_deltaLumaWeightL0[i] << std::endl;
1499 }
1500 for (auto i = 0; i < 15; i++)
1501 {
1502 oss << "lumaOffsetL0[" << +i << "]: " << +vvcSliceControl->m_wpInfo.m_lumaOffsetL0[i] << std::endl;
1503 }
1504 for (auto i = 0; i < 15; i++)
1505 {
1506 for (auto j = 0; j < 2; j++)
1507 {
1508 oss << "deltaChromaWeightL0[" << +i << "][" << +j << "]: " << +vvcSliceControl->m_wpInfo.m_deltaChromaWeightL0[i][j] << std::endl;
1509 }
1510 }
1511 for (auto i = 0; i < 15; i++)
1512 {
1513 for (auto j = 0; j < 2; j++)
1514 {
1515 oss << "deltaChromaOffsetL0[" << +i << "][" << +j << "]: " << +vvcSliceControl->m_wpInfo.m_deltaChromaOffsetL0[i][j] << std::endl;
1516 }
1517 }
1518 oss << "numL1Weights: " << +vvcSliceControl->m_wpInfo.m_numL1Weights << std::endl;
1519 for (auto i = 0; i < 15; i++)
1520 {
1521 oss << "lumaWeightL1Flag[" << +i << "]: " << +vvcSliceControl->m_wpInfo.m_lumaWeightL1Flag[i] << std::endl;
1522 }
1523 for (auto i = 0; i < 15; i++)
1524 {
1525 oss << "chromaWeightL1Flag[" << +i << "]: " << +vvcSliceControl->m_wpInfo.m_chromaWeightL1Flag[i] << std::endl;
1526 }
1527 for (auto i = 0; i < 15; i++)
1528 {
1529 oss << "deltaLumaWeightL1[" << +i << "]: " << +vvcSliceControl->m_wpInfo.m_deltaLumaWeightL1[i] << std::endl;
1530 }
1531 for (auto i = 0; i < 15; i++)
1532 {
1533 oss << "lumaOffsetL1[" << +i << "]: " << +vvcSliceControl->m_wpInfo.m_lumaOffsetL1[i] << std::endl;
1534 }
1535 for (auto i = 0; i < 15; i++)
1536 {
1537 for (auto j = 0; j < 2; j++)
1538 {
1539 oss << "deltaChromaWeightL1[" << +i << "][" << +j << "]: " << +vvcSliceControl->m_wpInfo.m_deltaChromaWeightL1[i][j] << std::endl;
1540 }
1541 }
1542 for (auto i = 0; i < 15; i++)
1543 {
1544 for (auto j = 0; j < 2; j++)
1545 {
1546 oss << "deltaChromaOffsetL1[" << +i << "][" << +j << "]: " << +vvcSliceControl->m_wpInfo.m_deltaChromaOffsetL1[i][j] << std::endl;
1547 }
1548 }
1549
1550 oss << "longSliceFlags value: " << +vvcSliceControl->m_longSliceFlags.m_value << std::endl;
1551 oss << "shAlfEnabledFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shAlfEnabledFlag << std::endl;
1552 oss << "shAlfCbEnabledFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shAlfCbEnabledFlag << std::endl;
1553 oss << "shAlfCrEnabledFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shAlfCrEnabledFlag << std::endl;
1554 oss << "shAlfCcCbEnabledFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shAlfCcCbEnabledFlag << std::endl;
1555 oss << "shAlfCcCrEnabledFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shAlfCcCrEnabledFlag << std::endl;
1556 oss << "shLmcsUsedFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shLmcsUsedFlag << std::endl;
1557 oss << "shExplicitScalingListUsedFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shExplicitScalingListUsedFlag << std::endl;
1558 oss << "shCabacInitFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shCabacInitFlag << std::endl;
1559 oss << "shCollocatedFromL0Flag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shCollocatedFromL0Flag << std::endl;
1560 oss << "shCuChromaQpOffsetEnabledFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shCuChromaQpOffsetEnabledFlag << std::endl;
1561 oss << "shSaoLumaUsedFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shSaoLumaUsedFlag << std::endl;
1562 oss << "shSaoChromaUsedFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shSaoChromaUsedFlag << std::endl;
1563 oss << "shDeblockingFilterDisabledFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shDeblockingFilterDisabledFlag << std::endl;
1564 oss << "shDepQuantUsedFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shDepQuantUsedFlag << std::endl;
1565 oss << "shSignDataHidingUsedFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shSignDataHidingUsedFlag << std::endl;
1566 oss << "shTsResidualCodingDisabledFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_shTsResidualCodingDisabledFlag << std::endl;
1567 oss << "lastSliceOfPic: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_lastSliceOfPic << std::endl;
1568 oss << "noBackwardPredFlag: " << +vvcSliceControl->m_longSliceFlags.m_fields.m_noBackwardPredFlag << std::endl;
1569 }
1570 }
1571
1572 std::ofstream ofs(fileName, std::ios::out);
1573 ofs << oss.str();
1574 ofs.close();
1575 }
1576 #endif
1577
1578 MOS_STATUS VvcPipeline::CreateFeatureManager()
1579 {
1580 DECODE_FUNC_CALL();
1581
1582 m_featureManager = MOS_New(DecodeVvcFeatureManager, m_allocator, dynamic_cast<CodechalHwInterfaceNext *>(m_hwInterface), m_osInterface);
1583 DECODE_CHK_NULL(m_featureManager);
1584
1585 return MOS_STATUS_SUCCESS;
1586 }
1587
1588 }