[x265] [PATCH 2 of 2] rc: change the predictors update algorithm
aarthi at multicorewareinc.com
aarthi at multicorewareinc.com
Thu Nov 12 10:15:58 CET 2015
# HG changeset patch
# User Aarthi Thirumalai
# Date 1447240285 -19800
# Wed Nov 11 16:41:25 2015 +0530
# Node ID 44c08c1f5d3c88cf9cb3dd85cd9e2c4904cebb16
# Parent ca5137a54613304a6351a31c022806686898a52a
rc: change the predictors update algorithm
diff -r ca5137a54613 -r 44c08c1f5d3c source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp Wed Nov 11 16:24:10 2015 +0530
+++ b/source/encoder/ratecontrol.cpp Wed Nov 11 16:41:25 2015 +0530
@@ -928,16 +928,20 @@
/* Frame Predictors used in vbv */
for (int i = 0; i < 4; i++)
{
+ m_pred[i].coeffMin = 1.0 / 4;
m_pred[i].coeff = 1.0;
m_pred[i].count = 1.0;
m_pred[i].decay = 0.5;
m_pred[i].offset = 0.0;
}
m_pred[0].coeff = m_pred[3].coeff = 0.75;
+ m_pred[0].coeffMin = m_pred[3].coeffMin = 0.75 / 4;
if (m_param->rc.qCompress >= 0.8) // when tuned for grain
{
+ m_pred[1].coeffMin = 0.75 / 4;
m_pred[1].coeff = 0.75;
- m_pred[0].coeff = m_pred[3].coeff = 0.50;
+ m_pred[0].coeff = m_pred[3].coeff = 0.5;
+ m_pred[0].coeffMin = m_pred[3].coeffMin = 0.5 / 4;
}
}
@@ -997,6 +1001,7 @@
{
for (int j = 0; j < 2; j++)
{
+ rce->rowPreds[i][j].coeffMin = 0.25 / 4;
rce->rowPreds[i][j].coeff = 0.25;
rce->rowPreds[i][j].count = 1.0;
rce->rowPreds[i][j].decay = 0.5;
@@ -2149,7 +2154,8 @@
return;
const double range = 2;
double old_coeff = p->coeff / p->count;
- double new_coeff = bits * q / var;
+ double old_offset = p->offset / p->count;
+ double new_coeff = X265_MAX((bits * q - old_offset) / var, p->coeffMin );
double new_coeff_clipped = x265_clip3(old_coeff / range, old_coeff * range, new_coeff);
double new_offset = bits * q - new_coeff_clipped * var;
if (new_offset >= 0)
diff -r ca5137a54613 -r 44c08c1f5d3c source/encoder/ratecontrol.h
--- a/source/encoder/ratecontrol.h Wed Nov 11 16:24:10 2015 +0530
+++ b/source/encoder/ratecontrol.h Wed Nov 11 16:41:25 2015 +0530
@@ -48,6 +48,7 @@
struct Predictor
{
+ double coeffMin;
double coeff;
double count;
double decay;
More information about the x265-devel
mailing list