<div dir="ltr">From 610cb3767d5941011afb07e5d2d4c6d40c66ffb9 Mon Sep 17 00:00:00 2001<br>From: AnusuyaKumarasamy <<a href="mailto:anusuya.kumarasamy@multicorewareinc.com" target="_blank">anusuya.kumarasamy@multicorewareinc.com</a>><br>Date: Mon, 29 Jul 2024 16:57:25 +0530<br>Subject: [PATCH 9/9] Fix segmentation fault in linux<br><br>---<br> source/encoder/analysis.cpp | 126 +++++++++++++++++++++++++-----------<br> source/encoder/analysis.h   |  12 +++-<br> 2 files changed, 98 insertions(+), 40 deletions(-)<br><br>diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp<br>index 4ff6a69f6..380a83f68 100644<br>--- a/source/encoder/analysis.cpp<br>+++ b/source/encoder/analysis.cpp<br>@@ -238,7 +238,11 @@ Mode& Analysis::compressCTU(CUData& ctu, Frame& frame, const CUGeom& cuGeom, con<br>             memcpy(ctu.m_partSize, &intraDataCTU->partSizes[ctu.m_cuAddr * numPartition], sizeof(char) * numPartition);<br>             memcpy(ctu.m_chromaIntraDir, &intraDataCTU->chromaModes[ctu.m_cuAddr * numPartition], sizeof(uint8_t) * numPartition);<br>         }<br>-        compressIntraCU(ctu, cuGeom, qp, m_ibc);<br>+#if ENABLE_SCC_EXT<br>+        compressIntraCU(ctu, cuGeom, qp, &m_ibc);<br>+#else<br>+        compressIntraCU(ctu, cuGeom, qp);<br>+#endif<br>     }<br>     else<br>     {<br>@@ -271,7 +275,7 @@ Mode& Analysis::compressCTU(CUData& ctu, Frame& frame, const CUGeom& cuGeom, con<br>         if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE &&<br>             ctu.m_cuPelX / m_param->maxCUSize >= frame.m_encData->m_pir.pirStartCol<br>             && ctu.m_cuPelX / m_param->maxCUSize < frame.m_encData->m_pir.pirEndCol)<br>-            compressIntraCU(ctu, cuGeom, qp, m_ibc);<br>+            compressIntraCU(ctu, cuGeom, qp);<br>         else if (!m_param->rdLevel)<br>         {<br>             /* In RD Level 0/1, copy source pixels into the reconstructed block so<br>@@ -309,7 +313,11 @@ Mode& Analysis::compressCTU(CUData& ctu, Frame& frame, const CUGeom& cuGeom, con<br>         else if (m_param->rdLevel <= 4)<br>             compressInterCU_rd0_4(ctu, cuGeom, qp);<br>         else<br>-            compressInterCU_rd5_6(ctu, cuGeom, qp, m_ibc);<br>+#if ENABLE_SCC_EXT<br>+            compressInterCU_rd5_6(ctu, cuGeom, qp, &m_ibc);<br>+#else<br>+            compressInterCU_rd5_6(ctu, cuGeom, qp);<br>+#endif<br>     }<br> <br>     if (m_param->bEnableRdRefine || m_param->bOptCUDeltaQP)<br>@@ -516,7 +524,11 @@ void Analysis::qprdRefine(const CUData& parentCTU, const CUGeom& cuGeom, int32_t<br>     md.bestMode->reconYuv.copyToPicYuv(*m_frame->m_reconPic[0], parentCTU.m_cuAddr, cuGeom.absPartIdx);<br> }<br> <br>-uint64_t Analysis::compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, IBC& ibc)<br>+#if ENABLE_SCC_EXT<br>+uint64_t Analysis::compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, IBC* ibc)<br>+#else<br>+uint64_t Analysis::compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp)<br>+#endif<br> {<br>     uint32_t depth = cuGeom.depth;<br>     ModeDepth& md = m_modeDepth[depth];<br>@@ -579,34 +591,34 @@ uint64_t Analysis::compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom<br>         bool intraBlockCopyFastSearch = (m_param->bEnableSCC == 1) ? true : false, bUse1DSearchFor8x8 = false;<br>         if (m_param->bEnableSCC)<br>         {<br>-            md.pred[PRED_MERGE_IBC].cu.initSubCU(parentCTU, cuGeom, qp, ibc.m_lastIntraBCMv);<br>+            md.pred[PRED_MERGE_IBC].cu.initSubCU(parentCTU, cuGeom, qp, ibc->m_lastIntraBCMv);<br>             checkRDCostIntraBCMerge2Nx2N(md.pred[PRED_MERGE_IBC], cuGeom);<br> <br>-            md.pred[PRED_IBC_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp, ibc.m_lastIntraBCMv);<br>-            checkIntraBC_rd5_6(md.pred[PRED_IBC_2Nx2N], cuGeom, SIZE_2Nx2N, false, bUse1DSearchFor8x8, ibc);<br>+            md.pred[PRED_IBC_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp, ibc->m_lastIntraBCMv);<br>+            checkIntraBC_rd5_6(md.pred[PRED_IBC_2Nx2N], cuGeom, SIZE_2Nx2N, false, bUse1DSearchFor8x8, *ibc);<br>             checkBestMode(md.pred[PRED_IBC_2Nx2N], depth);<br> <br>             if (intraBlockCopyFastSearch)<br>             {<br>                 if ((int)depth == m_slice->m_sps->log2DiffMaxMinCodingBlockSize)<br>                 {<br>-                    md.pred[PRED_IBC_Nx2N].cu.initSubCU(parentCTU, cuGeom, qp, ibc.m_lastIntraBCMv);<br>-                    checkIntraBC_rd5_6(md.pred[PRED_IBC_Nx2N], cuGeom, SIZE_Nx2N, false, bUse1DSearchFor8x8, ibc, (iMVCandList[SIZE_Nx2N] + 8));<br>+                    md.pred[PRED_IBC_Nx2N].cu.initSubCU(parentCTU, cuGeom, qp, ibc->m_lastIntraBCMv);<br>+                    checkIntraBC_rd5_6(md.pred[PRED_IBC_Nx2N], cuGeom, SIZE_Nx2N, false, bUse1DSearchFor8x8, *ibc, (iMVCandList[SIZE_Nx2N] + 8));<br>                     checkBestMode(md.pred[PRED_IBC_Nx2N], depth);<br> <br>-                    md.pred[PRED_IBC_2NxN].cu.initSubCU(parentCTU, cuGeom, qp, ibc.m_lastIntraBCMv);<br>-                    checkIntraBC_rd5_6(md.pred[PRED_IBC_2NxN], cuGeom, SIZE_2NxN, false, bUse1DSearchFor8x8, ibc, (iMVCandList[SIZE_2NxN] + 8));<br>+                    md.pred[PRED_IBC_2NxN].cu.initSubCU(parentCTU, cuGeom, qp, ibc->m_lastIntraBCMv);<br>+                    checkIntraBC_rd5_6(md.pred[PRED_IBC_2NxN], cuGeom, SIZE_2NxN, false, bUse1DSearchFor8x8, *ibc, (iMVCandList[SIZE_2NxN] + 8));<br>                     checkBestMode(md.pred[PRED_IBC_2NxN], depth);<br>                 }<br>             }<br>             else<br>             {<br>                 md.pred[PRED_IBC_2NxN].cu.initSubCU(parentCTU, cuGeom, qp);<br>-                checkIntraBC_rd5_6(md.pred[PRED_IBC_2NxN], cuGeom, SIZE_2NxN, false, bUse1DSearchFor8x8, ibc, (iMVCandList[SIZE_2NxN] + 8));<br>+                checkIntraBC_rd5_6(md.pred[PRED_IBC_2NxN], cuGeom, SIZE_2NxN, false, bUse1DSearchFor8x8, *ibc, (iMVCandList[SIZE_2NxN] + 8));<br>                 checkBestMode(md.pred[PRED_IBC_2NxN], depth);<br> <br>                 md.pred[PRED_IBC_Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);<br>-                checkIntraBC_rd5_6(md.pred[PRED_IBC_Nx2N], cuGeom, SIZE_Nx2N, false, bUse1DSearchFor8x8, ibc, (iMVCandList[SIZE_Nx2N] + 8));<br>+                checkIntraBC_rd5_6(md.pred[PRED_IBC_Nx2N], cuGeom, SIZE_Nx2N, false, bUse1DSearchFor8x8, *ibc, (iMVCandList[SIZE_Nx2N] + 8));<br>                 checkBestMode(md.pred[PRED_IBC_Nx2N], depth);<br>             }<br>         }<br>@@ -735,7 +747,11 @@ uint64_t Analysis::compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom<br> <br>                 if (m_param->bEnableSplitRdSkip)<br>                 {<br>+#if ENABLE_SCC_EXT<br>                     curCost += compressIntraCU(parentCTU, childGeom, nextQP, ibc);<br>+#else<br>+                    curCost += compressIntraCU(parentCTU, childGeom, nextQP);<br>+#endif<br>                     if (m_modeDepth[depth].bestMode && curCost > m_modeDepth[depth].bestMode->rdCost)<br>                     {<br>                         skipSplitCheck = 1;<br>@@ -743,14 +759,17 @@ uint64_t Analysis::compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom<br>                     }<br>                 }<br>                 else<br>+<br>+#if !ENABLE_SCC_EXT<br>+                    compressIntraCU(parentCTU, childGeom, nextQP);<br>+#else<br>                     compressIntraCU(parentCTU, childGeom, nextQP, ibc);<br> <br>-#if ENABLE_SCC_EXT<br>                 if (nd.bestMode->cu.m_lastIntraBCMv[0].x != 0 || nd.bestMode->cu.m_lastIntraBCMv[0].y != 0)<br>                 {<br>                     for (int i = 0; i < 2; i++)<br>                     {<br>-                        ibc.m_lastIntraBCMv[i] = nd.bestMode->cu.m_lastIntraBCMv[i];<br>+                        ibc->m_lastIntraBCMv[i] = nd.bestMode->cu.m_lastIntraBCMv[i];<br>                     }<br>                 }<br> #endif<br>@@ -1289,7 +1308,7 @@ uint32_t Analysis::compressInterCU_dist(const CUData& parentCTU, const CUGeom& c<br> SplitData Analysis::compressInterCU_rd0_4(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp)<br> {<br>     if (parentCTU.m_vbvAffected && calculateQpforCuSize(parentCTU, cuGeom, 1))<br>-        return compressInterCU_rd5_6(parentCTU, cuGeom, qp, m_ibc);<br>+        return compressInterCU_rd5_6(parentCTU, cuGeom, qp);<br> <br>     uint32_t depth = cuGeom.depth;<br>     uint32_t cuAddr = parentCTU.m_cuAddr;<br>@@ -1990,7 +2009,11 @@ SplitData Analysis::compressInterCU_rd0_4(const CUData& parentCTU, const CUGeom&<br>     return splitCUData;<br> }<br> <br>-SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, IBC& ibc)<br>+#if ENABLE_SCC_EXT<br>+SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, IBC* ibc)<br>+#else<br>+SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp)<br>+#endif<br> {<br>     if (parentCTU.m_vbvAffected && !calculateQpforCuSize(parentCTU, cuGeom, 1))<br>         return compressInterCU_rd0_4(parentCTU, cuGeom, qp);<br>@@ -1999,7 +2022,7 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>     ModeDepth& md = m_modeDepth[depth];<br>     md.bestMode = NULL;<br> <br>-    Mode* interBest; // store the best modes in inter prediction<br>+    Mode* interBest = NULL; // store the best modes in inter prediction<br> <br>     MV iMVCandList[4][10];<br>     memset(iMVCandList, 0, sizeof(MV) * 4 * 10);<br>@@ -2175,7 +2198,7 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>             interBest = md.bestMode;<br>             if (m_param->bEnableSCC)<br>             {<br>-                md.pred[PRED_MERGE_IBC].cu.initSubCU(parentCTU, cuGeom, qp, ibc.m_lastIntraBCMv);<br>+                md.pred[PRED_MERGE_IBC].cu.initSubCU(parentCTU, cuGeom, qp, ibc->m_lastIntraBCMv);<br>                 checkRDCostIntraBCMerge2Nx2N(md.pred[PRED_MERGE_IBC], cuGeom);<br>             }<br> #endif<br>@@ -2216,14 +2239,17 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                     if (m_slice->m_pps->bUseDQP && nextDepth <= m_slice->m_pps->maxCuDQPDepth)<br>                         nextQP = setLambdaFromQP(parentCTU, calculateQpforCuSize(parentCTU, childGeom));<br> <br>-                    splitData[subPartIdx] = compressInterCU_rd5_6(parentCTU, childGeom, nextQP, ibc);<br> <br> #if ENABLE_SCC_EXT<br>+                    splitData[subPartIdx] = compressInterCU_rd5_6(parentCTU, childGeom, nextQP, ibc);<br>+<br>                     if (nd.bestMode->cu.m_lastIntraBCMv[0].x != 0 || nd.bestMode->cu.m_lastIntraBCMv[0].y != 0)<br>                     {<br>                         for (int i = 0; i < 2; i++)<br>-                            ibc.m_lastIntraBCMv[i] = nd.bestMode->cu.m_lastIntraBCMv[i];<br>+                            ibc->m_lastIntraBCMv[i] = nd.bestMode->cu.m_lastIntraBCMv[i];<br>                     }<br>+#else<br>+                    splitData[subPartIdx] = compressInterCU_rd5_6(parentCTU, childGeom, nextQP);<br> #endif<br> <br>                     // Save best CU and pred data for this sub CU<br>@@ -2325,9 +2351,13 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                             refMasks[0] = splitData[0].splitRefs | splitData[1].splitRefs; /* top */<br>                             refMasks[1] = splitData[2].splitRefs | splitData[3].splitRefs; /* bot */<br>                             md.pred[PRED_2NxN].cu.initSubCU(parentCTU, cuGeom, qp);<br>+#if ENABLE_SCC_EXT<br>                             checkInter_rd5_6(md.pred[PRED_2NxN], cuGeom, SIZE_2NxN, refMasks, iMVCandList[SIZE_2NxN]);<br>-                            checkBestMode(md.pred[PRED_2NxN], cuGeom.depth);<br>                             interBest = (md.pred[PRED_2NxN].rdCost < interBest->rdCost) ? &md.pred[PRED_2NxN] : interBest;<br>+#else<br>+                            checkInter_rd5_6(md.pred[PRED_2NxN], cuGeom, SIZE_2NxN, refMasks);<br>+#endif<br>+                            checkBestMode(md.pred[PRED_2NxN], cuGeom.depth);<br>                         }<br> <br>                         if (splitCost < md.bestMode->rdCost + threshold_Nx2N)<br>@@ -2335,9 +2365,13 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                             refMasks[0] = splitData[0].splitRefs | splitData[2].splitRefs; /* left */<br>                             refMasks[1] = splitData[1].splitRefs | splitData[3].splitRefs; /* right */<br>                             md.pred[PRED_Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);<br>+#if ENABLE_SCC_EXT<br>                             checkInter_rd5_6(md.pred[PRED_Nx2N], cuGeom, SIZE_Nx2N, refMasks, iMVCandList[SIZE_Nx2N]);<br>-                            checkBestMode(md.pred[PRED_Nx2N], cuGeom.depth);<br>                             interBest = (md.pred[PRED_Nx2N].rdCost < interBest->rdCost) ? &md.pred[PRED_Nx2N] : interBest;<br>+#else<br>+                            checkInter_rd5_6(md.pred[PRED_Nx2N], cuGeom, SIZE_Nx2N, refMasks);<br>+#endif<br>+                            checkBestMode(md.pred[PRED_Nx2N], cuGeom.depth);<br>                         }<br> <br>                         if (!try_2NxN_first && splitCost < md.bestMode->rdCost + threshold_2NxN)<br>@@ -2345,9 +2379,13 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                             refMasks[0] = splitData[0].splitRefs | splitData[1].splitRefs; /* top */<br>                             refMasks[1] = splitData[2].splitRefs | splitData[3].splitRefs; /* bot */<br>                             md.pred[PRED_2NxN].cu.initSubCU(parentCTU, cuGeom, qp);<br>+#if ENABLE_SCC_EXT<br>                             checkInter_rd5_6(md.pred[PRED_2NxN], cuGeom, SIZE_2NxN, refMasks, iMVCandList[SIZE_2NxN]);<br>-                            checkBestMode(md.pred[PRED_2NxN], cuGeom.depth);<br>                             interBest = (md.pred[PRED_2NxN].rdCost < interBest->rdCost) ? &md.pred[PRED_2NxN] : interBest;<br>+#else<br>+                            checkInter_rd5_6(md.pred[PRED_2NxN], cuGeom, SIZE_2NxN, refMasks);<br>+#endif<br>+                            checkBestMode(md.pred[PRED_2NxN], cuGeom.depth);<br>                         }<br>                     }<br> <br>@@ -2399,7 +2437,9 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                                 md.pred[PRED_2NxnD].cu.initSubCU(parentCTU, cuGeom, qp);<br>                                 checkInter_rd5_6(md.pred[PRED_2NxnD], cuGeom, SIZE_2NxnD, refMasks);<br>                                 checkBestMode(md.pred[PRED_2NxnD], cuGeom.depth);<br>+#if ENABLE_SCC_EXT<br>                                 interBest = (md.pred[PRED_2NxnD].rdCost < interBest->rdCost) ? &md.pred[PRED_2NxnD] : interBest;<br>+#endif<br>                             }<br> <br>                             if (splitCost < md.bestMode->rdCost + threshold_2NxnU)<br>@@ -2409,7 +2449,9 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                                 md.pred[PRED_2NxnU].cu.initSubCU(parentCTU, cuGeom, qp);<br>                                 checkInter_rd5_6(md.pred[PRED_2NxnU], cuGeom, SIZE_2NxnU, refMasks);<br>                                 checkBestMode(md.pred[PRED_2NxnU], cuGeom.depth);<br>+#if ENABLE_SCC_EXT<br>                                 interBest = (md.pred[PRED_2NxnU].rdCost < interBest->rdCost) ? &md.pred[PRED_2NxnU] : interBest;<br>+#endif<br>                             }<br> <br>                             if (!try_2NxnD_first && splitCost < md.bestMode->rdCost + threshold_2NxnD)<br>@@ -2419,7 +2461,9 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                                 md.pred[PRED_2NxnD].cu.initSubCU(parentCTU, cuGeom, qp);<br>                                 checkInter_rd5_6(md.pred[PRED_2NxnD], cuGeom, SIZE_2NxnD, refMasks);<br>                                 checkBestMode(md.pred[PRED_2NxnD], cuGeom.depth);<br>+#if ENABLE_SCC_EXT<br>                                 interBest = (md.pred[PRED_2NxnD].rdCost < interBest->rdCost) ? &md.pred[PRED_2NxnD] : interBest;<br>+#endif<br>                             }<br>                         }<br> <br>@@ -2433,7 +2477,9 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                                 md.pred[PRED_nRx2N].cu.initSubCU(parentCTU, cuGeom, qp);<br>                                 checkInter_rd5_6(md.pred[PRED_nRx2N], cuGeom, SIZE_nRx2N, refMasks);<br>                                 checkBestMode(md.pred[PRED_nRx2N], cuGeom.depth);<br>+#if ENABLE_SCC_EXT<br>                                 interBest = (md.pred[PRED_nRx2N].rdCost < interBest->rdCost) ? &md.pred[PRED_nRx2N] : interBest;<br>+#endif<br>                             }<br> <br>                             if (splitCost < md.bestMode->rdCost + threshold_nLx2N)<br>@@ -2443,7 +2489,9 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                                 md.pred[PRED_nLx2N].cu.initSubCU(parentCTU, cuGeom, qp);<br>                                 checkInter_rd5_6(md.pred[PRED_nLx2N], cuGeom, SIZE_nLx2N, refMasks);<br>                                 checkBestMode(md.pred[PRED_nLx2N], cuGeom.depth);<br>+#if ENABLE_SCC_EXT<br>                                 interBest = (md.pred[PRED_nLx2N].rdCost < interBest->rdCost) ? &md.pred[PRED_nLx2N] : interBest;<br>+#endif<br>                             }<br> <br>                             if (!try_nRx2N_first && splitCost < md.bestMode->rdCost + threshold_nRx2N)<br>@@ -2453,7 +2501,9 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                                 md.pred[PRED_nRx2N].cu.initSubCU(parentCTU, cuGeom, qp);<br>                                 checkInter_rd5_6(md.pred[PRED_nRx2N], cuGeom, SIZE_nRx2N, refMasks);<br>                                 checkBestMode(md.pred[PRED_nRx2N], cuGeom.depth);<br>+#if ENABLE_SCC_EXT<br>                                 interBest = (md.pred[PRED_nRx2N].rdCost < interBest->rdCost) ? &md.pred[PRED_nRx2N] : interBest;<br>+#endif<br>                             }<br>                         }<br>                     }<br>@@ -2463,19 +2513,19 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                 if (m_param->bEnableSCC)<br>                 {<br>                     bool intraBlockCopyFastSearch = (m_param->bEnableSCC == 1) ? true : false, bUse1DSearchFor8x8 = false, bValid;<br>-                    md.pred[PRED_IBC_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp, ibc.m_lastIntraBCMv);<br>-                    checkIntraBC_rd5_6(md.pred[PRED_IBC_2Nx2N], cuGeom, SIZE_2Nx2N, false, bUse1DSearchFor8x8, ibc);<br>+                    md.pred[PRED_IBC_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp, ibc->m_lastIntraBCMv);<br>+                    checkIntraBC_rd5_6(md.pred[PRED_IBC_2Nx2N], cuGeom, SIZE_2Nx2N, false, bUse1DSearchFor8x8, *ibc);<br>                     checkBestMode(md.pred[PRED_IBC_2Nx2N], depth);<br> <br>                     if (intraBlockCopyFastSearch)<br>                     {<br>                         if ((int)depth == m_slice->m_sps->log2DiffMaxMinCodingBlockSize)<br>                         {<br>-                            md.pred[PRED_IBC_Nx2N].cu.initSubCU(parentCTU, cuGeom, qp, ibc.m_lastIntraBCMv);<br>-                            checkIntraBC_rd5_6(md.pred[PRED_IBC_Nx2N], cuGeom, SIZE_Nx2N, false, bUse1DSearchFor8x8, ibc, (iMVCandList[SIZE_Nx2N] + 8));<br>+                            md.pred[PRED_IBC_Nx2N].cu.initSubCU(parentCTU, cuGeom, qp, ibc->m_lastIntraBCMv);<br>+                            checkIntraBC_rd5_6(md.pred[PRED_IBC_Nx2N], cuGeom, SIZE_Nx2N, false, bUse1DSearchFor8x8, *ibc, (iMVCandList[SIZE_Nx2N] + 8));<br>                             checkBestMode(md.pred[PRED_IBC_Nx2N], depth);<br> <br>-                            md.pred[PRED_MIXED_IBC_NX2N].cu.initSubCU(parentCTU, cuGeom, qp, ibc.m_lastIntraBCMv);<br>+                            md.pred[PRED_MIXED_IBC_NX2N].cu.initSubCU(parentCTU, cuGeom, qp, ibc->m_lastIntraBCMv);<br>                             bValid = predMixedIntraBCInterSearch(md.pred[PRED_MIXED_IBC_NX2N], cuGeom, m_csp != X265_CSP_I400 && m_frame->m_fencPic->m_picCsp != X265_CSP_I400, SIZE_Nx2N, iMVCandList[SIZE_Nx2N]);<br>                             if (bValid)<br>                                 encodeResAndCalcRdInterCU(md.pred[PRED_MIXED_IBC_NX2N], cuGeom);<br>@@ -2483,11 +2533,11 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                                 md.pred[PRED_MIXED_IBC_NX2N].rdCost = UINT64_MAX;<br>                             checkBestMode(md.pred[PRED_MIXED_IBC_NX2N], depth);<br> <br>-                            md.pred[PRED_IBC_2NxN].cu.initSubCU(parentCTU, cuGeom, qp, ibc.m_lastIntraBCMv);<br>-                            checkIntraBC_rd5_6(md.pred[PRED_IBC_2NxN], cuGeom, SIZE_2NxN, false, bUse1DSearchFor8x8, ibc, (iMVCandList[SIZE_2NxN] + 8));<br>+                            md.pred[PRED_IBC_2NxN].cu.initSubCU(parentCTU, cuGeom, qp, ibc->m_lastIntraBCMv);<br>+                            checkIntraBC_rd5_6(md.pred[PRED_IBC_2NxN], cuGeom, SIZE_2NxN, false, bUse1DSearchFor8x8, *ibc, (iMVCandList[SIZE_2NxN] + 8));<br>                             checkBestMode(md.pred[PRED_IBC_2NxN], depth);<br> <br>-                            md.pred[PRED_MIXED_IBC_2NXN].cu.initSubCU(parentCTU, cuGeom, qp, ibc.m_lastIntraBCMv);<br>+                            md.pred[PRED_MIXED_IBC_2NXN].cu.initSubCU(parentCTU, cuGeom, qp, ibc->m_lastIntraBCMv);<br>                             bValid = predMixedIntraBCInterSearch(md.pred[PRED_MIXED_IBC_2NXN], cuGeom, m_csp != X265_CSP_I400 && m_frame->m_fencPic->m_picCsp != X265_CSP_I400, SIZE_2NxN, iMVCandList[SIZE_2NxN]);<br>                             if (bValid)<br>                                 encodeResAndCalcRdInterCU(md.pred[PRED_MIXED_IBC_2NXN], cuGeom);<br>@@ -2499,11 +2549,11 @@ SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom&<br>                     else // full search<br>                     {<br>                         md.pred[PRED_IBC_2NxN].cu.initSubCU(parentCTU, cuGeom, qp);<br>-                        checkIntraBC_rd5_6(md.pred[PRED_IBC_2NxN], cuGeom, SIZE_2NxN, false, bUse1DSearchFor8x8, ibc, (iMVCandList[SIZE_2NxN] + 8));<br>+                        checkIntraBC_rd5_6(md.pred[PRED_IBC_2NxN], cuGeom, SIZE_2NxN, false, bUse1DSearchFor8x8, *ibc, (iMVCandList[SIZE_2NxN] + 8));<br>                         checkBestMode(md.pred[PRED_IBC_2NxN], depth);<br> <br>                         md.pred[PRED_IBC_Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);<br>-                        checkIntraBC_rd5_6(md.pred[PRED_IBC_Nx2N], cuGeom, SIZE_Nx2N, false, bUse1DSearchFor8x8, ibc, (iMVCandList[SIZE_Nx2N] + 8));<br>+                        checkIntraBC_rd5_6(md.pred[PRED_IBC_Nx2N], cuGeom, SIZE_Nx2N, false, bUse1DSearchFor8x8, *ibc, (iMVCandList[SIZE_Nx2N] + 8));<br>                         checkBestMode(md.pred[PRED_IBC_Nx2N], depth);<br>                     }<br>                 }<br>@@ -2765,7 +2815,7 @@ void Analysis::recodeCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t q<br>         if (parentCTU.isIntra(cuGeom.absPartIdx) && m_refineLevel < 2)<br>         {<br>             if (m_param->intraRefine == 4)<br>-                compressIntraCU(parentCTU, cuGeom, qp, m_ibc);<br>+                compressIntraCU(parentCTU, cuGeom, qp);<br>             else<br>             {<br>                 bool reuseModes = !((m_param->intraRefine == 3) ||<br>@@ -2884,7 +2934,7 @@ void Analysis::recodeCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t q<br>                 if (parentCTU.m_skipFlag[list][cuGeom.absPartIdx] == 1 && cuGeom.numPartitions <= 16)<br>                     m_checkMergeAndSkipOnly[list] = true;<br>             }<br>-            m_param->rdLevel > 4 ? compressInterCU_rd5_6(parentCTU, cuGeom, qp, m_ibc) : compressInterCU_rd0_4(parentCTU, cuGeom, qp);<br>+            m_param->rdLevel > 4 ? compressInterCU_rd5_6(parentCTU, cuGeom, qp) : compressInterCU_rd0_4(parentCTU, cuGeom, qp);<br>             for (int list = 0; list < m_slice->isInterB() + 1; list++)<br>             {<br>                 m_modeFlag[list] = false;<br>@@ -2901,7 +2951,7 @@ void Analysis::recodeCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t q<br>                 m_evaluateInter = 1;<br>             else<br>                 bDecidedDepth = true;<br>-            m_param->rdLevel > 4 ? compressInterCU_rd5_6(parentCTU, cuGeom, qp, m_ibc) : compressInterCU_rd0_4(parentCTU, cuGeom, qp);<br>+            m_param->rdLevel > 4 ? compressInterCU_rd5_6(parentCTU, cuGeom, qp) : compressInterCU_rd0_4(parentCTU, cuGeom, qp);<br>             m_evaluateInter = 0;<br>         }<br>     }<br>@@ -2934,7 +2984,7 @@ void Analysis::recodeCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t q<br>                 int lamdaQP = (m_param->analysisLoadReuseLevel >= 7) ? nextQP : lqp;<br> <br>                 if (split)<br>-                    m_param->rdLevel > 4 ? compressInterCU_rd5_6(parentCTU, childGeom, nextQP, m_ibc) : compressInterCU_rd0_4(parentCTU, childGeom, nextQP);<br>+                    m_param->rdLevel > 4 ? compressInterCU_rd5_6(parentCTU, childGeom, nextQP) : compressInterCU_rd0_4(parentCTU, childGeom, nextQP);<br>                 else<br>                     qprdRefine(parentCTU, childGeom, nextQP, lamdaQP);<br> <br>diff --git a/source/encoder/analysis.h b/source/encoder/analysis.h<br>index ad1ef6b63..586e50ef0 100644<br>--- a/source/encoder/analysis.h<br>+++ b/source/encoder/analysis.h<br>@@ -172,12 +172,20 @@ protected:<br>     void qprdRefine(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, int32_t lqp);<br> <br>     /* full analysis for an I-slice CU */<br>-    uint64_t compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, IBC& ibc);<br>+#if ENABLE_SCC_EXT<br>+    uint64_t compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, IBC* ibc = NULL);<br>+#else<br>+    uint64_t compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp);<br>+#endif<br> <br>     /* full analysis for a P or B slice CU */<br>     uint32_t compressInterCU_dist(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp);<br>     SplitData compressInterCU_rd0_4(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp);<br>-    SplitData compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, IBC& ibc);<br>+#if ENABLE_SCC_EXT<br>+    SplitData compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, IBC* ibc = NULL);<br>+#else<br>+    SplitData compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp);<br>+#endif<br> <br>     void recodeCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, int32_t origqp = -1);<br> <br>-- <br>2.36.0.windows.1<br><br></div>