From: Marco Date: Tue, 29 Sep 2015 17:00:16 +0000 (-0700) Subject: aq-mode for SVC: Add consec_zero_mv to layer context. X-Git-Tag: v1.5.0~104^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c05c58f8ff99b11fa003cc4b1eca2ffb9d463528;p=libvpx aq-mode for SVC: Add consec_zero_mv to layer context. Change-Id: I63fadf1c7240d4b2893384f75c519311e9659d47 --- diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c index 64a4ebd7a..25209f4b1 100644 --- a/vp9/encoder/vp9_svc_layercontext.c +++ b/vp9/encoder/vp9_svc_layercontext.c @@ -55,7 +55,6 @@ void vp9_init_layer_context(VP9_COMP *const cpi) { int layer = LAYER_IDS_TO_IDX(sl, tl, oxcf->ts_number_layers); LAYER_CONTEXT *const lc = &svc->layer_context[layer]; RATE_CONTROL *const lrc = &lc->rc; - size_t last_coded_q_map_size; int i; lc->current_video_frame_in_layer = 0; lc->layer_size = 0; @@ -105,14 +104,18 @@ void vp9_init_layer_context(VP9_COMP *const cpi) { // Cyclic refresh is only applied on base temporal layer. if (oxcf->ss_number_layers > 1 && tl == 0) { + size_t last_coded_q_map_size; + size_t consec_zero_mv_size; lc->sb_index = 0; lc->map = vpx_malloc(mi_rows * mi_cols * sizeof(signed char)); memset(lc->map, 0, mi_rows * mi_cols); - last_coded_q_map_size = - mi_rows * mi_cols * sizeof(uint8_t); + last_coded_q_map_size = mi_rows * mi_cols * sizeof(uint8_t); lc->last_coded_q_map = vpx_malloc(last_coded_q_map_size); assert(MAXQ <= 255); memset(lc->last_coded_q_map, MAXQ, last_coded_q_map_size); + consec_zero_mv_size = mi_rows * mi_cols * sizeof(uint8_t); + lc->consec_zero_mv = vpx_malloc(consec_zero_mv_size); + memset(lc->consec_zero_mv, 0, consec_zero_mv_size); } } } @@ -286,10 +289,13 @@ void vp9_restore_layer_context(VP9_COMP *const cpi) { CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; signed char *temp = cr->map; uint8_t *temp2 = cr->last_coded_q_map; + uint8_t *temp3 = cr->consec_zero_mv; cr->map = lc->map; lc->map = temp; cr->last_coded_q_map = lc->last_coded_q_map; lc->last_coded_q_map = temp2; + cr->consec_zero_mv = lc->consec_zero_mv; + lc->consec_zero_mv = temp3; cr->sb_index = lc->sb_index; } } @@ -311,10 +317,13 @@ void vp9_save_layer_context(VP9_COMP *const cpi) { CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; signed char *temp = lc->map; uint8_t *temp2 = lc->last_coded_q_map; + uint8_t *temp3 = lc->consec_zero_mv; lc->map = cr->map; cr->map = temp; lc->last_coded_q_map = cr->last_coded_q_map; cr->last_coded_q_map = temp2; + lc->consec_zero_mv = cr->consec_zero_mv; + cr->consec_zero_mv = temp3; lc->sb_index = cr->sb_index; } } @@ -721,6 +730,8 @@ void vp9_free_svc_cyclic_refresh(VP9_COMP *const cpi) { vpx_free(lc->map); if (lc->last_coded_q_map) vpx_free(lc->last_coded_q_map); + if (lc->consec_zero_mv) + vpx_free(lc->consec_zero_mv); } } } diff --git a/vp9/encoder/vp9_svc_layercontext.h b/vp9/encoder/vp9_svc_layercontext.h index ae55c2fd3..8feab2968 100644 --- a/vp9/encoder/vp9_svc_layercontext.h +++ b/vp9/encoder/vp9_svc_layercontext.h @@ -45,6 +45,7 @@ typedef struct { int sb_index; signed char *map; uint8_t *last_coded_q_map; + uint8_t *consec_zero_mv; } LAYER_CONTEXT; typedef struct {