[x265] zero stride for zeroPel[]

Satoshi Nakagawa nakagawa424 at oki.com
Fri Jul 11 06:33:10 CEST 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1405052989 -32400
#      Fri Jul 11 13:29:49 2014 +0900
# Node ID 18a6ee92620f1f7266dfbeff3b9010aae356d796
# Parent  e3e077965c39a56a24e09189652e1de3c5a0e3ea
zero stride for zeroPel[]

diff -r e3e077965c39 -r 18a6ee92620f source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Jul 10 19:29:46 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Jul 11 13:29:49 2014 +0900
@@ -47,7 +47,7 @@
 
 using namespace x265;
 
-ALIGN_VAR_32(const pixel, RDCost::zeroPel[MAX_CU_SIZE * MAX_CU_SIZE]) = { 0 };
+ALIGN_VAR_32(const pixel, RDCost::zeroPel[MAX_CU_SIZE]) = { 0 };
 
 TEncSearch::TEncSearch()
 {
@@ -2404,7 +2404,7 @@
         {
             int size = g_convertToBit[cuSize];
             zeroPsyEnergyY = m_rdCost->psyCost(size, fencYuv->getLumaAddr(), fencYuv->getStride(),
-                (pixel*)RDCost::zeroPel, MAX_CU_SIZE); // need to check whether zero distortion is similar to psyenergy of fenc
+                (pixel*)RDCost::zeroPel, 0); // need to check whether zero distortion is similar to psyenergy of fenc
             zeroCost = m_rdCost->calcPsyRdCost(zeroDistortion, zeroResiBits, zeroPsyEnergyY);
         }
         else
@@ -2813,13 +2813,13 @@
         }
 
         int partSize = partitionFromSize(trSize);
-        uint32_t distY = primitives.sse_sp[partSize](resiYuv->getLumaAddr(absPartIdx), resiYuv->m_width, (pixel*)RDCost::zeroPel, trSize);
+        uint32_t distY = primitives.sse_sp[partSize](resiYuv->getLumaAddr(absPartIdx), resiYuv->m_width, (pixel*)RDCost::zeroPel, 0);
         uint32_t psyEnergyY = 0;
         if (m_rdCost->psyRdEnabled())
         {
-            int size = g_convertToBit[trSize];
+            int size = log2TrSize - 2;
             psyEnergyY = m_rdCost->psyCost(size, fencYuv->getLumaAddr(absPartIdx), fencYuv->getStride(),
-                (pixel*)RDCost::zeroPel, trSize); // need to check whether zero distortion is similar to psyenergy of fenc
+                (pixel*)RDCost::zeroPel, 0); // need to check whether zero distortion is similar to psyenergy of fenc
         }
         int16_t *curResiY = m_qtTempShortYuv[qtLayer].getLumaAddr(absPartIdx);
         X265_CHECK(m_qtTempShortYuv[qtLayer].m_width == MAX_CU_SIZE, "width not full CU\n");
@@ -2845,7 +2845,7 @@
                 uint32_t stride = fencYuv->getStride();
                 //===== reconstruction =====
                 primitives.luma_add_ps[partSize](reconIPred, reconIPredStride, pred, curResiY, stride, strideResiY);
-                int size = g_convertToBit[trSize];
+                int size = log2TrSize - 2;
                 nonZeroPsyEnergyY = m_rdCost->psyCost(size, fencYuv->getLumaAddr(absPartIdx), fencYuv->getStride(),
                     cu->getPic()->getPicYuvRec()->getLumaAddr(cu->getAddr(), zorder), cu->getPic()->getPicYuvRec()->getStride());
             }
@@ -2922,12 +2922,10 @@
                 int16_t *curResiU = m_qtTempShortYuv[qtLayer].getCbAddr(absPartIdxC);
                 int16_t *curResiV = m_qtTempShortYuv[qtLayer].getCrAddr(absPartIdxC);
 
-                distU = m_rdCost->scaleChromaDistCb(primitives.sse_sp[partSizeC](resiYuv->getCbAddr(absPartIdxC), resiYuv->m_cwidth, (pixel*)RDCost::zeroPel, trSizeC));
-
+                distU = m_rdCost->scaleChromaDistCb(primitives.sse_sp[partSizeC](resiYuv->getCbAddr(absPartIdxC), resiYuv->m_cwidth, (pixel*)RDCost::zeroPel, 0));
                 if (outZeroDist)
-                {
                     *outZeroDist += distU;
-                }
+
                 if (numSigU[tuIterator.section])
                 {
                     int curChromaQpOffset = cu->getSlice()->getPPS()->getChromaCbQpOffset() + cu->getSlice()->getSliceQpDeltaCb();
@@ -2938,7 +2936,6 @@
                                                                  curResiU, strideResiC);
                     const uint32_t nonZeroDistU = m_rdCost->scaleChromaDistCb(dist);
                     uint32_t nonZeroPsyEnergyU = 0;
-
                     if (m_rdCost->psyRdEnabled())
                     {
                         pixel*   pred = predYuv->getCbAddr(absPartIdxC);
@@ -2948,7 +2945,7 @@
                         uint32_t stride = fencYuv->getCStride();
                         //===== reconstruction =====
                         primitives.luma_add_ps[partSizeC](reconIPred, reconIPredStride, pred, curResiU, stride, strideResiC);
-                        int size = g_convertToBit[trSizeC];
+                        int size = log2TrSizeC - 2;
                         nonZeroPsyEnergyU = m_rdCost->psyCost(size, fencYuv->getCbAddr(absPartIdxC), fencYuv->getCStride(),
                             cu->getPic()->getPicYuvRec()->getCbAddr(cu->getAddr(), zorder), cu->getPic()->getPicYuvRec()->getCStride());
                     }
