Commit 2a588555 authored by Geza Lore's avatar Geza Lore
Browse files

Pass segment id explicitly to quantizer init.

This is purely refactoring in preparation of fixing supertx segment
handling

Change-Id: I74bcae34241fdf2b592e1cd45b67af77b9e16c9a
parent 05bd964a
......@@ -35,14 +35,14 @@ typedef struct macroblock_plane {
struct buf_2d src;
// Quantizer setings
int16_t *quant_fp;
int16_t *round_fp;
int16_t *quant;
int16_t *quant_shift;
int16_t *zbin;
int16_t *round;
const int16_t *quant_fp;
const int16_t *round_fp;
const int16_t *quant;
const int16_t *quant_shift;
const int16_t *zbin;
const int16_t *round;
#if CONFIG_NEW_QUANT
cuml_bins_type_nuq *cuml_bins_nuq;
const cuml_bins_type_nuq *cuml_bins_nuq;
#endif // CONFIG_NEW_QUANT
int64_t quant_thred[2];
......
......@@ -318,7 +318,7 @@ static void set_offsets(VP10_COMP *cpi, const TileInfo *const tile,
: cm->last_frame_seg_map;
mbmi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col);
}
vp10_init_plane_quantizers(cpi, x);
vp10_init_plane_quantizers(cpi, x, mbmi->segment_id);
x->encode_breakout = cpi->segment_encode_breakout[mbmi->segment_id];
} else {
......@@ -394,7 +394,7 @@ static void set_offsets_extend(VP10_COMP *cpi, ThreadData *td,
mbmi->segment_id = get_segment_id(cm, map, bsize_ori,
mi_row_ori, mi_col_ori);
}
vp10_init_plane_quantizers(cpi, x);
vp10_init_plane_quantizers(cpi, x, mbmi->segment_id);
x->encode_breakout = cpi->segment_encode_breakout[mbmi->segment_id];
} else {
......@@ -1153,7 +1153,7 @@ static void update_state(VP10_COMP *cpi, ThreadData *td,
}
if (cpi->oxcf.aq_mode)
vp10_init_plane_quantizers(cpi, x);
vp10_init_plane_quantizers(cpi, x, xd->mi[0]->mbmi.segment_id);
if (is_inter_block(mbmi) && mbmi->sb_type < BLOCK_8X8) {
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
......@@ -1297,7 +1297,7 @@ static void update_state_supertx(VP10_COMP *cpi, ThreadData *td,
vp10_cyclic_refresh_update_segment(cpi, &xd->mi[0]->mbmi,
mi_row, mi_col, bsize,
ctx->rate, ctx->dist, 1);
vp10_init_plane_quantizers(cpi, x);
vp10_init_plane_quantizers(cpi, x, xd->mi[0]->mbmi.segment_id);
}
}
......@@ -1311,7 +1311,7 @@ static void update_state_supertx(VP10_COMP *cpi, ThreadData *td,
}
if (cpi->oxcf.aq_mode)
vp10_init_plane_quantizers(cpi, x);
vp10_init_plane_quantizers(cpi, x, xd->mi[0]->mbmi.segment_id);
if (is_inter_block(mbmi) && mbmi->sb_type < BLOCK_8X8) {
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
......@@ -1644,7 +1644,7 @@ static int set_segment_rdmult(VP10_COMP *const cpi,
int8_t segment_id) {
int segment_qindex;
VP10_COMMON *const cm = &cpi->common;
vp10_init_plane_quantizers(cpi, x);
vp10_init_plane_quantizers(cpi, x, segment_id);
vpx_clear_system_state();
segment_qindex = vp10_get_qindex(&cm->seg, segment_id,
cm->base_qindex);
......
......@@ -1280,11 +1280,11 @@ void vp10_init_quantizer(VP10_COMP *cpi) {
}
}
void vp10_init_plane_quantizers(VP10_COMP *cpi, MACROBLOCK *x) {
void vp10_init_plane_quantizers(const VP10_COMP *cpi, MACROBLOCK *x,
const int segment_id) {
const VP10_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
QUANTS *const quants = &cpi->quants;
const int segment_id = xd->mi[0]->mbmi.segment_id;
const QUANTS *const quants = &cpi->quants;
const int qindex = vp10_get_qindex(&cm->seg, segment_id, cm->base_qindex);
const int rdmult = vp10_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q);
int i;
......@@ -1299,11 +1299,9 @@ void vp10_init_plane_quantizers(VP10_COMP *cpi, MACROBLOCK *x) {
xd->plane[0].dequant = cpi->y_dequant[qindex];
#if CONFIG_NEW_QUANT
x->plane[0].cuml_bins_nuq = quants->y_cuml_bins_nuq[qindex];
xd->plane[0].dequant_val_nuq = (const dequant_val_type_nuq*)
cpi->y_dequant_val_nuq[qindex];
xd->plane[0].dequant_val_nuq = cpi->y_dequant_val_nuq[qindex];
#endif // CONFIG_NEW_QUANT
x->plane[0].quant_thred[0] = x->plane[0].zbin[0] * x->plane[0].zbin[0];
x->plane[0].quant_thred[1] = x->plane[0].zbin[1] * x->plane[0].zbin[1];
......@@ -1318,8 +1316,7 @@ void vp10_init_plane_quantizers(VP10_COMP *cpi, MACROBLOCK *x) {
xd->plane[i].dequant = cpi->uv_dequant[qindex];
#if CONFIG_NEW_QUANT
x->plane[i].cuml_bins_nuq = quants->uv_cuml_bins_nuq[qindex];
xd->plane[i].dequant_val_nuq = (const dequant_val_type_nuq*)
cpi->uv_dequant_val_nuq[qindex];
xd->plane[i].dequant_val_nuq = cpi->uv_dequant_val_nuq[qindex];
#endif // CONFIG_NEW_QUANT
x->plane[i].quant_thred[0] = x->plane[i].zbin[0] * x->plane[i].zbin[0];
......@@ -1335,7 +1332,9 @@ void vp10_init_plane_quantizers(VP10_COMP *cpi, MACROBLOCK *x) {
}
void vp10_frame_init_quantizer(VP10_COMP *cpi) {
vp10_init_plane_quantizers(cpi, &cpi->td.mb);
MACROBLOCK *const x = &cpi->td.mb;
MACROBLOCKD *const xd = &x->e_mbd;
vp10_init_plane_quantizers(cpi, x, xd->mi[0]->mbmi.segment_id);
}
void vp10_set_quantizer(VP10_COMMON *cm, int q) {
......
......@@ -66,7 +66,8 @@ struct VP10Common;
void vp10_frame_init_quantizer(struct VP10_COMP *cpi);
void vp10_init_plane_quantizers(struct VP10_COMP *cpi, MACROBLOCK *x);
void vp10_init_plane_quantizers(const struct VP10_COMP *cpi, MACROBLOCK *x,
int segment_id);
void vp10_init_quantizer(struct VP10_COMP *cpi);
......
......@@ -289,7 +289,8 @@ static int compute_rd_thresh_factor(int qindex, vpx_bit_depth_t bit_depth) {
return VPXMAX((int)(pow(q, RD_THRESH_POW) * 5.12), 8);
}
void vp10_initialize_me_consts(VP10_COMP *cpi, MACROBLOCK *x, int qindex) {
void vp10_initialize_me_consts(const VP10_COMP *cpi, MACROBLOCK *x,
int qindex) {
#if CONFIG_VP9_HIGHBITDEPTH
switch (cpi->common.bit_depth) {
case VPX_BITS_8:
......
......@@ -406,7 +406,7 @@ int vp10_compute_rd_mult(const struct VP10_COMP *cpi, int qindex);
void vp10_initialize_rd_consts(struct VP10_COMP *cpi);
void vp10_initialize_me_consts(struct VP10_COMP *cpi,
void vp10_initialize_me_consts(const struct VP10_COMP *cpi,
MACROBLOCK *x, int qindex);
void vp10_model_rd_from_var_lapndz(unsigned int var, unsigned int n,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment