Unified · Split
| @@ -2496,8 +2496,6 @@ static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) { · 2495 unmodified lines | |||
| 2496 | double gf_group_inter = 0.0; | 2496 | double gf_group_inter = 0.0; |
| 2497 | double gf_group_motion = 0.0; | 2497 | double gf_group_motion = 0.0; |
| 2498 | 2498 | ||
| 2499 | double zero_motion_accumulator = 1.0; | ||
| 2500 | |||
| 2501 | unsigned int allow_alt_ref = is_altref_enabled(cpi); | 2499 | unsigned int allow_alt_ref = is_altref_enabled(cpi); |
| 2502 | 2500 | ||
| 2503 | int active_max_gf_interval; | 2501 | int active_max_gf_interval; |
| @@ -2584,6 +2582,7 @@ static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) { · 80 unmodified lines | |||
| 2584 | // Motion breakout threshold for loop below depends on image size. | 2582 | // Motion breakout threshold for loop below depends on image size. |
| 2585 | double mv_ratio_accumulator_thresh = | 2583 | double mv_ratio_accumulator_thresh = |
| 2586 | (cpi->initial_height + cpi->initial_width) / 4.0; | 2584 | (cpi->initial_height + cpi->initial_width) / 4.0; |
| 2585 | double zero_motion_accumulator = 1.0; | ||
| 2587 | 2586 | ||
| 2588 | while (i < rc->static_scene_max_gf_interval && i < rc->frames_to_key) { | 2587 | while (i < rc->static_scene_max_gf_interval && i < rc->frames_to_key) { |
| 2589 | const FIRSTPASS_STATS *next_next_frame; | 2588 | const FIRSTPASS_STATS *next_next_frame; |
| @@ -2670,14 +2669,14 @@ static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) { · 80 unmodified lines | |||
| 2670 | break; | 2669 | break; |
| 2671 | } | 2670 | } |
| 2672 | } | 2671 | } |
| 2672 | allow_alt_ref &= zero_motion_accumulator < 0.995; | ||
| 2673 | } | 2673 | } |
| 2674 | 2674 | ||
| 2675 | // Was the group length constrained by the requirement for a new KF? | 2675 | // Was the group length constrained by the requirement for a new KF? |
| 2676 | rc->constrained_gf_group = (i >= rc->frames_to_key) ? 1 : 0; | 2676 | rc->constrained_gf_group = (i >= rc->frames_to_key) ? 1 : 0; |
| 2677 | 2677 | ||
| 2678 | // Should we use the alternate reference frame. | 2678 | // Should we use the alternate reference frame. |
| 2679 | if ((zero_motion_accumulator < 0.995) && allow_alt_ref && | 2679 | if (allow_alt_ref && (twopass->kf_zeromotion_pct < STATIC_KF_GROUP_THRESH) && |
| 2680 | (twopass->kf_zeromotion_pct < STATIC_KF_GROUP_THRESH) && | ||
| 2681 | (i < cpi->oxcf.lag_in_frames) && (i >= rc->min_gf_interval)) { | 2680 | (i < cpi->oxcf.lag_in_frames) && (i >= rc->min_gf_interval)) { |
| 2682 | const int f_frames = (rc->frames_to_key - i >= i - 1) | 2681 | const int f_frames = (rc->frames_to_key - i >= i - 1) |
| 2683 | ? i - 1 | 2682 | ? i - 1 |