@@ -3007,7 +3004,7 @@
                 if (!numSigU[tuIterator.section])
                     primitives.blockfill_s[sizeIdxC](curResiU, strideResiC, 0);
 
-                distV = m_rdCost->scaleChromaDistCr(primitives.sse_sp[partSizeC](resiYuv->getCrAddr(absPartIdxC), resiYuv->m_cwidth, (pixel*)RDCost::zeroPel, trSizeC));
+                distV = m_rdCost->scaleChromaDistCr(primitives.sse_sp[partSizeC](resiYuv->getCrAddr(absPartIdxC), resiYuv->m_cwidth, (pixel*)RDCost::zeroPel, 0));
                 if (outZeroDist)
                     *outZeroDist += distV;
 
@@ -3021,7 +3018,6 @@
                                                                  curResiV, strideResiC);
                     const uint32_t nonZeroDistV = m_rdCost->scaleChromaDistCr(dist);
                     uint32_t nonZeroPsyEnergyV = 0;
-
                     if (m_rdCost->psyRdEnabled())
                     {
                         pixel*   pred = predYuv->getCrAddr(absPartIdxC);
@@ -3031,7 +3027,7 @@
                         uint32_t stride = fencYuv->getCStride();
                         //===== reconstruction =====
                         primitives.luma_add_ps[partSizeC](reconIPred, reconIPredStride, pred, curResiV, stride, strideResiC);
-                        int size = g_convertToBit[trSizeC];
+                        int size = log2TrSizeC - 2;
                         nonZeroPsyEnergyV = m_rdCost->psyCost(size, fencYuv->getCrAddr(absPartIdxC), fencYuv->getCStride(),
                             cu->getPic()->getPicYuvRec()->getCrAddr(cu->getAddr(), zorder), cu->getPic()->getPicYuvRec()->getCStride());
                     }
@@ -3139,7 +3135,7 @@
                     uint32_t stride = fencYuv->getStride();
                     //===== reconstruction =====
                     primitives.luma_add_ps[partSize](reconIPred, reconIPredStride, pred, tsResiY, stride, trSize);
-                    int size = g_convertToBit[trSize];
+                    int size = log2TrSize - 2;
                     nonZeroPsyEnergyY = m_rdCost->psyCost(size, fencYuv->getLumaAddr(absPartIdx), fencYuv->getStride(),
                         cu->getPic()->getPicYuvRec()->getLumaAddr(cu->getAddr(), zorder), cu->getPic()->getPicYuvRec()->getStride());
                     singleCostY = m_rdCost->calcPsyRdCost(nonZeroDistY, skipSingleBitsY, nonZeroPsyEnergyY);
@@ -3232,7 +3228,7 @@
                         uint32_t stride = fencYuv->getCStride();
                         //===== reconstruction =====
                         primitives.luma_add_ps[partSizeC](reconIPred, reconIPredStride, pred, tsResiU, stride, trSizeC);
-                        int size = g_convertToBit[trSizeC];
+                        int size = log2TrSizeC - 2;
                         nonZeroPsyEnergyU = m_rdCost->psyCost(size, fencYuv->getCbAddr(absPartIdxC), fencYuv->getCStride(),
                             cu->getPic()->getPicYuvRec()->getCbAddr(cu->getAddr(), zorder), cu->getPic()->getPicYuvRec()->getCStride());
                         singleCostU = m_rdCost->calcPsyRdCost(nonZeroDistU, singleBitsComp[TEXT_CHROMA_U][tuIterator.section], nonZeroPsyEnergyU);
@@ -3275,7 +3271,7 @@
                         uint32_t stride = fencYuv->getCStride();
                         //===== reconstruction =====
                         primitives.luma_add_ps[partSizeC](reconIPred, reconIPredStride, pred, tsResiV, stride, trSizeC);
-                        int size = g_convertToBit[trSizeC];
+                        int size = log2TrSizeC - 2;
                         nonZeroPsyEnergyV = m_rdCost->psyCost(size, fencYuv->getCrAddr(absPartIdxC), fencYuv->getCStride(),
                             cu->getPic()->getPicYuvRec()->getCrAddr(cu->getAddr(), zorder), cu->getPic()->getPicYuvRec()->getCStride());
                         singleCostV = m_rdCost->calcPsyRdCost(nonZeroDistV, singleBitsComp[TEXT_CHROMA_V][tuIterator.section], nonZeroPsyEnergyV);
diff -r e3e077965c39 -r 18a6ee92620f source/encoder/rdcost.h
--- a/source/encoder/rdcost.h	Thu Jul 10 19:29:46 2014 -0500
+++ b/source/encoder/rdcost.h	Fri Jul 11 13:29:49 2014 +0900
@@ -45,7 +45,7 @@
 
 public:
 
-    static const pixel zeroPel[MAX_CU_SIZE * MAX_CU_SIZE];
+    static const pixel zeroPel[MAX_CU_SIZE];
 
     void setLambda(double lambda2, double lambda)
     {


More information about the x265-devel mailing list