[x265] [PATCH 1 of 2] fix SSE_PP intermedia result overflow in Main12, (fixes #180)

Min Chen chenm003 at 163.com
Wed Sep 16 20:14:29 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1442423260 18000
# Node ID e35d3260b5138abf09bf79808bf55104606c4626
# Parent  dd77e2f94ec941da1483011e8c382d41ed2afade
fix SSE_PP intermedia result overflow in Main12, (fixes #180)
---
 source/encoder/rdcost.h   |    4 ++--
 source/encoder/search.cpp |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff -r dd77e2f94ec9 -r e35d3260b513 source/encoder/rdcost.h
--- a/source/encoder/rdcost.h	Wed Sep 16 12:07:39 2015 -0500
+++ b/source/encoder/rdcost.h	Wed Sep 16 12:07:40 2015 -0500
@@ -125,11 +125,11 @@
         return sadCost + ((bits * m_lambda + 128) >> 8);
     }
 
-    inline uint32_t scaleChromaDist(uint32_t plane, uint32_t dist) const
+    inline sse_ret_t scaleChromaDist(uint32_t plane, sse_ret_t dist) const
     {
         X265_CHECK(dist <= (UINT64_MAX - 128) / m_chromaDistWeight[plane - 1],
                    "scaleChromaDist wrap detected dist: %u, lambda: %u\n", dist, m_chromaDistWeight[plane - 1]);
-        return (uint32_t)((dist * (uint64_t)m_chromaDistWeight[plane - 1] + 128) >> 8);
+        return (sse_ret_t)((dist * (uint64_t)m_chromaDistWeight[plane - 1] + 128) >> 8);
     }
 
     inline uint32_t getCost(uint32_t bits) const
diff -r dd77e2f94ec9 -r e35d3260b513 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Wed Sep 16 12:07:39 2015 -0500
+++ b/source/encoder/search.cpp	Wed Sep 16 12:07:40 2015 -0500
@@ -2549,7 +2549,7 @@
     uint32_t tqBypass = cu.m_tqBypass[0];
     if (!tqBypass)
     {
-        uint32_t cbf0Dist = primitives.cu[sizeIdx].sse_pp(fencYuv->m_buf[0], fencYuv->m_size, predYuv->m_buf[0], predYuv->m_size);
+        sse_ret_t cbf0Dist = primitives.cu[sizeIdx].sse_pp(fencYuv->m_buf[0], fencYuv->m_size, predYuv->m_buf[0], predYuv->m_size);
         cbf0Dist += m_rdCost.scaleChromaDist(1, primitives.chroma[m_csp].cu[sizeIdx].sse_pp(fencYuv->m_buf[1], predYuv->m_csize, predYuv->m_buf[1], predYuv->m_csize));
         cbf0Dist += m_rdCost.scaleChromaDist(2, primitives.chroma[m_csp].cu[sizeIdx].sse_pp(fencYuv->m_buf[2], predYuv->m_csize, predYuv->m_buf[2], predYuv->m_csize));
 



More information about the x265-devel mailing list