[x265] [PATCH 2 of 2] compress: save best bits, sad in xcomputeCostIntrainInter

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Fri Nov 29 09:25:56 CET 2013


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1385713407 -19800
# Node ID a7d2fb189311e80979722699e47d8febf33c61a8
# Parent  e0036ec4a61ba7936a5fe0a7620bc0355172c12e
compress: save best bits, sad in xcomputeCostIntrainInter

diff -r e0036ec4a61b -r a7d2fb189311 source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Fri Nov 29 13:34:21 2013 +0530
+++ b/source/encoder/compress.cpp	Fri Nov 29 13:53:27 2013 +0530
@@ -103,8 +103,8 @@
     Pel *aboveFiltered = m_search->refAboveFlt + width - 1;
     Pel *left          = m_search->refLeft     + width - 1;
     Pel *leftFiltered  = m_search->refLeftFlt  + width - 1;
-    int sad;
-    uint32_t bits, mode, bmode;
+    int sad, bsad;
+    uint32_t bits, bbits, mode, bmode;
     uint64_t cost, bcost;
 
     // 33 Angle modes once
@@ -147,10 +147,10 @@
 
     // DC
     primitives.intra_pred_dc[log2SizeMinus2](above + 1, left + 1, tmp, scaleStride, (scaleWidth <= 16));
-    sad = costMultiplier * sa8d(fenc, scaleStride, tmp, scaleStride);
+    bsad = costMultiplier * sa8d(fenc, scaleStride, tmp, scaleStride);
     bmode = mode = DC_IDX;
-    bits  = m_search->xModeBitsIntra(cu, mode, partOffset, depth, initTrDepth);
-    bcost = m_rdCost->calcRdSADCost(sad, bits);
+    bbits  = m_search->xModeBitsIntra(cu, mode, partOffset, depth, initTrDepth);
+    bcost = m_rdCost->calcRdSADCost(bsad, bbits);
 
     Pel *abovePlanar   = above;
     Pel *leftPlanar    = left;
@@ -167,7 +167,7 @@
     mode = PLANAR_IDX;
     bits = m_search->xModeBitsIntra(cu, mode, partOffset, depth, initTrDepth);
     cost = m_rdCost->calcRdSADCost(sad, bits);
-    COPY2_IF_LT(bcost, cost, bmode, mode);
+    COPY4_IF_LT(bcost, cost, bmode, mode, bsad, sad, bbits, bits);
 
     // Transpose NxN
     primitives.transpose[log2SizeMinus2](buf_trans, fenc, scaleStride);
@@ -182,9 +182,13 @@
         sad  = costMultiplier * sa8d(cmp, srcStride, &tmp[(mode - 2) * (scaleWidth * scaleWidth)], scaleWidth);
         bits = m_search->xModeBitsIntra(cu, mode, partOffset, depth, initTrDepth);
         cost = m_rdCost->calcRdSADCost(sad, bits);
-        COPY2_IF_LT(bcost, cost, bmode, mode);
+        COPY4_IF_LT(bcost, cost, bmode, mode, bsad, sad, bbits, bits);
     }
 
+    cu->m_totalBits = bbits;
+    cu->m_totalDistortion = bsad;
+    cu->m_totalCost = bcost;
+
     // generate predYuv for the best mode
     cu->setLumaIntraDirSubParts(bmode, partOffset, depth + initTrDepth);
 


More information about the x265-devel mailing list