From 5359ae810cdbb974060297ecf935183baf7b009b Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Mon, 25 Mar 2019 15:35:35 -0700 Subject: [PATCH] Allow macroblock_plane to have its own rounding buffer Add 8 bytes buffer to macroblock_plane to support rounding factor. Change-Id: I3751689e4449c0caea28d3acf6cd17d7f39508ed --- vp9/encoder/vp9_block.h | 2 +- vp9/encoder/vp9_quantize.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vp9/encoder/vp9_block.h b/vp9/encoder/vp9_block.h index c879a19..37a4605 100644 --- a/vp9/encoder/vp9_block.h +++ b/vp9/encoder/vp9_block.h @@ -34,8 +34,8 @@ struct macroblock_plane { struct buf_2d src; // Quantizer setings + DECLARE_ALIGNED(16, int16_t, round_fp[8]); int16_t *quant_fp; - int16_t *round_fp; int16_t *quant; int16_t *quant_shift; int16_t *zbin; diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c index 75f3a8b..26d1434 100644 --- a/vp9/encoder/vp9_quantize.c +++ b/vp9/encoder/vp9_quantize.c @@ -288,12 +288,12 @@ void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) { // Y x->plane[0].quant = quants->y_quant[qindex]; x->plane[0].quant_fp = quants->y_quant_fp[qindex]; - x->plane[0].round_fp = quants->y_round_fp[qindex]; + memcpy(x->plane[0].round_fp, quants->y_round_fp[qindex], + 8 * sizeof(*(x->plane[0].round_fp))); x->plane[0].quant_shift = quants->y_quant_shift[qindex]; x->plane[0].zbin = quants->y_zbin[qindex]; x->plane[0].round = quants->y_round[qindex]; xd->plane[0].dequant = cpi->y_dequant[qindex]; - 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]; @@ -301,12 +301,12 @@ void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) { for (i = 1; i < 3; i++) { x->plane[i].quant = quants->uv_quant[qindex]; x->plane[i].quant_fp = quants->uv_quant_fp[qindex]; - x->plane[i].round_fp = quants->uv_round_fp[qindex]; + memcpy(x->plane[i].round_fp, quants->uv_round_fp[qindex], + 8 * sizeof(*(x->plane[i].round_fp))); x->plane[i].quant_shift = quants->uv_quant_shift[qindex]; x->plane[i].zbin = quants->uv_zbin[qindex]; x->plane[i].round = quants->uv_round[qindex]; xd->plane[i].dequant = cpi->uv_dequant[qindex]; - x->plane[i].quant_thred[0] = x->plane[i].zbin[0] * x->plane[i].zbin[0]; x->plane[i].quant_thred[1] = x->plane[i].zbin[1] * x->plane[i].zbin[1]; } -- 2.7.4