[x265] [PATCH 1 of 4] modify m_psyRdoqScale from int64 to int32 because dynamic range is [0, 50]*256

Min Chen chenm003 at 163.com
Mon Apr 27 14:32:09 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1430137902 -28800
# Node ID c04edc2c3139c9561a08c675738ae976302fc000
# Parent  4a7176bab7423d831675f0419b6470668bdbd919
modify m_psyRdoqScale from int64 to int32 because dynamic range is [0,50]*256
---
 source/common/quant.cpp |    3 ++-
 source/common/quant.h   |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff -r 4a7176bab742 -r c04edc2c3139 source/common/quant.cpp
--- a/source/common/quant.cpp	Fri Apr 24 16:07:42 2015 -0500
+++ b/source/common/quant.cpp	Mon Apr 27 20:31:42 2015 +0800
@@ -198,7 +198,8 @@
 {
     m_entropyCoder = &entropy;
     m_rdoqLevel    = rdoqLevel;
-    m_psyRdoqScale = (int64_t)(psyScale * 256.0);
+    m_psyRdoqScale = (int32_t)(psyScale * 256.0);
+    X265_CHECK((psyScale * 256.0) < (double)MAX_INT, "psyScale value too large\n");
     m_scalingList  = &scalingList;
     m_resiDctCoeff = X265_MALLOC(int16_t, MAX_TR_SIZE * MAX_TR_SIZE * 2);
     m_fencDctCoeff = m_resiDctCoeff + (MAX_TR_SIZE * MAX_TR_SIZE);
diff -r 4a7176bab742 -r c04edc2c3139 source/common/quant.h
--- a/source/common/quant.h	Fri Apr 24 16:07:42 2015 -0500
+++ b/source/common/quant.h	Mon Apr 27 20:31:42 2015 +0800
@@ -82,7 +82,7 @@
     QpParam            m_qpParam[3];
 
     int                m_rdoqLevel;
-    int64_t            m_psyRdoqScale;
+    int32_t            m_psyRdoqScale;  // dynamic range [0,50] * 256 = 14-bits
     int16_t*           m_resiDctCoeff;
     int16_t*           m_fencDctCoeff;
     int16_t*           m_fencShortBuf;



More information about the x265-devel mailing list