diff options
author | Dmitry Kovalev <dkovalev@google.com> | 2013-08-15 11:44:57 -0700 |
---|---|---|
committer | Dmitry Kovalev <dkovalev@google.com> | 2013-08-15 11:44:57 -0700 |
commit | bb3b817c1e64e4f1460db0d5b3c65f44273c0944 (patch) | |
tree | 2626cdf9fd1b30143442c47c5301f08d9c724ae4 /vp9/common | |
parent | bb072000e8da3b5a4f59cf851b8c0d43871b9b6e (diff) | |
download | libvpx-bb3b817c1e64e4f1460db0d5b3c65f44273c0944.tar libvpx-bb3b817c1e64e4f1460db0d5b3c65f44273c0944.tar.gz libvpx-bb3b817c1e64e4f1460db0d5b3c65f44273c0944.tar.bz2 libvpx-bb3b817c1e64e4f1460db0d5b3c65f44273c0944.zip |
Converting code from using ss_txfrm_size to tx_size.
Updated function signatures:
txfrm_block_to_raster_block
txfrm_block_to_raster_xy
extend_for_intra
vp9_optimize_b
Change-Id: I7213f4c4b1b9ec802f90621d5ba61d5e4dac5e0a
Diffstat (limited to 'vp9/common')
-rw-r--r-- | vp9/common/vp9_blockd.h | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 77c952f57..85d662569 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -544,52 +544,55 @@ static int raster_block_offset(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize, return y * stride + x; } static int16_t* raster_block_offset_int16(MACROBLOCKD *xd, - BLOCK_SIZE_TYPE bsize, - int plane, int block, int16_t *base) { + BLOCK_SIZE_TYPE bsize, + int plane, int block, int16_t *base) { const int stride = plane_block_width(bsize, &xd->plane[plane]); return base + raster_block_offset(xd, bsize, plane, block, stride); } static uint8_t* raster_block_offset_uint8(MACROBLOCKD *xd, - BLOCK_SIZE_TYPE bsize, - int plane, int block, - uint8_t *base, int stride) { + BLOCK_SIZE_TYPE bsize, + int plane, int block, + uint8_t *base, int stride) { return base + raster_block_offset(xd, bsize, plane, block, stride); } static int txfrm_block_to_raster_block(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize, int plane, int block, - int ss_txfrm_size) { + TX_SIZE tx_size) { const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x; - const int txwl = ss_txfrm_size >> 1; - const int tx_cols_log2 = bwl - txwl; + const int ss_txfrm_size = tx_size << 1; + const int tx_cols_log2 = bwl - tx_size; const int tx_cols = 1 << tx_cols_log2; const int raster_mb = block >> ss_txfrm_size; - const int x = (raster_mb & (tx_cols - 1)) << (txwl); - const int y = raster_mb >> tx_cols_log2 << (txwl); + const int x = (raster_mb & (tx_cols - 1)) << tx_size; + const int y = raster_mb >> tx_cols_log2 << tx_size; return x + (y << bwl); } static void txfrm_block_to_raster_xy(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize, int plane, int block, - int ss_txfrm_size, + TX_SIZE tx_size, int *x, int *y) { const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x; - const int txwl = ss_txfrm_size >> 1; - const int tx_cols_log2 = bwl - txwl; + const int ss_txfrm_size = tx_size << 1; + const int tx_cols_log2 = bwl - tx_size; const int tx_cols = 1 << tx_cols_log2; const int raster_mb = block >> ss_txfrm_size; - *x = (raster_mb & (tx_cols - 1)) << (txwl); - *y = raster_mb >> tx_cols_log2 << (txwl); + *x = (raster_mb & (tx_cols - 1)) << tx_size; + *y = raster_mb >> tx_cols_log2 << tx_size; } -static void extend_for_intra(MACROBLOCKD* const xd, int plane, int block, - BLOCK_SIZE_TYPE bsize, int ss_txfrm_size) { - const int bw = plane_block_width(bsize, &xd->plane[plane]); - const int bh = plane_block_height(bsize, &xd->plane[plane]); +static void extend_for_intra(MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize, + int plane, int block, TX_SIZE tx_size) { + struct macroblockd_plane *const pd = &xd->plane[plane]; + uint8_t *const buf = pd->dst.buf; + const int stride = pd->dst.stride; + const int bw = plane_block_width(bsize, pd); + const int bh = plane_block_height(bsize, pd); int x, y; - txfrm_block_to_raster_xy(xd, bsize, plane, block, ss_txfrm_size, &x, &y); + txfrm_block_to_raster_xy(xd, bsize, plane, block, tx_size, &x, &y); x = x * 4 - 1; y = y * 4 - 1; // Copy a pixel into the umv if we are in a situation where the block size @@ -597,29 +600,23 @@ static void extend_for_intra(MACROBLOCKD* const xd, int plane, int block, // TODO(JBB): Should be able to do the full extend in place so we don't have // to do this multiple times. if (xd->mb_to_right_edge < 0) { - int umv_border_start = bw - + (xd->mb_to_right_edge >> (3 + xd->plane[plane].subsampling_x)); + const int umv_border_start = bw + (xd->mb_to_right_edge >> + (3 + pd->subsampling_x)); if (x + bw > umv_border_start) - vpx_memset( - xd->plane[plane].dst.buf + y * xd->plane[plane].dst.stride - + umv_border_start, - *(xd->plane[plane].dst.buf + y * xd->plane[plane].dst.stride - + umv_border_start - 1), - bw); + vpx_memset(&buf[y * stride + umv_border_start], + buf[y * stride + umv_border_start - 1], bw); } + if (xd->mb_to_bottom_edge < 0) { - int umv_border_start = bh - + (xd->mb_to_bottom_edge >> (3 + xd->plane[plane].subsampling_y)); + const int umv_border_start = bh + (xd->mb_to_bottom_edge >> + (3 + pd->subsampling_y)); int i; - uint8_t c = *(xd->plane[plane].dst.buf - + (umv_border_start - 1) * xd->plane[plane].dst.stride + x); - - uint8_t *d = xd->plane[plane].dst.buf - + umv_border_start * xd->plane[plane].dst.stride + x; + const uint8_t c = buf[(umv_border_start - 1) * stride + x]; + uint8_t *d = &buf[umv_border_start * stride + x]; if (y + bh > umv_border_start) - for (i = 0; i < bh; i++, d += xd->plane[plane].dst.stride) + for (i = 0; i < bh; ++i, d += stride) *d = c; } } |