diff options
author | hui su <huisu@google.com> | 2015-08-18 16:57:07 -0700 |
---|---|---|
committer | hui su <huisu@google.com> | 2015-08-21 09:53:37 -0700 |
commit | 5eed74e1d3179b7a6391d22edcab11def38aa2e6 (patch) | |
tree | cb87d124b4b38aebbdaf0bc1109db50dba301905 /vp10/encoder/rdopt.c | |
parent | b1339751b970b286f4019e62ea3eb583b8807326 (diff) | |
download | libvpx-5eed74e1d3179b7a6391d22edcab11def38aa2e6.tar libvpx-5eed74e1d3179b7a6391d22edcab11def38aa2e6.tar.gz libvpx-5eed74e1d3179b7a6391d22edcab11def38aa2e6.tar.bz2 libvpx-5eed74e1d3179b7a6391d22edcab11def38aa2e6.zip |
Refactor get_tx_type and get_scan
This makes it easier to add new transform types and scan orders
to VP10 in the future.
Change-Id: I94874ddc9b19928d7820d57e94e2af04adf51efe
Diffstat (limited to 'vp10/encoder/rdopt.c')
-rw-r--r-- | vp10/encoder/rdopt.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index 5f1ed365d..0272afc65 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c @@ -557,6 +557,7 @@ static void txfm_rd_in_plane(MACROBLOCK *x, int use_fast_coef_casting) { MACROBLOCKD *const xd = &x->e_mbd; const struct macroblockd_plane *const pd = &xd->plane[plane]; + TX_TYPE tx_type; struct rdcost_block_args args; vp10_zero(args); args.x = x; @@ -569,7 +570,8 @@ static void txfm_rd_in_plane(MACROBLOCK *x, vp10_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left); - args.so = get_scan(xd, tx_size, pd->plane_type, 0); + tx_type = get_tx_type(pd->plane_type, xd, 0); + args.so = get_scan(tx_size, tx_type); vp10_foreach_transformed_block_in_plane(xd, bsize, plane, block_rd_txfm, &args); @@ -795,7 +797,8 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, vpx_highbd_subtract_block(4, 4, src_diff, 8, src, src_stride, dst, dst_stride, xd->bd); if (xd->lossless) { - const scan_order *so = &vp10_default_scan_orders[TX_4X4]; + TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); + const scan_order *so = get_scan(TX_4X4, tx_type); vp10_highbd_fwht4x4(src_diff, coeff, 8); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, @@ -808,8 +811,8 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, p->eobs[block], xd->bd); } else { int64_t unused; - const TX_TYPE tx_type = get_tx_type_4x4(PLANE_TYPE_Y, xd, block); - const scan_order *so = &vp10_scan_orders[TX_4X4][tx_type]; + TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); + const scan_order *so = get_scan(TX_4X4, tx_type); if (tx_type == DCT_DCT) vpx_highbd_fdct4x4(src_diff, coeff, 8); else @@ -897,7 +900,8 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, vpx_subtract_block(4, 4, src_diff, 8, src, src_stride, dst, dst_stride); if (xd->lossless) { - const scan_order *so = &vp10_default_scan_orders[TX_4X4]; + TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); + const scan_order *so = get_scan(TX_4X4, tx_type); vp10_fwht4x4(src_diff, coeff, 8); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, @@ -909,8 +913,8 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, p->eobs[block]); } else { int64_t unused; - const TX_TYPE tx_type = get_tx_type_4x4(PLANE_TYPE_Y, xd, block); - const scan_order *so = &vp10_scan_orders[TX_4X4][tx_type]; + TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); + const scan_order *so = get_scan(TX_4X4, tx_type); vp10_fht4x4(src_diff, coeff, 8, tx_type); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4, @@ -1301,7 +1305,8 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi, pd->dst.stride)]; int64_t thisdistortion = 0, thissse = 0; int thisrate = 0, ref; - const scan_order *so = &vp10_default_scan_orders[TX_4X4]; + TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, i); + const scan_order *so = get_scan(TX_4X4, tx_type); const int is_compound = has_second_ref(&mi->mbmi); const InterpKernel *kernel = vp10_filter_kernels[mi->mbmi.interp_filter]; |