Merge "vp10: remove MACROBLOCK.fwd_txm4x4 function pointer."

This commit is contained in:
Ronald S. Bultje 2015-09-26 01:19:49 +00:00 коммит произвёл Gerrit Code Review
Родитель b945a532e5 c74b33a413
Коммит 690f662e26
6 изменённых файлов: 87 добавлений и 72 удалений

Просмотреть файл

@ -133,7 +133,6 @@ struct macroblock {
// the visual quality at the boundary of moving color objects. // the visual quality at the boundary of moving color objects.
uint8_t color_sensitivity[2]; uint8_t color_sensitivity[2];
void (*fwd_txm4x4)(const int16_t *input, tran_low_t *output, int stride);
void (*itxm_add)(const tran_low_t *input, uint8_t *dest, int stride, int eob); void (*itxm_add)(const tran_low_t *input, uint8_t *dest, int stride, int eob);
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
void (*highbd_itxm_add)(const tran_low_t *input, uint8_t *dest, int stride, void (*highbd_itxm_add)(const tran_low_t *input, uint8_t *dest, int stride,

Просмотреть файл

@ -2697,14 +2697,8 @@ static void encode_frame_internal(VP10_COMP *cpi) {
cm->uv_ac_delta_q == 0; cm->uv_ac_delta_q == 0;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (cm->use_highbitdepth)
x->fwd_txm4x4 = xd->lossless ? vp10_highbd_fwht4x4 : vpx_highbd_fdct4x4;
else
x->fwd_txm4x4 = xd->lossless ? vp10_fwht4x4 : vpx_fdct4x4;
x->highbd_itxm_add = xd->lossless ? vp10_highbd_iwht4x4_add : x->highbd_itxm_add = xd->lossless ? vp10_highbd_iwht4x4_add :
vp10_highbd_idct4x4_add; vp10_highbd_idct4x4_add;
#else
x->fwd_txm4x4 = xd->lossless ? vp10_fwht4x4 : vpx_fdct4x4;
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
x->itxm_add = xd->lossless ? vp10_iwht4x4_add : vp10_idct4x4_add; x->itxm_add = xd->lossless ? vp10_iwht4x4_add : vp10_idct4x4_add;

Просмотреть файл

@ -367,7 +367,11 @@ void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block,
scan_order->scan, scan_order->iscan); scan_order->scan, scan_order->iscan);
break; break;
case TX_4X4: case TX_4X4:
x->fwd_txm4x4(src_diff, coeff, diff_stride); if (xd->lossless) {
vp10_highbd_fwht4x4(src_diff, coeff, diff_stride);
} else {
vpx_highbd_fdct4x4(src_diff, coeff, diff_stride);
}
vp10_highbd_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp, vp10_highbd_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff, p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, pd->dequant, eob,
@ -403,7 +407,11 @@ void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block,
scan_order->scan, scan_order->iscan); scan_order->scan, scan_order->iscan);
break; break;
case TX_4X4: case TX_4X4:
x->fwd_txm4x4(src_diff, coeff, diff_stride); if (xd->lossless) {
vp10_fwht4x4(src_diff, coeff, diff_stride);
} else {
vpx_fdct4x4(src_diff, coeff, diff_stride);
}
vp10_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp, vp10_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff, p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, pd->dequant, eob,
@ -453,7 +461,11 @@ void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,
pd->dequant[0], eob); pd->dequant[0], eob);
break; break;
case TX_4X4: case TX_4X4:
x->fwd_txm4x4(src_diff, coeff, diff_stride); if (xd->lossless) {
vp10_highbd_fwht4x4(src_diff, coeff, diff_stride);
} else {
vpx_highbd_fdct4x4(src_diff, coeff, diff_stride);
}
vpx_highbd_quantize_dc(coeff, 16, x->skip_block, p->round, vpx_highbd_quantize_dc(coeff, 16, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff, p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob); pd->dequant[0], eob);
@ -485,7 +497,11 @@ void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,
pd->dequant[0], eob); pd->dequant[0], eob);
break; break;
case TX_4X4: case TX_4X4:
x->fwd_txm4x4(src_diff, coeff, diff_stride); if (xd->lossless) {
vp10_fwht4x4(src_diff, coeff, diff_stride);
} else {
vpx_fdct4x4(src_diff, coeff, diff_stride);
}
vpx_quantize_dc(coeff, 16, x->skip_block, p->round, vpx_quantize_dc(coeff, 16, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff, p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob); pd->dequant[0], eob);
@ -496,22 +512,24 @@ void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,
} }
} }
void vp10_fwd_txfm_4x4(const int16_t *src_diff, void vp10_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
tran_low_t *coeff, int diff_stride, TX_TYPE tx_type, int diff_stride, TX_TYPE tx_type, int lossless) {
void (*fwd_txm4x4)(const int16_t *input, if (lossless) {
tran_low_t *output, int stride)) { vp10_fwht4x4(src_diff, coeff, diff_stride);
switch (tx_type) { } else {
case DCT_DCT: switch (tx_type) {
fwd_txm4x4(src_diff, coeff, diff_stride); case DCT_DCT:
break; vpx_fdct4x4(src_diff, coeff, diff_stride);
case ADST_DCT: break;
case DCT_ADST: case ADST_DCT:
case ADST_ADST: case DCT_ADST:
vp10_fht4x4(src_diff, coeff, diff_stride, tx_type); case ADST_ADST:
break; vp10_fht4x4(src_diff, coeff, diff_stride, tx_type);
default: break;
assert(0); default:
break; assert(0);
break;
}
} }
} }
@ -565,21 +583,24 @@ static void fwd_txfm_32x32(int rd_transform, const int16_t *src_diff,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff, void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, TX_TYPE tx_type, int diff_stride, TX_TYPE tx_type, int lossless) {
void (*highbd_fwd_txm4x4)(const int16_t *input, if (lossless) {
tran_low_t *output, int stride)) { assert(tx_type == DCT_DCT);
switch (tx_type) { vp10_highbd_fwht4x4(src_diff, coeff, diff_stride);
case DCT_DCT: } else {
highbd_fwd_txm4x4(src_diff, coeff, diff_stride); switch (tx_type) {
break; case DCT_DCT:
case ADST_DCT: vpx_highbd_fdct4x4(src_diff, coeff, diff_stride);
case DCT_ADST: break;
case ADST_ADST: case ADST_DCT:
vp10_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type); case DCT_ADST:
break; case ADST_ADST:
default: vp10_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
assert(0); break;
break; default:
assert(0);
break;
}
} }
} }
@ -681,7 +702,7 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
break; break;
case TX_4X4: case TX_4X4:
vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
x->fwd_txm4x4); xd->lossless);
vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff, p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, pd->dequant, eob,
@ -717,7 +738,7 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
scan_order->scan, scan_order->iscan); scan_order->scan, scan_order->iscan);
break; break;
case TX_4X4: case TX_4X4:
vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, x->fwd_txm4x4); vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, xd->lossless);
vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff, p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, pd->dequant, eob,
@ -999,7 +1020,7 @@ void vp10_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
vpx_highbd_subtract_block(4, 4, src_diff, diff_stride, vpx_highbd_subtract_block(4, 4, src_diff, diff_stride,
src, src_stride, dst, dst_stride, xd->bd); src, src_stride, dst, dst_stride, xd->bd);
vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
x->fwd_txm4x4); xd->lossless);
vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff, p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, pd->dequant, eob,
@ -1068,7 +1089,7 @@ void vp10_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
if (!x->skip_recode) { if (!x->skip_recode) {
vpx_subtract_block(4, 4, src_diff, diff_stride, vpx_subtract_block(4, 4, src_diff, diff_stride,
src, src_stride, dst, dst_stride); src, src_stride, dst, dst_stride);
vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, x->fwd_txm4x4); vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, xd->lossless);
vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant, vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan, pd->dequant, eob, scan_order->scan,

