Merge "Code cleanup inside vp9_decodframe.c." into experimental
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index 878da4c..3d15624 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -278,14 +278,6 @@
union b_mode_info bmi[16];
} MODE_INFO;
-typedef struct blockd {
- uint8_t **base_dst;
- int dst;
- int dst_stride;
-
- union b_mode_info bmi;
-} BLOCKD;
-
struct scale_factors {
int x_num;
int x_den;
@@ -339,9 +331,6 @@
typedef struct macroblockd {
struct macroblockd_plane plane[MAX_MB_PLANE];
- /* 16 Y blocks, 4 U, 4 V, each with 16 entries. */
- BLOCKD block[24];
-
struct scale_factors scale_factor[2];
struct scale_factors scale_factor_uv[2];
@@ -585,23 +574,22 @@
return DCT_DCT;
if (xd->mode_info_context->mbmi.mode == I4X4_PRED &&
xd->q_index < ACTIVE_HT) {
- const BLOCKD *b = &xd->block[ib];
tx_type = txfm_map(
#if CONFIG_NEWBINTRAMODES
- b->bmi.as_mode.first == B_CONTEXT_PRED ? b->bmi.as_mode.context :
+ xd->mode_info_context->bmi[ib].as_mode.first == B_CONTEXT_PRED ?
+ xd->mode_info_context->bmi[ib].as_mode.context :
#endif
- b->bmi.as_mode.first);
+ xd->mode_info_context->bmi[ib].as_mode.first);
} else if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
xd->q_index < ACTIVE_HT) {
- const BLOCKD *b = &xd->block[ib];
const int ic = (ib & 10);
#if USE_ADST_FOR_I8X8_4X4
#if USE_ADST_PERIPHERY_ONLY
// Use ADST for periphery blocks only
const int inner = ib & 5;
- b += ic - ib;
tx_type = txfm_map(pred_mode_conv(
- (MB_PREDICTION_MODE)b->bmi.as_mode.first));
+ (MB_PREDICTION_MODE)xd->mode_info_context->bmi[ic].as_mode.first));
+
#if USE_ADST_FOR_REMOTE_EDGE
if (inner == 5)
tx_type = DCT_DCT;
@@ -672,11 +660,10 @@
return tx_type;
if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
xd->q_index < ACTIVE_HT8) {
- const BLOCKD *b = &xd->block[ib];
// TODO(rbultje): MB_PREDICTION_MODE / B_PREDICTION_MODE should be merged
// or the relationship otherwise modified to address this type conversion.
tx_type = txfm_map(pred_mode_conv(
- (MB_PREDICTION_MODE)b->bmi.as_mode.first));
+ (MB_PREDICTION_MODE)xd->mode_info_context->bmi[ib].as_mode.first));
} else if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
xd->q_index < ACTIVE_HT8) {
#if USE_ADST_FOR_I16X16_8X8
@@ -745,19 +732,8 @@
return tx_type;
}
-void vp9_build_block_doffsets(MACROBLOCKD *xd);
void vp9_setup_block_dptrs(MACROBLOCKD *xd);
-static void update_blockd_bmi(MACROBLOCKD *xd) {
- const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
-
- if (mode == SPLITMV || mode == I8X8_PRED || mode == I4X4_PRED) {
- int i;
- for (i = 0; i < 16; i++)
- xd->block[i].bmi = xd->mode_info_context->bmi[i];
- }
-}
-
static TX_SIZE get_uv_tx_size(const MACROBLOCKD *xd) {
MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
const TX_SIZE size = mbmi->txfm_size;
diff --git a/vp9/common/vp9_mbpitch.c b/vp9/common/vp9_mbpitch.c
index 3a91852..8c05a34 100644
--- a/vp9/common/vp9_mbpitch.c
+++ b/vp9/common/vp9_mbpitch.c
@@ -11,51 +11,6 @@
#include "vp9/common/vp9_blockd.h"
-typedef enum {
- PRED = 0,
- DEST = 1
-} BLOCKSET;
-
-static void setup_block(BLOCKD *b, uint8_t **base, uint8_t **base2,
- int stride, int offset, BLOCKSET bs) {
- if (bs == DEST) {
- b->dst_stride = stride;
- b->dst = offset;
- b->base_dst = base;
- }
-}
-
-static void setup_macroblock(MACROBLOCKD *mb, BLOCKSET bs) {
- BLOCKD *blockd = mb->block;
- uint8_t **y, **u, **v, **y2, **u2, **v2;
- int i, stride;
-
- if (bs == DEST) {
- y = &mb->plane[0].dst.buf;
- u = &mb->plane[1].dst.buf;
- v = &mb->plane[2].dst.buf;
-
- y2 = NULL;
- u2 = NULL;
- v2 = NULL;
- }
-
- // luma
- stride = mb->plane[0].dst.stride;
- for (i = 0; i < 16; ++i) {
- const int offset = (i >> 2) * 4 * stride + (i & 3) * 4;
- setup_block(&blockd[i], y, y2, stride, offset, bs);
- }
-
- // chroma
- stride = mb->plane[1].dst.stride;
- for (i = 16; i < 20; i++) {
- const int offset = ((i - 16) >> 1) * 4 * stride + (i & 1) * 4;
- setup_block(&blockd[i], u, u2, stride, offset, bs);
- setup_block(&blockd[i + 4], v, v2, stride, offset, bs);
- }
-}
-
void vp9_setup_block_dptrs(MACROBLOCKD *mb) {
int i;
@@ -65,8 +20,3 @@
mb->plane[i].subsampling_y = !!i;
}
}
-
-void vp9_build_block_doffsets(MACROBLOCKD *mb) {
- // handle the destination pitch features
- setup_macroblock(mb, DEST);
-}
diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c
index 42cb1f4..483db07 100644
--- a/vp9/common/vp9_reconinter.c
+++ b/vp9/common/vp9_reconinter.c
@@ -307,18 +307,6 @@
return clamped_mv;
}
-// TODO(jkoleszar): In principle, nothing has to depend on this, but it's
-// currently required. Some users look at the mi->bmi, some look at the
-// xd->bmi.
-static void duplicate_splitmv_bmi(MACROBLOCKD *xd) {
- int i;
-
- for (i = 0; i < 16; i += 2) {
- xd->block[i + 0].bmi = xd->mode_info_context->bmi[i + 0];
- xd->block[i + 1].bmi = xd->mode_info_context->bmi[i + 1];
- }
-}
-
struct build_inter_predictors_args {
MACROBLOCKD *xd;
int x;
@@ -366,7 +354,7 @@
if (xd->mode_info_context->mbmi.mode == SPLITMV) {
if (plane == 0) {
- mv = &xd->block[block].bmi.as_mv[which_mv].as_mv;
+ mv = &xd->mode_info_context->bmi[block].as_mv[which_mv].as_mv;
} else {
const int y_block = (block & 2) * 4 + (block & 1) * 2;
split_chroma_mv.row = mi_mv_pred_row_q4(xd, y_block, which_mv);
@@ -410,11 +398,6 @@
{{xd->plane[0].pre[0].stride, 0, 0}, {xd->plane[0].pre[1].stride, 0, 0}},
};
- // TODO(jkoleszar): This is a hack no matter where you put it, but does it
- // belong here?
- if (xd->mode_info_context->mbmi.mode == SPLITMV)
- duplicate_splitmv_bmi(xd);
-
foreach_predicted_block_in_plane(xd, bsize, 0, build_inter_predictors, &args);
}
void vp9_build_inter_predictors_sbuv(MACROBLOCKD *xd,
diff --git a/vp9/common/vp9_reconintra.c b/vp9/common/vp9_reconintra.c
index 23fc552..a66e782 100644
--- a/vp9/common/vp9_reconintra.c
+++ b/vp9/common/vp9_reconintra.c
@@ -611,37 +611,31 @@
}
void vp9_intra8x8_predict(MACROBLOCKD *xd,
- BLOCKD *b,
+ int block4x4_idx,
int mode,
uint8_t *predictor, int pre_stride) {
- const int block4x4_idx = (b - xd->block);
const int block_idx = (block4x4_idx >> 2) | !!(block4x4_idx & 2);
const int have_top = (block_idx >> 1) || xd->up_available;
const int have_left = (block_idx & 1) || xd->left_available;
const int have_right = !(block_idx & 1) || xd->right_available;
- vp9_build_intra_predictors(*(b->base_dst) + b->dst,
- b->dst_stride, predictor, pre_stride,
+ vp9_build_intra_predictors(predictor, pre_stride,
+ predictor, pre_stride,
mode, 8, 8, have_top, have_left,
have_right);
}
void vp9_intra_uv4x4_predict(MACROBLOCKD *xd,
- BLOCKD *b,
+ int block4x4_idx,
int mode,
uint8_t *predictor, int pre_stride) {
- const int block_idx = (b - xd->block) & 3;
+ const int block_idx = block4x4_idx & 3;
const int have_top = (block_idx >> 1) || xd->up_available;
const int have_left = (block_idx & 1) || xd->left_available;
const int have_right = !(block_idx & 1) || xd->right_available;
- vp9_build_intra_predictors(*(b->base_dst) + b->dst,
- b->dst_stride, predictor, pre_stride,
+ vp9_build_intra_predictors(predictor, pre_stride,
+ predictor, pre_stride,
mode, 4, 4, have_top, have_left,
have_right);
}
-
-/* TODO: try different ways of use Y-UV mode correlation
- Current code assumes that a uv 4x4 block use same mode
- as corresponding Y 8x8 area
- */
diff --git a/vp9/common/vp9_reconintra.h b/vp9/common/vp9_reconintra.h
index e943596..21cd7ab 100644
--- a/vp9/common/vp9_reconintra.h
+++ b/vp9/common/vp9_reconintra.h
@@ -18,7 +18,8 @@
int stride, int n,
int tx, int ty);
-B_PREDICTION_MODE vp9_find_bpred_context(MACROBLOCKD *xd, BLOCKD *x);
+B_PREDICTION_MODE vp9_find_bpred_context(MACROBLOCKD *xd, int block,
+ uint8_t *ptr, int stride);
#if CONFIG_COMP_INTERINTRA_PRED
void vp9_build_interintra_predictors(MACROBLOCKD *xd,
diff --git a/vp9/common/vp9_reconintra4x4.c b/vp9/common/vp9_reconintra4x4.c
index 7f81b05..08a5fac 100644
--- a/vp9/common/vp9_reconintra4x4.c
+++ b/vp9/common/vp9_reconintra4x4.c
@@ -147,12 +147,10 @@
}
#endif
-B_PREDICTION_MODE vp9_find_bpred_context(MACROBLOCKD *xd, BLOCKD *x) {
- const int block_idx = x - xd->block;
+B_PREDICTION_MODE vp9_find_bpred_context(MACROBLOCKD *xd, int block_idx,
+ uint8_t *ptr, int stride) {
const int have_top = (block_idx >> 2) || xd->up_available;
const int have_left = (block_idx & 3) || xd->left_available;
- uint8_t *ptr = *(x->base_dst) + x->dst;
- int stride = x->dst_stride;
int tx = have_left ? 4 : 0;
int ty = have_top ? 4 : 0;
if (!have_left && !have_top)
@@ -162,12 +160,11 @@
#endif
void vp9_intra4x4_predict(MACROBLOCKD *xd,
- BLOCKD *x,
+ int block_idx,
int b_mode,
uint8_t *predictor,
int ps) {
int i, r, c;
- const int block_idx = x - xd->block;
const int have_top = (block_idx >> 2) || xd->up_available;
const int have_left = (block_idx & 3) || xd->left_available;
const int have_right = (block_idx & 3) != 3 || xd->right_available;
@@ -182,8 +179,8 @@
*/
if (have_left) {
- uint8_t *left_ptr = *(x->base_dst) + x->dst - 1;
- const int stride = x->dst_stride;
+ uint8_t *left_ptr = predictor - 1;
+ const int stride = ps;
left[0] = left_ptr[0 * stride];
left[1] = left_ptr[1 * stride];
@@ -194,7 +191,7 @@
}
if (have_top) {
- uint8_t *above_ptr = *(x->base_dst) + x->dst - x->dst_stride;
+ uint8_t *above_ptr = predictor - ps;
top_left = have_left ? above_ptr[-1] : 127;
above[0] = above_ptr[0];
@@ -213,10 +210,10 @@
uint8_t *above_right = above_ptr + 4;
if (xd->sb_index == 3 && (xd->mb_index & 1))
- above_right -= 32 * x->dst_stride;
+ above_right -= 32 * ps;
if (xd->mb_index == 3)
- above_right -= 16 * x->dst_stride;
- above_right -= (block_idx & ~3) * x->dst_stride;
+ above_right -= 16 * ps;
+ above_right -= (block_idx & ~3) * ps;
/* use a more distant above-right (from closest available top-right
* corner), but with a "localized DC" (similar'ish to TM-pred):
@@ -253,7 +250,7 @@
#if CONFIG_NEWBINTRAMODES
if (b_mode == B_CONTEXT_PRED)
- b_mode = x->bmi.as_mode.context;
+ b_mode = xd->mode_info_context->bmi[block_idx].as_mode.context;
#endif
switch (b_mode) {
diff --git a/vp9/common/vp9_rtcd_defs.sh b/vp9/common/vp9_rtcd_defs.sh
index 2460788..745cc69 100644
--- a/vp9/common/vp9_rtcd_defs.sh
+++ b/vp9/common/vp9_rtcd_defs.sh
@@ -8,7 +8,6 @@
#include "vp9/common/vp9_enums.h"
struct loop_filter_info;
-struct blockd;
struct macroblockd;
struct loop_filter_info;
@@ -95,13 +94,13 @@
prototype void vp9_build_intra_predictors_sbuv_s "struct macroblockd *x, enum BLOCK_SIZE_TYPE bsize"
specialize vp9_build_intra_predictors_sbuv_s
-prototype void vp9_intra4x4_predict "struct macroblockd *xd, struct blockd *x, int b_mode, uint8_t *predictor, int pre_stride"
+prototype void vp9_intra4x4_predict "struct macroblockd *xd, int block, int b_mode, uint8_t *predictor, int pre_stride"
specialize vp9_intra4x4_predict;
-prototype void vp9_intra8x8_predict "struct macroblockd *xd, struct blockd *x, int b_mode, uint8_t *predictor, int pre_stride"
+prototype void vp9_intra8x8_predict "struct macroblockd *xd, int block, int b_mode, uint8_t *predictor, int pre_stride"
specialize vp9_intra8x8_predict;
-prototype void vp9_intra_uv4x4_predict "struct macroblockd *xd, struct blockd *x, int b_mode, uint8_t *predictor, int pre_stride"
+prototype void vp9_intra_uv4x4_predict "struct macroblockd *xd, int block, int b_mode, uint8_t *predictor, int pre_stride"
specialize vp9_intra_uv4x4_predict;
if [ "$CONFIG_VP9_DECODER" = "yes" ]; then
@@ -591,16 +590,16 @@
#
# Motion search
#
-prototype int vp9_full_search_sad "struct macroblock *x, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, union int_mv *center_mv"
+prototype int vp9_full_search_sad "struct macroblock *x, union int_mv *ref_mv, int sad_per_bit, int distance, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, union int_mv *center_mv, int n"
specialize vp9_full_search_sad sse3 sse4_1
vp9_full_search_sad_sse3=vp9_full_search_sadx3
vp9_full_search_sad_sse4_1=vp9_full_search_sadx8
-prototype int vp9_refining_search_sad "struct macroblock *x, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, union int_mv *center_mv"
+prototype int vp9_refining_search_sad "struct macroblock *x, union int_mv *ref_mv, int sad_per_bit, int distance, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, union int_mv *center_mv"
specialize vp9_refining_search_sad sse3
vp9_refining_search_sad_sse3=vp9_refining_search_sadx4
-prototype int vp9_diamond_search_sad "struct macroblock *x, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, union int_mv *center_mv"
+prototype int vp9_diamond_search_sad "struct macroblock *x, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, union int_mv *center_mv"
specialize vp9_diamond_search_sad sse3
vp9_diamond_search_sad_sse3=vp9_diamond_search_sadx4
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index e00e951..246484c 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -1044,7 +1044,5 @@
for (y = 0; y < y_mbs; y++)
for (x = !y; x < x_mbs; x++)
mi[y * mis + x] = *mi;
- } else {
- update_blockd_bmi(xd);
}
}
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index efe4772..ad3a489 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -229,12 +229,14 @@
int ib = vp9_i8x8_block[i];
int idx = (ib & 0x02) ? (ib + 2) : ib;
int16_t *q = BLOCK_OFFSET(xd->plane[0].qcoeff, idx, 16);
- uint8_t *dst = *(xd->block[ib].base_dst) + xd->block[ib].dst;
+ uint8_t* const dst =
+ raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
+ xd->plane[0].dst.buf,
+ xd->plane[0].dst.stride);
int stride = xd->plane[0].dst.stride;
if (mode == I8X8_PRED) {
- BLOCKD *b = &xd->block[ib];
- int i8x8mode = b->bmi.as_mode.first;
- vp9_intra8x8_predict(xd, b, i8x8mode, dst, stride);
+ int i8x8mode = xd->mode_info_context->bmi[ib].as_mode.first;
+ vp9_intra8x8_predict(xd, ib, i8x8mode, dst, stride);
}
tx_type = get_tx_type_8x8(xd, ib);
vp9_iht_add_8x8_c(tx_type, q, dst, stride, xd->plane[0].eobs[idx]);
@@ -249,21 +251,25 @@
int i;
for (i = 0; i < 4; i++) {
int ib = vp9_i8x8_block[i];
- BLOCKD *b = &xd->block[ib];
- int i8x8mode = b->bmi.as_mode.first;
+ int i8x8mode = xd->mode_info_context->bmi[ib].as_mode.first;
+ uint8_t* dst;
- b = &xd->block[16 + i];
- vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst,
- b->dst_stride);
+ dst = raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 1, i,
+ xd->plane[1].dst.buf,
+ xd->plane[1].dst.stride);
+ vp9_intra_uv4x4_predict(xd, 16 + i, i8x8mode,
+ dst, xd->plane[1].dst.stride);
xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, i, 16),
- *(b->base_dst) + b->dst, b->dst_stride,
+ dst, xd->plane[1].dst.stride,
xd->plane[1].eobs[i]);
- b = &xd->block[20 + i];
- vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst,
- b->dst_stride);
+ dst = raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 2, i,
+ xd->plane[2].dst.buf,
+ xd->plane[1].dst.stride);
+ vp9_intra_uv4x4_predict(xd, 20 + i, i8x8mode,
+ dst, xd->plane[1].dst.stride);
xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, i, 16),
- *(b->base_dst) + b->dst, b->dst_stride,
+ dst, xd->plane[1].dst.stride,
xd->plane[2].eobs[i]);
}
} else if (mode == SPLITMV) {
@@ -281,14 +287,16 @@
}
static INLINE void dequant_add_y(MACROBLOCKD *xd, TX_TYPE tx_type, int idx) {
- BLOCKD *const b = &xd->block[idx];
struct macroblockd_plane *const y = &xd->plane[0];
+ uint8_t* const dst = raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, idx,
+ xd->plane[0].dst.buf,
+ xd->plane[0].dst.stride);
if (tx_type != DCT_DCT) {
vp9_iht_add_c(tx_type, BLOCK_OFFSET(y->qcoeff, idx, 16),
- *(b->base_dst) + b->dst, b->dst_stride, y->eobs[idx]);
+ dst, xd->plane[0].dst.stride, y->eobs[idx]);
} else {
- xd->itxm_add(BLOCK_OFFSET(y->qcoeff, idx, 16), *(b->base_dst) + b->dst,
- b->dst_stride, y->eobs[idx]);
+ xd->itxm_add(BLOCK_OFFSET(y->qcoeff, idx, 16),
+ dst, xd->plane[0].dst.stride, y->eobs[idx]);
}
}
@@ -302,39 +310,48 @@
int ib = vp9_i8x8_block[i];
const int iblock[4] = {0, 1, 4, 5};
int j;
- BLOCKD *b = &xd->block[ib];
- int i8x8mode = b->bmi.as_mode.first;
- vp9_intra8x8_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst,
- b->dst_stride);
+ uint8_t* dst;
+ int i8x8mode = xd->mode_info_context->bmi[ib].as_mode.first;
+
+ dst = raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
+ xd->plane[0].dst.buf,
+ xd->plane[0].dst.stride);
+ vp9_intra8x8_predict(xd, ib, i8x8mode, dst, xd->plane[0].dst.stride);
for (j = 0; j < 4; j++) {
tx_type = get_tx_type_4x4(xd, ib + iblock[j]);
dequant_add_y(xd, tx_type, ib + iblock[j]);
}
- b = &xd->block[16 + i];
- vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst,
- b->dst_stride);
+ dst = raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 1, i,
+ xd->plane[1].dst.buf,
+ xd->plane[1].dst.stride);
+ vp9_intra_uv4x4_predict(xd, 16 + i, i8x8mode,
+ dst, xd->plane[1].dst.stride);
xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, i, 16),
- *(b->base_dst) + b->dst, b->dst_stride,
+ dst, xd->plane[1].dst.stride,
xd->plane[1].eobs[i]);
- b = &xd->block[20 + i];
- vp9_intra_uv4x4_predict(xd, b, i8x8mode, *(b->base_dst) + b->dst,
- b->dst_stride);
+ dst = raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 2, i,
+ xd->plane[2].dst.buf,
+ xd->plane[2].dst.stride);
+ vp9_intra_uv4x4_predict(xd, 20 + i, i8x8mode,
+ dst, xd->plane[1].dst.stride);
xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, i, 16),
- *(b->base_dst) + b->dst, b->dst_stride,
+ dst, xd->plane[1].dst.stride,
xd->plane[2].eobs[i]);
}
} else if (mode == I4X4_PRED) {
for (i = 0; i < 16; i++) {
- BLOCKD *b = &xd->block[i];
int b_mode = xd->mode_info_context->bmi[i].as_mode.first;
+ uint8_t* dst;
+ dst = raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, i,
+ xd->plane[0].dst.buf,
+ xd->plane[0].dst.stride);
#if CONFIG_NEWBINTRAMODES
- xd->mode_info_context->bmi[i].as_mode.context = b->bmi.as_mode.context =
- vp9_find_bpred_context(xd, b);
+ xd->mode_info_context->bmi[i].as_mode.context =
+ vp9_find_bpred_context(xd, i, dst, xd->plane[0].dst.stride);
if (!xd->mode_info_context->mbmi.mb_skip_coeff)
vp9_decode_coefs_4x4(pbi, xd, r, PLANE_TYPE_Y_WITH_DC, i);
#endif
- vp9_intra4x4_predict(xd, b, b_mode, *(b->base_dst) + b->dst,
- b->dst_stride);
+ vp9_intra4x4_predict(xd, i, b_mode, dst, xd->plane[0].dst.stride);
tx_type = get_tx_type_4x4(xd, i);
dequant_add_y(xd, tx_type, i);
}
@@ -1541,7 +1558,6 @@
vp9_setup_intra_recon(new_fb);
vp9_setup_block_dptrs(xd);
- vp9_build_block_doffsets(xd);
// clear out the coeff buffer
vpx_memset(xd->plane[0].qcoeff, 0, sizeof(xd->plane[0].qcoeff));
diff --git a/vp9/encoder/vp9_asm_enc_offsets.c b/vp9/encoder/vp9_asm_enc_offsets.c
new file mode 100644
index 0000000..921e8f0
--- /dev/null
+++ b/vp9/encoder/vp9_asm_enc_offsets.c
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+
+#include "vpx_ports/asm_offsets.h"
+
+BEGIN
+
+
+END
diff --git a/vp9/encoder/vp9_block.h b/vp9/encoder/vp9_block.h
index a688001..2c06457 100644
--- a/vp9/encoder/vp9_block.h
+++ b/vp9/encoder/vp9_block.h
@@ -155,7 +155,8 @@
void (*fwd_txm8x4)(int16_t *input, int16_t *output, int pitch);
void (*fwd_txm8x8)(int16_t *input, int16_t *output, int pitch);
void (*fwd_txm16x16)(int16_t *input, int16_t *output, int pitch);
- void (*quantize_b_4x4)(MACROBLOCK *x, int b_idx, int y_blocks);
+ void (*quantize_b_4x4)(MACROBLOCK *x, int b_idx, TX_TYPE tx_type,
+ int y_blocks);
void (*quantize_b_4x4_pair)(MACROBLOCK *x, int b_idx1, int b_idx2,
int y_blocks);
void (*quantize_b_16x16)(MACROBLOCK *x, int b_idx, TX_TYPE tx_type,
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index dbadcfc..1436566 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -383,16 +383,7 @@
ctx->txfm_rd_diff[ALLOW_32X32] = ctx->txfm_rd_diff[ALLOW_16X16];
}
- if (mb_mode == I4X4_PRED) {
- for (i = 0; i < 16; i++) {
- xd->block[i].bmi.as_mode = xd->mode_info_context->bmi[i].as_mode;
- assert(xd->block[i].bmi.as_mode.first < B_MODE_COUNT);
- }
- } else if (mb_mode == I8X8_PRED) {
- for (i = 0; i < 16; i++) {
- xd->block[i].bmi = xd->mode_info_context->bmi[i];
- }
- } else if (mb_mode == SPLITMV) {
+ if (mb_mode == SPLITMV) {
vpx_memcpy(x->partition_info, &ctx->partition_info,
sizeof(PARTITION_INFO));
@@ -1788,7 +1779,6 @@
}
void vp9_build_block_offsets(MACROBLOCK *x) {
- vp9_build_block_doffsets(&x->e_mbd);
}
static void sum_intra_stats(VP9_COMP *cpi, MACROBLOCK *x) {
@@ -1828,15 +1818,15 @@
if (m != I8X8_PRED)
++cpi->y_uv_mode_count[m][uvm];
else {
- cpi->i8x8_mode_count[xd->block[0].bmi.as_mode.first]++;
- cpi->i8x8_mode_count[xd->block[2].bmi.as_mode.first]++;
- cpi->i8x8_mode_count[xd->block[8].bmi.as_mode.first]++;
- cpi->i8x8_mode_count[xd->block[10].bmi.as_mode.first]++;
+ cpi->i8x8_mode_count[xd->mode_info_context->bmi[0].as_mode.first]++;
+ cpi->i8x8_mode_count[xd->mode_info_context->bmi[2].as_mode.first]++;
+ cpi->i8x8_mode_count[xd->mode_info_context->bmi[8].as_mode.first]++;
+ cpi->i8x8_mode_count[xd->mode_info_context->bmi[10].as_mode.first]++;
}
if (m == I4X4_PRED) {
int b = 0;
do {
- int m = xd->block[b].bmi.as_mode.first;
+ int m = xd->mode_info_context->bmi[b].as_mode.first;
#if CONFIG_NEWBINTRAMODES
if (m == B_CONTEXT_PRED) m -= CONTEXT_PRED_REPLACEMENTS;
#endif
diff --git a/vp9/encoder/vp9_encodeintra.c b/vp9/encoder/vp9_encodeintra.c
index 5618bdc..54c4f36 100644
--- a/vp9/encoder/vp9_encodeintra.c
+++ b/vp9/encoder/vp9_encodeintra.c
@@ -32,7 +32,7 @@
int i;
for (i = 0; i < 16; i++) {
- x->e_mbd.block[i].bmi.as_mode.first = B_DC_PRED;
+ x->e_mbd.mode_info_context->bmi[i].as_mode.first = B_DC_PRED;
encode_intra4x4block(x, i);
}
}
@@ -41,12 +41,14 @@
}
static void encode_intra4x4block(MACROBLOCK *x, int ib) {
- BLOCKD *b = &x->e_mbd.block[ib];
MACROBLOCKD * const xd = &x->e_mbd;
TX_TYPE tx_type;
uint8_t* const src =
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
x->plane[0].src.buf, x->plane[0].src.stride);
+ uint8_t* const dst =
+ raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
+ xd->plane[0].dst.buf, xd->plane[0].dst.stride);
int16_t* const src_diff =
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
x->plane[0].src_diff);
@@ -58,31 +60,32 @@
assert(ib < 16);
#if CONFIG_NEWBINTRAMODES
- b->bmi.as_mode.context = vp9_find_bpred_context(&x->e_mbd, b);
+ xd->mode_info_context->bmi[ib].as_mode.context =
+ vp9_find_bpred_context(&x->e_mbd, ib, dst, xd->plane[0].dst.stride);
#endif
- vp9_intra4x4_predict(&x->e_mbd, b, b->bmi.as_mode.first,
- *(b->base_dst) + b->dst, b->dst_stride);
+ vp9_intra4x4_predict(&x->e_mbd, ib,
+ xd->mode_info_context->bmi[ib].as_mode.first,
+ dst, xd->plane[0].dst.stride);
vp9_subtract_block(4, 4, src_diff, 16,
src, x->plane[0].src.stride,
- *(b->base_dst) + b->dst, b->dst_stride);
+ dst, xd->plane[0].dst.stride);
tx_type = get_tx_type_4x4(&x->e_mbd, ib);
if (tx_type != DCT_DCT) {
vp9_short_fht4x4(src_diff, coeff, 16, tx_type);
- vp9_ht_quantize_b_4x4(x, ib, tx_type);
+ x->quantize_b_4x4(x, ib, tx_type, 16);
vp9_short_iht4x4(BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
diff, 16, tx_type);
} else {
x->fwd_txm4x4(src_diff, coeff, 32);
- x->quantize_b_4x4(x, ib, 16);
+ x->quantize_b_4x4(x, ib, tx_type, 16);
vp9_inverse_transform_b_4x4(&x->e_mbd, xd->plane[0].eobs[ib],
BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
diff, 32);
}
- vp9_recon_b(*(b->base_dst) + b->dst, diff,
- *(b->base_dst) + b->dst, b->dst_stride);
+ vp9_recon_b(dst, diff, dst, xd->plane[0].dst.stride);
}
void vp9_encode_intra4x4mby(MACROBLOCK *mb) {
@@ -155,7 +158,6 @@
void vp9_encode_intra8x8(MACROBLOCK *x, int ib) {
MACROBLOCKD *xd = &x->e_mbd;
- BLOCKD *b = &xd->block[ib];
uint8_t* const src =
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
x->plane[0].src.buf, x->plane[0].src.stride);
@@ -165,16 +167,19 @@
int16_t* const diff =
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
xd->plane[0].diff);
+ uint8_t* const dst =
+ raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
+ xd->plane[0].dst.buf, xd->plane[0].dst.stride);
const int iblock[4] = {0, 1, 4, 5};
int i;
TX_TYPE tx_type;
- vp9_intra8x8_predict(xd, b, b->bmi.as_mode.first,
- *(b->base_dst) + b->dst, b->dst_stride);
+ vp9_intra8x8_predict(xd, ib, xd->mode_info_context->bmi[ib].as_mode.first,
+ dst, xd->plane[0].dst.stride);
// generate residual blocks
vp9_subtract_block(8, 8, src_diff, 16,
src, x->plane[0].src.stride,
- *(b->base_dst) + b->dst, b->dst_stride);
+ dst, xd->plane[0].dst.stride);
if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
int idx = (ib & 0x02) ? (ib + 2) : ib;
@@ -205,11 +210,10 @@
xd->plane[0].diff);
assert(idx < 16);
- b = &xd->block[ib + iblock[i]];
tx_type = get_tx_type_4x4(xd, ib + iblock[i]);
if (tx_type != DCT_DCT) {
vp9_short_fht4x4(src_diff, coeff, 16, tx_type);
- vp9_ht_quantize_b_4x4(x, ib + iblock[i], tx_type);
+ x->quantize_b_4x4(x, ib + iblock[i], tx_type, 16);
vp9_short_iht4x4(dqcoeff, diff, 16, tx_type);
} else if (!(i & 1) &&
get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) {
@@ -222,7 +226,7 @@
i++;
} else {
x->fwd_txm4x4(src_diff, coeff, 32);
- x->quantize_b_4x4(x, ib + iblock[i], 16);
+ x->quantize_b_4x4(x, ib + iblock[i], tx_type, 16);
vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i]],
dqcoeff, diff, 32);
}
@@ -234,9 +238,11 @@
int16_t* const diff =
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib + iblock[i],
xd->plane[0].diff);
- b = &xd->block[ib + iblock[i]];
- vp9_recon_b_c(*(b->base_dst) + b->dst, diff, *(b->base_dst) + b->dst,
- b->dst_stride);
+ uint8_t* const dst =
+ raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib + iblock[i],
+ xd->plane[0].dst.buf,
+ xd->plane[0].dst.stride);
+ vp9_recon_b_c(dst, diff, dst, xd->plane[0].dst.stride);
}
}
@@ -249,7 +255,6 @@
static void encode_intra_uv4x4(MACROBLOCK *x, int ib, int mode) {
MACROBLOCKD * const xd = &x->e_mbd;
- BLOCKD *b = &x->e_mbd.block[ib];
int16_t * const dqcoeff = MB_SUBBLOCK_FIELD(xd, dqcoeff, ib);
int16_t* const coeff = MB_SUBBLOCK_FIELD(x, coeff, ib);
const int plane = ib < 20 ? 1 : 2;
@@ -264,31 +269,33 @@
int16_t* const diff =
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, plane, block,
xd->plane[plane].diff);
+ uint8_t* const dst =
+ raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, plane, block,
+ xd->plane[plane].dst.buf,
+ xd->plane[plane].dst.stride);
assert(ib >= 16 && ib < 24);
- vp9_intra_uv4x4_predict(&x->e_mbd, b, mode,
- *(b->base_dst) + b->dst, b->dst_stride);
+ vp9_intra_uv4x4_predict(&x->e_mbd, ib, mode,
+ dst, xd->plane[plane].dst.stride);
assert(xd->plane[1].subsampling_x == 1);
vp9_subtract_block(4, 4, src_diff, 8,
src, x->plane[plane].src.stride,
- *(b->base_dst) + b->dst, b->dst_stride);
+ dst, xd->plane[plane].dst.stride);
x->fwd_txm4x4(src_diff, coeff, 16);
- x->quantize_b_4x4(x, ib, 16);
+ x->quantize_b_4x4(x, ib, DCT_DCT, 16);
vp9_inverse_transform_b_4x4(&x->e_mbd, xd->plane[plane].eobs[block],
dqcoeff, diff, 16);
- vp9_recon_uv_b_c(*(b->base_dst) + b->dst, diff, *(b->base_dst) + b->dst,
- b->dst_stride);
+ vp9_recon_uv_b_c(dst, diff, dst, xd->plane[plane].dst.stride);
}
void vp9_encode_intra8x8mbuv(MACROBLOCK *x) {
int i;
for (i = 0; i < 4; i++) {
- BLOCKD *b = &x->e_mbd.block[vp9_i8x8_block[i]];
- int mode = b->bmi.as_mode.first;
+ int mode = x->e_mbd.mode_info_context->bmi[vp9_i8x8_block[i]].as_mode.first;
encode_intra_uv4x4(x, i + 16, mode); // u
encode_intra_uv4x4(x, i + 20, mode); // v
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index a83669a..607cd99 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -363,7 +363,6 @@
YV12_BUFFER_CONFIG *recon_buffer,
int *best_motion_err, int recon_yoffset) {
MACROBLOCKD *const xd = &x->e_mbd;
- BLOCKD *d = &x->e_mbd.block[0];
int num00;
int_mv tmp_mv;
@@ -399,7 +398,7 @@
tmp_mv.as_int = 0;
ref_mv_full.as_mv.col = ref_mv->as_mv.col >> 3;
ref_mv_full.as_mv.row = ref_mv->as_mv.row >> 3;
- tmp_err = cpi->diamond_search_sad(x, d, &ref_mv_full, &tmp_mv, step_param,
+ tmp_err = cpi->diamond_search_sad(x, &ref_mv_full, &tmp_mv, step_param,
x->sadperbit16, &num00, &v_fn_ptr,
x->nmvjointcost,
x->mvcost, ref_mv);
@@ -422,7 +421,7 @@
if (num00)
num00--;
else {
- tmp_err = cpi->diamond_search_sad(x, d, &ref_mv_full, &tmp_mv,
+ tmp_err = cpi->diamond_search_sad(x, &ref_mv_full, &tmp_mv,
step_param + n, x->sadperbit16,
&num00, &v_fn_ptr,
x->nmvjointcost,
diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c
index 7e67b6b..27e9ece 100644
--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -25,11 +25,9 @@
int mb_col) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
- BLOCKD *d = &xd->block[0];
vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
unsigned int best_err;
-
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
@@ -47,7 +45,7 @@
/*cpi->sf.search_method == HEX*/
best_err = vp9_hex_search(
- x, d,
+ x,
&ref_full, dst_mv,
step_param,
x->errorperbit,
@@ -62,7 +60,7 @@
int distortion;
unsigned int sse;
best_err = cpi->find_fractional_mv_step(
- x, d,
+ x,
dst_mv, ref_mv,
x->errorperbit, &v_fn_ptr,
NULL, NULL,
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index 607e456..74caba5 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -239,7 +239,7 @@
}, \
v = INT_MAX;)
-int vp9_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCKD *d,
+int vp9_find_best_sub_pixel_step_iteratively(MACROBLOCK *x,
int_mv *bestmv, int_mv *ref_mv,
int error_per_bit,
const vp9_variance_fn_ptr_t *vfp,
@@ -421,7 +421,7 @@
#undef MIN
#undef MAX
-int vp9_find_best_sub_pixel_step(MACROBLOCK *x, BLOCKD *d,
+int vp9_find_best_sub_pixel_step(MACROBLOCK *x,
int_mv *bestmv, int_mv *ref_mv,
int error_per_bit,
const vp9_variance_fn_ptr_t *vfp,
@@ -924,7 +924,7 @@
#undef SP
-int vp9_find_best_half_pixel_step(MACROBLOCK *x, BLOCKD *d,
+int vp9_find_best_half_pixel_step(MACROBLOCK *x,
int_mv *bestmv, int_mv *ref_mv,
int error_per_bit,
const vp9_variance_fn_ptr_t *vfp,
@@ -1096,7 +1096,6 @@
int vp9_hex_search
(
MACROBLOCK *x,
- BLOCKD *d,
int_mv *ref_mv,
int_mv *best_mv,
int search_param,
@@ -1250,7 +1249,7 @@
#undef CHECK_POINT
#undef CHECK_BETTER
-int vp9_diamond_search_sad_c(MACROBLOCK *x, BLOCKD *d,
+int vp9_diamond_search_sad_c(MACROBLOCK *x,
int_mv *ref_mv, int_mv *best_mv,
int search_param, int sad_per_bit, int *num00,
vp9_variance_fn_ptr_t *fn_ptr, int *mvjcost,
@@ -1361,7 +1360,7 @@
xd->allow_high_precision_mv);
}
-int vp9_diamond_search_sadx4(MACROBLOCK *x, BLOCKD *d,
+int vp9_diamond_search_sadx4(MACROBLOCK *x,
int_mv *ref_mv, int_mv *best_mv, int search_param,
int sad_per_bit, int *num00,
vp9_variance_fn_ptr_t *fn_ptr,
@@ -1512,13 +1511,13 @@
point as the best match, we will do a final 1-away diamond
refining search */
int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
- BLOCKD *d, int_mv *mvp_full, int step_param,
+ int_mv *mvp_full, int step_param,
int sadpb, int further_steps,
int do_refine, vp9_variance_fn_ptr_t *fn_ptr,
int_mv *ref_mv, int_mv *dst_mv) {
int_mv temp_mv;
int thissme, n, num00;
- int bestsme = cpi->diamond_search_sad(x, d, mvp_full, &temp_mv,
+ int bestsme = cpi->diamond_search_sad(x, mvp_full, &temp_mv,
step_param, sadpb, &num00,
fn_ptr, x->nmvjointcost,
x->mvcost, ref_mv);
@@ -1537,7 +1536,7 @@
if (num00)
num00--;
else {
- thissme = cpi->diamond_search_sad(x, d, mvp_full, &temp_mv,
+ thissme = cpi->diamond_search_sad(x, mvp_full, &temp_mv,
step_param + n, sadpb, &num00,
fn_ptr, x->nmvjointcost, x->mvcost,
ref_mv);
@@ -1558,7 +1557,7 @@
int search_range = 8;
int_mv best_mv;
best_mv.as_int = dst_mv->as_int;
- thissme = cpi->refining_search_sad(x, d, &best_mv, sadpb, search_range,
+ thissme = cpi->refining_search_sad(x, &best_mv, sadpb, search_range,
fn_ptr, x->nmvjointcost, x->mvcost,
ref_mv);
@@ -1570,11 +1569,11 @@
return bestsme;
}
-int vp9_full_search_sad_c(MACROBLOCK *x, BLOCKD *d, int_mv *ref_mv,
+int vp9_full_search_sad_c(MACROBLOCK *x, int_mv *ref_mv,
int sad_per_bit, int distance,
vp9_variance_fn_ptr_t *fn_ptr, int *mvjcost,
int *mvcost[2],
- int_mv *center_mv) {
+ int_mv *center_mv, int n) {
const MACROBLOCKD* const xd = &x->e_mbd;
uint8_t *what = x->plane[0].src.buf;
int what_stride = x->plane[0].src.stride;
@@ -1582,7 +1581,7 @@
int in_what_stride = xd->plane[0].pre[0].stride;
int mv_stride = xd->plane[0].pre[0].stride;
uint8_t *bestaddress;
- int_mv *best_mv = &d->bmi.as_mv[0];
+ int_mv *best_mv = &x->e_mbd.mode_info_context->bmi[n].as_mv[0];
int_mv this_mv;
int bestsad = INT_MAX;
int r, c;
@@ -1666,10 +1665,10 @@
return INT_MAX;
}
-int vp9_full_search_sadx3(MACROBLOCK *x, BLOCKD *d, int_mv *ref_mv,
+int vp9_full_search_sadx3(MACROBLOCK *x, int_mv *ref_mv,
int sad_per_bit, int distance,
vp9_variance_fn_ptr_t *fn_ptr, int *mvjcost,
- int *mvcost[2], int_mv *center_mv) {
+ int *mvcost[2], int_mv *center_mv, int n) {
const MACROBLOCKD* const xd = &x->e_mbd;
uint8_t *what = x->plane[0].src.buf;
int what_stride = x->plane[0].src.stride;
@@ -1677,7 +1676,7 @@
int in_what_stride = xd->plane[0].pre[0].stride;
int mv_stride = xd->plane[0].pre[0].stride;
uint8_t *bestaddress;
- int_mv *best_mv = &d->bmi.as_mv[0];
+ int_mv *best_mv = &x->e_mbd.mode_info_context->bmi[n].as_mv[0];
int_mv this_mv;
unsigned int bestsad = INT_MAX;
int r, c;
@@ -1794,11 +1793,11 @@
return INT_MAX;
}
-int vp9_full_search_sadx8(MACROBLOCK *x, BLOCKD *d, int_mv *ref_mv,
+int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
int sad_per_bit, int distance,
vp9_variance_fn_ptr_t *fn_ptr,
int *mvjcost, int *mvcost[2],
- int_mv *center_mv) {
+ int_mv *center_mv, int n) {
const MACROBLOCKD* const xd = &x->e_mbd;
uint8_t *what = x->plane[0].src.buf;
int what_stride = x->plane[0].src.stride;
@@ -1806,7 +1805,7 @@
int in_what_stride = xd->plane[0].pre[0].stride;
int mv_stride = xd->plane[0].pre[0].stride;
uint8_t *bestaddress;
- int_mv *best_mv = &d->bmi.as_mv[0];
+ int_mv *best_mv = &x->e_mbd.mode_info_context->bmi[n].as_mv[0];
int_mv this_mv;
unsigned int bestsad = INT_MAX;
int r, c;
@@ -1948,7 +1947,7 @@
else
return INT_MAX;
}
-int vp9_refining_search_sad_c(MACROBLOCK *x, BLOCKD *d,
+int vp9_refining_search_sad_c(MACROBLOCK *x,
int_mv *ref_mv, int error_per_bit,
int search_range, vp9_variance_fn_ptr_t *fn_ptr,
int *mvjcost, int *mvcost[2], int_mv *center_mv) {
@@ -2026,7 +2025,7 @@
return INT_MAX;
}
-int vp9_refining_search_sadx4(MACROBLOCK *x, BLOCKD *d,
+int vp9_refining_search_sadx4(MACROBLOCK *x,
int_mv *ref_mv, int error_per_bit,
int search_range, vp9_variance_fn_ptr_t *fn_ptr,
int *mvjcost, int *mvcost[2], int_mv *center_mv) {
diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h
index 8125814..e1ba7fd 100644
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -38,12 +38,12 @@
// Runs sequence of diamond searches in smaller steps for RD
struct VP9_COMP;
int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x,
- BLOCKD *d, int_mv *mvp_full, int step_param,
+ int_mv *mvp_full, int step_param,
int sadpb, int further_steps, int do_refine,
vp9_variance_fn_ptr_t *fn_ptr,
int_mv *ref_mv, int_mv *dst_mv);
-int vp9_hex_search(MACROBLOCK *x, BLOCKD *d,
+int vp9_hex_search(MACROBLOCK *x,
int_mv *ref_mv, int_mv *best_mv,
int search_param, int error_per_bit,
const vp9_variance_fn_ptr_t *vf,
@@ -51,27 +51,27 @@
int *mvjcost, int *mvcost[2],
int_mv *center_mv);
-typedef int (fractional_mv_step_fp) (MACROBLOCK *x, BLOCKD *d, int_mv
+typedef int (fractional_mv_step_fp) (MACROBLOCK *x, int_mv
*bestmv, int_mv *ref_mv, int error_per_bit, const vp9_variance_fn_ptr_t *vfp,
int *mvjcost, int *mvcost[2], int *distortion, unsigned int *sse);
extern fractional_mv_step_fp vp9_find_best_sub_pixel_step_iteratively;
extern fractional_mv_step_fp vp9_find_best_sub_pixel_step;
extern fractional_mv_step_fp vp9_find_best_half_pixel_step;
-typedef int (*vp9_full_search_fn_t)(MACROBLOCK *x, BLOCKD *d,
+typedef int (*vp9_full_search_fn_t)(MACROBLOCK *x,
int_mv *ref_mv, int sad_per_bit,
int distance, vp9_variance_fn_ptr_t *fn_ptr,
int *mvjcost, int *mvcost[2],
- int_mv *center_mv);
+ int_mv *center_mv, int n);
-typedef int (*vp9_refining_search_fn_t)(MACROBLOCK *x, BLOCKD *d,
+typedef int (*vp9_refining_search_fn_t)(MACROBLOCK *x,
int_mv *ref_mv, int sad_per_bit,
int distance,
vp9_variance_fn_ptr_t *fn_ptr,
int *mvjcost, int *mvcost[2],
int_mv *center_mv);
-typedef int (*vp9_diamond_search_fn_t)(MACROBLOCK *x, BLOCKD *d,
+typedef int (*vp9_diamond_search_fn_t)(MACROBLOCK *x,
int_mv *ref_mv, int_mv *best_mv,
int search_param, int sad_per_bit,
int *num00,
diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c
index 3c60af7..ece1318 100644
--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -26,209 +26,6 @@
plane == 1 ? 16 : 20;
}
-void vp9_ht_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) {
- MACROBLOCKD *const xd = &mb->e_mbd;
- int i, rc, eob;
- int zbin;
- int x, y, z, sz;
- int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[0].coeff, b_idx, 16);
- // ht is luma-only
- int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[0].qcoeff, b_idx, 16);
- int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[0].dqcoeff, b_idx, 16);
- int16_t *zbin_boost_ptr = mb->plane[0].zrun_zbin_boost;
- int16_t *zbin_ptr = mb->plane[0].zbin;
- int16_t *round_ptr = mb->plane[0].round;
- int16_t *quant_ptr = mb->plane[0].quant;
- uint8_t *quant_shift_ptr = mb->plane[0].quant_shift;
- int16_t *dequant_ptr = xd->plane[0].dequant;
- int zbin_oq_value = mb->plane[0].zbin_extra;
- const int *pt_scan = get_scan_4x4(tx_type);
-
- vpx_memset(qcoeff_ptr, 0, 32);
- vpx_memset(dqcoeff_ptr, 0, 32);
-
- eob = -1;
-
- if (!mb->skip_block) {
- for (i = 0; i < 16; i++) {
- rc = pt_scan[i];
- z = coeff_ptr[rc];
-
- zbin = zbin_ptr[rc] + *zbin_boost_ptr + zbin_oq_value;
- zbin_boost_ptr++;
-
- sz = (z >> 31); // sign of z
- x = (z ^ sz) - sz; // x = abs(z)
-
- if (x >= zbin) {
- x += round_ptr[rc];
- y = (((x * quant_ptr[rc]) >> 16) + x)
- >> quant_shift_ptr[rc]; // quantize (x)
- x = (y ^ sz) - sz; // get the sign back
- qcoeff_ptr[rc] = x; // write to destination
- dqcoeff_ptr[rc] = x * dequant_ptr[rc]; // dequantized value
-
- if (y) {
- eob = i; // last nonzero coeffs
- zbin_boost_ptr = mb->plane[0].zrun_zbin_boost; // reset zero run len
- }
- }
- }
- }
-
- xd->plane[0].eobs[b_idx] = eob + 1;
-}
-
-void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx, int y_blocks) {
- MACROBLOCKD *const xd = &mb->e_mbd;
- const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
- const int c_idx = plane_idx(pb_idx.plane);
- int i, rc, eob;
- int zbin;
- int x, y, z, sz;
- int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff,
- pb_idx.block, 16);
- int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff,
- pb_idx.block, 16);
- int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff,
- pb_idx.block, 16);
- int16_t *zbin_boost_ptr = mb->plane[pb_idx.plane].zrun_zbin_boost;
- int16_t *zbin_ptr = mb->plane[pb_idx.plane].zbin;
- int16_t *round_ptr = mb->plane[pb_idx.plane].round;
- int16_t *quant_ptr = mb->plane[pb_idx.plane].quant;
- uint8_t *quant_shift_ptr = mb->plane[pb_idx.plane].quant_shift;
- int16_t *dequant_ptr = xd->plane[0].dequant;
- int zbin_oq_value = mb->plane[pb_idx.plane].zbin_extra;
-
- if (c_idx == 0) assert(pb_idx.plane == 0);
- if (c_idx == 16) assert(pb_idx.plane == 1);
- if (c_idx == 20) assert(pb_idx.plane == 2);
- vpx_memset(qcoeff_ptr, 0, 32);
- vpx_memset(dqcoeff_ptr, 0, 32);
-
- eob = -1;
-
- if (!mb->skip_block) {
- for (i = 0; i < 16; i++) {
- rc = vp9_default_zig_zag1d_4x4[i];
- z = coeff_ptr[rc];
-
- zbin = zbin_ptr[rc] + *zbin_boost_ptr + zbin_oq_value;
- zbin_boost_ptr++;
-
- sz = (z >> 31); // sign of z
- x = (z ^ sz) - sz; // x = abs(z)
-
- if (x >= zbin) {
- x += round_ptr[rc];
-
- y = (((x * quant_ptr[rc]) >> 16) + x)
- >> quant_shift_ptr[rc]; // quantize (x)
- x = (y ^ sz) - sz; // get the sign back
- qcoeff_ptr[rc] = x; // write to destination
- dqcoeff_ptr[rc] = x * dequant_ptr[rc]; // dequantized value
-
- if (y) {
- eob = i; // last nonzero coeffs
- zbin_boost_ptr = mb->plane[pb_idx.plane].zrun_zbin_boost;
- }
- }
- }
- }
-
- xd->plane[pb_idx.plane].eobs[pb_idx.block] = eob + 1;
-}
-
-void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
- int y_blocks) {
- MACROBLOCKD *const xd = &mb->e_mbd;
- const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
- const int c_idx = plane_idx(pb_idx.plane);
- int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff,
- pb_idx.block, 16);
- int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff,
- pb_idx.block, 16);
- int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff,
- pb_idx.block, 16);
- const int *pt_scan = get_scan_8x8(tx_type);
-
- if (c_idx == 0) assert(pb_idx.plane == 0);
- if (c_idx == 16) assert(pb_idx.plane == 1);
- if (c_idx == 20) assert(pb_idx.plane == 2);
- vpx_memset(qcoeff_ptr, 0, 64 * sizeof(int16_t));
- vpx_memset(dqcoeff_ptr, 0, 64 * sizeof(int16_t));
-
- if (!mb->skip_block) {
- int i, rc, eob;
- int zbin;
- int x, y, z, sz;
- int zero_run;
- int16_t *zbin_boost_ptr = mb->plane[pb_idx.plane].zrun_zbin_boost;
- int16_t *zbin_ptr = mb->plane[pb_idx.plane].zbin;
- int16_t *round_ptr = mb->plane[pb_idx.plane].round;
- int16_t *quant_ptr = mb->plane[pb_idx.plane].quant;
- uint8_t *quant_shift_ptr = mb->plane[pb_idx.plane].quant_shift;
- int16_t *dequant_ptr = xd->plane[pb_idx.plane].dequant;
- int zbin_oq_value = mb->plane[pb_idx.plane].zbin_extra;
-
- eob = -1;
-
- // Special case for DC as it is the one triggering access in various
- // tables: {zbin, quant, quant_shift, dequant}_ptr[rc != 0]
- {
- z = coeff_ptr[0];
- zbin = (zbin_ptr[0] + zbin_boost_ptr[0] + zbin_oq_value);
- zero_run = 1;
-
- sz = (z >> 31); // sign of z
- x = (z ^ sz) - sz; // x = abs(z)
-
- if (x >= zbin) {
- x += (round_ptr[0]);
- y = ((int)(((int)(x * quant_ptr[0]) >> 16) + x))
- >> quant_shift_ptr[0]; // quantize (x)
- x = (y ^ sz) - sz; // get the sign back
- qcoeff_ptr[0] = x; // write to destination
- dqcoeff_ptr[0] = x * dequant_ptr[0]; // dequantized value
-
- if (y) {
- eob = 0; // last nonzero coeffs
- zero_run = 0;
- }
- }
- }
- for (i = 1; i < 64; i++) {
- rc = pt_scan[i];
- z = coeff_ptr[rc];
- zbin = (zbin_ptr[1] + zbin_boost_ptr[zero_run] + zbin_oq_value);
- // The original code was incrementing zero_run while keeping it at
- // maximum 15 by adding "(zero_run < 15)". The same is achieved by
- // removing the opposite of the sign mask of "(zero_run - 15)".
- zero_run -= (zero_run - 15) >> 31;
-
- sz = (z >> 31); // sign of z
- x = (z ^ sz) - sz; // x = abs(z)
-
- if (x >= zbin) {
- x += (round_ptr[rc != 0]);
- y = ((int)(((int)(x * quant_ptr[1]) >> 16) + x))
- >> quant_shift_ptr[1]; // quantize (x)
- x = (y ^ sz) - sz; // get the sign back
- qcoeff_ptr[rc] = x; // write to destination
- dqcoeff_ptr[rc] = x * dequant_ptr[1]; // dequantized value
-
- if (y) {
- eob = i; // last nonzero coeffs
- zero_run = 0;
- }
- }
- }
- xd->plane[pb_idx.plane].eobs[pb_idx.block] = eob + 1;
- } else {
- xd->plane[pb_idx.plane].eobs[pb_idx.block] = 0;
- }
-}
-
static void quantize(int16_t *zbin_boost_orig_ptr,
int16_t *coeff_ptr, int n_coeffs, int skip_block,
int16_t *zbin_ptr, int16_t *round_ptr, int16_t *quant_ptr,
@@ -278,16 +75,54 @@
*eob_ptr = eob + 1;
}
+void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
+ int y_blocks) {
+ MACROBLOCKD *const xd = &mb->e_mbd;
+ const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
+ const int *pt_scan = get_scan_4x4(tx_type);
+
+ quantize(mb->plane[pb_idx.plane].zrun_zbin_boost,
+ BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff, pb_idx.block, 16),
+ 16, mb->skip_block,
+ mb->plane[pb_idx.plane].zbin,
+ mb->plane[pb_idx.plane].round,
+ mb->plane[pb_idx.plane].quant,
+ mb->plane[pb_idx.plane].quant_shift,
+ BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block, 16),
+ BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block, 16),
+ xd->plane[pb_idx.plane].dequant,
+ mb->plane[pb_idx.plane].zbin_extra,
+ &xd->plane[pb_idx.plane].eobs[pb_idx.block],
+ pt_scan, 1);
+}
+
+void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
+ int y_blocks) {
+ MACROBLOCKD *const xd = &mb->e_mbd;
+ const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
+ const int *pt_scan = get_scan_8x8(tx_type);
+
+ quantize(mb->plane[pb_idx.plane].zrun_zbin_boost,
+ BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff, pb_idx.block, 16),
+ 64, mb->skip_block,
+ mb->plane[pb_idx.plane].zbin,
+ mb->plane[pb_idx.plane].round,
+ mb->plane[pb_idx.plane].quant,
+ mb->plane[pb_idx.plane].quant_shift,
+ BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block, 16),
+ BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block, 16),
+ xd->plane[pb_idx.plane].dequant,
+ mb->plane[pb_idx.plane].zbin_extra,
+ &xd->plane[pb_idx.plane].eobs[pb_idx.block],
+ pt_scan, 1);
+}
+
void vp9_regular_quantize_b_16x16(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
int y_blocks) {
MACROBLOCKD *const xd = &mb->e_mbd;
const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
- const int c_idx = plane_idx(pb_idx.plane);
const int *pt_scan = get_scan_16x16(tx_type);
- if (c_idx == 0) assert(pb_idx.plane == 0);
- if (c_idx == 16) assert(pb_idx.plane == 1);
- if (c_idx == 20) assert(pb_idx.plane == 2);
quantize(mb->plane[pb_idx.plane].zrun_zbin_boost,
BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff, pb_idx.block, 16),
256, mb->skip_block,
@@ -306,11 +141,7 @@
void vp9_regular_quantize_b_32x32(MACROBLOCK *mb, int b_idx, int y_blocks) {
MACROBLOCKD *const xd = &mb->e_mbd;
const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
- const int c_idx = plane_idx(pb_idx.plane);
- if (c_idx == 0) assert(pb_idx.plane == 0);
- if (c_idx == 16) assert(pb_idx.plane == 1);
- if (c_idx == 20) assert(pb_idx.plane == 2);
quantize(mb->plane[pb_idx.plane].zrun_zbin_boost,
BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff, pb_idx.block, 16),
1024, mb->skip_block,
@@ -371,11 +202,7 @@
for (n = 0; n < bw * bh; n++) {
const TX_TYPE tx_type = get_tx_type_4x4(xd, n);
- if (tx_type != DCT_DCT) {
- vp9_ht_quantize_b_4x4(x, n, tx_type);
- } else {
- x->quantize_b_4x4(x, n, bw * bh);
- }
+ x->quantize_b_4x4(x, n, tx_type, bw * bh);
}
}
@@ -412,7 +239,7 @@
int i;
for (i = uoff; i < ((uoff * 3) >> 1); i++)
- x->quantize_b_4x4(x, i, uoff);
+ x->quantize_b_4x4(x, i, DCT_DCT, uoff);
}
/* quantize_b_pair function pointer in MACROBLOCK structure is set to one of
@@ -421,8 +248,8 @@
* of blocks. */
void vp9_regular_quantize_b_4x4_pair(MACROBLOCK *x, int b_idx1, int b_idx2,
int y_blocks) {
- vp9_regular_quantize_b_4x4(x, b_idx1, y_blocks);
- vp9_regular_quantize_b_4x4(x, b_idx2, y_blocks);
+ vp9_regular_quantize_b_4x4(x, b_idx1, DCT_DCT, y_blocks);
+ vp9_regular_quantize_b_4x4(x, b_idx2, DCT_DCT, y_blocks);
}
static void invert_quant(int16_t *quant, uint8_t *shift, int d) {
diff --git a/vp9/encoder/vp9_quantize.h b/vp9/encoder/vp9_quantize.h
index 2b8a7b0..fd7a4bb 100644
--- a/vp9/encoder/vp9_quantize.h
+++ b/vp9/encoder/vp9_quantize.h
@@ -26,10 +26,10 @@
#include "x86/vp9_quantize_x86.h"
#endif
-void vp9_ht_quantize_b_4x4(MACROBLOCK *mb, int b_ix, TX_TYPE type);
-void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx, int y_blocks);
void vp9_regular_quantize_b_4x4_pair(MACROBLOCK *mb, int b_idx1, int b_idx2,
int y_blocks);
+void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
+ int y_blocks);
void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
int y_blocks);
void vp9_regular_quantize_b_16x16(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index b7b3f0a..7de5bf7 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -850,7 +850,6 @@
int rate = 0;
int distortion;
VP9_COMMON *const cm = &cpi->common;
- BLOCKD *b = xd->block + ib;
const int src_stride = x->plane[0].src.stride;
uint8_t* const src =
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
@@ -862,6 +861,9 @@
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
xd->plane[0].diff);
int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, ib, 16);
+ uint8_t* const dst =
+ raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
+ xd->plane[0].dst.buf, xd->plane[0].dst.stride);
ENTROPY_CONTEXT ta = *a, tempa = *a;
ENTROPY_CONTEXT tl = *l, templ = *l;
TX_TYPE tx_type = DCT_DCT;
@@ -875,7 +877,8 @@
assert(ib < 16);
#if CONFIG_NEWBINTRAMODES
- b->bmi.as_mode.context = vp9_find_bpred_context(xd, b);
+ xd->mode_info_context->bmi[ib].as_mode.context =
+ vp9_find_bpred_context(xd, ib, dst, xd->plane[0].dst.stride);
#endif
xd->mode_info_context->mbmi.txfm_size = TX_4X4;
for (mode = B_DC_PRED; mode < LEFT4X4; mode++) {
@@ -892,7 +895,7 @@
}
#endif
- b->bmi.as_mode.first = mode;
+ xd->mode_info_context->bmi[ib].as_mode.first = mode;
#if CONFIG_NEWBINTRAMODES
rate = bmode_costs[
mode == B_CONTEXT_PRED ? mode - CONTEXT_PRED_REPLACEMENTS : mode];
@@ -900,25 +903,25 @@
rate = bmode_costs[mode];
#endif
- vp9_intra4x4_predict(xd, b, mode, *(b->base_dst) + b->dst, b->dst_stride);
+ vp9_intra4x4_predict(xd, ib, mode, dst, xd->plane[0].dst.stride);
vp9_subtract_block(4, 4, src_diff, 16,
src, src_stride,
- *(b->base_dst) + b->dst, b->dst_stride);
+ dst, xd->plane[0].dst.stride);
- b->bmi.as_mode.first = mode;
+ xd->mode_info_context->bmi[ib].as_mode.first = mode;
tx_type = get_tx_type_4x4(xd, ib);
if (tx_type != DCT_DCT) {
vp9_short_fht4x4(src_diff, coeff, 16, tx_type);
- vp9_ht_quantize_b_4x4(x, ib, tx_type);
+ x->quantize_b_4x4(x, ib, tx_type, 16);
} else {
x->fwd_txm4x4(src_diff, coeff, 32);
- x->quantize_b_4x4(x, ib, 16);
+ x->quantize_b_4x4(x, ib, tx_type, 16);
}
tempa = ta;
templ = tl;
- ratey = cost_coeffs(cm, x, b - xd->block,
+ ratey = cost_coeffs(cm, x, ib,
PLANE_TYPE_Y_WITH_DC, &tempa, &templ, TX_4X4, 16);
rate += ratey;
distortion = vp9_block_error(coeff,
@@ -939,7 +942,8 @@
vpx_memcpy(best_dqcoeff, BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16), 32);
}
}
- b->bmi.as_mode.first = (B_PREDICTION_MODE)(*best_mode);
+ xd->mode_info_context->bmi[ib].as_mode.first =
+ (B_PREDICTION_MODE)(*best_mode);
// inverse transform
if (best_tx_type != DCT_DCT)
@@ -947,10 +951,10 @@
else
xd->inv_txm4x4(best_dqcoeff, diff, 32);
- vp9_intra4x4_predict(xd, b, *best_mode,
- *(b->base_dst) + b->dst, b->dst_stride);
- vp9_recon_b(*(b->base_dst) + b->dst, diff,
- *(b->base_dst) + b->dst, b->dst_stride);
+ vp9_intra4x4_predict(xd, ib, *best_mode,
+ dst, xd->plane[0].dst.stride);
+ vp9_recon_b(dst, diff,
+ dst, xd->plane[0].dst.stride);
return best_rd;
}
@@ -984,6 +988,12 @@
const int mis = xd->mode_info_stride;
B_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
int UNINITIALIZED_IS_SAFE(r), UNINITIALIZED_IS_SAFE(ry), UNINITIALIZED_IS_SAFE(d);
+#if CONFIG_NEWBINTRAMODES
+ uint8_t* const dst =
+ raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, i,
+ xd->plane[0].dst.buf,
+ xd->plane[0].dst.stride);
+#endif
if (xd->frame_type == KEY_FRAME) {
const B_PREDICTION_MODE A = above_block_mode(mic, i, mis);
@@ -992,7 +1002,8 @@
bmode_costs = mb->bmode_costs[A][L];
}
#if CONFIG_NEWBINTRAMODES
- mic->bmi[i].as_mode.context = vp9_find_bpred_context(xd, xd->block + i);
+ mic->bmi[i].as_mode.context = vp9_find_bpred_context(xd, i, dst,
+ xd->plane[0].dst.stride);
#endif
total_rd += rd_pick_intra4x4block(
@@ -1088,7 +1099,6 @@
MACROBLOCKD *xd = &x->e_mbd;
int64_t best_rd = INT64_MAX;
int distortion = 0, rate = 0;
- BLOCKD *b = xd->block + ib;
ENTROPY_CONTEXT_PLANES ta, tl;
ENTROPY_CONTEXT *ta0, *ta1, besta0 = 0, besta1 = 0;
ENTROPY_CONTEXT *tl0, *tl1, bestl0 = 0, bestl1 = 0;
@@ -1103,6 +1113,9 @@
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
x->plane[0].src_diff);
int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, idx, 16);
+ uint8_t* const dst =
+ raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
+ xd->plane[0].dst.buf, xd->plane[0].dst.stride);
assert(ib < 16);
for (mode = DC_PRED; mode <= TM_PRED; mode++) {
@@ -1111,13 +1124,13 @@
// FIXME rate for compound mode and second intrapred mode
rate = mode_costs[mode];
- b->bmi.as_mode.first = mode;
+ xd->mode_info_context->bmi[ib].as_mode.first = mode;
- vp9_intra8x8_predict(xd, b, mode, *(b->base_dst) + b->dst, b->dst_stride);
+ vp9_intra8x8_predict(xd, ib, mode, dst, xd->plane[0].dst.stride);
vp9_subtract_block(8, 8, src_diff, 16,
src, src_stride,
- *(b->base_dst) + b->dst, b->dst_stride);
+ dst, xd->plane[0].dst.stride);
if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
TX_TYPE tx_type = get_tx_type_8x8(xd, ib);
@@ -1163,11 +1176,10 @@
int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff,
ib + iblock[i], 16);
int do_two = 0;
- b = &xd->block[ib + iblock[i]];
tx_type = get_tx_type_4x4(xd, ib + iblock[i]);
if (tx_type != DCT_DCT) {
vp9_short_fht4x4(src_diff, coeff, 16, tx_type);
- vp9_ht_quantize_b_4x4(x, ib + iblock[i], tx_type);
+ x->quantize_b_4x4(x, ib + iblock[i], tx_type, 16);
} else if (!(i & 1) &&
get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) {
x->fwd_txm8x4(src_diff, coeff, 32);
@@ -1175,7 +1187,7 @@
do_two = 1;
} else {
x->fwd_txm4x4(src_diff, coeff, 32);
- x->quantize_b_4x4(x, ib + iblock[i], 16);
+ x->quantize_b_4x4(x, ib + iblock[i], tx_type, 16);
}
distortion += vp9_block_error_c(coeff,
BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[i], 16),
@@ -1190,7 +1202,6 @@
TX_4X4, 16);
}
}
- b = &xd->block[ib];
rate += rate_t;
}
@@ -1208,7 +1219,7 @@
*best_mode = mode;
}
}
- b->bmi.as_mode.first = (*best_mode);
+ xd->mode_info_context->bmi[ib].as_mode.first = (*best_mode);
vp9_encode_intra8x8(x, ib);
if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
@@ -1607,7 +1618,6 @@
Ones from this macroblock have to be pulled from the BLOCKD array
as they have not yet made it to the bmi array in our MB_MODE_INFO. */
for (i = 0; i < 16; ++i) {
- BLOCKD *const d = xd->block + i;
const int row = i >> 2, col = i & 3;
B_PREDICTION_MODE m;
@@ -1639,17 +1649,17 @@
}
break;
case LEFT4X4:
- this_mv->as_int = col ? d[-1].bmi.as_mv[0].as_int :
+ this_mv->as_int = col ? mic->bmi[i - 1].as_mv[0].as_int :
left_block_mv(xd, mic, i);
if (mbmi->second_ref_frame > 0)
- this_second_mv->as_int = col ? d[-1].bmi.as_mv[1].as_int :
+ this_second_mv->as_int = col ? mic->bmi[i - 1].as_mv[1].as_int :
left_block_second_mv(xd, mic, i);
break;
case ABOVE4X4:
- this_mv->as_int = row ? d[-4].bmi.as_mv[0].as_int :
+ this_mv->as_int = row ? mic->bmi[i - 4].as_mv[0].as_int :
above_block_mv(mic, i, mis);
if (mbmi->second_ref_frame > 0)
- this_second_mv->as_int = row ? d[-4].bmi.as_mv[1].as_int :
+ this_second_mv->as_int = row ? mic->bmi[i - 4].as_mv[1].as_int :
above_block_second_mv(mic, i, mis);
break;
case ZERO4X4:
@@ -1665,10 +1675,10 @@
int_mv left_mv, left_second_mv;
left_second_mv.as_int = 0;
- left_mv.as_int = col ? d[-1].bmi.as_mv[0].as_int :
+ left_mv.as_int = col ? mic->bmi[i - 1].as_mv[0].as_int :
left_block_mv(xd, mic, i);
if (mbmi->second_ref_frame > 0)
- left_second_mv.as_int = col ? d[-1].bmi.as_mv[1].as_int :
+ left_second_mv.as_int = col ? mic->bmi[i - 1].as_mv[1].as_int :
left_block_second_mv(xd, mic, i);
if (left_mv.as_int == this_mv->as_int &&
@@ -1685,9 +1695,9 @@
#endif
}
- d->bmi.as_mv[0].as_int = this_mv->as_int;
+ mic->bmi[i].as_mv[0].as_int = this_mv->as_int;
if (mbmi->second_ref_frame > 0)
- d->bmi.as_mv[1].as_int = this_second_mv->as_int;
+ mic->bmi[i].as_mv[1].as_int = this_second_mv->as_int;
x->partition_info->bmi[i].mode = m;
x->partition_info->bmi[i].mv.as_int = this_mv->as_int;
@@ -1714,7 +1724,6 @@
*distortion = 0;
for (i = 0; i < 16; i++) {
if (labels[i] == which_label) {
- BLOCKD *bd = &x->e_mbd.block[i];
const int src_stride = x->plane[0].src.stride;
uint8_t* const src =
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, i,
@@ -1727,13 +1736,17 @@
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, i,
xd->plane[0].pre[0].buf,
xd->plane[0].pre[0].stride);
+ uint8_t* const dst =
+ raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, i,
+ xd->plane[0].dst.buf,
+ xd->plane[0].dst.stride);
int thisdistortion;
vp9_build_inter_predictor(pre,
xd->plane[0].pre[0].stride,
- *(bd->base_dst) + bd->dst,
- bd->dst_stride,
- &bd->bmi.as_mv[0],
+ dst,
+ xd->plane[0].dst.stride,
+ &xd->mode_info_context->bmi[i].as_mv[0],
&xd->scale_factor[0],
4, 4, 0 /* no avg */, &xd->subpix);
@@ -1747,16 +1760,17 @@
xd->plane[0].pre[1].stride);
vp9_build_inter_predictor(
second_pre, xd->plane[0].pre[1].stride,
- *(bd->base_dst) + bd->dst, bd->dst_stride,
- &bd->bmi.as_mv[1], &xd->scale_factor[1], 4, 4, 1,
+ dst, xd->plane[0].dst.stride,
+ &xd->mode_info_context->bmi[i].as_mv[1],
+ &xd->scale_factor[1], 4, 4, 1,
&xd->subpix);
}
vp9_subtract_block(4, 4, src_diff, 16,
src, src_stride,
- *(bd->base_dst) + bd->dst, bd->dst_stride);
+ dst, xd->plane[0].dst.stride);
x->fwd_txm4x4(src_diff, coeff, 32);
- x->quantize_b_4x4(x, i, 16);
+ x->quantize_b_4x4(x, i, DCT_DCT, 16);
thisdistortion = vp9_block_error(coeff,
BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16), 16);
*distortion += thisdistortion;
@@ -1801,7 +1815,6 @@
xd->mode_info_context->mbmi.second_ref_frame > 0;
int which_mv;
const int idx = (ib & 8) + ((ib & 2) << 1);
- BLOCKD *bd = &xd->block[ib];
const int src_stride = x->plane[0].src.stride;
uint8_t* const src =
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
@@ -1811,6 +1824,10 @@
x->plane[0].src_diff);
int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, idx, 16);
int thisdistortion;
+ uint8_t* const dst =
+ raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
+ xd->plane[0].dst.buf,
+ xd->plane[0].dst.stride);
assert(idx < 16);
for (which_mv = 0; which_mv < 1 + use_second_ref; ++which_mv) {
@@ -1824,14 +1841,15 @@
// weighting for splitmv modes is turned on.
vp9_build_inter_predictor(
pre, xd->plane[0].pre[which_mv].stride,
- *(bd->base_dst) + bd->dst, bd->dst_stride,
- &bd->bmi.as_mv[which_mv], &xd->scale_factor[which_mv], 8, 8,
+ dst, xd->plane[0].dst.stride,
+ &xd->mode_info_context->bmi[ib].as_mv[which_mv],
+ &xd->scale_factor[which_mv], 8, 8,
which_mv, &xd->subpix);
}
vp9_subtract_block(8, 8, src_diff, 16,
src, src_stride,
- *(bd->base_dst) + bd->dst, bd->dst_stride);
+ dst, xd->plane[0].dst.stride);
if (xd->mode_info_context->mbmi.txfm_size == TX_4X4) {
if (otherrd) {
@@ -1854,7 +1872,6 @@
x->plane[0].src_diff);
int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff,
ib + iblock[j], 16);
- bd = &xd->block[ib + iblock[j]];
x->fwd_txm8x4(src_diff, coeff, 32);
x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j] + 1, 16);
thisdistortion = vp9_block_error_c(coeff,
@@ -2039,7 +2056,6 @@
int step_param = 0;
int further_steps;
int thissme, bestsme = INT_MAX;
- BLOCKD *e;
const struct buf_2d orig_src = x->plane[0].src;
const struct buf_2d orig_pre = x->e_mbd.plane[0].pre[0];
@@ -2060,9 +2076,11 @@
// use previous block's result as next block's MV predictor.
if (segmentation == PARTITIONING_4X4 && i > 0) {
- bsi->mvp.as_int = x->e_mbd.block[i - 1].bmi.as_mv[0].as_int;
+ bsi->mvp.as_int =
+ x->e_mbd.mode_info_context->bmi[i - 1].as_mv[0].as_int;
if (i == 4 || i == 8 || i == 12)
- bsi->mvp.as_int = x->e_mbd.block[i - 4].bmi.as_mv[0].as_int;
+ bsi->mvp.as_int =
+ x->e_mbd.mode_info_context->bmi[i - 4].as_mv[0].as_int;
step_param = 2;
}
}
@@ -2089,9 +2107,8 @@
raster_block_offset_uint8(&x->e_mbd, BLOCK_SIZE_MB16X16, 0, n,
x->e_mbd.plane[0].pre[0].buf,
x->e_mbd.plane[0].pre[0].stride);
- e = &x->e_mbd.block[n];
- bestsme = vp9_full_pixel_diamond(cpi, x, e, &mvp_full, step_param,
+ bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
sadpb, further_steps, 0, v_fn_ptr,
bsi->ref_mv, &mode_mv[NEW4X4]);
@@ -2103,18 +2120,21 @@
clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max,
x->mv_row_min, x->mv_row_max);
- thissme = cpi->full_search_sad(x, e, &mvp_full,
+ thissme = cpi->full_search_sad(x, &mvp_full,
sadpb, 16, v_fn_ptr,
x->nmvjointcost, x->mvcost,
- bsi->ref_mv);
+ bsi->ref_mv,
+ n);
if (thissme < bestsme) {
bestsme = thissme;
- mode_mv[NEW4X4].as_int = e->bmi.as_mv[0].as_int;
+ mode_mv[NEW4X4].as_int =
+ x->e_mbd.mode_info_context->bmi[n].as_mv[0].as_int;
} else {
/* The full search result is actually worse so re-instate the
* previous best vector */
- e->bmi.as_mv[0].as_int = mode_mv[NEW4X4].as_int;
+ x->e_mbd.mode_info_context->bmi[n].as_mv[0].as_int =
+ mode_mv[NEW4X4].as_int;
}
}
}
@@ -2122,7 +2142,7 @@
if (bestsme < INT_MAX) {
int distortion;
unsigned int sse;
- cpi->find_fractional_mv_step(x, e, &mode_mv[NEW4X4],
+ cpi->find_fractional_mv_step(x, &mode_mv[NEW4X4],
bsi->ref_mv, x->errorperbit, v_fn_ptr,
x->nmvjointcost, x->mvcost,
&distortion, &sse);
@@ -2459,11 +2479,10 @@
/* set it to the best */
for (i = 0; i < 16; i++) {
- BLOCKD *bd = &x->e_mbd.block[i];
-
- bd->bmi.as_mv[0].as_int = bsi.mvs[i].as_int;
+ x->e_mbd.mode_info_context->bmi[i].as_mv[0].as_int = bsi.mvs[i].as_int;
if (mbmi->second_ref_frame > 0)
- bd->bmi.as_mv[1].as_int = bsi.second_mvs[i].as_int;
+ x->e_mbd.mode_info_context->bmi[i].as_mv[1].as_int =
+ bsi.second_mvs[i].as_int;
x->e_mbd.plane[0].eobs[i] = bsi.eobs[i];
}
@@ -2554,10 +2573,6 @@
// printf("%d,%d,%d,%d\n",
// modes[0], modes[1], modes[2], modes[3]);
}
-
- for (i = 0; i < 16; i++) {
- xd->block[i].bmi = xd->mode_info_context->bmi[i];
- }
}
extern void vp9_calc_ref_probs(int *count, vp9_prob *probs);
@@ -2865,7 +2880,6 @@
VP9_COMMON *cm = &cpi->common;
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
- BLOCKD *d = &xd->block[0];
const int is_comp_pred = (mbmi->second_ref_frame > 0);
#if CONFIG_COMP_INTERINTRA_PRED
const int is_comp_interintra_pred = (mbmi->second_ref_frame == INTRA_FRAME);
@@ -2946,7 +2960,7 @@
// Further step/diamond searches as necessary
further_steps = (cpi->sf.max_step_search_steps - 1) - step_param;
- bestsme = vp9_full_pixel_diamond(cpi, x, d, &mvp_full, step_param,
+ bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
sadpb, further_steps, 1,
&cpi->fn_ptr[block_size],
&ref_mv[0], &tmp_mv);
@@ -2959,15 +2973,15 @@
if (bestsme < INT_MAX) {
int dis; /* TODO: use dis in distortion calculation later. */
unsigned int sse;
- cpi->find_fractional_mv_step(x, d, &tmp_mv,
+ cpi->find_fractional_mv_step(x, &tmp_mv,
&ref_mv[0],
x->errorperbit,
&cpi->fn_ptr[block_size],
x->nmvjointcost, x->mvcost,
&dis, &sse);
}
- d->bmi.as_mv[0].as_int = tmp_mv.as_int;
- frame_mv[NEWMV][refs[0]].as_int = d->bmi.as_mv[0].as_int;
+ frame_mv[NEWMV][refs[0]].as_int =
+ xd->mode_info_context->bmi[0].as_mv[0].as_int = tmp_mv.as_int;
// Add the new motion vector cost to our rolling cost variable
*rate2 += vp9_mv_bit_cost(&tmp_mv, &ref_mv[0],
@@ -3676,7 +3690,7 @@
vpx_memcpy(&tmp_best_partition, x->partition_info,
sizeof(PARTITION_INFO));
for (i = 0; i < 16; i++) {
- tmp_best_bmodes[i] = xd->block[i].bmi;
+ tmp_best_bmodes[i] = xd->mode_info_context->bmi[i];
}
pred_exists = 1;
}
@@ -3711,7 +3725,7 @@
vpx_memcpy(x->partition_info, &tmp_best_partition,
sizeof(PARTITION_INFO));
for (i = 0; i < 16; i++) {
- xd->block[i].bmi = xd->mode_info_context->bmi[i] = tmp_best_bmodes[i];
+ xd->mode_info_context->bmi[i] = tmp_best_bmodes[i];
}
}
@@ -3920,7 +3934,7 @@
|| (this_mode == I8X8_PRED)
|| (this_mode == SPLITMV))
for (i = 0; i < 16; i++) {
- best_bmodes[i] = xd->block[i].bmi;
+ best_bmodes[i] = xd->mode_info_context->bmi[i];
}
}
@@ -4049,7 +4063,6 @@
if (best_mbmode.mode == I4X4_PRED) {
for (i = 0; i < 16; i++) {
xd->mode_info_context->bmi[i].as_mode = best_bmodes[i].as_mode;
- xd->block[i].bmi.as_mode = xd->mode_info_context->bmi[i].as_mode;
}
}
diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c
index 1774d9b..1e6b984 100644
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -129,9 +129,9 @@
int sadpb = x->sadperbit16;
int bestsme = INT_MAX;
- BLOCKD *d = &x->e_mbd.block[0];
int_mv best_ref_mv1;
int_mv best_ref_mv1_full; /* full-pixel value of best_ref_mv1 */
+ int_mv *ref_mv;
// Save input state
struct buf_2d src = x->plane[0].src;
@@ -158,7 +158,8 @@
/*cpi->sf.search_method == HEX*/
// TODO Check that the 16x16 vf & sdf are selected here
// Ignore mv costing by sending NULL pointer instead of cost arrays
- bestsme = vp9_hex_search(x, d, &best_ref_mv1_full, &d->bmi.as_mv[0],
+ ref_mv = &x->e_mbd.mode_info_context->bmi[0].as_mv[0];
+ bestsme = vp9_hex_search(x, &best_ref_mv1_full, ref_mv,
step_param, sadpb, &cpi->fn_ptr[BLOCK_16X16],
NULL, NULL, NULL, NULL,
&best_ref_mv1);
@@ -170,7 +171,7 @@
int distortion;
unsigned int sse;
// Ignore mv costing by sending NULL pointer instead of cost array
- bestsme = cpi->find_fractional_mv_step(x, d, &d->bmi.as_mv[0],
+ bestsme = cpi->find_fractional_mv_step(x, ref_mv,
&best_ref_mv1,
x->errorperbit,
&cpi->fn_ptr[BLOCK_16X16],
@@ -246,8 +247,8 @@
if (cpi->frames[frame] == NULL)
continue;
- mbd->block[0].bmi.as_mv[0].as_mv.row = 0;
- mbd->block[0].bmi.as_mv[0].as_mv.col = 0;
+ mbd->mode_info_context->bmi[0].as_mv[0].as_mv.row = 0;
+ mbd->mode_info_context->bmi[0].as_mv[0].as_mv.col = 0;
if (frame == alt_ref_index) {
filter_weight = 2;
@@ -280,8 +281,8 @@
cpi->frames[frame]->u_buffer + mb_uv_offset,
cpi->frames[frame]->v_buffer + mb_uv_offset,
cpi->frames[frame]->y_stride,
- mbd->block[0].bmi.as_mv[0].as_mv.row,
- mbd->block[0].bmi.as_mv[0].as_mv.col,
+ mbd->mode_info_context->bmi[0].as_mv[0].as_mv.row,
+ mbd->mode_info_context->bmi[0].as_mv[0].as_mv.col,
predictor);
// Apply the filter (YUV)