From 8d3a533f69798b1f037fd63634099d2c6ef5d449 Mon Sep 17 00:00:00 2001 From: somuvineela Date: Tue, 5 May 2026 17:38:10 +0530 Subject: [PATCH] TME: Move setSourcePU() earlier to fix segfault --- source/encoder/search.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/encoder/search.cpp b/source/encoder/search.cpp index cb5c276da..057c1bbec 100644 --- a/source/encoder/search.cpp +++ b/source/encoder/search.cpp @@ -277,6 +277,10 @@ void Search::puMotionEstimation(const Slice* slice, const CUGeom& cuGeom, CUData const MV* amvp = zeroMV; int mvpIdx = 0; + PicYuv* recon = slice->m_mref[list][ref].reconPic; + int offset = recon->getLumaAddr(cu.m_cuAddr, pu.cuAbsPartIdx + pu.puAbsPartIdx) - recon->getLumaAddr(0); + m_me.setSourcePU(fencPic->m_picOrg[0], fencPic->m_stride, offset, pu.width, pu.height, m_param->searchMethod, m_param->subpelRefine); + bool bLowresMVP = false; if (!isMVP) { @@ -345,16 +349,12 @@ void Search::puMotionEstimation(const Slice* slice, const CUGeom& cuGeom, CUData } } - PicYuv* recon = slice->m_mref[list][ref].reconPic; - int offset = recon->getLumaAddr(cu.m_cuAddr, pu.cuAbsPartIdx + pu.puAbsPartIdx) - recon->getLumaAddr(0); - if (m_param->searchMethod == X265_SEA) { for (int planes = 0; planes < INTEGRAL_PLANE_NUM; planes++) m_me.integral[planes] = slice->m_refFrameList[list][ref]->m_encData->m_meIntegral[planes] + offset; } - m_me.setSourcePU(fencPic->m_picOrg[0], fencPic->m_stride, offset, pu.width, pu.height, m_param->searchMethod, m_param->subpelRefine); setSearchRange(cu, mvp, searchRange, mvmin, mvmax); if (isMVP) -- 2.43.0.windows.1