summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_svc_layercontext.c
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2018-08-09 21:46:27 -0700
committerJerome Jiang <jianj@google.com>2018-08-10 11:27:04 -0700
commitf8d4492d2249744b34cfdd4bb1adc13f14a14906 (patch)
treeb247700fd378a0c7312e128f7f9dad29c5ca7144 /vp9/encoder/vp9_svc_layercontext.c
parentb6264524021f8dcbb1038259fcaab8537f7bf661 (diff)
downloadlibvpx-f8d4492d2249744b34cfdd4bb1adc13f14a14906.tar
libvpx-f8d4492d2249744b34cfdd4bb1adc13f14a14906.tar.gz
libvpx-f8d4492d2249744b34cfdd4bb1adc13f14a14906.tar.bz2
libvpx-f8d4492d2249744b34cfdd4bb1adc13f14a14906.zip
Refactor: Move code updating ref frames for svc & denoiser.
Make new functions and move them to vp9_denoiser.c and vp9_svc_layercontext.c Change-Id: Ia34266ee2831d0f1316b7a641cbbf40fe64e1a0c
Diffstat (limited to 'vp9/encoder/vp9_svc_layercontext.c')
-rw-r--r--vp9/encoder/vp9_svc_layercontext.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c
index 2154d144a..0bd4fd29a 100644
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -1126,7 +1126,7 @@ void vp9_svc_update_ref_frame_buffer_idx(VP9_COMP *const cpi) {
}
}
-void vp9_svc_update_ref_frame_bypass_mode(VP9_COMP *const cpi) {
+static void vp9_svc_update_ref_frame_bypass_mode(VP9_COMP *const cpi) {
// For non-flexible/bypass SVC mode: check for refreshing other buffer
// slots.
SVC *const svc = &cpi->svc;
@@ -1142,3 +1142,40 @@ void vp9_svc_update_ref_frame_bypass_mode(VP9_COMP *const cpi) {
}
}
}
+
+void vp9_svc_update_ref_frame(VP9_COMP *const cpi) {
+ VP9_COMMON *const cm = &cpi->common;
+ SVC *const svc = &cpi->svc;
+ BufferPool *const pool = cm->buffer_pool;
+
+ if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS) {
+ vp9_svc_update_ref_frame_bypass_mode(cpi);
+ } else if (cm->frame_type == KEY_FRAME) {
+ // Keep track of frame index for each reference frame.
+ int i;
+ // On key frame update all reference frame slots.
+ for (i = 0; i < REF_FRAMES; i++) {
+ svc->fb_idx_spatial_layer_id[i] = svc->spatial_layer_id;
+ svc->fb_idx_temporal_layer_id[i] = svc->temporal_layer_id;
+ // LAST/GOLDEN/ALTREF is already updated above.
+ if (i != cpi->lst_fb_idx && i != cpi->gld_fb_idx && i != cpi->alt_fb_idx)
+ ref_cnt_fb(pool->frame_bufs, &cm->ref_frame_map[i], cm->new_fb_idx);
+ }
+ } else {
+ if (cpi->refresh_last_frame) {
+ svc->fb_idx_spatial_layer_id[cpi->lst_fb_idx] = svc->spatial_layer_id;
+ svc->fb_idx_temporal_layer_id[cpi->lst_fb_idx] = svc->temporal_layer_id;
+ }
+ if (cpi->refresh_golden_frame) {
+ svc->fb_idx_spatial_layer_id[cpi->gld_fb_idx] = svc->spatial_layer_id;
+ svc->fb_idx_temporal_layer_id[cpi->gld_fb_idx] = svc->temporal_layer_id;
+ }
+ if (cpi->refresh_alt_ref_frame) {
+ svc->fb_idx_spatial_layer_id[cpi->alt_fb_idx] = svc->spatial_layer_id;
+ svc->fb_idx_temporal_layer_id[cpi->alt_fb_idx] = svc->temporal_layer_id;
+ }
+ }
+ // Copy flags from encoder to SVC struct.
+ vp9_copy_flags_ref_update_idx(cpi);
+ vp9_svc_update_ref_frame_buffer_idx(cpi);
+}