Commit c20c955e authored by James Zern's avatar James Zern
Browse files

vp9/inverse_transform_block_inter: move eob check

1 level up. the function is a no-op for eob == 0 and shouldn't be called

Change-Id: Id0a490bcce78c2b2ec6ea24d942191eb9b2bc16e
parent f64a30ac
...@@ -189,54 +189,31 @@ static void inverse_transform_block_inter(MACROBLOCKD* xd, int plane, ...@@ -189,54 +189,31 @@ static void inverse_transform_block_inter(MACROBLOCKD* xd, int plane,
uint8_t *dst, int stride, uint8_t *dst, int stride,
int eob) { int eob) {
struct macroblockd_plane *const pd = &xd->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane];
if (eob > 0) { tran_low_t *const dqcoeff = pd->dqcoeff;
tran_low_t *const dqcoeff = pd->dqcoeff; assert(eob > 0);
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
if (xd->lossless) { if (xd->lossless) {
vp9_highbd_iwht4x4_add(dqcoeff, dst, stride, eob, xd->bd); vp9_highbd_iwht4x4_add(dqcoeff, dst, stride, eob, xd->bd);
} else {
switch (tx_size) {
case TX_4X4:
vp9_highbd_idct4x4_add(dqcoeff, dst, stride, eob, xd->bd);
break;
case TX_8X8:
vp9_highbd_idct8x8_add(dqcoeff, dst, stride, eob, xd->bd);
break;
case TX_16X16:
vp9_highbd_idct16x16_add(dqcoeff, dst, stride, eob, xd->bd);
break;
case TX_32X32:
vp9_highbd_idct32x32_add(dqcoeff, dst, stride, eob, xd->bd);
break;
default:
assert(0 && "Invalid transform size");
}
}
} else { } else {
if (xd->lossless) { switch (tx_size) {
vp9_iwht4x4_add(dqcoeff, dst, stride, eob); case TX_4X4:
} else { vp9_highbd_idct4x4_add(dqcoeff, dst, stride, eob, xd->bd);
switch (tx_size) { break;
case TX_4X4: case TX_8X8:
vp9_idct4x4_add(dqcoeff, dst, stride, eob); vp9_highbd_idct8x8_add(dqcoeff, dst, stride, eob, xd->bd);
break; break;
case TX_8X8: case TX_16X16:
vp9_idct8x8_add(dqcoeff, dst, stride, eob); vp9_highbd_idct16x16_add(dqcoeff, dst, stride, eob, xd->bd);
break; break;
case TX_16X16: case TX_32X32:
vp9_idct16x16_add(dqcoeff, dst, stride, eob); vp9_highbd_idct32x32_add(dqcoeff, dst, stride, eob, xd->bd);
break; break;
case TX_32X32: default:
vp9_idct32x32_add(dqcoeff, dst, stride, eob); assert(0 && "Invalid transform size");
break;
default:
assert(0 && "Invalid transform size");
return;
}
} }
} }
#else } else {
if (xd->lossless) { if (xd->lossless) {
vp9_iwht4x4_add(dqcoeff, dst, stride, eob); vp9_iwht4x4_add(dqcoeff, dst, stride, eob);
} else { } else {
...@@ -258,18 +235,40 @@ static void inverse_transform_block_inter(MACROBLOCKD* xd, int plane, ...@@ -258,18 +235,40 @@ static void inverse_transform_block_inter(MACROBLOCKD* xd, int plane,
return; return;
} }
} }
}
#else
if (xd->lossless) {
vp9_iwht4x4_add(dqcoeff, dst, stride, eob);
} else {
switch (tx_size) {
case TX_4X4:
vp9_idct4x4_add(dqcoeff, dst, stride, eob);
break;
case TX_8X8:
vp9_idct8x8_add(dqcoeff, dst, stride, eob);
break;
case TX_16X16:
vp9_idct16x16_add(dqcoeff, dst, stride, eob);
break;
case TX_32X32:
vp9_idct32x32_add(dqcoeff, dst, stride, eob);
break;
default:
assert(0 && "Invalid transform size");
return;
}
}
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
if (eob == 1) { if (eob == 1) {
dqcoeff[0] = 0; dqcoeff[0] = 0;
} else { } else {
if (tx_size <= TX_16X16 && eob <= 10) if (tx_size <= TX_16X16 && eob <= 10)
memset(dqcoeff, 0, 4 * (4 << tx_size) * sizeof(dqcoeff[0])); memset(dqcoeff, 0, 4 * (4 << tx_size) * sizeof(dqcoeff[0]));
else if (tx_size == TX_32X32 && eob <= 34) else if (tx_size == TX_32X32 && eob <= 34)
memset(dqcoeff, 0, 256 * sizeof(dqcoeff[0])); memset(dqcoeff, 0, 256 * sizeof(dqcoeff[0]));
else else
memset(dqcoeff, 0, (16 << (tx_size << 1)) * sizeof(dqcoeff[0])); memset(dqcoeff, 0, (16 << (tx_size << 1)) * sizeof(dqcoeff[0]));
}
} }
} }
...@@ -403,9 +402,11 @@ static int reconstruct_inter_block(MACROBLOCKD *const xd, vpx_reader *r, ...@@ -403,9 +402,11 @@ static int reconstruct_inter_block(MACROBLOCKD *const xd, vpx_reader *r,
const int eob = vp9_decode_block_tokens(xd, plane, sc, col, row, tx_size, r, const int eob = vp9_decode_block_tokens(xd, plane, sc, col, row, tx_size, r,
mi->segment_id); mi->segment_id);
inverse_transform_block_inter(xd, plane, tx_size, if (eob > 0) {
&pd->dst.buf[4 * row * pd->dst.stride + 4 * col], inverse_transform_block_inter(
pd->dst.stride, eob); xd, plane, tx_size, &pd->dst.buf[4 * row * pd->dst.stride + 4 * col],
pd->dst.stride, eob);
}
return eob; return eob;
} }
......
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