[x265] [PATCH STABLE] rdcost: use FIX16 for psyrd scale multiplier
Steve Borho
steve at borho.org
Wed Feb 4 22:11:29 CET 2015
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1423084119 21600
# Wed Feb 04 15:08:39 2015 -0600
# Branch stable
# Node ID 24642eec8f6b4fe29de4c25c43e2b4ece42ef541
# Parent 18cb1eef8cd500c6db074fac838844d5c3f0f531
rdcost: use FIX16 for psyrd scale multiplier
Gives us more resolution at the lower end of the range of psy-rd values. The
max value of m_psyRdBase after the 0.33 scaling of [0..2] is less than 1.
diff -r 18cb1eef8cd5 -r 24642eec8f6b source/encoder/rdcost.h
--- a/source/encoder/rdcost.h Wed Feb 04 15:00:31 2015 -0600
+++ b/source/encoder/rdcost.h Wed Feb 04 15:08:39 2015 -0600
@@ -42,7 +42,7 @@
uint32_t m_psyRd;
int m_qp;
- void setPsyRdScale(double scale) { m_psyRdBase = (uint32_t)floor(256.0 * scale * 0.33); }
+ void setPsyRdScale(double scale) { m_psyRdBase = (uint32_t)floor(65536.0 * scale * 0.33); }
void setQP(const Slice& slice, int qp)
{
@@ -106,7 +106,7 @@
/* return the RD cost of this prediction, including the effect of psy-rd */
inline uint64_t calcPsyRdCost(uint32_t distortion, uint32_t bits, uint32_t psycost) const
{
- return distortion + ((m_lambda * m_psyRd * psycost) >> 16) + ((bits * m_lambda2) >> 8);
+ return distortion + ((m_lambda * m_psyRd * psycost) >> 24) + ((bits * m_lambda2) >> 8);
}
inline uint64_t calcRdSADCost(uint32_t sadCost, uint32_t bits) const
More information about the x265-devel
mailing list