summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@google.com>2013-04-24 09:18:16 -0700
committerRonald S. Bultje <rbultje@google.com>2013-04-25 14:20:59 -0700
commitc849eaca5918cbe523968cde479fbb5a125b866d (patch)
treedf747effc3c87e52a210f7b5f2bb13696c7e3bcc /vp9
parente40a769036a97403718244caa81b8680a4c9c7eb (diff)
downloadlibvpx-c849eaca5918cbe523968cde479fbb5a125b866d.tar
libvpx-c849eaca5918cbe523968cde479fbb5a125b866d.tar.gz
libvpx-c849eaca5918cbe523968cde479fbb5a125b866d.tar.bz2
libvpx-c849eaca5918cbe523968cde479fbb5a125b866d.zip
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
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_blockd.h18
-rw-r--r--vp9/common/vp9_invtrans.c22
-rw-r--r--vp9/decoder/vp9_decodframe.c32
-rw-r--r--vp9/decoder/vp9_detokenize.c4
-rw-r--r--vp9/encoder/vp9_encodemb.c59
-rw-r--r--vp9/encoder/vp9_quantize.c28
-rw-r--r--vp9/encoder/vp9_rdopt.c38
-rw-r--r--vp9/encoder/vp9_tokenize.c6
8 files changed, 102 insertions, 105 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index b6354855a..878da4cc4 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -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;
diff --git a/vp9/common/vp9_invtrans.c b/vp9/common/vp9_invtrans.c
index 0673fd81a..458f13532 100644
--- a/vp9/common/vp9_invtrans.c
+++ b/vp9/common/vp9_invtrans.c
@@ -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;
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index 7958a3e3a..46ef07625 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -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;
diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c
index 4e931a12a..0a682657b 100644
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -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) ?
diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c
index 823e92d07..a11bb3ecf 100644
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -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);
diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c
index b275ab19b..3c60af76b 100644
--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -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;
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 5c4402a5b..6778c09b0 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -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) {
- 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) - 4, bw = 1 << bwl;
+ const int bh = 1 << (b_height_log2(bsize) - 4);
int yoff = 256 * bh * bw;
int p, b, cost = 0;
MACROBLOCKD *const xd = &x->e_mbd;
diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c
index 0edf126bd..67e139053 100644
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -210,7 +210,7 @@ static void tokenize_b(VP9_COMP *cpi,
break;
}
case TX_8X8: {
- 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 = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
@@ -227,7 +227,7 @@ static void tokenize_b(VP9_COMP *cpi,
break;
}
case TX_16X16: {
- 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 = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
@@ -468,7 +468,7 @@ void vp9_tokenize_sb(VP9_COMP *cpi,
MACROBLOCKD *xd,
TOKENEXTRA **t,
int dry_run, 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);
VP9_COMMON * const cm = &cpi->common;
MB_MODE_INFO * const mbmi = &xd->mode_info_context->mbmi;
TOKENEXTRA *t_backup = *t;