[x265] [PATCH] fix crash when no-sao & no-lft

Min Chen chenm003 at 163.com
Tue Jan 12 19:39:42 CET 2016


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1452615873 21600
# Node ID b0b34836e66dd792c51c3e1dde90054a154b1867
# Parent  6ccd503a4c3a2f6ed215584859cdf35ee7b80bd9
fix crash when no-sao & no-lft
---
 source/encoder/frameencoder.cpp |    2 +-
 source/encoder/framefilter.cpp  |   98 +--------------------------------------
 source/encoder/framefilter.h    |    1 -
 3 files changed, 2 insertions(+), 99 deletions(-)

diff -r 6ccd503a4c3a -r b0b34836e66d source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Tue Jan 12 11:36:55 2016 +0530
+++ b/source/encoder/frameencoder.cpp	Tue Jan 12 10:24:33 2016 -0600
@@ -1011,7 +1011,7 @@
         // Both Loopfilter and SAO Disabled
         else
         {
-            m_frameFilter.processPostCu(row, col);
+            m_frameFilter.m_parallelFilter[row].processPostCu(col);
         }
 
         // Completed CU processing
diff -r 6ccd503a4c3a -r b0b34836e66d source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Tue Jan 12 11:36:55 2016 +0530
+++ b/source/encoder/framefilter.cpp	Tue Jan 12 10:24:33 2016 -0600
@@ -67,8 +67,7 @@
     if (m_param->bEnableSsim)
         m_ssimBuf = X265_MALLOC(int, 8 * (m_param->sourceWidth / 4 + 3));
 
-    if (m_param->bEnableLoopFilter | m_param->bEnableSAO)
-        m_parallelFilter = new ParallelFilter[numRows];
+    m_parallelFilter = new ParallelFilter[numRows];
 
     if (m_parallelFilter)
     {
@@ -514,101 +513,6 @@
     }
 }
 
-// NOTE: This version for case that Disable both Deblock and Sao
-void FrameFilter::processPostCu(uint32_t row, uint32_t col) const
-{
-    // Update finished CU cursor
-    m_frame->m_reconColCount[row].set(col);
-
-    // shortcut path for non-border area
-    if ((col != 0) & (col != m_parallelFilter[row].m_numCols - 1) & (row != 0) & (row != m_parallelFilter[row].m_numRows - 1))
-        return;
-
-    PicYuv *reconPic = m_frame->m_reconPic;
-    const uint32_t rowAddr = row * m_parallelFilter[row].m_numCols;
-    const uint32_t lineStartCUAddr = rowAddr + col;
-    const int realH = m_parallelFilter[row].getCUHeight();
-    const int realW = m_parallelFilter[row].getCUWidth(col);
-
-    const uint32_t lumaMarginX = reconPic->m_lumaMarginX;
-    const uint32_t lumaMarginY = reconPic->m_lumaMarginY;
-    const uint32_t chromaMarginX = reconPic->m_chromaMarginX;
-    const uint32_t chromaMarginY = reconPic->m_chromaMarginY;
-    const int hChromaShift = reconPic->m_hChromaShift;
-    const int vChromaShift = reconPic->m_vChromaShift;
-    const intptr_t stride = reconPic->m_stride;
-    const intptr_t strideC = reconPic->m_strideC;
-    pixel *pixY = reconPic->getLumaAddr(lineStartCUAddr);
-    // MUST BE check I400 since m_picOrg uninitialize in that case
-    pixel *pixU = (m_param->internalCsp != X265_CSP_I400) ? reconPic->getCbAddr(lineStartCUAddr) : NULL;
-    pixel *pixV = (m_param->internalCsp != X265_CSP_I400) ? reconPic->getCrAddr(lineStartCUAddr) : NULL;
-    int copySizeY = realW;
-    int copySizeC = (realW >> hChromaShift);
-
-    if ((col == 0) | (col == m_parallelFilter[row].m_numCols - 1))
-    {
-        // TODO: improve by process on Left or Right only
-        primitives.extendRowBorder(reconPic->getLumaAddr(rowAddr), stride, reconPic->m_picWidth, realH, reconPic->m_lumaMarginX);
-
-        if (m_param->internalCsp != X265_CSP_I400)
-        {
-            primitives.extendRowBorder(reconPic->getCbAddr(rowAddr), strideC, reconPic->m_picWidth >> hChromaShift, realH >> vChromaShift, reconPic->m_chromaMarginX);
-            primitives.extendRowBorder(reconPic->getCrAddr(rowAddr), strideC, reconPic->m_picWidth >> hChromaShift, realH >> vChromaShift, reconPic->m_chromaMarginX);
-        }
-    }
-
-    // Extra Left and Right border on first and last CU
-    if ((col == 0) | (col == m_parallelFilter[row].m_numCols - 1))
-    {
-        copySizeY += lumaMarginX;
-        copySizeC += chromaMarginX;
-    }
-
-    // First column need extension left padding area and first CU
-    if (col == 0)
-    {
-        pixY -= lumaMarginX;
-        pixU -= chromaMarginX;
-        pixV -= chromaMarginX;
-    }
-
-    // Border extend Top
-    if (row == 0)
-    {
-        for (uint32_t y = 0; y < lumaMarginY; y++)
-            memcpy(pixY - (y + 1) * stride, pixY, copySizeY * sizeof(pixel));
-
-        if (m_param->internalCsp != X265_CSP_I400)
-        {
-            for (uint32_t y = 0; y < chromaMarginY; y++)
-            {
-                memcpy(pixU - (y + 1) * strideC, pixU, copySizeC * sizeof(pixel));
-                memcpy(pixV - (y + 1) * strideC, pixV, copySizeC * sizeof(pixel));
-            }
-        }
-    }
-
-    // Border extend Bottom
-    if (row == m_parallelFilter[row].m_numRows - 1)
-    {
-        pixY += (realH - 1) * stride;
-        for (uint32_t y = 0; y < lumaMarginY; y++)
-            memcpy(pixY + (y + 1) * stride, pixY, copySizeY * sizeof(pixel));
-
-        if (m_param->internalCsp != X265_CSP_I400)
-        {
-            pixU += ((realH >> vChromaShift) - 1) * strideC;
-            pixV += ((realH >> vChromaShift) - 1) * strideC;
-
-            for (uint32_t y = 0; y < chromaMarginY; y++)
-            {
-                memcpy(pixU + (y + 1) * strideC, pixU, copySizeC * sizeof(pixel));
-                memcpy(pixV + (y + 1) * strideC, pixV, copySizeC * sizeof(pixel));
-            }
-        }
-    }
-}
-
 void FrameFilter::processPostRow(int row)
 {
     PicYuv *reconPic = m_frame->m_reconPic;
diff -r 6ccd503a4c3a -r b0b34836e66d source/encoder/framefilter.h
--- a/source/encoder/framefilter.h	Tue Jan 12 11:36:55 2016 +0530
+++ b/source/encoder/framefilter.h	Tue Jan 12 10:24:33 2016 -0600
@@ -139,7 +139,6 @@
 
     void processRow(int row);
     void processPostRow(int row);
-    void processPostCu(uint32_t row, uint32_t col) const;
 };
 }
 



More information about the x265-devel mailing list