[x265] [PATCH] optimize and remove Pow() in processRowEncoder() to avoid VS2008 build error 'ambiguous...'

Min Chen chenm003 at 163.com
Thu Jul 3 20:40:41 CEST 2014


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1404412834 25200
# Node ID 3abc248fb4844224bd4af90d3c8d6bff2a811bf5
# Parent  e3f9acd4ff88eee82b7554baaab512bc1fd8e840
optimize and remove Pow() in processRowEncoder() to avoid VS2008 build error 'ambiguous...'

diff -r e3f9acd4ff88 -r 3abc248fb484 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Thu Jul 03 16:24:26 2014 +0530
+++ b/source/encoder/frameencoder.cpp	Thu Jul 03 11:40:34 2014 -0700
@@ -949,7 +949,10 @@
         // copy no. of intra, inter Cu cnt per row into frame stats for 2 pass
         if (m_param->rc.bStatWrite)
         {
-            double scale = pow((double)2, g_maxCUSize / 16);
+            static const uint32_t scaleTable[] = {2, 4, 16};
+            uint32_t scaleIndex = (g_convertToBit[g_maxCUSize] + 2 - 4);
+            double scale = (double)scaleTable[scaleIndex];
+            X265_CHECK(pow((double)2, (int)(g_maxCUSize >> 4)) == scale, "Failed on scale!\n");
             for (uint32_t part = 0; part < g_maxCUDepth ; part++, scale /= 4)
             {
                 curRow.m_iCuCnt += scale * tld.m_cuCoder.m_log->qTreeIntraCnt[part];



More information about the x265-devel mailing list