summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUng, Teng En <teng.en.ung@intel.com>2021-03-10 11:14:12 +0800
committerAnuj Mittal <anuj.mittal@intel.com>2021-03-10 11:20:32 +0800
commit850940e3e5ebc75328fa75e718235342cb6c2172 (patch)
tree685c19b521368c259e5ad376184ae209ef48d879
parente4ccee0047032fea36810b70ea1b5f20c480685d (diff)
downloadmeta-intel-850940e3e5ebc75328fa75e718235342cb6c2172.tar.gz
intel-mediasdk: Enable the SPS/PPS error reporting on hevcd
These patches are merged into upstream. Will need to remove once update to version later than 21.1.2. Signed-off-by: Ung, Teng En <teng.en.ung@intel.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-rw-r--r--recipes-multimedia/mediasdk/files/0001-hevcd-Enable-the-SPS-PPS-error-reporting.patch139
-rw-r--r--recipes-multimedia/mediasdk/files/0002-hevcd-Use-reinterpret_cast-for-style-alignment.patch27
-rw-r--r--recipes-multimedia/mediasdk/intel-mediasdk_21.1.1.bb2
3 files changed, 168 insertions, 0 deletions
diff --git a/recipes-multimedia/mediasdk/files/0001-hevcd-Enable-the-SPS-PPS-error-reporting.patch b/recipes-multimedia/mediasdk/files/0001-hevcd-Enable-the-SPS-PPS-error-reporting.patch
new file mode 100644
index 00000000..f980c4bf
--- /dev/null
+++ b/recipes-multimedia/mediasdk/files/0001-hevcd-Enable-the-SPS-PPS-error-reporting.patch
@@ -0,0 +1,139 @@
1From ee1b87d107833e8803567cac438f55bde72d8e02 Mon Sep 17 00:00:00 2001
2From: "Ung, Teng En" <teng.en.ung@intel.com>
3Date: Mon, 30 Mar 2020 13:40:39 +0000
4Subject: [PATCH 1/2] [hevcd] Enable the SPS/PPS error reporting
5
6Issue:N/A
7Test:sample_decode with mfxExtDecodeErrorReport
8
9Upstream-Status: Accepted [https://github.com/Intel-Media-SDK/MediaSDK/pull/2383]
10
11Signed-off-by: Ung, Teng En <teng.en.ung@intel.com>
12---
13 .../decode/h265/src/mfx_h265_dec_decode.cpp | 10 ++++++
14 .../umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp | 7 ++++
15 .../codec/h265_dec/src/umc_h265_task_supplier.cpp | 41 +++++++++++++++++++++-
16 3 files changed, 57 insertions(+), 1 deletion(-)
17
18diff --git a/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp b/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
19index 4ae164f..f346e8c 100644
20--- a/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
21+++ b/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
22@@ -1105,6 +1105,16 @@ mfxStatus VideoDECODEH265::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1 *
23
24 MFXMediaDataAdapter src(bs);
25
26+#if (MFX_VERSION >= 1025)
27+ mfxExtBuffer* extbuf = (bs) ? GetExtendedBuffer(bs->ExtParam, bs->NumExtParam, MFX_EXTBUFF_DECODE_ERROR_REPORT) : NULL;
28+
29+ if (extbuf)
30+ {
31+ ((mfxExtDecodeErrorReport *)extbuf)->ErrorTypes = 0;
32+ src.SetExtBuffer(extbuf);
33+ }
34+#endif
35+
36 for (;;)
37 {
38 if (m_FrameAllocator->FindFreeSurface() == -1)
39diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp
40index 4cc5dd5..db876f4 100644
41--- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp
42+++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp
43@@ -488,6 +488,13 @@ UMC::Status HeadersAnalyzer::DecodeHeader(UMC::MediaData * data, mfxBitstream *b
44 H265SeqParamSet* first_sps = 0;
45 notifier0<H265SeqParamSet> sps_guard(&H265Slice::DecrementReference);
46
47+#if (MFX_VERSION >= 1025)
48+ mfxExtBuffer* extbuf = (bs) ? GetExtendedBuffer(bs->ExtParam, bs->NumExtParam, MFX_EXTBUFF_DECODE_ERROR_REPORT) : NULL;
49+
50+ if (extbuf)
51+ data->SetAuxInfo(extbuf, extbuf->BufferSz, extbuf->BufferId);
52+#endif
53+
54 UMC::Status umcRes = UMC::UMC_ERR_NOT_ENOUGH_DATA;
55 for ( ; data->GetDataSize() > 3; )
56 {
57diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp
58index 9062568..e220095 100755
59--- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp
60+++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp
61@@ -47,6 +47,21 @@
62 namespace UMC_HEVC_DECODER
63 {
64
65+#if (MFX_VERSION >= 1025)
66+inline void SetDecodeErrorTypes(NalUnitType nalUnit, mfxExtDecodeErrorReport *pDecodeErrorReport)
67+{
68+ if (!pDecodeErrorReport)
69+ return;
70+
71+ switch (nalUnit)
72+ {
73+ case NAL_UT_SPS: pDecodeErrorReport->ErrorTypes |= MFX_ERROR_SPS; break;
74+ case NAL_UT_PPS: pDecodeErrorReport->ErrorTypes |= MFX_ERROR_PPS; break;
75+ default: break;
76+ };
77+}
78+#endif
79+
80 const uint32_t levelIndexArray[] = {
81 H265_LEVEL_1,
82 H265_LEVEL_2,
83@@ -1662,6 +1677,15 @@ UMC::Status TaskSupplier_H265::ProcessNalUnit(UMC::MediaDataEx *nalUnit)
84 case NAL_UT_SPS:
85 case NAL_UT_PPS:
86 umcRes = DecodeHeaders(nalUnit);
87+ {
88+#if (MFX_VERSION >= 1025)
89+ UMC::MediaData::AuxInfo* aux = (nalUnit) ? nalUnit->GetAuxInfo(MFX_EXTBUFF_DECODE_ERROR_REPORT) : NULL;
90+ mfxExtDecodeErrorReport* pDecodeErrorReport = (aux) ? reinterpret_cast<mfxExtDecodeErrorReport*>(aux->ptr) : NULL;
91+ if (pDecodeErrorReport && umcRes == UMC::UMC_ERR_INVALID_STREAM)
92+ SetDecodeErrorTypes(unitType, pDecodeErrorReport);
93+#endif
94+ }
95+
96 break;
97
98 case NAL_UT_SEI:
99@@ -1703,6 +1727,11 @@ UMC::Status TaskSupplier_H265::AddOneFrame(UMC::MediaData * pSource)
100
101 UMC::MediaDataEx::_MediaDataEx* pMediaDataEx = nalUnit->GetExData();
102
103+#if (MFX_VERSION >= 1025)
104+ UMC::MediaData::AuxInfo* aux = (pSource) ? pSource->GetAuxInfo(MFX_EXTBUFF_DECODE_ERROR_REPORT) : NULL;
105+ mfxExtDecodeErrorReport* pDecodeErrorReport = (aux) ? reinterpret_cast<mfxExtDecodeErrorReport*>(aux->ptr) : NULL;
106+#endif
107+
108 for (int32_t i = 0; i < (int32_t)pMediaDataEx->count; i++, pMediaDataEx->index ++)
109 {
110 if (m_checkCRAInsideResetProcess)
111@@ -1755,7 +1784,13 @@ UMC::Status TaskSupplier_H265::AddOneFrame(UMC::MediaData * pSource)
112 case NAL_UT_VPS:
113 case NAL_UT_SPS:
114 case NAL_UT_PPS:
115- DecodeHeaders(nalUnit);
116+ {
117+ UMC::Status sts = DecodeHeaders(nalUnit);
118+#if (MFX_VERSION >= 1025)
119+ if (pDecodeErrorReport && sts == UMC::UMC_ERR_INVALID_STREAM)
120+ SetDecodeErrorTypes((NalUnitType)pMediaDataEx->values[i], pDecodeErrorReport);
121+#endif
122+ }
123 break;
124
125 default:
126@@ -1822,6 +1857,10 @@ UMC::Status TaskSupplier_H265::AddOneFrame(UMC::MediaData * pSource)
127 moveToSpsOffset = pSource->GetDataSize() + size + 3;
128 continue;
129 }
130+#if (MFX_VERSION >= 1025)
131+ if (pDecodeErrorReport && umsRes == UMC::UMC_ERR_INVALID_STREAM)
132+ SetDecodeErrorTypes(nut, pDecodeErrorReport);
133+#endif
134
135 return umsRes;
136 }
137--
1382.7.4
139
diff --git a/recipes-multimedia/mediasdk/files/0002-hevcd-Use-reinterpret_cast-for-style-alignment.patch b/recipes-multimedia/mediasdk/files/0002-hevcd-Use-reinterpret_cast-for-style-alignment.patch
new file mode 100644
index 00000000..00a1ee28
--- /dev/null
+++ b/recipes-multimedia/mediasdk/files/0002-hevcd-Use-reinterpret_cast-for-style-alignment.patch
@@ -0,0 +1,27 @@
1From d1938a90c7e09f6c901b7ef556bd3e8c33a257aa Mon Sep 17 00:00:00 2001
2From: "Ung, Teng En" <teng.en.ung@intel.com>
3Date: Tue, 19 Jan 2021 15:31:24 +0800
4Subject: [PATCH 2/2] [hevcd] Use reinterpret_cast for style alignment.
5
6Upstream-Status: Accepted [https://github.com/Intel-Media-SDK/MediaSDK/pull/2383]
7Signed-off-by: Ung, Teng En <teng.en.ung@intel.com>
8---
9 _studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp b/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
13index f346e8c..3069f04 100644
14--- a/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
15+++ b/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
16@@ -1110,7 +1110,7 @@ mfxStatus VideoDECODEH265::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1 *
17
18 if (extbuf)
19 {
20- ((mfxExtDecodeErrorReport *)extbuf)->ErrorTypes = 0;
21+ reinterpret_cast<mfxExtDecodeErrorReport *>(extbuf)->ErrorTypes = 0;
22 src.SetExtBuffer(extbuf);
23 }
24 #endif
25--
262.7.4
27
diff --git a/recipes-multimedia/mediasdk/intel-mediasdk_21.1.1.bb b/recipes-multimedia/mediasdk/intel-mediasdk_21.1.1.bb
index ce82af8a..de5fd61f 100644
--- a/recipes-multimedia/mediasdk/intel-mediasdk_21.1.1.bb
+++ b/recipes-multimedia/mediasdk/intel-mediasdk_21.1.1.bb
@@ -33,6 +33,8 @@ PACKAGECONFIG[wayland] = "-DENABLE_WAYLAND=ON, -DENABLE_WAYLAND=OFF, wayland way
33 33
34SRC_URI = "git://github.com/Intel-Media-SDK/MediaSDK.git;protocol=https;nobranch=1;lfs=0 \ 34SRC_URI = "git://github.com/Intel-Media-SDK/MediaSDK.git;protocol=https;nobranch=1;lfs=0 \
35 file://0001-FindITT.cmake-fix-detection-of-header-library.patch \ 35 file://0001-FindITT.cmake-fix-detection-of-header-library.patch \
36 file://0001-hevcd-Enable-the-SPS-PPS-error-reporting.patch \
37 file://0002-hevcd-Use-reinterpret_cast-for-style-alignment.patch \
36 " 38 "
37 39
38SRCREV = "c982e8cccc98c2ad0b3c6043cdbd6aaf7447cf54" 40SRCREV = "c982e8cccc98c2ad0b3c6043cdbd6aaf7447cf54"