<div dir="ltr"><div dir="ltr">This patch has been pushed to the master branch. <br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"></div></div></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"></div></div></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><b>__________________________</b></div><div><b>Karam Singh</b></div><div><b>Ph.D. IIT Guwahati</b></div><div><font size="1">Senior Software (Video Coding) Engineer  </font></div><div><font size="1">Mobile: +91 8011279030</font></div><div><font size="1">Block 9A, 6th floor, DLF Cyber City</font></div><div><font size="1">Manapakkam, Chennai 600 089</font></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 27, 2024 at 3:32 PM Anusuya Kumarasamy <<a href="mailto:anusuya.kumarasamy@multicorewareinc.com">anusuya.kumarasamy@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">From 7cacb15e7992677942cacf858c80698a2af8d5b3 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: Wed, 18 Sep 2024 16:29:29 +0530<br>Subject: [PATCH 1/5] Fix seg fault while enabling sea<br><br>---<br> source/encoder/encoder.cpp     | 28 ++++++++++++++++------------<br> source/encoder/framefilter.cpp |  6 +++---<br> source/encoder/framefilter.h   |  2 +-<br> 3 files changed, 20 insertions(+), 16 deletions(-)<br><br>diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>index 65c247aba..82123606c 100644<br>--- a/source/encoder/encoder.cpp<br>+++ b/source/encoder/encoder.cpp<br>@@ -2332,22 +2332,26 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)<br>                     }<br>                 }<br>             }<br>-            if (m_param->searchMethod == X265_SEA && frameEnc[0]->m_lowres.sliceType != X265_TYPE_B)<br>+<br>+            for (int layer = 0; layer < m_param->numLayers; layer++)<br>             {<br>-                int padX = m_param->maxCUSize + 32;<br>-                int padY = m_param->maxCUSize + 16;<br>-                uint32_t numCuInHeight = (frameEnc[0]->m_encData->m_reconPic[0]->m_picHeight + m_param->maxCUSize - 1) / m_param->maxCUSize;<br>-                int maxHeight = numCuInHeight * m_param->maxCUSize;<br>-                for (int i = 0; i < INTEGRAL_PLANE_NUM; i++)<br>+                if (m_param->searchMethod == X265_SEA && (frameEnc[layer]->m_lowres.sliceType != X265_TYPE_B || !layer))<br>                 {<br>-                    frameEnc[0]->m_encData->m_meBuffer[i] = X265_MALLOC(uint32_t, frameEnc[0]->m_reconPic[0]->m_stride * (maxHeight + (2 * padY)));<br>-                    if (frameEnc[0]->m_encData->m_meBuffer[i])<br>+                    int padX = m_param->maxCUSize + 32;<br>+                    int padY = m_param->maxCUSize + 16;<br>+                    uint32_t numCuInHeight = (frameEnc[layer]->m_encData->m_reconPic[0]->m_picHeight + m_param->maxCUSize - 1) / m_param->maxCUSize;<br>+                    int maxHeight = numCuInHeight * m_param->maxCUSize;<br>+                    for (int i = 0; i < INTEGRAL_PLANE_NUM; i++)<br>                     {<br>-                        memset(frameEnc[0]->m_encData->m_meBuffer[i], 0, sizeof(uint32_t)* frameEnc[0]->m_reconPic[0]->m_stride * (maxHeight + (2 * padY)));<br>-                        frameEnc[0]->m_encData->m_meIntegral[i] = frameEnc[0]->m_encData->m_meBuffer[i] + frameEnc[0]->m_encData->m_reconPic[0]->m_stride * padY + padX;<br>+                        frameEnc[layer]->m_encData->m_meBuffer[i] = X265_MALLOC(uint32_t, frameEnc[layer]->m_reconPic[0]->m_stride * (maxHeight + (2 * padY)));<br>+                        if (frameEnc[layer]->m_encData->m_meBuffer[i])<br>+                        {<br>+                            memset(frameEnc[layer]->m_encData->m_meBuffer[i], 0, sizeof(uint32_t) * frameEnc[layer]->m_reconPic[0]->m_stride * (maxHeight + (2 * padY)));<br>+                            frameEnc[layer]->m_encData->m_meIntegral[i] = frameEnc[layer]->m_encData->m_meBuffer[i] + frameEnc[layer]->m_encData->m_reconPic[0]->m_stride * padY + padX;<br>+                        }<br>+                        else<br>+                            x265_log(m_param, X265_LOG_ERROR, "SEA motion search: POC %d Integral buffer[%d] unallocated\n", frameEnc[0]->m_poc, i);<br>                     }<br>-                    else<br>-                        x265_log(m_param, X265_LOG_ERROR, "SEA motion search: POC %d Integral buffer[%d] unallocated\n", frameEnc[0]->m_poc, i);<br>                 }<br>             }<br> <br>diff --git a/source/encoder/framefilter.cpp b/source/encoder/framefilter.cpp<br>index 344ac738d..71dc42b2c 100644<br>--- a/source/encoder/framefilter.cpp<br>+++ b/source/encoder/framefilter.cpp<br>@@ -659,7 +659,7 @@ void FrameFilter::processPostRow(int row, int layer)<br> <br>     /* Generate integral planes for SEA motion search */<br>     if(m_param->searchMethod == X265_SEA)<br>-        computeMEIntegral(row);<br>+        computeMEIntegral(row, layer);<br>     // Notify other FrameEncoders that this row of reconstructed pixels is available<br>     m_frame->m_reconRowFlag[row].set(1);<br> <br>@@ -722,10 +722,10 @@ void FrameFilter::processPostRow(int row, int layer)<br>     }<br> }<br> <br>-void FrameFilter::computeMEIntegral(int row)<br>+void FrameFilter::computeMEIntegral(int row, int layer)<br> {<br>     int lastRow = row == (int)m_frame->m_encData->m_slice->m_sps->numCuInHeight - 1;<br>-    if (m_frame->m_lowres.sliceType != X265_TYPE_B)<br>+    if (m_frame->m_lowres.sliceType != X265_TYPE_B || !layer)<br>     {<br>         /* If WPP, other than first row, integral calculation for current row needs to wait till the<br>         * integral for the previous row is computed */<br>diff --git a/source/encoder/framefilter.h b/source/encoder/framefilter.h<br>index b84b7094c..8bea1a0e9 100644<br>--- a/source/encoder/framefilter.h<br>+++ b/source/encoder/framefilter.h<br>@@ -130,7 +130,7 @@ public:<br> <br>     void processRow(int row, int layer);<br>     void processPostRow(int row, int layer);<br>-    void computeMEIntegral(int row);<br>+    void computeMEIntegral(int row, int layer);<br> };<br> }<br> <br>-- <br>2.36.0.windows.1<br><br></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div>