Skip to content

Commit 4968c07

Browse files
pengwan1intel-mediadev
authored andcommitted
[Decode] [PDVT-SH] AVC CRC Output Enable
AVC CRC Output Enable
1 parent df6ece1 commit 4968c07

File tree

7 files changed

+283
-2
lines changed

7 files changed

+283
-2
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright (c) 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+
//!
24+
//! \file decode_avc_debug_packet.cpp
25+
//! \brief Defines the implementation of AVC decode debug packet
26+
//! \details The AVC decode debug packet provides debug functionality for AVC decoding
27+
//!
28+
29+
#if (_DEBUG || _RELEASE_INTERNAL)
30+
31+
#include "decode_avc_debug_packet.h"
32+
#include "decode_utils.h"
33+
34+
namespace decode
35+
{
36+
37+
AvcDecodeDebugPkt::AvcDecodeDebugPkt(DecodePipeline *pipeline, CodechalHwInterfaceNext *hwInterface)
38+
: DecodeSubPacket(pipeline, hwInterface)
39+
{
40+
m_hwInterface = hwInterface;
41+
m_pipeline = pipeline;
42+
}
43+
44+
MOS_STATUS AvcDecodeDebugPkt::Init()
45+
{
46+
DECODE_FUNC_CALL();
47+
48+
DECODE_CHK_NULL(m_pipeline);
49+
DECODE_CHK_NULL(m_hwInterface);
50+
51+
m_miItf = m_hwInterface->GetMiInterfaceNext();
52+
DECODE_CHK_NULL(m_miItf);
53+
54+
return MOS_STATUS_SUCCESS;
55+
}
56+
57+
MOS_STATUS AvcDecodeDebugPkt::Prepare()
58+
{
59+
DECODE_FUNC_CALL();
60+
61+
return MOS_STATUS_SUCCESS;
62+
}
63+
64+
MOS_STATUS AvcDecodeDebugPkt::CalculateCommandSize(uint32_t &commandBufferSize, uint32_t &requestedPatchListSize)
65+
{
66+
DECODE_FUNC_CALL();
67+
68+
commandBufferSize = 0;
69+
requestedPatchListSize = 0;
70+
return MOS_STATUS_SUCCESS;
71+
}
72+
73+
MOS_STATUS AvcDecodeDebugPkt::Destroy()
74+
{
75+
DECODE_FUNC_CALL();
76+
77+
return MOS_STATUS_SUCCESS;
78+
}
79+
80+
MOS_STATUS AvcDecodeDebugPkt::Execute(MOS_COMMAND_BUFFER& cmdBuffer, MediaStatusReport *statusReport)
81+
{
82+
DECODE_FUNC_CALL();
83+
84+
return MOS_STATUS_SUCCESS;
85+
}
86+
87+
MOS_STATUS AvcDecodeDebugPkt::Completed()
88+
{
89+
DECODE_FUNC_CALL();
90+
91+
return MOS_STATUS_SUCCESS;
92+
}
93+
94+
} // namespace decode
95+
96+
#endif // (_DEBUG || _RELEASE_INTERNAL)
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* Copyright (c) 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+
//!
24+
//! \file decode_avc_debug_packet.h
25+
//! \brief Defines the implementation of AVC decode debug packet
26+
//! \details The AVC decode debug packet provides debug functionality for AVC decoding
27+
//!
28+
29+
#ifndef __DECODE_AVC_DEBUG_PACKET_H__
30+
#define __DECODE_AVC_DEBUG_PACKET_H__
31+
32+
#if (_DEBUG || _RELEASE_INTERNAL)
33+
34+
#include "decode_sub_packet.h"
35+
#include "media_cmd_packet.h"
36+
37+
namespace decode
38+
{
39+
40+
class AvcDecodeDebugPkt : public DecodeSubPacket
41+
{
42+
public:
43+
//!
44+
//! \brief AVC decode debug sub packet constructor
45+
//!
46+
AvcDecodeDebugPkt(DecodePipeline *pipeline, CodechalHwInterfaceNext *hwInterface);
47+
48+
//!
49+
//! \brief AVC decode debug sub packet destructor
50+
//!
51+
virtual ~AvcDecodeDebugPkt() {};
52+
53+
//!
54+
//! \brief Initialize the debug sub packet
55+
//! \return MOS_STATUS
56+
//! MOS_STATUS_SUCCESS if success, else fail reason
57+
//!
58+
virtual MOS_STATUS Init() override;
59+
60+
//!
61+
//! \brief Prepare the parameters for debug sub packet
62+
//! \return MOS_STATUS
63+
//! MOS_STATUS_SUCCESS if success, else fail reason
64+
//!
65+
virtual MOS_STATUS Prepare() override;
66+
67+
//!
68+
//! \brief Calculate Command Size
69+
//!
70+
//! \param [in, out] commandBufferSize
71+
//! requested size
72+
//! \param [in, out] requestedPatchListSize
73+
//! requested size
74+
//! \return MOS_STATUS
75+
//! status
76+
//!
77+
virtual MOS_STATUS CalculateCommandSize(
78+
uint32_t &commandBufferSize,
79+
uint32_t &requestedPatchListSize) override;
80+
81+
//!
82+
//! \brief Destroy the debug sub packet
83+
//! \return MOS_STATUS
84+
//! MOS_STATUS_SUCCESS if success, else fail reason
85+
//!
86+
virtual MOS_STATUS Destroy();
87+
88+
//!
89+
//! \brief Execute debug sub packet
90+
//! \param [in] cmdBuffer
91+
//! Command buffer
92+
//! \return MOS_STATUS
93+
//! MOS_STATUS_SUCCESS if success, else fail reason
94+
//!
95+
virtual MOS_STATUS Execute(MOS_COMMAND_BUFFER& cmdBuffer, MediaStatusReport *statusReport);
96+
97+
//!
98+
//! \brief Complete debug operations after decode
99+
//! \return MOS_STATUS
100+
//! MOS_STATUS_SUCCESS if success, else fail reason
101+
//!
102+
virtual MOS_STATUS Completed();
103+
104+
protected:
105+
std::shared_ptr<mhw::mi::Itf> m_miItf = nullptr;
106+
107+
MEDIA_CLASS_DEFINE_END(decode__AvcDecodeDebugPkt)
108+
};
109+
110+
} // namespace decode
111+
112+
#endif // (_DEBUG || _RELEASE_INTERNAL)
113+
114+
#endif // !__DECODE_AVC_DEBUG_PACKET_H__

