These patches are merged into upstream. Will need to remove once update to
version later than 21.1.2.

Upstream-Status: Accepted 
[https://github.com/Intel-Media-SDK/MediaSDK/pull/2383]

Signed-off-by: Ung, Teng En <[email protected]>
---
 ...-hevcd-Enable-the-SPS-PPS-error-reporting.patch | 137 +++++++++++++++++++++
 ...-Use-reinterpret_cast-for-style-alignment.patch |  25 ++++
 .../mediasdk/intel-mediasdk_21.1.1.bb              |   2 +
 3 files changed, 164 insertions(+)
 create mode 100644 
recipes-multimedia/mediasdk/files/0001-hevcd-Enable-the-SPS-PPS-error-reporting.patch
 create mode 100644 
recipes-multimedia/mediasdk/files/0002-hevcd-Use-reinterpret_cast-for-style-alignment.patch

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 0000000..84816eb
--- /dev/null
+++ 
b/recipes-multimedia/mediasdk/files/0001-hevcd-Enable-the-SPS-PPS-error-reporting.patch
@@ -0,0 +1,137 @@
+From ee1b87d107833e8803567cac438f55bde72d8e02 Mon Sep 17 00:00:00 2001
+From: "Ung, Teng En" <[email protected]>
+Date: Mon, 30 Mar 2020 13:40:39 +0000
+Subject: [PATCH 1/2] [hevcd] Enable the SPS/PPS error reporting
+
+Issue:N/A
+Test:sample_decode with mfxExtDecodeErrorReport
+
+Signed-off-by: Ung, Teng En <[email protected]>
+---
+ .../decode/h265/src/mfx_h265_dec_decode.cpp        | 10 ++++++
+ .../umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp  |  7 ++++
+ .../codec/h265_dec/src/umc_h265_task_supplier.cpp  | 41 +++++++++++++++++++++-
+ 3 files changed, 57 insertions(+), 1 deletion(-)
+
+diff --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
+index 4ae164f..f346e8c 100644
+--- a/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
++++ b/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
+@@ -1105,6 +1105,16 @@ mfxStatus 
VideoDECODEH265::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1 *
+ 
+         MFXMediaDataAdapter src(bs);
+ 
++#if (MFX_VERSION >= 1025)
++        mfxExtBuffer* extbuf = (bs) ? GetExtendedBuffer(bs->ExtParam, 
bs->NumExtParam, MFX_EXTBUFF_DECODE_ERROR_REPORT) : NULL;
++
++        if (extbuf)
++        {
++            ((mfxExtDecodeErrorReport *)extbuf)->ErrorTypes = 0;
++            src.SetExtBuffer(extbuf);
++        }
++#endif
++
+         for (;;)
+         {
+             if (m_FrameAllocator->FindFreeSurface() == -1)
+diff --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
+index 4cc5dd5..db876f4 100644
+--- 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
+@@ -488,6 +488,13 @@ UMC::Status HeadersAnalyzer::DecodeHeader(UMC::MediaData 
* data, mfxBitstream *b
+     H265SeqParamSet* first_sps = 0;
+     notifier0<H265SeqParamSet> sps_guard(&H265Slice::DecrementReference);
+ 
++#if (MFX_VERSION >= 1025)
++    mfxExtBuffer* extbuf = (bs) ? GetExtendedBuffer(bs->ExtParam, 
bs->NumExtParam, MFX_EXTBUFF_DECODE_ERROR_REPORT) : NULL;
++
++    if (extbuf)
++        data->SetAuxInfo(extbuf, extbuf->BufferSz, extbuf->BufferId);
++#endif
++
+     UMC::Status umcRes = UMC::UMC_ERR_NOT_ENOUGH_DATA;
+     for ( ; data->GetDataSize() > 3; )
+     {
+diff --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
+index 9062568..e220095 100755
+--- 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
+@@ -47,6 +47,21 @@
+ namespace UMC_HEVC_DECODER
+ {
+ 
++#if (MFX_VERSION >= 1025)
++inline void SetDecodeErrorTypes(NalUnitType nalUnit, mfxExtDecodeErrorReport 
*pDecodeErrorReport)
++{
++    if (!pDecodeErrorReport)
++        return;
++
++    switch (nalUnit)
++    {
++        case NAL_UT_SPS: pDecodeErrorReport->ErrorTypes |= MFX_ERROR_SPS; 
break;
++        case NAL_UT_PPS: pDecodeErrorReport->ErrorTypes |= MFX_ERROR_PPS; 
break;
++        default: break;
++    };
++}
++#endif
++
+ const uint32_t levelIndexArray[] = {
+     H265_LEVEL_1,
+     H265_LEVEL_2,
+@@ -1662,6 +1677,15 @@ UMC::Status 
TaskSupplier_H265::ProcessNalUnit(UMC::MediaDataEx *nalUnit)
+     case NAL_UT_SPS:
+     case NAL_UT_PPS:
+         umcRes = DecodeHeaders(nalUnit);
++        {
++#if (MFX_VERSION >= 1025)
++            UMC::MediaData::AuxInfo* aux = (nalUnit) ? 
nalUnit->GetAuxInfo(MFX_EXTBUFF_DECODE_ERROR_REPORT) : NULL;
++            mfxExtDecodeErrorReport* pDecodeErrorReport = (aux) ? 
reinterpret_cast<mfxExtDecodeErrorReport*>(aux->ptr) : NULL;
++            if (pDecodeErrorReport && umcRes == UMC::UMC_ERR_INVALID_STREAM)
++                SetDecodeErrorTypes(unitType, pDecodeErrorReport);
++#endif
++        }
++
+         break;
+ 
+     case NAL_UT_SEI:
+@@ -1703,6 +1727,11 @@ UMC::Status 
TaskSupplier_H265::AddOneFrame(UMC::MediaData * pSource)
+ 
+         UMC::MediaDataEx::_MediaDataEx* pMediaDataEx = nalUnit->GetExData();
+ 
++#if (MFX_VERSION >= 1025)
++        UMC::MediaData::AuxInfo* aux = (pSource) ? 
pSource->GetAuxInfo(MFX_EXTBUFF_DECODE_ERROR_REPORT) : NULL;
++        mfxExtDecodeErrorReport* pDecodeErrorReport = (aux) ? 
reinterpret_cast<mfxExtDecodeErrorReport*>(aux->ptr) : NULL;
++#endif
++
+         for (int32_t i = 0; i < (int32_t)pMediaDataEx->count; i++, 
pMediaDataEx->index ++)
+         {
+             if (m_checkCRAInsideResetProcess)
+@@ -1755,7 +1784,13 @@ UMC::Status 
TaskSupplier_H265::AddOneFrame(UMC::MediaData * pSource)
+                 case NAL_UT_VPS:
+                 case NAL_UT_SPS:
+                 case NAL_UT_PPS:
+-                    DecodeHeaders(nalUnit);
++                    {
++                        UMC::Status sts = DecodeHeaders(nalUnit);
++#if (MFX_VERSION >= 1025)
++                        if (pDecodeErrorReport && sts == 
UMC::UMC_ERR_INVALID_STREAM)
++                            
SetDecodeErrorTypes((NalUnitType)pMediaDataEx->values[i], pDecodeErrorReport);
++#endif
++                    }
+                     break;
+ 
+                 default:
+@@ -1822,6 +1857,10 @@ UMC::Status 
TaskSupplier_H265::AddOneFrame(UMC::MediaData * pSource)
+                             moveToSpsOffset = pSource->GetDataSize() + size + 
3;
+                             continue;
+                         }
++#if (MFX_VERSION >= 1025)
++                        if (pDecodeErrorReport && umsRes == 
UMC::UMC_ERR_INVALID_STREAM)
++                            SetDecodeErrorTypes(nut, pDecodeErrorReport);
++#endif
+ 
+                         return umsRes;
+                     }
+-- 
+2.7.4
+
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 0000000..d3526db
--- /dev/null
+++ 
b/recipes-multimedia/mediasdk/files/0002-hevcd-Use-reinterpret_cast-for-style-alignment.patch
@@ -0,0 +1,25 @@
+From d1938a90c7e09f6c901b7ef556bd3e8c33a257aa Mon Sep 17 00:00:00 2001
+From: "Ung, Teng En" <[email protected]>
+Date: Tue, 19 Jan 2021 15:31:24 +0800
+Subject: [PATCH 2/2] [hevcd] Use reinterpret_cast for style alignment.
+
+---
+ _studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --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
+index f346e8c..3069f04 100644
+--- a/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
++++ b/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
+@@ -1110,7 +1110,7 @@ mfxStatus VideoDECODEH265::DecodeFrameCheck(mfxBitstream 
*bs, mfxFrameSurface1 *
+ 
+         if (extbuf)
+         {
+-            ((mfxExtDecodeErrorReport *)extbuf)->ErrorTypes = 0;
++            reinterpret_cast<mfxExtDecodeErrorReport *>(extbuf)->ErrorTypes = 
0;
+             src.SetExtBuffer(extbuf);
+         }
+ #endif
+-- 
+2.7.4
+
diff --git a/recipes-multimedia/mediasdk/intel-mediasdk_21.1.1.bb 
b/recipes-multimedia/mediasdk/intel-mediasdk_21.1.1.bb
index ce82af8..de5fd61 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
 
 SRC_URI = 
"git://github.com/Intel-Media-SDK/MediaSDK.git;protocol=https;nobranch=1;lfs=0 \
            file://0001-FindITT.cmake-fix-detection-of-header-library.patch \
+           file://0001-hevcd-Enable-the-SPS-PPS-error-reporting.patch \
+           file://0002-hevcd-Use-reinterpret_cast-for-style-alignment.patch \
            "
 
 SRCREV = "c982e8cccc98c2ad0b3c6043cdbd6aaf7447cf54"
-- 
2.7.4

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6953): 
https://lists.yoctoproject.org/g/meta-intel/message/6953
Mute This Topic: https://lists.yoctoproject.org/mt/81219375/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-intel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to