diff options
author | Jingning Han <jingning@google.com> | 2018-10-16 10:09:52 -0700 |
---|---|---|
committer | Jingning Han <jingning@google.com> | 2018-10-16 10:29:07 -0700 |
commit | d8825f16b2efd6054ac19953ffe99c9a827041cb (patch) | |
tree | 1343842e9d54f5f5ae51f51131483333f8aa3f10 /vp9/encoder | |
parent | 4dae31877dd3cceb5a129cb9b42f61d58665ddf3 (diff) | |
download | libvpx-d8825f16b2efd6054ac19953ffe99c9a827041cb.tar libvpx-d8825f16b2efd6054ac19953ffe99c9a827041cb.tar.gz libvpx-d8825f16b2efd6054ac19953ffe99c9a827041cb.tar.bz2 libvpx-d8825f16b2efd6054ac19953ffe99c9a827041cb.zip |
Refactor tpl dependency model to support multi-layer ARF updates
Refactor to form a systematic reference frame update system for
the temporal dependency model. This prepares to support the multi-
layer ARF system.
Change-Id: Idb90fbe3966695b487c1a0a52f4626b0b6807434
Diffstat (limited to 'vp9/encoder')
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index dfc92e8e8..67aed520a 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -5362,6 +5362,8 @@ void init_gop_frames(VP9_COMP *cpi, GF_PICTURE *gf_picture, int gld_index = -1; int alt_index = -1; int lst_index = -1; + int arf_index_stack[MAX_ARF_LAYERS]; + int arf_stack_size = 0; int extend_frame_count = 0; int pframe_qindex = cpi->tpl_stats[2].base_qindex; @@ -5369,6 +5371,7 @@ void init_gop_frames(VP9_COMP *cpi, GF_PICTURE *gf_picture, int8_t recon_frame_index[REFS_PER_FRAME + MAX_ARF_LAYERS]; memset(recon_frame_index, -1, sizeof(recon_frame_index)); + stack_init(arf_index_stack, MAX_ARF_LAYERS); // TODO(jingning): To be used later for gf frame type parsing. (void)gf_group; @@ -5406,7 +5409,7 @@ void init_gop_frames(VP9_COMP *cpi, GF_PICTURE *gf_picture, gld_index = 0; ++*tpl_group_frames; - // Initialize ARF frame + // Initialize base layer ARF frame gf_picture[1].frame = cpi->Source; gf_picture[1].ref_frame[0] = gld_index; gf_picture[1].ref_frame[1] = lst_index; @@ -5427,8 +5430,27 @@ void init_gop_frames(VP9_COMP *cpi, GF_PICTURE *gf_picture, gf_picture[frame_idx].ref_frame[1] = lst_index; gf_picture[frame_idx].ref_frame[2] = alt_index; + switch (gf_group->update_type[frame_idx]) { + case ARF_UPDATE: + stack_push(arf_index_stack, alt_index, arf_stack_size); + ++arf_stack_size; + alt_index = frame_idx; + break; + case LF_UPDATE: lst_index = frame_idx; break; + case OVERLAY_UPDATE: + gld_index = frame_idx; + alt_index = stack_pop(arf_index_stack, arf_stack_size); + --arf_stack_size; + break; + case USE_BUF_FRAME: + lst_index = frame_idx; + alt_index = stack_pop(arf_index_stack, arf_stack_size); + --arf_stack_size; + break; + default: break; + } + ++*tpl_group_frames; - lst_index = frame_idx; // The length of group of pictures is baseline_gf_interval, plus the // beginning golden frame from last GOP, plus the last overlay frame in @@ -5436,8 +5458,6 @@ void init_gop_frames(VP9_COMP *cpi, GF_PICTURE *gf_picture, if (frame_idx == gf_group->gf_group_size) break; } - gld_index = frame_idx; - lst_index = VPXMAX(0, frame_idx - 1); alt_index = -1; ++frame_idx; |