[x265] [PATCH] cu-lossless: fix inter hash mistake

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Tue Aug 26 09:26:43 CEST 2014


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1409037983 -19800
#      Tue Aug 26 12:56:23 2014 +0530
# Node ID 6573fd72294e481133f2d1636100d6c8419fb597
# Parent  9387a276897fc3ab11bbbe20d4f0d7831caf3115
cu-lossless: fix inter hash mistake

The CU needs to be re-encoded if lossless is chosen as the best mode.

diff -r 9387a276897f -r 6573fd72294e source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Mon Aug 25 17:07:45 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Tue Aug 26 12:56:23 2014 +0530
@@ -2325,6 +2325,7 @@
     }
 
     uint64_t bestCost = MAX_INT64;
+    uint32_t bestMode = 0;
 
     for (uint32_t modeId = 0; modeId < numModes; modeId++)
     {
@@ -2392,6 +2393,7 @@
             if (cu->getQtRootCbf(0))
                 xSetResidualQTData(cu, 0, outBestResiYuv, depth, true);
 
+            bestMode = modeId; //0 for lossless
             bestBits = bits;
             bestCost = cost;
             bestCoeffBits = cu->m_coeffBits;
@@ -2401,6 +2403,19 @@
 
     X265_CHECK(bestCost != MAX_INT64, "no best cost\n");
 
+    if(bIsTQBypassEnable && !bestMode)
+    {
+        cu->setCUTransquantBypassSubParts(true, 0, depth);
+        m_entropyCoder->load(m_rdEntropyCoders[depth][CI_CURR_BEST]);
+        uint64_t cost = 0;
+        uint32_t zeroDistortion = 0;
+        uint32_t bits = 0;
+        uint32_t distortion = 0;
+        xEstimateResidualQT(cu, 0, fencYuv, predYuv, outResiYuv, depth, cost, bits, distortion, &zeroDistortion);
+        xSetResidualQTData(cu, 0, NULL, depth, false);
+        m_entropyCoder->store(m_rdEntropyCoders[depth][CI_TEMP_BEST]);
+    }
+
     if (cu->getQtRootCbf(0))
         outReconYuv->addClip(predYuv, outBestResiYuv, log2CUSize);
     else


More information about the x265-devel mailing list