Commit bab8d38f authored by Ronald S. Bultje's avatar Ronald S. Bultje

vp10: remove MACROBLOCK.{highbd_,}itxfm_add function pointer.

This is preparatory work for allowing per-segment lossless coding.

See issue 1035.

Change-Id: I9487d02717ee3e766aee61a487780056bb35d2d3
parent c74b33a4
......@@ -179,21 +179,24 @@ void vp10_idct32x32_add(const tran_low_t *input, uint8_t *dest, int stride,
}
void vp10_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type,
void (*itxm_add_4x4)(const tran_low_t *input,
uint8_t *dest, int stride, int eob)) {
switch (tx_type) {
case DCT_DCT:
itxm_add_4x4(input, dest, stride, eob);
break;
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
vp10_iht4x4_16_add(input, dest, stride, tx_type);
break;
default:
assert(0);
break;
int stride, int eob, TX_TYPE tx_type, int lossless) {
if (lossless) {
assert(tx_type == DCT_DCT);
vp10_iwht4x4_add(input, dest, stride, eob);
} else {
switch (tx_type) {
case DCT_DCT:
vp10_idct4x4_add(input, dest, stride, eob);
break;
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
vp10_iht4x4_16_add(input, dest, stride, tx_type);
break;
default:
assert(0);
break;
}
}
}
......@@ -418,21 +421,24 @@ void vp10_highbd_idct32x32_add(const tran_low_t *input, uint8_t *dest,
void vp10_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, TX_TYPE tx_type,
void (*highbd_itxm_add_4x4)
(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd)) {
switch (tx_type) {
case DCT_DCT:
highbd_itxm_add_4x4(input, dest, stride, eob, bd);
break;
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
vp10_highbd_iht4x4_16_add(input, dest, stride, tx_type, bd);
break;
default:
assert(0);
break;
int lossless) {
if (lossless) {
assert(tx_type == DCT_DCT);
vp10_highbd_iwht4x4_add(input, dest, stride, eob, bd);
} else {
switch (tx_type) {
case DCT_DCT:
vp10_highbd_idct4x4_add(input, dest, stride, eob, bd);
break;
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
vp10_highbd_iht4x4_16_add(input, dest, stride, tx_type, bd);
break;
default:
assert(0);
break;
}
}
}
......
......@@ -44,9 +44,7 @@ void vp10_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
int eob);
void vp10_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type,
void (*itxm_add_4x4)(const tran_low_t *input,
uint8_t *dest, int stride, int eob));
int stride, int eob, TX_TYPE tx_type, int lossless);
void vp10_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type);
void vp10_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
......@@ -67,9 +65,7 @@ void vp10_highbd_idct32x32_add(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd);
void vp10_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, TX_TYPE tx_type,
void (*highbd_itxm_add_4x4)
(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd));
int lossless);
void vp10_highbd_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, TX_TYPE tx_type);
void vp10_highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
......
......@@ -203,9 +203,7 @@ static void inverse_transform_block_inter(MACROBLOCKD* xd, int plane,
switch (tx_size) {
case TX_4X4:
vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, xd->bd,
tx_type, xd->lossless ?
vp10_highbd_iwht4x4_add :
vp10_highbd_idct4x4_add);
tx_type, xd->lossless);
break;
case TX_8X8:
vp10_highbd_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, xd->bd,
......@@ -228,8 +226,7 @@ static void inverse_transform_block_inter(MACROBLOCKD* xd, int plane,
switch (tx_size) {
case TX_4X4:
vp10_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, tx_type,
xd->lossless ? vp10_iwht4x4_add :
vp10_idct4x4_add);
xd->lossless);
break;
case TX_8X8:
vp10_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, tx_type);
......@@ -274,9 +271,7 @@ static void inverse_transform_block_intra(MACROBLOCKD* xd, int plane,
switch (tx_size) {
case TX_4X4:
vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, xd->bd,
tx_type, xd->lossless ?
vp10_highbd_iwht4x4_add :
vp10_highbd_idct4x4_add);
tx_type, xd->lossless);
break;
case TX_8X8:
vp10_highbd_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, xd->bd,
......@@ -299,8 +294,7 @@ static void inverse_transform_block_intra(MACROBLOCKD* xd, int plane,
switch (tx_size) {
case TX_4X4:
vp10_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, tx_type,
xd->lossless ? vp10_iwht4x4_add :
vp10_idct4x4_add);
xd->lossless);
break;
case TX_8X8:
vp10_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, tx_type);
......
......@@ -132,12 +132,6 @@ struct macroblock {
// Strong color activity detection. Used in RTC coding mode to enhance
// the visual quality at the boundary of moving color objects.
uint8_t color_sensitivity[2];
void (*itxm_add)(const tran_low_t *input, uint8_t *dest, int stride, int eob);
#if CONFIG_VP9_HIGHBITDEPTH
void (*highbd_itxm_add)(const tran_low_t *input, uint8_t *dest, int stride,
int eob, int bd);
#endif
};
#ifdef __cplusplus
......
......@@ -2696,12 +2696,6 @@ static void encode_frame_internal(VP10_COMP *cpi) {
cm->uv_dc_delta_q == 0 &&
cm->uv_ac_delta_q == 0;
#if CONFIG_VP9_HIGHBITDEPTH
x->highbd_itxm_add = xd->lossless ? vp10_highbd_iwht4x4_add :
vp10_highbd_idct4x4_add;
#endif // CONFIG_VP9_HIGHBITDEPTH
x->itxm_add = xd->lossless ? vp10_iwht4x4_add : vp10_idct4x4_add;
if (xd->lossless)
x->optimize = 0;
......
......@@ -841,7 +841,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
// case.
vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, pd->dst.stride,
p->eobs[block], xd->bd, tx_type,
x->highbd_itxm_add);
xd->lossless);
break;
default:
assert(0 && "Invalid transform size");
......@@ -870,7 +870,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
// which is significant (not just an optimization) for the lossless
// case.
vp10_inv_txfm_add_4x4(dqcoeff, dst, pd->dst.stride, p->eobs[block],
tx_type, x->itxm_add);
tx_type, xd->lossless);
break;
default:
assert(0 && "Invalid transform size");
......@@ -895,11 +895,21 @@ static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize,
if (p->eobs[block] > 0) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
x->highbd_itxm_add(dqcoeff, dst, pd->dst.stride, p->eobs[block], xd->bd);
return;
if (xd->lossless) {
vp10_highbd_iwht4x4_add(dqcoeff, dst, pd->dst.stride,
p->eobs[block], xd->bd);
} else {
vp10_highbd_idct4x4_add(dqcoeff, dst, pd->dst.stride,
p->eobs[block], xd->bd);
}
return;
}
#endif // CONFIG_VP9_HIGHBITDEPTH
x->itxm_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
if (xd->lossless) {
vp10_iwht4x4_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
} else {
vp10_idct4x4_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
}
}
}
......@@ -1032,7 +1042,7 @@ void vp10_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
// eob<=1 which is significant (not just an optimization) for the
// lossless case.
vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, dst_stride, *eob, xd->bd,
tx_type, x->highbd_itxm_add);
tx_type, xd->lossless);
break;
default:
assert(0);
......@@ -1101,7 +1111,7 @@ void vp10_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
// which is significant (not just an optimization) for the lossless
// case.
vp10_inv_txfm_add_4x4(dqcoeff, dst, dst_stride, *eob, tx_type,
x->itxm_add);
xd->lossless);
}
break;
default:
......
......@@ -4087,13 +4087,6 @@ int vp10_get_compressed_data(VP10_COMP *cpi, unsigned int *frame_flags,
if (oxcf->pass == 1) {
cpi->td.mb.e_mbd.lossless = is_lossless_requested(oxcf);
#if CONFIG_VP9_HIGHBITDEPTH
cpi->td.mb.highbd_itxm_add =
cpi->td.mb.e_mbd.lossless ? vp10_highbd_iwht4x4_add
: vp10_highbd_idct4x4_add;
#endif // CONFIG_VP9_HIGHBITDEPTH
cpi->td.mb.itxm_add = cpi->td.mb.e_mbd.lossless ? vp10_iwht4x4_add
: vp10_idct4x4_add;
vp10_first_pass(cpi, source);
} else if (oxcf->pass == 2) {
Pass2Encode(cpi, size, dest, frame_flags);
......
......@@ -807,8 +807,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
goto next_highbd;
vp10_highbd_inv_txfm_add_4x4(BLOCK_OFFSET(pd->dqcoeff, block),
dst, dst_stride, p->eobs[block],
xd->bd, DCT_DCT,
vp10_highbd_iwht4x4_add);
xd->bd, DCT_DCT, 1);
} else {
int64_t unused;
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
......@@ -825,8 +824,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
goto next_highbd;
vp10_highbd_inv_txfm_add_4x4(BLOCK_OFFSET(pd->dqcoeff, block),
dst, dst_stride, p->eobs[block],
xd->bd, tx_type,
vp10_highbd_idct4x4_add);
xd->bd, tx_type, 0);
}
}
}
......@@ -907,8 +905,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
if (RDCOST(x->rdmult, x->rddiv, ratey, distortion) >= best_rd)
goto next;
vp10_inv_txfm_add_4x4(BLOCK_OFFSET(pd->dqcoeff, block),
dst, dst_stride, p->eobs[block], DCT_DCT,
vp10_iwht4x4_add);
dst, dst_stride, p->eobs[block], DCT_DCT, 1);
} else {
int64_t unused;
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
......@@ -923,8 +920,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
if (RDCOST(x->rdmult, x->rddiv, ratey, distortion) >= best_rd)
goto next;
vp10_inv_txfm_add_4x4(BLOCK_OFFSET(pd->dqcoeff, block),
dst, dst_stride, p->eobs[block], tx_type,
vp10_idct4x4_add);
dst, dst_stride, p->eobs[block], tx_type, 0);
}
}
}
......
Markdown is supported
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