Просмотреть файл

@ -39,16 +39,12 @@ void vp10_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane); void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
void vp10_fwd_txfm_4x4(const int16_t *src_diff, void vp10_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
tran_low_t *coeff, int diff_stride, TX_TYPE tx_type, int diff_stride, TX_TYPE tx_type, int lossless);
void (*fwd_txm4x4)(const int16_t *input,
tran_low_t *output, int stride));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff, void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, TX_TYPE tx_type, int diff_stride, TX_TYPE tx_type, int lossless);
void (*highbd_fwd_txm4x4)(const int16_t *input,
tran_low_t *output, int stride));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#ifdef __cplusplus #ifdef __cplusplus

Просмотреть файл

@ -4086,19 +4086,14 @@ int vp10_get_compressed_data(VP10_COMP *cpi, unsigned int *frame_flags,
} }
if (oxcf->pass == 1) { if (oxcf->pass == 1) {
const int lossless = is_lossless_requested(oxcf); cpi->td.mb.e_mbd.lossless = is_lossless_requested(oxcf);
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (cpi->oxcf.use_highbitdepth) cpi->td.mb.highbd_itxm_add =
cpi->td.mb.fwd_txm4x4 = lossless ? cpi->td.mb.e_mbd.lossless ? vp10_highbd_iwht4x4_add
vp10_highbd_fwht4x4 : vpx_highbd_fdct4x4; : vp10_highbd_idct4x4_add;
else
cpi->td.mb.fwd_txm4x4 = lossless ? vp10_fwht4x4 : vpx_fdct4x4;
cpi->td.mb.highbd_itxm_add = lossless ? vp10_highbd_iwht4x4_add :
vp10_highbd_idct4x4_add;
#else
cpi->td.mb.fwd_txm4x4 = lossless ? vp10_fwht4x4 : vpx_fdct4x4;
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
cpi->td.mb.itxm_add = lossless ? vp10_iwht4x4_add : vp10_idct4x4_add; cpi->td.mb.itxm_add = cpi->td.mb.e_mbd.lossless ? vp10_iwht4x4_add
: vp10_idct4x4_add;
vp10_first_pass(cpi, source); vp10_first_pass(cpi, source);
} else if (oxcf->pass == 2) { } else if (oxcf->pass == 2) {
Pass2Encode(cpi, size, dest, frame_flags); Pass2Encode(cpi, size, dest, frame_flags);

Просмотреть файл

@ -798,8 +798,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
if (xd->lossless) { if (xd->lossless) {
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const scan_order *so = get_scan(TX_4X4, tx_type); const scan_order *so = get_scan(TX_4X4, tx_type);
vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1);
vp10_highbd_fwht4x4);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
so->scan, so->neighbors, so->scan, so->neighbors,
@ -814,8 +813,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
int64_t unused; int64_t unused;
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const scan_order *so = get_scan(TX_4X4, tx_type); const scan_order *so = get_scan(TX_4X4, tx_type);
vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0);
vpx_highbd_fdct4x4);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
so->scan, so->neighbors, so->scan, so->neighbors,
@ -901,7 +899,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
if (xd->lossless) { if (xd->lossless) {
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const scan_order *so = get_scan(TX_4X4, tx_type); const scan_order *so = get_scan(TX_4X4, tx_type);
vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, vp10_fwht4x4); vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
so->scan, so->neighbors, so->scan, so->neighbors,
@ -915,7 +913,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
int64_t unused; int64_t unused;
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const scan_order *so = get_scan(TX_4X4, tx_type); const scan_order *so = get_scan(TX_4X4, tx_type);
vp10_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, vpx_fdct4x4); vp10_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
so->scan, so->neighbors, so->scan, so->neighbors,
@ -1290,6 +1288,8 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi,
const int width = 4 * num_4x4_blocks_wide_lookup[plane_bsize]; const int width = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
const int height = 4 * num_4x4_blocks_high_lookup[plane_bsize]; const int height = 4 * num_4x4_blocks_high_lookup[plane_bsize];
int idx, idy; int idx, idy;
void (*fwd_txm4x4)(const int16_t *input, tran_low_t *output, int stride);
const uint8_t *const src = const uint8_t *const src =
&p->src.buf[vp10_raster_block_offset(BLOCK_8X8, i, p->src.stride)]; &p->src.buf[vp10_raster_block_offset(BLOCK_8X8, i, p->src.stride)];
uint8_t *const dst = &pd->dst.buf[vp10_raster_block_offset(BLOCK_8X8, i, uint8_t *const dst = &pd->dst.buf[vp10_raster_block_offset(BLOCK_8X8, i,
@ -1301,6 +1301,16 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi,
vp10_build_inter_predictor_sub8x8(xd, 0, i, ir, ic, mi_row, mi_col); vp10_build_inter_predictor_sub8x8(xd, 0, i, ir, ic, mi_row, mi_col);
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
fwd_txm4x4 = xd->lossless ? vp10_highbd_fwht4x4 : vpx_highbd_fdct4x4;
} else {
fwd_txm4x4 = xd->lossless ? vp10_fwht4x4 : vpx_fdct4x4;
}
#else
fwd_txm4x4 = xd->lossless ? vp10_fwht4x4 : vpx_fdct4x4;
#endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
vpx_highbd_subtract_block( vpx_highbd_subtract_block(
@ -1325,8 +1335,8 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi,
k += (idy * 2 + idx); k += (idy * 2 + idx);
coeff = BLOCK_OFFSET(p->coeff, k); coeff = BLOCK_OFFSET(p->coeff, k);
x->fwd_txm4x4(vp10_raster_block_offset_int16(BLOCK_8X8, k, p->src_diff), fwd_txm4x4(vp10_raster_block_offset_int16(BLOCK_8X8, k, p->src_diff),
coeff, 8); coeff, 8);
vp10_regular_quantize_b_4x4(x, 0, k, so->scan, so->iscan); vp10_regular_quantize_b_4x4(x, 0, k, so->scan, so->iscan);
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {