[x265] [PATCH 2 of 2] fix SSE_PP intermedia result overflow in Main12, issue #180

Min Chen chenm003 at 163.com
Mon Sep 14 22:47:05 CEST 2015


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

diff -r d80790d350d0 -r 32584ddbe906 source/encoder/rdcost.h
--- a/source/encoder/rdcost.h	Mon Sep 14 15:26:42 2015 -0500
+++ b/source/encoder/rdcost.h	Mon Sep 14 15:26:45 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 d80790d350d0 -r 32584ddbe906 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Mon Sep 14 15:26:42 2015 -0500
+++ b/source/encoder/search.cpp	Mon Sep 14 15:26:45 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