Unified · Split
| @@ -2620,6 +2620,22 @@ static RANGE get_active_gf_inverval_range( · 2619 unmodified lines | ||
| 2620 | 2620 | return active_gf_interval; |
| 2621 | 2621 | } |
| 2622 | 2622 | |
| 2623 | +static int get_arf_layers(int multi_layer_arf, int max_layers, | |
| 2624 | + int coding_frame_num) { | |
| 2625 | + assert(max_layers <= MAX_ARF_LAYERS); | |
| 2626 | + if (multi_layer_arf) { | |
| 2627 | + int layers = 0; | |
| 2628 | + int i; | |
| 2629 | + for (i = coding_frame_num; i > 0; i >>= 1) { | |
| 2630 | + ++layers; | |
| 2631 | + } | |
| 2632 | + layers = VPXMIN(max_layers, layers); | |
| 2633 | + return layers; | |
| 2634 | + } else { | |
| 2635 | + return 1; | |
| 2636 | + } | |
| 2637 | +} | |
| 2638 | + | |
| 2623 | 2639 | static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) { |
| 2624 | 2640 | VP9_COMMON *const cm = &cpi->common; |
| 2625 | 2641 | RATE_CONTROL *const rc = &cpi->rc; |
| @@ -2649,7 +2665,7 @@ static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) { · 23 unmodified lines | ||
| 2649 | 2665 | const int arf_active_or_kf = is_key_frame || rc->source_alt_ref_active; |
| 2650 | 2666 | int is_alt_ref_flash = 0; |
| 2651 | 2667 | |
| 2652 | − double gop_intra_factor = 1.0; | |
| 2668 | + double gop_intra_factor; | |
| 2653 | 2669 | int gop_frames; |
| 2654 | 2670 | RANGE active_gf_interval; |
| 2655 | 2671 | |
| @@ -2664,16 +2680,13 @@ static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) { · 8 unmodified lines | ||
| 2664 | 2680 | active_gf_interval = get_active_gf_inverval_range( |
| 2665 | 2681 | frame_info, rc, arf_active_or_kf, gf_start_show_idx, |
| 2666 | 2682 | twopass->active_worst_quality, rc->last_boosted_qindex); |
| 2667 | − if (cpi->multi_layer_arf) { | |
| 2668 | − int layers = 0; | |
| 2669 | − int max_layers = VPXMIN(MAX_ARF_LAYERS, cpi->oxcf.enable_auto_arf); | |
| 2670 | − int i; | |
| 2671 | 2683 | |
| 2672 | − // Adapt the intra_error factor to active_max_gf_interval limit. | |
| 2673 | − for (i = active_gf_interval.max; i > 0; i >>= 1) ++layers; | |
| 2674 | − | |
| 2675 | − layers = VPXMIN(max_layers, layers); | |
| 2676 | − gop_intra_factor += (layers * 0.25); | |
| 2684 | + if (cpi->multi_layer_arf) { | |
| 2685 | + int arf_layers = get_arf_layers(cpi->multi_layer_arf, oxcf->enable_auto_arf, | |
| 2686 | + active_gf_interval.max); | |
| 2687 | + gop_intra_factor = 1.0 + 0.25 * arf_layers; | |
| 2688 | + } else { | |
| 2689 | + gop_intra_factor = 1.0; | |
| 2677 | 2690 | } |
| 2678 | 2691 | |
| 2679 | 2692 | { |