static void decode_block(int plane, int block, BLOCK_SIZE_TYPE bsize, int ss_txfrm_size, void *arg) { MACROBLOCKD* const xd = arg; struct macroblockd_plane *pd = &xd->plane[plane]; int16_t* const qcoeff = BLOCK_OFFSET(pd->qcoeff, block, 16); const int stride = pd->dst.stride; const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane, block, ss_txfrm_size); uint8_t* const dst = raster_block_offset_uint8(xd, bsize, plane, raster_block, pd->dst.buf, stride); TX_TYPE tx_type; switch (ss_txfrm_size / 2) { case TX_4X4: tx_type = plane == 0 ? get_tx_type_4x4(xd, raster_block) : DCT_DCT; if (tx_type == DCT_DCT) xd->itxm_add(qcoeff, dst, stride, pd->eobs[block]); else vp9_iht_add_c(tx_type, qcoeff, dst, stride, pd->eobs[block]); break; case TX_8X8: tx_type = plane == 0 ? get_tx_type_8x8(xd, raster_block) : DCT_DCT; vp9_iht_add_8x8_c(tx_type, qcoeff, dst, stride, pd->eobs[block]); break; case TX_16X16: tx_type = plane == 0 ? get_tx_type_16x16(xd, raster_block) : DCT_DCT; vp9_iht_add_16x16_c(tx_type, qcoeff, dst, stride, pd->eobs[block]); break; case TX_32X32: vp9_idct_add_32x32(qcoeff, dst, stride, pd->eobs[block]); break; } }
static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) { struct macroblockd_plane *const pd = &xd->plane[plane]; int16_t* const qcoeff = BLOCK_OFFSET(pd->qcoeff, block); const int stride = pd->dst.stride; const int eob = pd->eobs[block]; if (eob > 0) { TX_TYPE tx_type; const int raster_block = txfrm_block_to_raster_block(plane_bsize, tx_size, block); uint8_t* const dst = raster_block_offset_uint8(plane_bsize, raster_block, pd->dst.buf, stride); switch (tx_size) { case TX_4X4: tx_type = get_tx_type_4x4(pd->plane_type, xd, raster_block); if (tx_type == DCT_DCT) xd->itxm_add(qcoeff, dst, stride, eob); else vp9_iht4x4_add(tx_type, qcoeff, dst, stride, eob); break; case TX_8X8: tx_type = get_tx_type_8x8(pd->plane_type, xd); vp9_iht8x8_add(tx_type, qcoeff, dst, stride, eob); break; case TX_16X16: tx_type = get_tx_type_16x16(pd->plane_type, xd); vp9_iht16x16_add(tx_type, qcoeff, dst, stride, eob); break; case TX_32X32: tx_type = DCT_DCT; vp9_idct32x32_add(qcoeff, dst, stride, eob); break; default: assert(!"Invalid transform size"); } if (eob == 1) { vpx_memset(qcoeff, 0, 2 * sizeof(qcoeff[0])); } else { if (tx_type == DCT_DCT && tx_size <= TX_16X16 && eob <= 10) vpx_memset(qcoeff, 0, 4 * (4 << tx_size) * sizeof(qcoeff[0])); else vpx_memset(qcoeff, 0, (16 << (tx_size << 1)) * sizeof(qcoeff[0])); } } }
static void decode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize, int ss_txfrm_size, void *arg) { MACROBLOCKD* const xd = arg; struct macroblockd_plane *pd = &xd->plane[plane]; const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane, block, ss_txfrm_size); uint8_t* const dst = raster_block_offset_uint8(xd, bsize, plane, raster_block, pd->dst.buf, pd->dst.stride); const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size / 2); int b_mode; int plane_b_size; const int tx_ib = raster_block >> tx_size; const int mode = plane == 0 ? xd->mode_info_context->mbmi.mode : xd->mode_info_context->mbmi.uv_mode; if (plane == 0 && xd->mode_info_context->mbmi.sb_type < BLOCK_SIZE_SB8X8) { assert(bsize == BLOCK_SIZE_SB8X8); b_mode = xd->mode_info_context->bmi[raster_block].as_mode.first; } else { b_mode = mode; } if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) extend_for_intra(xd, plane, block, bsize, ss_txfrm_size); plane_b_size = b_width_log2(bsize) - pd->subsampling_x; vp9_predict_intra_block(xd, tx_ib, plane_b_size, tx_size, b_mode, dst, pd->dst.stride); // Early exit if there are no coefficients if (xd->mode_info_context->mbmi.mb_skip_coeff) return; decode_block(plane, block, bsize, ss_txfrm_size, arg); }