<div dir="ltr">From 815a784c473b0d95498974228e60d1440316ea11 Mon Sep 17 00:00:00 2001<br>From: AnusuyaKumarasamy <<a href="mailto:anusuya.kumarasamy@multicorewareinc.com">anusuya.kumarasamy@multicorewareinc.com</a>><br>Date: Mon, 14 Oct 2024 13:11:47 +0530<br>Subject: [PATCH] Fix decoder crash in scc<br><br>---<br> source/common/slice.cpp    |  2 +-<br> source/common/slice.h      |  1 -<br> source/encoder/dpb.cpp     | 41 --------------------------------------<br> source/encoder/entropy.cpp |  4 ----<br> 4 files changed, 1 insertion(+), 47 deletions(-)<br><br>diff --git a/source/common/slice.cpp b/source/common/slice.cpp<br>index 5e5ad8a92..b5b5e815c 100644<br>--- a/source/common/slice.cpp<br>+++ b/source/common/slice.cpp<br>@@ -101,7 +101,7 @@ void Slice::setRefPicList(PicList& picList, int sLayerId)<br>     if (!checkNumPocTotalCurr && m_rps.numberOfPictures == 0)<br>     {<br>         Frame* prevPic = picList.getPOC(X265_MAX(0, m_poc - 1));<br>-        if (prevPic->m_poc != X265_MAX(0, m_poc - 1))<br>+        if (prevPic && prevPic->m_poc != X265_MAX(0, m_poc - 1))<br>         {<br>             prevPic = picList.getPOC(m_poc);<br> <br>diff --git a/source/common/slice.h b/source/common/slice.h<br>index 0d0b2efb4..08e2577c7 100644<br>--- a/source/common/slice.h<br>+++ b/source/common/slice.h<br>@@ -405,7 +405,6 @@ public:<br> <br> #if  ENABLE_SCC_EXT<br>     Frame*      m_lastEncPic;<br>-    bool        m_bLMvdL1Zero;<br>     bool        m_useIntegerMv;<br> #endif<br>     bool        m_bTemporalMvp;<br>diff --git a/source/encoder/dpb.cpp b/source/encoder/dpb.cpp<br>index ae26c5518..69f821aee 100644<br>--- a/source/encoder/dpb.cpp<br>+++ b/source/encoder/dpb.cpp<br>@@ -341,47 +341,6 @@ void DPB::prepareEncode(Frame *newFrame)<br> <br>     slice->m_bTemporalMvp = slice->m_sps->bTemporalMVPEnabled;<br> #if ENABLE_SCC_EXT<br>-    bool bGPBcheck = false;<br>-    if (slice->m_sliceType == B_SLICE)<br>-    {<br>-        if (slice->m_param->bEnableSCC)<br>-        {<br>-            if (slice->m_numRefIdx[0] - 1 == slice->m_numRefIdx[1])<br>-            {<br>-                bGPBcheck = true;<br>-                for (int i = 0; i < slice->m_numRefIdx[1]; i++)<br>-                {<br>-                    if (slice->m_refPOCList[1][i] != slice->m_refPOCList[0][i])<br>-                    {<br>-                        bGPBcheck = false;<br>-                        break;<br>-                    }<br>-                }<br>-            }<br>-        }<br>-        else if (slice->m_numRefIdx[0] == slice->m_numRefIdx[1])<br>-        {<br>-            bGPBcheck = true;<br>-            int i;<br>-            for (i = 0; i < slice->m_numRefIdx[1]; i++)<br>-            {<br>-                if (slice->m_refPOCList[1][i] != slice->m_refPOCList[0][i])<br>-                {<br>-                    bGPBcheck = false;<br>-                    break;<br>-                }<br>-            }<br>-        }<br>-    }<br>-    if (bGPBcheck)<br>-    {<br>-        slice->m_bLMvdL1Zero = true;<br>-    }<br>-    else<br>-    {<br>-        slice->m_bLMvdL1Zero = false;<br>-    }<br>-<br>     if (!slice->isIntra() && slice->m_param->bEnableTemporalMvp)<br>     {<br>         const Frame* colPic = slice->m_refFrameList[slice->isInterB() && !slice->m_colFromL0Flag][slice->m_colRefIdx];<br>diff --git a/source/encoder/entropy.cpp b/source/encoder/entropy.cpp<br>index 18978f26e..86a1d0c7d 100644<br>--- a/source/encoder/entropy.cpp<br>+++ b/source/encoder/entropy.cpp<br>@@ -1073,11 +1073,7 @@ void Entropy::codeSliceHeader(const Slice& slice, FrameData& encData, uint32_t s<br>     }<br> <br>     if (slice.isInterB())<br>-#if ENABLE_SCC_EXT<br>-        WRITE_FLAG(slice.m_bLMvdL1Zero, "mvd_l1_zero_flag");<br>-#else<br>         WRITE_FLAG(0, "mvd_l1_zero_flag");<br>-#endif<br> <br> #if ENABLE_SCC_EXT<br>     if (slice.m_bTemporalMvp)<br>-- <br>2.36.0.windows.1<br><br></div>