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

Use b_width/height_log2 instead of mb_ where appropriate.

Basic assumption: when talking about transform units, use b_; when
talking about macroblock indices, use mb_.

Change-Id: Ifd163f595d4924ff892de4eb0401ccd56dc81884
parent e40a7690
......@@ -574,12 +574,12 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) {
// is smaller than the prediction size
TX_TYPE tx_type = DCT_DCT;
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
const int wb = mb_width_log2(sb_type), hb = mb_height_log2(sb_type);
const int wb = b_width_log2(sb_type), hb = b_height_log2(sb_type);
#if !USE_ADST_FOR_SB
if (sb_type > BLOCK_SIZE_MB16X16)
return tx_type;
#endif
if (ib >= (16 << (wb + hb))) // no chroma adst
if (ib >= (1 << (wb + hb))) // no chroma adst
return tx_type;
if (xd->lossless)
return DCT_DCT;
......@@ -630,7 +630,7 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) {
xd->q_index < ACTIVE_HT) {
#if USE_ADST_FOR_I16X16_4X4
#if USE_ADST_PERIPHERY_ONLY
const int hmax = 4 << wb;
const int hmax = 1 << wb;
tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
#if USE_ADST_FOR_REMOTE_EDGE
if ((ib & (hmax - 1)) != 0 && ib >= hmax)
......@@ -663,12 +663,12 @@ static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, int ib) {
// is smaller than the prediction size
TX_TYPE tx_type = DCT_DCT;
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
const int wb = mb_width_log2(sb_type), hb = mb_height_log2(sb_type);
const int wb = b_width_log2(sb_type), hb = b_height_log2(sb_type);
#if !USE_ADST_FOR_SB
if (sb_type > BLOCK_SIZE_MB16X16)
return tx_type;
#endif
if (ib >= (16 << (wb + hb))) // no chroma adst
if (ib >= (1 << (wb + hb))) // no chroma adst
return tx_type;
if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
xd->q_index < ACTIVE_HT8) {
......@@ -681,7 +681,7 @@ static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, int ib) {
xd->q_index < ACTIVE_HT8) {
#if USE_ADST_FOR_I16X16_8X8
#if USE_ADST_PERIPHERY_ONLY
const int hmax = 4 << wb;
const int hmax = 1 << wb;
tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
#if USE_ADST_FOR_REMOTE_EDGE
if ((ib & (hmax - 1)) != 0 && ib >= hmax)
......@@ -712,19 +712,19 @@ static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, int ib) {
static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, int ib) {
TX_TYPE tx_type = DCT_DCT;
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
const int wb = mb_width_log2(sb_type), hb = mb_height_log2(sb_type);
const int wb = b_width_log2(sb_type), hb = b_height_log2(sb_type);
#if !USE_ADST_FOR_SB
if (sb_type > BLOCK_SIZE_MB16X16)
return tx_type;
#endif
if (ib >= (16 << (wb + hb)))
if (ib >= (1 << (wb + hb)))
return tx_type;
if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
xd->q_index < ACTIVE_HT16) {
tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
#if USE_ADST_PERIPHERY_ONLY
if (sb_type > BLOCK_SIZE_MB16X16) {
const int hmax = 4 << wb;
const int hmax = 1 << wb;
#if USE_ADST_FOR_REMOTE_EDGE
if ((ib & (hmax - 1)) != 0 && ib >= hmax)
tx_type = DCT_DCT;
......
......@@ -31,8 +31,8 @@ void vp9_inverse_transform_b_16x16(int16_t *input_dqcoeff,
}
void vp9_inverse_transform_sby_32x32(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) - 1);
const int bwl = b_width_log2(bsize) - 3, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 3);
const int stride = 32 << bwl;
int n;
......@@ -46,8 +46,8 @@ void vp9_inverse_transform_sby_32x32(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
}
void vp9_inverse_transform_sby_16x16(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bw = 1 << bwl;
const int bh = 1 << mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 2);
const int stride = 16 << bwl, bstride = 4 << bwl;
int n;
......@@ -68,8 +68,8 @@ void vp9_inverse_transform_sby_16x16(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
}
void vp9_inverse_transform_sby_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) + 1);
const int bwl = b_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 1);
const int stride = 8 << bwl, bstride = 2 << bwl;
int n;
......@@ -89,8 +89,8 @@ void vp9_inverse_transform_sby_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
}
void vp9_inverse_transform_sby_4x4(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) + 2);
const int bwl = b_width_log2(bsize), bw = 1 << bwl;
const int bh = 1 << b_height_log2(bsize);
const int stride = 4 << bwl, bstride = 1 << bwl;
int n;
......@@ -118,7 +118,7 @@ void vp9_inverse_transform_sbuv_32x32(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
}
void vp9_inverse_transform_sbuv_16x16(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bhl = mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2, bhl = b_height_log2(bsize) - 2;
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
const int stride = 16 << (bwl - 1);
int n;
......@@ -135,7 +135,7 @@ void vp9_inverse_transform_sbuv_16x16(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
}
void vp9_inverse_transform_sbuv_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bhl = mb_height_log2(bsize) + 1;
const int bwl = b_width_log2(bsize) - 1, bhl = b_height_log2(bsize) - 1;
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
const int stride = 8 << (bwl - 1);
int n;
......@@ -152,7 +152,7 @@ void vp9_inverse_transform_sbuv_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
}
void vp9_inverse_transform_sbuv_4x4(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
const int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
const int stride = 4 << (bwl - 1);
int n;
......
......@@ -388,8 +388,8 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_reader *r) {
}
static INLINE void decode_sby_32x32(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) - 1, bw = 1 << bwl;
const int bhl = mb_height_log2(bsize) - 1, bh = 1 << bhl;
const int bwl = b_width_log2(bsize) - 3, bw = 1 << bwl;
const int bhl = b_height_log2(bsize) - 3, bh = 1 << bhl;
const int y_count = bw * bh;
int n;
......@@ -405,8 +405,8 @@ static INLINE void decode_sby_32x32(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
}
static INLINE void decode_sbuv_32x32(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) - 1, bw = (1 << bwl) / 2;
const int bhl = mb_height_log2(bsize) - 1, bh = (1 << bhl) / 2;
const int bwl = b_width_log2(bsize) - 3, bw = (1 << bwl) / 2;
const int bhl = b_height_log2(bsize) - 3, bh = (1 << bhl) / 2;
const int uv_count = bw * bh;
int n;
for (n = 0; n < uv_count; n++) {
......@@ -426,8 +426,8 @@ static INLINE void decode_sbuv_32x32(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
}
static INLINE void decode_sby_16x16(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bw = 1 << bwl;
const int bhl = mb_height_log2(bsize), bh = 1 << bhl;
const int bwl = b_width_log2(bsize) - 2, bw = 1 << bwl;
const int bhl = b_height_log2(bsize) - 2, bh = 1 << bhl;
const int y_count = bw * bh;
int n;
......@@ -444,8 +444,8 @@ static INLINE void decode_sby_16x16(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
}
static INLINE void decode_sbuv_16x16(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bw = (1 << bwl) / 2;
const int bhl = mb_height_log2(bsize), bh = (1 << bhl) / 2;
const int bwl = b_width_log2(bsize) - 2, bw = (1 << bwl) / 2;
const int bhl = b_height_log2(bsize) - 2, bh = (1 << bhl) / 2;
const int uv_count = bw * bh;
int n;
......@@ -465,8 +465,8 @@ static INLINE void decode_sbuv_16x16(MACROBLOCKD *mb, BLOCK_SIZE_TYPE bsize) {
}
static INLINE void decode_sby_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bw = 1 << bwl;
const int bhl = mb_height_log2(bsize) + 1, bh = 1 << bhl;
const int bwl = b_width_log2(bsize) - 1, bw = 1 << bwl;
const int bhl = b_height_log2(bsize) - 1, bh = 1 << bhl;
const int y_count = bw * bh;
int n;
......@@ -485,8 +485,8 @@ static INLINE void decode_sby_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
}
static INLINE void decode_sbuv_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bw = 1 << (bwl - 1);
const int bhl = mb_height_log2(bsize) + 1, bh = 1 << (bhl - 1);
const int bwl = b_width_log2(bsize) - 1, bw = 1 << (bwl - 1);
const int bhl = b_height_log2(bsize) - 1, bh = 1 << (bhl - 1);
const int uv_count = bw * bh;
int n;
......@@ -505,8 +505,8 @@ static INLINE void decode_sbuv_8x8(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
}
static INLINE void decode_sby_4x4(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bw = 1 << bwl;
const int bhl = mb_height_log2(bsize) + 2, bh = 1 << bhl;
const int bwl = b_width_log2(bsize), bw = 1 << bwl;
const int bhl = b_height_log2(bsize), bh = 1 << bhl;
const int y_count = bw * bh;
int n;
......@@ -528,8 +528,8 @@ static INLINE void decode_sby_4x4(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
}
static INLINE void decode_sbuv_4x4(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bw = 1 << (bwl - 1);
const int bhl = mb_height_log2(bsize) + 2, bh = 1 << (bhl - 1);
const int bwl = b_width_log2(bsize), bw = 1 << (bwl - 1);
const int bhl = b_height_log2(bsize), bh = 1 << (bhl - 1);
const int uv_count = bw * bh;
int n;
......
......@@ -175,7 +175,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
}
case TX_8X8: {
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
const int sz = 3 + mb_width_log2(sb_type);
const int sz = 1 + b_width_log2(sb_type);
const int x = block_idx & ((1 << sz) - 1);
const int y = block_idx - x;
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
......@@ -194,7 +194,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
}
case TX_16X16: {
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
const int sz = 4 + mb_width_log2(sb_type);
const int sz = 2 + b_width_log2(sb_type);
const int x = block_idx & ((1 << sz) - 1);
const int y = block_idx - x;
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
......
......@@ -68,8 +68,8 @@ void vp9_subtract_sb(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
void vp9_transform_sby_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) - 1);
const int bwl = b_width_log2(bsize) - 3, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 3);
const int stride = 32 << bwl;
int n;
......@@ -82,8 +82,8 @@ void vp9_transform_sby_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_transform_sby_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bw = 1 << bwl;
const int bh = 1 << mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 2);
const int stride = 16 << bwl, bstride = 4 << bwl;
MACROBLOCKD *const xd = &x->e_mbd;
int n;
......@@ -105,8 +105,8 @@ void vp9_transform_sby_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_transform_sby_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) + 1);
const int bwl = b_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 1);
const int stride = 8 << bwl, bstride = 2 << bwl;
MACROBLOCKD *const xd = &x->e_mbd;
int n;
......@@ -126,8 +126,8 @@ void vp9_transform_sby_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_transform_sby_4x4(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) + 2);
const int bwl = b_width_log2(bsize), bw = 1 << bwl;
const int bh = 1 << b_height_log2(bsize);
const int stride = 4 << bwl;
MACROBLOCKD *const xd = &x->e_mbd;
int n;
......@@ -154,7 +154,7 @@ void vp9_transform_sbuv_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_transform_sbuv_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bhl = mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2, bhl = b_height_log2(bsize) - 2;
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
const int stride = 16 << (bwl - 1);
int n;
......@@ -171,7 +171,7 @@ void vp9_transform_sbuv_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_transform_sbuv_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bhl = mb_height_log2(bsize) + 1;
const int bwl = b_width_log2(bsize) - 1, bhl = b_height_log2(bsize) - 1;
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
const int stride = 8 << (bwl - 1);
int n;
......@@ -188,7 +188,7 @@ void vp9_transform_sbuv_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_transform_sbuv_4x4(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
const int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
const int stride = 4 << (bwl - 1);
int n;
......@@ -288,7 +288,7 @@ static void optimize_b(VP9_COMMON *const cm,
}
case TX_8X8: {
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
const int sz = 3 + mb_width_log2(sb_type);
const int sz = 1 + b_width_log2(sb_type);
const int x = ib & ((1 << sz) - 1), y = ib - x;
const TX_TYPE tx_type = get_tx_type_8x8(xd, y + (x >> 1));
scan = get_scan_8x8(tx_type);
......@@ -297,7 +297,7 @@ static void optimize_b(VP9_COMMON *const cm,
}
case TX_16X16: {
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
const int sz = 4 + mb_width_log2(sb_type);
const int sz = 2 + b_width_log2(sb_type);
const int x = ib & ((1 << sz) - 1), y = ib - x;
const TX_TYPE tx_type = get_tx_type_16x16(xd, y + (x >> 2));
scan = get_scan_16x16(tx_type);
......@@ -486,8 +486,8 @@ static void optimize_b(VP9_COMMON *const cm,
void vp9_optimize_sby_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) - 1);
const int bwl = b_width_log2(bsize) - 3, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 3);
ENTROPY_CONTEXT ta[2], tl[2];
int n;
......@@ -516,8 +516,8 @@ void vp9_optimize_sby_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
void vp9_optimize_sby_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bw = 1 << bwl;
const int bh = 1 << mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 2);
ENTROPY_CONTEXT ta[4], tl[4];
int n;
......@@ -539,8 +539,8 @@ void vp9_optimize_sby_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
void vp9_optimize_sby_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bw = 1 << bwl;
const int bh = 2 << mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 1);
ENTROPY_CONTEXT ta[8], tl[8];
int n;
......@@ -567,20 +567,17 @@ void vp9_optimize_sby_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
void vp9_optimize_sby_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
int bwl = mb_width_log2(bsize), bw = 1 << bwl;
int bh = 1 << mb_height_log2(bsize);
int bwl = b_width_log2(bsize), bw = 1 << bwl;
int bh = 1 << b_height_log2(bsize);
ENTROPY_CONTEXT ta[16], tl[16];
int n;
for (n = 0; n < bw; n++)
vpx_memcpy(&ta[n * 4], x->e_mbd.above_context + n,
for (n = 0; n < bw; n += 4)
vpx_memcpy(&ta[n], x->e_mbd.above_context + (n >> 2),
sizeof(ENTROPY_CONTEXT) * 4);
for (n = 0; n < bh; n++)
vpx_memcpy(&tl[n * 4], x->e_mbd.left_context + n,
for (n = 0; n < bh; n += 4)
vpx_memcpy(&tl[n], x->e_mbd.left_context + (n >> 2),
sizeof(ENTROPY_CONTEXT) * 4);
bw *= 4;
bh *= 4;
bwl += 2;
for (n = 0; n < bw * bh; n++) {
const int x_idx = n & (bw - 1), y_idx = n >> bwl;
......@@ -617,7 +614,7 @@ void vp9_optimize_sbuv_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
void vp9_optimize_sbuv_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bhl = mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2, bhl = b_height_log2(bsize) - 2;
const int bw = 1 << (bwl - 1);
const int bh = 1 << (bhl - 1);
int uvoff = 16 << (bwl + bhl);
......@@ -651,7 +648,7 @@ void vp9_optimize_sbuv_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
void vp9_optimize_sbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bhl = mb_height_log2(bsize) + 1;
const int bwl = b_width_log2(bsize) - 1, bhl = b_height_log2(bsize) - 1;
const int bw = 1 << (bwl - 1);
const int bh = 1 << (bhl - 1);
int uvoff = 4 << (bwl + bhl);
......@@ -683,7 +680,7 @@ void vp9_optimize_sbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
void vp9_optimize_sbuv_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
const int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
const int bw = 1 << (bwl - 1);
const int bh = 1 << (bhl - 1);
int uvoff = 1 << (bwl + bhl);
......
......@@ -327,8 +327,8 @@ void vp9_regular_quantize_b_32x32(MACROBLOCK *mb, int b_idx, int y_blocks) {
}
void vp9_quantize_sby_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bw = 1 << (mb_width_log2(bsize) - 1);
const int bh = 1 << (mb_height_log2(bsize) - 1);
const int bw = 1 << (b_width_log2(bsize) - 3);
const int bh = 1 << (b_height_log2(bsize) - 3);
int n;
for (n = 0; n < bw * bh; n++)
......@@ -336,8 +336,8 @@ void vp9_quantize_sby_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_quantize_sby_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bw = 1 << bwl;
const int bh = 1 << mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 2);
const int bstride = 16 << bwl;
int n;
......@@ -350,8 +350,8 @@ void vp9_quantize_sby_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_quantize_sby_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) + 1);
const int bwl = b_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 1);
const int bstride = 4 << bwl;
int n;
......@@ -364,8 +364,8 @@ void vp9_quantize_sby_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_quantize_sby_4x4(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) + 2);
const int bwl = b_width_log2(bsize), bw = 1 << bwl;
const int bh = 1 << b_height_log2(bsize);
MACROBLOCKD *const xd = &x->e_mbd;
int n;
......@@ -386,8 +386,8 @@ void vp9_quantize_sbuv_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_quantize_sbuv_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize);
const int bhl = mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2;
const int bhl = b_height_log2(bsize) - 2;
const int uoff = 16 << (bhl + bwl);
int i;
......@@ -396,8 +396,8 @@ void vp9_quantize_sbuv_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_quantize_sbuv_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize);
const int bhl = mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2;
const int bhl = b_height_log2(bsize) - 2;
const int uoff = 16 << (bhl + bwl);
int i;
......@@ -406,8 +406,8 @@ void vp9_quantize_sbuv_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
}
void vp9_quantize_sbuv_4x4(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize);
const int bhl = mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2;
const int bhl = b_height_log2(bsize) - 2;
const int uoff = 16 << (bhl + bwl);
int i;
......
......@@ -360,7 +360,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
}
case TX_8X8: {
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
const int sz = 3 + mb_width_log2(sb_type);
const int sz = 1 + b_width_log2(sb_type);
const int x = ib & ((1 << sz) - 1), y = ib - x;
TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
......@@ -376,7 +376,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
}
case TX_16X16: {
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
const int sz = 4 + mb_width_log2(sb_type);
const int sz = 2 + b_width_log2(sb_type);
const int x = ib & ((1 << sz) - 1), y = ib - x;
TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
......@@ -666,8 +666,8 @@ static int block_error_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize, int shift) {
static int rdcost_sby_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) + 2);
const int bwl = b_width_log2(bsize), bw = 1 << bwl;
const int bh = 1 << b_height_log2(bsize);
int cost = 0, b;
MACROBLOCKD *const xd = &x->e_mbd;
ENTROPY_CONTEXT_PLANES t_above[4], t_left[4];
......@@ -691,7 +691,7 @@ static int rdcost_sby_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
static void super_block_yrd_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
int *rate, int *distortion, int *skippable,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
const int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
MACROBLOCKD *const xd = &x->e_mbd;
xd->mode_info_context->mbmi.txfm_size = TX_4X4;
......@@ -705,8 +705,8 @@ static void super_block_yrd_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
static int rdcost_sby_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) + 1);
const int bwl = b_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 1);
int cost = 0, b;
MACROBLOCKD *const xd = &x->e_mbd;
ENTROPY_CONTEXT_PLANES t_above[4], t_left[4];
......@@ -744,8 +744,8 @@ static void super_block_yrd_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
static int rdcost_sby_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bw = 1 << bwl;
const int bh = 1 << mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 2);
int cost = 0, b;
MACROBLOCKD *const xd = &x->e_mbd;
ENTROPY_CONTEXT_PLANES t_above[4], t_left[4];
......@@ -781,8 +781,8 @@ static void super_block_yrd_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
static int rdcost_sby_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) - 1);
const int bwl = b_width_log2(bsize) - 3, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 3);
int cost = 0, b;
MACROBLOCKD * const xd = &x->e_mbd;
ENTROPY_CONTEXT_PLANES t_above[4], t_left[4];
......@@ -1345,8 +1345,8 @@ static int64_t rd_pick_intra8x8mby_modes_and_txsz(VP9_COMP *cpi, MACROBLOCK *x,
#define UVCTX(c, p) ((p) ? (c).v : (c).u)
static int rd_cost_sbuv_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 1, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) + 1);
const int bwl = b_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 1);
int yoff = 4 * bw * bh;
int p, b, cost = 0;
MACROBLOCKD *const xd = &x->e_mbd;
......@@ -1386,8 +1386,8 @@ static void super_block_uvrd_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
static int rd_cost_sbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize), bw = 1 << bwl;
const int bh = 1 << mb_height_log2(bsize);
const int bwl = b_width_log2(bsize) - 2, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 2);
int yoff = 16 * bw * bh;
int p, b, cost = 0;
MACROBLOCKD *const xd = &x->e_mbd;
......@@ -1427,8 +1427,8 @@ static void super_block_uvrd_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
static int rd_cost_sbuv_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) - 1, bw = 1 << bwl;
const int bh = 1 << (mb_height_log2(bsize) - 1);
const int bwl = b_width_log2(bsize) - 3, bw = 1 << bwl;
const int bh = 1 << (b_height_log2(bsize) - 3);
int yoff = 64 * bw * bh;
int p, b, cost = 0;
MACROBLOCKD *const xd = &x->e_mbd;
......@@ -1468,8 +1468,8 @@ static void super_block_uvrd_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
static int rd_cost_sbuv_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {