summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoe Liu <zoeliu@google.com>2016-01-22 17:13:03 -0800
committerZoe Liu <zoeliu@google.com>2016-01-25 09:38:45 -0800
commit9e612763f0eeab6c231afe6a2821ebed529715c9 (patch)
treeceaafd22fd0d29ef224862cf1b89c69234556ee5
parent27c13712c9c5d665ee84d8753255a23257c43600 (diff)
downloadlibvpx-9e612763f0eeab6c231afe6a2821ebed529715c9.tar
libvpx-9e612763f0eeab6c231afe6a2821ebed529715c9.tar.gz
libvpx-9e612763f0eeab6c231afe6a2821ebed529715c9.tar.bz2
libvpx-9e612763f0eeab6c231afe6a2821ebed529715c9.zip
Cleaned a code in define_gf_group() for firstpass
Change-Id: I0b8eff9e74e3446024482d011ec4fb28b19136d3
-rw-r--r--vp10/encoder/firstpass.c11
-rw-r--r--vp9/encoder/vp9_firstpass.c7
2 files changed, 8 insertions, 10 deletions
diff --git a/vp10/encoder/firstpass.c b/vp10/encoder/firstpass.c
index c41fa3e39..73ea408d6 100644
--- a/vp10/encoder/firstpass.c
+++ b/vp10/encoder/firstpass.c
@@ -1819,10 +1819,10 @@ static void define_gf_group(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
{
int int_max_q =
(int)(vp10_convert_qindex_to_q(twopass->active_worst_quality,
- cpi->common.bit_depth));
+ cpi->common.bit_depth));
int int_lbq =
(int)(vp10_convert_qindex_to_q(rc->last_boosted_qindex,
- cpi->common.bit_depth));
+ cpi->common.bit_depth));
active_min_gf_interval = rc->min_gf_interval + VPXMIN(2, int_max_q / 200);
if (active_min_gf_interval > rc->max_gf_interval)
active_min_gf_interval = rc->max_gf_interval;
@@ -1835,13 +1835,12 @@ static void define_gf_group(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// At high Q when there are few bits to spare we are better with a longer
// interval to spread the cost of the GF.
active_max_gf_interval = 12 + VPXMIN(4, (int_lbq / 6));
- if (active_max_gf_interval < active_min_gf_interval)
- active_max_gf_interval = active_min_gf_interval;
- if (active_max_gf_interval > rc->max_gf_interval)
- active_max_gf_interval = rc->max_gf_interval;
+ // We have: active_min_gf_interval <= rc->max_gf_interval
if (active_max_gf_interval < active_min_gf_interval)
active_max_gf_interval = active_min_gf_interval;
+ else if (active_max_gf_interval > rc->max_gf_interval)
+ active_max_gf_interval = rc->max_gf_interval;
}
}
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index 43fcdbd2e..aa982f0e9 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1939,13 +1939,12 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// At high Q when there are few bits to spare we are better with a longer
// interval to spread the cost of the GF.
active_max_gf_interval = 12 + VPXMIN(4, (int_lbq / 6));
- if (active_max_gf_interval < active_min_gf_interval)
- active_max_gf_interval = active_min_gf_interval;
- if (active_max_gf_interval > rc->max_gf_interval)
- active_max_gf_interval = rc->max_gf_interval;
+ // We have: active_min_gf_interval <= rc->max_gf_interval
if (active_max_gf_interval < active_min_gf_interval)
active_max_gf_interval = active_min_gf_interval;
+ else if (active_max_gf_interval > rc->max_gf_interval)
+ active_max_gf_interval = rc->max_gf_interval;
}
}