media_softlet/agnostic/common/codec/hal/dec/avc/packet/decode_avc_packet.cpp

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
#include "decode_status_report_defs.h"
3131
#include "decode_predication_packet.h"
3232
#include "codechal_debug.h"
33+
#if (_DEBUG || _RELEASE_INTERNAL)
34+
#include "decode_avc_debug_packet.h"
35+
#endif
3336

3437
namespace decode
3538
{
@@ -63,6 +66,17 @@ MOS_STATUS AvcDecodePkt::Init()
6366
DECODE_CHK_NULL(m_slicePkt);
6467
DECODE_CHK_STATUS(m_slicePkt->CalculateCommandSize(m_sliceStatesSize, m_slicePatchListSize));
6568

69+
#if (_DEBUG || _RELEASE_INTERNAL)
70+
// Initialize debug packet
71+
DecodeSubPacket* debugSubPacket = m_avcPipeline->GetSubPacket(
72+
DecodePacketId(m_avcPipeline, avcDebugSubPacketId));
73+
m_debugPkt = dynamic_cast<AvcDecodeDebugPkt*>(debugSubPacket);
74+
if (m_debugPkt != nullptr)
75+
{
76+
DECODE_CHK_STATUS(m_debugPkt->Init());
77+
}
78+
#endif
79+
6680
return MOS_STATUS_SUCCESS;
6781
}
6882

@@ -79,6 +93,15 @@ MOS_STATUS AvcDecodePkt::Prepare()
7993
MOS_STATUS AvcDecodePkt::Destroy()
8094
{
8195
m_statusReport->UnregistObserver(this);
96+
97+
#if (_DEBUG || _RELEASE_INTERNAL)
98+
// Destroy debug packet
99+
if (m_debugPkt != nullptr)
100+
{
101+
DECODE_CHK_STATUS(m_debugPkt->Destroy());
102+
}
103+
#endif
104+
82105
return MOS_STATUS_SUCCESS;
83106
}
84107

@@ -180,6 +203,14 @@ MOS_STATUS AvcDecodePkt::Completed(void *mfxStatus, void *rcsStatus, void *statu
180203
DECODE_VERBOSEMESSAGE("Current Frame Index = %d", statusReportData->currDecodedPic.FrameIdx);
181204
DECODE_VERBOSEMESSAGE("FrameCrc = 0x%x", statusReportData->frameCrc);
182205

206+
#if (_DEBUG || _RELEASE_INTERNAL)
207+
// Call debug packet completion handling for MFX debug functionality
208+
if (m_debugPkt != nullptr)
209+
{
210+
DECODE_CHK_STATUS(m_debugPkt->Completed());
211+
}
212+
#endif
213+
183214
return MOS_STATUS_SUCCESS;
184215
}
185216

@@ -280,6 +311,13 @@ MOS_STATUS AvcDecodePkt::EndStatusReport(uint32_t srType, MOS_COMMAND_BUFFER *cm
280311
DECODE_FUNC_CALL();
281312
DECODE_CHK_NULL(cmdBuffer);
282313
DECODE_CHK_STATUS(ReadMfxStatus(m_statusReport, *cmdBuffer));
314+
#if (_DEBUG || _RELEASE_INTERNAL)
315+
// Execute debug packet for MFX debug functionality before MiFlush
316+
if (m_debugPkt != nullptr)
317+
{
318+
DECODE_CHK_STATUS(m_debugPkt->Execute(*cmdBuffer, m_statusReport));
319+
}
320+
#endif
283321
DECODE_CHK_STATUS(MediaPacket::EndStatusReportNext(srType, cmdBuffer));
284322

285323
MediaPerfProfiler *perfProfiler = MediaPerfProfiler::Instance();
@@ -334,4 +372,4 @@ MOS_STATUS AvcDecodePkt::SetCencBatchBuffer(
334372
return MOS_STATUS_SUCCESS;
335373
}
336374

337-
} // namespace decode
375+
} // namespace decode

