[x265] [PATCH] rdcost: fix checked build warnings, nits

Min Chen chenm003 at 163.com
Sat Sep 19 01:53:54 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1442620426 18000
# Node ID 33363fca1280c1fd3194e31f0f9f86235e03d0a9
# Parent  5dde4773fcefdfef7b0b0fddd10a6c09341132b9
rdcost: fix checked build warnings, nits
---
 source/encoder/rdcost.h |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff -r 5dde4773fcef -r 33363fca1280 source/encoder/rdcost.h
--- a/source/encoder/rdcost.h	Fri Sep 18 11:49:00 2015 -0500
+++ b/source/encoder/rdcost.h	Fri Sep 18 18:53:46 2015 -0500
@@ -90,13 +90,15 @@
 
     inline uint64_t calcRdCost(sse_ret_t distortion, uint32_t bits) const
     {
+#if X265_DEPTH <= 10
         X265_CHECK(bits <= (UINT64_MAX - 128) / m_lambda2,
-#if X265_DEPTH <= 10
                    "calcRdCost wrap detected dist: %u, bits %u, lambda: " X265_LL "\n",
+                   distortion, bits, m_lambda2);
 #else
+        X265_CHECK(bits <= (UINT64_MAX - 128) / m_lambda2,
                    "calcRdCost wrap detected dist: " X265_LL ", bits %u, lambda: " X265_LL "\n",
+                   distortion, bits, m_lambda2);
 #endif
-                   distortion, bits, m_lambda2);
         return distortion + ((bits * m_lambda2 + 128) >> 8);
     }
 
@@ -127,13 +129,15 @@
 
     inline sse_ret_t scaleChromaDist(uint32_t plane, sse_ret_t dist) const
     {
+#if X265_DEPTH <= 10
         X265_CHECK(dist <= (UINT64_MAX - 128) / m_chromaDistWeight[plane - 1],
-#if X265_DEPTH <= 10
                    "scaleChromaDist wrap detected dist: %u, lambda: %u\n",
+                   dist, m_chromaDistWeight[plane - 1]);
 #else
+        X265_CHECK(dist <= (UINT64_MAX - 128) / m_chromaDistWeight[plane - 1],
                    "scaleChromaDist wrap detected dist: " X265_LL " lambda: %u\n",
+                   dist, m_chromaDistWeight[plane - 1]);
 #endif
-                   dist, m_chromaDistWeight[plane - 1]);
         return (sse_ret_t)((dist * (uint64_t)m_chromaDistWeight[plane - 1] + 128) >> 8);
     }
 



More information about the x265-devel mailing list