Merge "aq-mode for SVC: Add consec_zero_mv to layer context."

This commit is contained in:
Marco Paniconi 2015-09-29 17:47:39 +00:00 committed by Gerrit Code Review
commit 0ca0a536f5
2 changed files with 15 additions and 3 deletions

View File

@ -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);
}
}
}

View File

@ -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 {