[x265] [PATCH] fix PSYVALUE shift overflow, Issue #180 [OUTPUT CHANGE on 12bpp]

Min Chen chenm003 at 163.com
Fri Sep 11 22:33:47 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1442002697 18000
# Node ID f520fd29f3d71d495e08fe96df917489348c377b
# Parent  137854992fc614bdd6c446852528e24ed52c9991
fix PSYVALUE shift overflow, Issue #180 [OUTPUT CHANGE on 12bpp]
---
 source/common/quant.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff -r 137854992fc6 -r f520fd29f3d7 source/common/quant.cpp
--- a/source/common/quant.cpp	Fri Sep 11 15:18:14 2015 -0500
+++ b/source/common/quant.cpp	Fri Sep 11 15:18:17 2015 -0500
@@ -588,7 +588,7 @@
 #define UNQUANT(lvl)    (((lvl) * (unquantScale[blkPos] << per) + unquantRound) >> unquantShift)
 #define SIGCOST(bits)   ((lambda2 * (bits)) >> 8)
 #define RDCOST(d, bits) ((((int64_t)d * d) << scaleBits) + SIGCOST(bits))
-#define PSYVALUE(rec)   ((psyScale * (rec)) >> (2 * transformShift + 1))
+#define PSYVALUE(rec)   ((psyScale * (rec)) >> X265_MAX(0, (2 * transformShift + 1)))
 
     int64_t costCoeff[trSize * trSize];   /* d*d + lambda * bits */
     int64_t costUncoded[trSize * trSize]; /* d*d + lambda * 0    */



More information about the x265-devel mailing list