break;
case LF_UPDATE:
- cpi->refresh_last_frame = 1;
- cpi->refresh_golden_frame = 0;
#if CONFIG_EXT_REFS
- cpi->refresh_bwd_ref_frame = 0;
+ // If we have extra ALT_REFs, we can use the farthest ALT (ALT0) as
+ // the BWD_REF.
+ if (cpi->num_extra_arfs) {
+ int tmp = cpi->bwd_fb_idx;
+
+ cpi->rc.is_bwd_ref_frame = 1;
+ cpi->bwd_fb_idx = cpi->alt_fb_idx;
+ cpi->alt_fb_idx = cpi->arf_map[0];;
+ cpi->arf_map[0] = tmp;
+ } else {
+ cpi->rc.is_bwd_ref_frame = 0;
+ }
#endif // CONFIG_EXT_REFS
+ cpi->refresh_last_frame = 1;
+ cpi->refresh_golden_frame = 0;
cpi->refresh_alt_ref_frame = 0;
break;