Commit 88cae8b4 authored by Angie Chiang's avatar Angie Chiang
Browse files

Refactor vp10_xform_quant

1) Add facade to quantize b/fp/dc version so that their interface
   are the same.
2) Merge vp10_xform_quant b/fp/dc version to one function so that
   the code flow in encodemb.c is clear

Change-Id: Ib62d6215438fc2d07f4e7e72393f964832d6746f
parent a245d9f8
...@@ -171,7 +171,7 @@ struct buf_2d { ...@@ -171,7 +171,7 @@ struct buf_2d {
int stride; int stride;
}; };
struct macroblockd_plane { typedef struct macroblockd_plane {
tran_low_t *dqcoeff; tran_low_t *dqcoeff;
PLANE_TYPE plane_type; PLANE_TYPE plane_type;
int subsampling_x; int subsampling_x;
...@@ -190,7 +190,7 @@ struct macroblockd_plane { ...@@ -190,7 +190,7 @@ struct macroblockd_plane {
// encoder // encoder
const int16_t *dequant; const int16_t *dequant;
}; } MACROBLOCKD_PLANE;
#define BLOCK_OFFSET(x, i) ((x) + (i) * 16) #define BLOCK_OFFSET(x, i) ((x) + (i) * 16)
......
...@@ -24,7 +24,7 @@ typedef struct { ...@@ -24,7 +24,7 @@ typedef struct {
unsigned int var; unsigned int var;
} diff; } diff;
struct macroblock_plane { typedef struct macroblock_plane {
DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]); DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]);
tran_low_t *qcoeff; tran_low_t *qcoeff;
tran_low_t *coeff; tran_low_t *coeff;
...@@ -40,7 +40,7 @@ struct macroblock_plane { ...@@ -40,7 +40,7 @@ struct macroblock_plane {
int16_t *round; int16_t *round;
int64_t quant_thred[2]; int64_t quant_thred[2];
}; } MACROBLOCK_PLANE;
/* The [2] dimension is for whether we skip the EOB node (i.e. if previous /* The [2] dimension is for whether we skip the EOB node (i.e. if previous
* coefficient in this block was zero) or not. */ * coefficient in this block was zero) or not. */
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "vp10/encoder/encodemb.h" #include "vp10/encoder/encodemb.h"
#include "vp10/encoder/hybrid_fwd_txfm.h" #include "vp10/encoder/hybrid_fwd_txfm.h"
#include "vp10/encoder/quantize.h"
#include "vp10/encoder/rd.h" #include "vp10/encoder/rd.h"
#include "vp10/encoder/tokenize.h" #include "vp10/encoder/tokenize.h"
...@@ -307,185 +308,43 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block, ...@@ -307,185 +308,43 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block,
return final_eob; return final_eob;
} }
void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block,
int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &xd->plane[plane];
PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
const scan_order *const scan_order =
get_scan(tx_size, tx_type, is_inter_block(&xd->mi[0]->mbmi));
tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
uint16_t *const eob = &p->eobs[block];
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
const int16_t *src_diff;
FWD_TXFM_PARAM fwd_txfm_param;
fwd_txfm_param.tx_type = get_tx_type(plane_type, xd, block, tx_size);
fwd_txfm_param.tx_size = tx_size;
fwd_txfm_param.fwd_txfm_opt = FWD_TXFM_OPT_NORMAL;
fwd_txfm_param.rd_transform = x->use_lp32x32fdct;
fwd_txfm_param.lossless = xd->lossless[xd->mi[0]->mbmi.segment_id];
src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)];
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { typedef enum QUANT_FUNC {
highbd_fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param); QUANT_FUNC_LOWBD = 0,
switch (tx_size) { QUANT_FUNC_LOWBD_32 = 1,
case TX_32X32: QUANT_FUNC_HIGHBD = 2,
vp10_highbd_quantize_fp_32x32(coeff, 1024, x->skip_block, p->zbin, QUANT_FUNC_HIGHBD_32 = 3,
p->round_fp, p->quant_fp, p->quant_shift, QUANT_FUNC_LAST = 4
qcoeff, dqcoeff, pd->dequant, } QUANT_FUNC;
eob, scan_order->scan,
scan_order->iscan); static VP10_QUANT_FACADE quant_func_ls[VP10_XFORM_QUANT_LAST][QUANT_FUNC_LAST] =
break; {{vp10_quantize_fp_facade, vp10_quantize_fp_32x32_facade,
case TX_16X16: vp10_highbd_quantize_fp_facade, vp10_highbd_quantize_fp_32x32_facade},
vp10_highbd_quantize_fp(coeff, 256, x->skip_block, p->zbin, p->round_fp, {vp10_quantize_b_facade, vp10_quantize_b_32x32_facade,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff, vp10_highbd_quantize_b_facade, vp10_highbd_quantize_b_32x32_facade},
pd->dequant, eob, {vp10_quantize_dc_facade, vp10_quantize_dc_32x32_facade,
scan_order->scan, scan_order->iscan); vp10_highbd_quantize_dc_facade, vp10_highbd_quantize_dc_32x32_facade}};
break;
case TX_8X8:
vp10_highbd_quantize_fp(coeff, 64, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
case TX_4X4:
vp10_highbd_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
default:
assert(0);
}
return;
}
#endif // CONFIG_VP9_HIGHBITDEPTH
fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param);
switch (tx_size) {
case TX_32X32:
vp10_quantize_fp_32x32(coeff, 1024, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
scan_order->iscan);
break;
case TX_16X16:
vp10_quantize_fp(coeff, 256, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
case TX_8X8:
vp10_quantize_fp(coeff, 64, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
case TX_4X4:
vp10_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
default:
assert(0);
break;
}
}
void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,
int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &xd->plane[plane];
PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
uint16_t *const eob = &p->eobs[block];
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
const int16_t *src_diff;
FWD_TXFM_PARAM fwd_txfm_param; #else
fwd_txfm_param.tx_type = get_tx_type(plane_type, xd, block, tx_size); typedef enum QUANT_FUNC {
fwd_txfm_param.tx_size = tx_size; QUANT_FUNC_LOWBD = 0,
fwd_txfm_param.fwd_txfm_opt = FWD_TXFM_OPT_DC; QUANT_FUNC_LOWBD_32 = 1,
fwd_txfm_param.rd_transform = 0; QUANT_FUNC_LAST = 2
fwd_txfm_param.lossless = xd->lossless[xd->mi[0]->mbmi.segment_id]; } QUANT_FUNC;
src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)]; static VP10_QUANT_FACADE quant_func_ls[VP10_XFORM_QUANT_LAST][QUANT_FUNC_LAST] =
{{vp10_quantize_fp_facade, vp10_quantize_fp_32x32_facade},
{vp10_quantize_b_facade, vp10_quantize_b_32x32_facade},
{vp10_quantize_dc_facade, vp10_quantize_dc_32x32_facade}};
#if CONFIG_VP9_HIGHBITDEPTH #endif
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
highbd_fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param);
switch (tx_size) {
case TX_32X32:
vpx_highbd_quantize_dc_32x32(coeff, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
break;
case TX_16X16:
vpx_highbd_quantize_dc(coeff, 256, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
break;
case TX_8X8:
vpx_highbd_quantize_dc(coeff, 64, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
break;
case TX_4X4:
vpx_highbd_quantize_dc(coeff, 16, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
break;
default:
assert(0);
}
return;
}
#endif // CONFIG_VP9_HIGHBITDEPTH
fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param); static FWD_TXFM_OPT fwd_txfm_opt_ls[VP10_XFORM_QUANT_LAST] = {
switch (tx_size) { FWD_TXFM_OPT_NORMAL, FWD_TXFM_OPT_NORMAL, FWD_TXFM_OPT_DC};
case TX_32X32:
vpx_quantize_dc_32x32(coeff, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
break;
case TX_16X16:
vpx_quantize_dc(coeff, 256, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
break;
case TX_8X8:
vpx_quantize_dc(coeff, 64, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
break;
case TX_4X4:
vpx_quantize_dc(coeff, 16, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
break;
default:
assert(0);
break;
}
}
void vp10_xform_quant(MACROBLOCK *x, int plane, int block, void vp10_xform_quant(MACROBLOCK *x, int plane, int block, int blk_row,
int blk_row, int blk_col, int blk_col, BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) { VP10_XFORM_QUANT xform_quant_idx) {
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblock_plane *const p = &x->plane[plane]; const struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
...@@ -499,11 +358,13 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block, ...@@ -499,11 +358,13 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
uint16_t *const eob = &p->eobs[block]; uint16_t *const eob = &p->eobs[block];
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize]; const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
const int16_t *src_diff; const int16_t *src_diff;
const int tx1d_size = get_tx1d_size(tx_size);
const int tx2d_size = tx1d_size * tx1d_size;
FWD_TXFM_PARAM fwd_txfm_param; FWD_TXFM_PARAM fwd_txfm_param;
fwd_txfm_param.tx_type = get_tx_type(plane_type, xd, block, tx_size); fwd_txfm_param.tx_type = get_tx_type(plane_type, xd, block, tx_size);
fwd_txfm_param.tx_size = tx_size; fwd_txfm_param.tx_size = tx_size;
fwd_txfm_param.fwd_txfm_opt = FWD_TXFM_OPT_NORMAL; fwd_txfm_param.fwd_txfm_opt = fwd_txfm_opt_ls[xform_quant_idx];
fwd_txfm_param.rd_transform = x->use_lp32x32fdct; fwd_txfm_param.rd_transform = x->use_lp32x32fdct;
fwd_txfm_param.lossless = xd->lossless[xd->mi[0]->mbmi.segment_id]; fwd_txfm_param.lossless = xd->lossless[xd->mi[0]->mbmi.segment_id];
...@@ -512,67 +373,30 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block, ...@@ -512,67 +373,30 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
highbd_fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param); highbd_fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param);
switch (tx_size) { if (x->skip_block) {
case TX_32X32: vp10_quantize_skip(tx2d_size, qcoeff, dqcoeff, eob);
vpx_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, } else {
p->round, p->quant, p->quant_shift, qcoeff, if (tx_size == TX_32X32)
dqcoeff, pd->dequant, eob, quant_func_ls[xform_quant_idx][QUANT_FUNC_HIGHBD_32](
scan_order->scan, scan_order->iscan); coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob, scan_order);
break; else
case TX_16X16: quant_func_ls[xform_quant_idx][QUANT_FUNC_HIGHBD](
vpx_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob, scan_order);
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
case TX_8X8:
vpx_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
case TX_4X4:
vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
default:
assert(0);
} }
return; return;
} }
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param); fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param);
switch (tx_size) { if (x->skip_block) {
case TX_32X32: vp10_quantize_skip(tx2d_size, qcoeff, dqcoeff, eob);
vpx_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round, } else {
p->quant, p->quant_shift, qcoeff, dqcoeff, if (tx_size == TX_32X32)
pd->dequant, eob, scan_order->scan, quant_func_ls[xform_quant_idx][QUANT_FUNC_LOWBD_32](
scan_order->iscan); coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob, scan_order);
break; else
case TX_16X16: quant_func_ls[xform_quant_idx][QUANT_FUNC_LOWBD](
vpx_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob, scan_order);
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
case TX_8X8:
vpx_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
case TX_4X4:
vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
scan_order->scan, scan_order->iscan);
break;
default:
assert(0);
break;
} }
} }
...@@ -621,20 +445,20 @@ static void encode_block(int plane, int block, int blk_row, int blk_col, ...@@ -621,20 +445,20 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
*a = *l = 0; *a = *l = 0;
return; return;
} else { } else {
vp10_xform_quant_fp(x, plane, block, blk_row, blk_col, vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
plane_bsize, tx_size); tx_size, VP10_XFORM_QUANT_FP);
} }
} else { } else {
if (max_txsize_lookup[plane_bsize] == tx_size) { if (max_txsize_lookup[plane_bsize] == tx_size) {
int txfm_blk_index = (plane << 2) + (block >> (tx_size << 1)); int txfm_blk_index = (plane << 2) + (block >> (tx_size << 1));
if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_NONE) { if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_NONE) {
// full forward transform and quantization // full forward transform and quantization
vp10_xform_quant(x, plane, block, blk_row, blk_col, vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
plane_bsize, tx_size); tx_size, VP10_XFORM_QUANT_B);
} else if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_AC_ONLY) { } else if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_AC_ONLY) {
// fast path forward transform and quantization // fast path forward transform and quantization
vp10_xform_quant_dc(x, plane, block, blk_row, blk_col, vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
plane_bsize, tx_size); tx_size, VP10_XFORM_QUANT_DC);
} else { } else {
// skip forward transform // skip forward transform
p->eobs[block] = 0; p->eobs[block] = 0;
...@@ -644,8 +468,8 @@ static void encode_block(int plane, int block, int blk_row, int blk_col, ...@@ -644,8 +468,8 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
#endif #endif
} }
} else { } else {
vp10_xform_quant(x, plane, block, blk_row, blk_col, vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
plane_bsize, tx_size); tx_size, VP10_XFORM_QUANT_B);
} }
} }
} }
...@@ -778,7 +602,8 @@ static void encode_block_pass1(int plane, int block, int blk_row, int blk_col, ...@@ -778,7 +602,8 @@ static void encode_block_pass1(int plane, int block, int blk_row, int blk_col,
uint8_t *dst; uint8_t *dst;
dst = &pd->dst.buf[4 * blk_row * pd->dst.stride + 4 * blk_col]; dst = &pd->dst.buf[4 * blk_row * pd->dst.stride + 4 * blk_col];
vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize, tx_size); vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, VP10_XFORM_QUANT_B);
if (p->eobs[block] > 0) { if (p->eobs[block] > 0) {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
......
...@@ -23,17 +23,20 @@ struct encode_b_args { ...@@ -23,17 +23,20 @@ struct encode_b_args {
struct optimize_ctx *ctx; struct optimize_ctx *ctx;
int8_t *skip; int8_t *skip;
}; };
typedef enum VP10_XFORM_QUANT {
VP10_XFORM_QUANT_FP = 0,
VP10_XFORM_QUANT_B = 1,
VP10_XFORM_QUANT_DC = 2,
VP10_XFORM_QUANT_LAST = 3
} VP10_XFORM_QUANT;
void vp10_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize); void vp10_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize);
void vp10_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize); void vp10_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize);
void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block,
int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,
int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
void vp10_xform_quant(MACROBLOCK *x, int plane, int block, void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
int blk_row, int blk_col, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size); BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
VP10_XFORM_QUANT xform_quant_idx);
void vp10_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane); void vp10_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
......
...@@ -10,16 +10,194 @@ ...@@ -10,16 +10,194 @@
#include <math.h> #include <math.h>
#include "./vpx_dsp_rtcd.h" #include "./vpx_dsp_rtcd.h"
#include "vpx_dsp/quantize.h"
#include "vpx_mem/vpx_mem.h" #include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem.h" #include "vpx_ports/mem.h"
#include "vp10/common/quant_common.h" #include "vp10/common/quant_common.h"
#include "vp10/common/scan.h"
#include "vp10/common/seg_common.h" #include "vp10/common/seg_common.h"
#include "vp10/encoder/encoder.h" #include "vp10/encoder/encoder.h"
#include "vp10/encoder/quantize.h" #include "vp10/encoder/quantize.h"
#include "vp10/encoder/rd.h" #include "vp10/encoder/rd.h"
void vp10_quantize_skip(intptr_t n_coeffs, tran_low_t *qcoeff_ptr,
tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr) {
memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
*eob_ptr = 0;
}
void vp10_quantize_fp_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr,
const MACROBLOCKD_PLANE *pd,
tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
const scan_order *sc) {
// obsolete skip_block
const int skip_block = 0;
vp10_quantize_fp(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff_ptr, dqcoeff_ptr,
pd->dequant, eob_ptr, sc->scan, sc->iscan);
}
void vp10_quantize_b_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr,
const MACROBLOCKD_PLANE *pd,
tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
const scan_order *sc) {
// obsolete skip_block
const int skip_block = 0;
vpx_quantize_b(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff_ptr, dqcoeff_ptr, pd->dequant, eob_ptr,
sc->scan, sc->iscan);
}
void vp10_quantize_dc_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
const MACROBLOCK_PLANE *p, tran_low_t *qcoeff_ptr,
const MACROBLOCKD_PLANE *pd,
tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
const scan_order *sc) {
// obsolete skip_block
const int skip_block = 0;
(void)sc;
vpx_quantize_dc(coeff_ptr, n_coeffs, skip_block, p->round, p->quant_fp[0],
qcoeff_ptr, dqcoeff_ptr, pd->dequant[0], eob_ptr);
}
#if CONFIG_VP9_HIGHBITDEPTH
void vp10_highbd_quantize_fp_facade(
const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p,
tran_low_t *qcoeff_ptr, const MACROBLOCKD_PLANE *pd,
tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const scan_order *sc) {
// obsolete skip_block
const int skip_block = 0;
vp10_highbd_quantize_fp(coeff_ptr, n_coeffs, skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff_ptr, dqcoeff_ptr,
pd->dequant, eob_ptr, sc->scan, sc->iscan);
}
void vp10_highbd_quantize_b_facade(const tran_low_t *coeff_ptr,
intptr_t n_coeffs, const MACROBLOCK_PLANE *p,
tran_low_t *qcoeff_ptr,
const MACROBLOCKD_PLANE *pd,
tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,