Define a macro to replace hardcoded values
The definition is for the number of frames to check to determine the recent decay rate, further to determine the next key frame in the first pass of the encoder. Change-Id: Ic696d6eb518a86fa296842273cf8767ef0b0e27a
This commit is contained in:
parent
f74e04cc62
commit
0f7dd40324
@ -2135,6 +2135,8 @@ static int test_candidate_kf(TWO_PASS *twopass,
|
|||||||
return is_viable_kf;
|
return is_viable_kf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FRAMES_TO_CHECK_DECAY 8
|
||||||
|
|
||||||
static void find_next_key_frame(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
static void find_next_key_frame(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
||||||
int i, j;
|
int i, j;
|
||||||
RATE_CONTROL *const rc = &cpi->rc;
|
RATE_CONTROL *const rc = &cpi->rc;
|
||||||
@ -2153,7 +2155,7 @@ static void find_next_key_frame(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||||||
double boost_score = 0.0;
|
double boost_score = 0.0;
|
||||||
double kf_mod_err = 0.0;
|
double kf_mod_err = 0.0;
|
||||||
double kf_group_err = 0.0;
|
double kf_group_err = 0.0;
|
||||||
double recent_loop_decay[8] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
|
double recent_loop_decay[FRAMES_TO_CHECK_DECAY];
|
||||||
|
|
||||||
vp10_zero(next_frame);
|
vp10_zero(next_frame);
|
||||||
|
|
||||||
@ -2180,6 +2182,10 @@ static void find_next_key_frame(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||||||
|
|
||||||
kf_mod_err = calculate_modified_err(cpi, twopass, oxcf, this_frame);
|
kf_mod_err = calculate_modified_err(cpi, twopass, oxcf, this_frame);
|
||||||
|
|
||||||
|
// Initialize the decay rates for the recent frames to check
|
||||||
|
for (j = 0; j < FRAMES_TO_CHECK_DECAY; ++j)
|
||||||
|
recent_loop_decay[j] = 1.0;
|
||||||
|
|
||||||
// Find the next keyframe.
|
// Find the next keyframe.
|
||||||
i = 0;
|
i = 0;
|
||||||
while (twopass->stats_in < twopass->stats_in_end &&
|
while (twopass->stats_in < twopass->stats_in_end &&
|
||||||
@ -2206,9 +2212,9 @@ static void find_next_key_frame(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||||||
// We want to know something about the recent past... rather than
|
// We want to know something about the recent past... rather than
|
||||||
// as used elsewhere where we are concerned with decay in prediction
|
// as used elsewhere where we are concerned with decay in prediction
|
||||||
// quality since the last GF or KF.
|
// quality since the last GF or KF.
|
||||||
recent_loop_decay[i % 8] = loop_decay_rate;
|
recent_loop_decay[i % FRAMES_TO_CHECK_DECAY] = loop_decay_rate;
|
||||||
decay_accumulator = 1.0;
|
decay_accumulator = 1.0;
|
||||||
for (j = 0; j < 8; ++j)
|
for (j = 0; j < FRAMES_TO_CHECK_DECAY; ++j)
|
||||||
decay_accumulator *= recent_loop_decay[j];
|
decay_accumulator *= recent_loop_decay[j];
|
||||||
|
|
||||||
// Special check for transition or high motion followed by a
|
// Special check for transition or high motion followed by a
|
||||||
|
@ -2260,6 +2260,8 @@ static int test_candidate_kf(TWO_PASS *twopass,
|
|||||||
return is_viable_kf;
|
return is_viable_kf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FRAMES_TO_CHECK_DECAY 8
|
||||||
|
|
||||||
static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
||||||
int i, j;
|
int i, j;
|
||||||
RATE_CONTROL *const rc = &cpi->rc;
|
RATE_CONTROL *const rc = &cpi->rc;
|
||||||
@ -2278,7 +2280,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||||||
double boost_score = 0.0;
|
double boost_score = 0.0;
|
||||||
double kf_mod_err = 0.0;
|
double kf_mod_err = 0.0;
|
||||||
double kf_group_err = 0.0;
|
double kf_group_err = 0.0;
|
||||||
double recent_loop_decay[8] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
|
double recent_loop_decay[FRAMES_TO_CHECK_DECAY];
|
||||||
|
|
||||||
vp9_zero(next_frame);
|
vp9_zero(next_frame);
|
||||||
|
|
||||||
@ -2305,6 +2307,10 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||||||
|
|
||||||
kf_mod_err = calculate_modified_err(cpi, twopass, oxcf, this_frame);
|
kf_mod_err = calculate_modified_err(cpi, twopass, oxcf, this_frame);
|
||||||
|
|
||||||
|
// Initialize the decay rates for the recent frames to check
|
||||||
|
for (j = 0; j < FRAMES_TO_CHECK_DECAY; ++j)
|
||||||
|
recent_loop_decay[j] = 1.0;
|
||||||
|
|
||||||
// Find the next keyframe.
|
// Find the next keyframe.
|
||||||
i = 0;
|
i = 0;
|
||||||
while (twopass->stats_in < twopass->stats_in_end &&
|
while (twopass->stats_in < twopass->stats_in_end &&
|
||||||
@ -2331,9 +2337,9 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||||||
// We want to know something about the recent past... rather than
|
// We want to know something about the recent past... rather than
|
||||||
// as used elsewhere where we are concerned with decay in prediction
|
// as used elsewhere where we are concerned with decay in prediction
|
||||||
// quality since the last GF or KF.
|
// quality since the last GF or KF.
|
||||||
recent_loop_decay[i % 8] = loop_decay_rate;
|
recent_loop_decay[i % FRAMES_TO_CHECK_DECAY] = loop_decay_rate;
|
||||||
decay_accumulator = 1.0;
|
decay_accumulator = 1.0;
|
||||||
for (j = 0; j < 8; ++j)
|
for (j = 0; j < FRAMES_TO_CHECK_DECAY; ++j)
|
||||||
decay_accumulator *= recent_loop_decay[j];
|
decay_accumulator *= recent_loop_decay[j];
|
||||||
|
|
||||||
// Special check for transition or high motion followed by a
|
// Special check for transition or high motion followed by a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user