media_softlet/agnostic/common/codec/hal/dec/avc/packet/decode_avc_packet.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,15 @@
3636
#include "decode_avc_picture_packet.h"
3737
#include "decode_avc_slice_packet.h"
3838

39+
#if (_DEBUG || _RELEASE_INTERNAL)
40+
#include "decode_avc_debug_packet.h"
41+
#endif
42+
3943
namespace decode
4044
{
45+
46+
class AvcDecodeDebugPkt;
47+
4148
class AvcDecodePkt : public CmdPacket, public MediaStatusReportObserver
4249
{
4350
public:
@@ -166,6 +173,10 @@ class AvcDecodePkt : public CmdPacket, public MediaStatusReportObserver
166173
uint32_t m_sliceStatesSize = 0;
167174
uint32_t m_slicePatchListSize = 0;
168175

176+
#if (_DEBUG || _RELEASE_INTERNAL)
177+
AvcDecodeDebugPkt *m_debugPkt = nullptr;
178+
#endif
179+
169180
MEDIA_CLASS_DEFINE_END(decode__AvcDecodePkt)
170181
};
171182
} // namespace decode

media_softlet/agnostic/common/codec/hal/dec/avc/packet/media_srcs.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021-2022, Intel Corporation
1+
# Copyright (c) 2021-2025, Intel Corporation
22
#
33
# Permission is hereby granted, free of charge, to any person obtaining a
44
# copy of this software and associated documentation files (the "Software"),
@@ -25,6 +25,7 @@ set(SOFTLET_DECODE_AVC_SOURCES_
2525
${CMAKE_CURRENT_LIST_DIR}/decode_avc_picture_packet.cpp
2626
${CMAKE_CURRENT_LIST_DIR}/decode_avc_packet.cpp
2727
${CMAKE_CURRENT_LIST_DIR}/decode_avc_downsampling_packet.cpp
28+
${CMAKE_CURRENT_LIST_DIR}/decode_avc_debug_packet.cpp
2829
)
2930

3031
set(SOFTLET_DECODE_AVC_HEADERS_
@@ -33,6 +34,7 @@ set(SOFTLET_DECODE_AVC_HEADERS_
3334
${CMAKE_CURRENT_LIST_DIR}/decode_avc_slice_packet.h
3435
${CMAKE_CURRENT_LIST_DIR}/decode_avc_picture_packet.h
3536
${CMAKE_CURRENT_LIST_DIR}/decode_avc_downsampling_packet.h
37+
${CMAKE_CURRENT_LIST_DIR}/decode_avc_debug_packet.h
3638
)
3739

3840
source_group( CodecHalNext\\Shared\\Decode FILES ${SOFTLET_DECODE_AVC_SOURCES_} ${SOFTLET_DECODE_AVC_HEADERS_} )

media_softlet/agnostic/common/codec/hal/dec/avc/pipeline/decode_avc_pipeline.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,19 @@ namespace decode
235235

236236
DECODE_CHK_STATUS(DecodePipeline::CreateSubPackets(subPacketManager, codecSettings));
237237

238+
#if (_DEBUG || _RELEASE_INTERNAL)
239+
// Create debug packet
240+
AvcDecodeDebugPkt *debugPkt = MOS_New(AvcDecodeDebugPkt, this, m_hwInterface);
241+
DECODE_CHK_NULL(debugPkt);
242+
MOS_STATUS status = subPacketManager.Register(
243+
DecodePacketId(this, avcDebugSubPacketId), *debugPkt);
244+
if (status != MOS_STATUS_SUCCESS)
245+
{
246+
MOS_Delete(debugPkt);
247+
return status;
248+
}
249+
#endif
250+
238251
return MOS_STATUS_SUCCESS;
239252
}
240253

media_softlet/agnostic/common/codec/hal/dec/avc/pipeline/decode_avc_pipeline.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
#include "decode_pipeline.h"
3030
#include "decode_avc_basic_feature.h"
3131

32+
#if (_DEBUG || _RELEASE_INTERNAL)
33+
#include "decode_avc_debug_packet.h"
34+
#endif
35+
3236
namespace decode {
3337

3438
class AvcPipeline : public DecodePipeline
@@ -80,6 +84,9 @@ class AvcPipeline : public DecodePipeline
8084
DeclareDecodePacketId(avcSliceSubPacketId);
8185
DeclareDecodePacketId(avcFormatMonoPicPktId);
8286
DeclareDecodePacketId(avcDecodeAqmId);
87+
#if (_DEBUG || _RELEASE_INTERNAL)
88+
DeclareDecodePacketId(avcDebugSubPacketId);
89+
#endif
8390

8491
protected:
8592
//!

0 commit comments

Comments
 (0)