[x265] [PATCH 1 of 3] fix count of shift overflow bug in Quant::getSigCoeffGroupCtxInc

Min Chen chenm003 at 163.com
Mon Apr 6 14:18:13 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1428322672 -28800
# Node ID 67e573d7cb4369898e4e664fbc7e4421b800cc30
# Parent  ebe5e57c4b45b45338035a1009b64585f21d66d5
fix count of shift overflow bug in Quant::getSigCoeffGroupCtxInc
---
 source/common/quant.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff -r ebe5e57c4b45 -r 67e573d7cb43 source/common/quant.cpp
--- a/source/common/quant.cpp	Sat Apr 04 15:11:39 2015 -0500
+++ b/source/common/quant.cpp	Mon Apr 06 20:17:52 2015 +0800
@@ -1180,7 +1180,8 @@
 {
     const uint32_t trSizeCG = 1 << log2TrSizeCG;
 
-    const uint32_t sigPos = (uint32_t)(cgGroupMask >> (1 + (cgPosY << log2TrSizeCG) + cgPosX));
+    const uint32_t shift = (cgPosY << log2TrSizeCG) + cgPosX + 1;
+    const uint32_t sigPos = (uint32_t)(shift >= 64 ? 0 : cgGroupMask >> shift);
     const uint32_t sigRight = ((int32_t)(cgPosX - (trSizeCG - 1)) >> 31) & sigPos;
     const uint32_t sigLower = ((int32_t)(cgPosY - (trSizeCG - 1)) >> 31) & (sigPos >> (trSizeCG - 1));
 



More information about the x265-devel mailing list