Fix alignment issue when using the first pass stats.
BUG=b/260859962
Change-Id: Ia9c8dacf227e904d30423296e36d8cc439c68505
diff --git a/av1/qmode_rc/ratectrl_qmode.cc b/av1/qmode_rc/ratectrl_qmode.cc
index 6ca6d81..34b2782 100644
--- a/av1/qmode_rc/ratectrl_qmode.cc
+++ b/av1/qmode_rc/ratectrl_qmode.cc
@@ -1533,10 +1533,10 @@
double boost = 0.0;
// Check the influence of this arf frame to the frames before it
- for (int f = this_gop_len - 1; f > 0; --f) {
+ for (int f = this_gop_len - 2; f > 0; --f) {
// The contribution of this arf to frame f
double coeff_this = 1.0;
- for (int k = this_gop_len; k > f; --k) {
+ for (int k = this_gop_len - 1; k > f; --k) {
if (CheckFlash(analyzed_fp_info.stats_list, k)) continue;
coeff_this *= analyzed_fp_info.stats_list[k].cor_coeff;
}
@@ -1566,10 +1566,10 @@
}
// Check the influence of this arf frame to the frames after it
- for (int f = this_gop_len + 1; f < this_gop_len + next_gop_len; ++f) {
+ for (int f = this_gop_len; f < this_gop_len + next_gop_len; ++f) {
// The contribution of this arf to frame f
double coeff_this = 1.0;
- for (int k = this_gop_len + 1; k <= f; ++k) {
+ for (int k = this_gop_len; k <= f; ++k) {
if (CheckFlash(analyzed_fp_info.stats_list, k)) continue;
coeff_this *= analyzed_fp_info.stats_list[k].cor_coeff;
}
@@ -1577,7 +1577,7 @@
if (next_gop_len >= 4) {
// The contribution of next arf to frame f
double coeff_next = 1.0;
- for (int k = this_gop_len + next_gop_len; k > f; --k) {
+ for (int k = this_gop_len + next_gop_len - 1; k > f; --k) {
if (CheckFlash(analyzed_fp_info.stats_list, k)) continue;
coeff_next *= analyzed_fp_info.stats_list[k].cor_coeff;
}