summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_blockd.h5
-rw-r--r--vp9/common/vp9_entropy.c5
-rw-r--r--vp9/common/vp9_entropy.h2
-rw-r--r--vp9/common/vp9_reconinter.h87
-rw-r--r--vp9/decoder/vp9_decodemv.c14
-rw-r--r--vp9/decoder/vp9_decodframe.c16
-rw-r--r--vp9/encoder/vp9_boolhuff.c21
-rw-r--r--vp9/encoder/vp9_boolhuff.h20
-rw-r--r--vp9/encoder/vp9_rdopt.c103
-rw-r--r--vp9/encoder/vp9_treewriter.h4
10 files changed, 121 insertions, 156 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index e452684ed..d0a1203ef 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -313,11 +313,6 @@ struct macroblockd_plane {
#define BLOCK_OFFSET(x, i, n) ((x) + (i) * (n))
-#define MB_SUBBLOCK_FIELD(x, field, i) (\
- ((i) < 16) ? BLOCK_OFFSET((x)->plane[0].field, (i), 16) : \
- ((i) < 20) ? BLOCK_OFFSET((x)->plane[1].field, ((i) - 16), 16) : \
- BLOCK_OFFSET((x)->plane[2].field, ((i) - 20), 16))
-
typedef struct macroblockd {
struct macroblockd_plane plane[MAX_MB_PLANE];
diff --git a/vp9/common/vp9_entropy.c b/vp9/common/vp9_entropy.c
index 4dfe9c4ba..aef687176 100644
--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -8,9 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
-#include <stdio.h>
-
#include "vp9/common/vp9_entropy.h"
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_onyxc_int.h"
@@ -19,8 +16,6 @@
#include "vpx/vpx_integer.h"
#include "vp9/common/vp9_coefupdateprobs.h"
-const int vp9_i8x8_block[4] = {0, 2, 8, 10};
-
DECLARE_ALIGNED(16, const uint8_t, vp9_norm[256]) = {
0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h
index fe3d5c6f2..579313f86 100644
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -16,8 +16,6 @@
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_common.h"
-extern const int vp9_i8x8_block[4];
-
/* Coefficient token alphabet */
#define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */
diff --git a/vp9/common/vp9_reconinter.h b/vp9/common/vp9_reconinter.h
index d2e745592..3f9a7ab08 100644
--- a/vp9/common/vp9_reconinter.h
+++ b/vp9/common/vp9_reconinter.h
@@ -92,75 +92,42 @@ static void setup_pred_plane(struct buf_2d *dst,
static void setup_dst_planes(MACROBLOCKD *xd,
const YV12_BUFFER_CONFIG *src,
int mi_row, int mi_col) {
- setup_pred_plane(&xd->plane[0].dst,
- src->y_buffer, src->y_stride,
- mi_row, mi_col, NULL,
- xd->plane[0].subsampling_x, xd->plane[0].subsampling_y);
- setup_pred_plane(&xd->plane[1].dst,
- src->u_buffer, src->uv_stride,
- mi_row, mi_col, NULL,
- xd->plane[1].subsampling_x, xd->plane[1].subsampling_y);
- setup_pred_plane(&xd->plane[2].dst,
- src->v_buffer, src->uv_stride,
- mi_row, mi_col, NULL,
- xd->plane[2].subsampling_x, xd->plane[2].subsampling_y);
-}
-
-static void setup_pre_planes(MACROBLOCKD *xd,
- const YV12_BUFFER_CONFIG *src0,
- const YV12_BUFFER_CONFIG *src1,
- int mi_row, int mi_col,
- const struct scale_factors *scale,
- const struct scale_factors *scale_uv) {
+ uint8_t *buffers[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
+ int strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
int i;
- for (i = 0; i < 2; i++) {
- const YV12_BUFFER_CONFIG *src = i ? src1 : src0;
-
- if (!src)
- continue;
-
- setup_pred_plane(&xd->plane[0].pre[i],
- src->y_buffer, src->y_stride,
- mi_row, mi_col, scale ? scale + i : NULL,
- xd->plane[0].subsampling_x, xd->plane[0].subsampling_y);
- setup_pred_plane(&xd->plane[1].pre[i],
- src->u_buffer, src->uv_stride,
- mi_row, mi_col, scale_uv ? scale_uv + i : NULL,
- xd->plane[1].subsampling_x, xd->plane[1].subsampling_y);
- setup_pred_plane(&xd->plane[2].pre[i],
- src->v_buffer, src->uv_stride,
- mi_row, mi_col, scale_uv ? scale_uv + i : NULL,
- xd->plane[2].subsampling_x, xd->plane[2].subsampling_y);
+ for (i = 0; i < MAX_MB_PLANE; ++i) {
+ struct macroblockd_plane *pd = &xd->plane[i];
+ setup_pred_plane(&pd->dst, buffers[i], strides[i], mi_row, mi_col, NULL,
+ pd->subsampling_x, pd->subsampling_y);
}
}
-static void setup_pred_block(YV12_BUFFER_CONFIG *dst,
- const YV12_BUFFER_CONFIG *src,
+static void setup_pre_planes(MACROBLOCKD *xd,
+ const YV12_BUFFER_CONFIG *src0,
+ const YV12_BUFFER_CONFIG *src1,
int mi_row, int mi_col,
const struct scale_factors *scale,
const struct scale_factors *scale_uv) {
- const int recon_y_stride = src->y_stride;
- const int recon_uv_stride = src->uv_stride;
- int recon_yoffset;
- int recon_uvoffset;
-
- if (scale) {
- recon_yoffset = scaled_buffer_offset(MI_SIZE * mi_col, MI_SIZE * mi_row,
- recon_y_stride, scale);
- recon_uvoffset = scaled_buffer_offset(MI_UV_SIZE * mi_col,
- MI_UV_SIZE * mi_row,
- recon_uv_stride, scale_uv);
- } else {
- recon_yoffset = MI_SIZE * mi_row * recon_y_stride + MI_SIZE * mi_col;
- recon_uvoffset = MI_UV_SIZE * mi_row * recon_uv_stride +
- MI_UV_SIZE * mi_col;
+ const YV12_BUFFER_CONFIG *srcs[2] = {src0, src1};
+ int i, j;
+
+ for (i = 0; i < 2; ++i) {
+ const YV12_BUFFER_CONFIG *src = srcs[i];
+ if (src) {
+ uint8_t* buffers[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
+ int strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
+
+ for (j = 0; j < MAX_MB_PLANE; ++j) {
+ struct macroblockd_plane *pd = &xd->plane[j];
+ const struct scale_factors *sf = j ? scale_uv : scale;
+ setup_pred_plane(&pd->pre[i],
+ buffers[j], strides[j],
+ mi_row, mi_col, sf ? &sf[i] : NULL,
+ pd->subsampling_x, pd->subsampling_y);
+ }
+ }
}
-
- *dst = *src;
- dst->y_buffer += recon_yoffset;
- dst->u_buffer += recon_uvoffset;
- dst->v_buffer += recon_uvoffset;
}
static void set_scale_factors(MACROBLOCKD *xd,
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 0f0dee055..a1f780abb 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -97,7 +97,7 @@ static TX_SIZE select_txfm_size(VP9_COMMON *cm, vp9_reader *r,
return txfm_size;
}
-extern const int vp9_i8x8_block[4];
+
static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m,
int mi_row, int mi_col,
vp9_reader *r) {
@@ -403,14 +403,6 @@ unsigned int vp9_mv_cont_count[5][4] = {
};
#endif
-static const unsigned char mbsplit_fill_count[4] = { 8, 8, 4, 1 };
-static const unsigned char mbsplit_fill_offset[4][16] = {
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
- { 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15 },
- { 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15 },
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
-};
-
static void read_switchable_interp_probs(VP9D_COMP* const pbi, vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common;
int i, j;
@@ -849,10 +841,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
mbmi->uv_mode = read_uv_mode(r, cm->fc.uv_mode_prob[mbmi->mode]);
cm->fc.uv_mode_counts[mbmi->mode][mbmi->uv_mode]++;
}
- /*
- if (cm->current_video_frame == 1)
- printf("mode: %d skip: %d\n", mbmi->mode, mbmi->mb_skip_coeff);
- */
if (cm->txfm_mode == TX_MODE_SELECT && mbmi->mb_skip_coeff == 0 &&
((mbmi->ref_frame == INTRA_FRAME && mbmi->mode != I4X4_PRED) ||
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index f9c2a5183..7735213b5 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -9,7 +9,6 @@
*/
#include <assert.h>
-#include <stdio.h>
#include "vp9/decoder/vp9_onyxd_int.h"
#include "vp9/common/vp9_common.h"
@@ -250,10 +249,10 @@ static void decode_atom_intra(VP9D_COMP *pbi, MACROBLOCKD *xd,
for (i = 0; i < bc; i++) {
int b_mode = xd->mode_info_context->bmi[i].as_mode.first;
- uint8_t* dst;
- dst = raster_block_offset_uint8(xd, bsize, 0, i,
- xd->plane[0].dst.buf,
- xd->plane[0].dst.stride);
+
+ uint8_t* dst = raster_block_offset_uint8(xd, bsize, 0, i,
+ xd->plane[0].dst.buf,
+ xd->plane[0].dst.stride);
vp9_intra4x4_predict(xd, i, bsize, b_mode, dst, xd->plane[0].dst.stride);
// TODO(jingning): refactor to use foreach_transformed_block_in_plane_
@@ -458,12 +457,12 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
break;
case PARTITION_HORZ:
decode_modes_b(pbi, mi_row, mi_col, r, subsize);
- if ((mi_row + bs) < pc->mi_rows)
+ if (mi_row + bs < pc->mi_rows)
decode_modes_b(pbi, mi_row + bs, mi_col, r, subsize);
break;
case PARTITION_VERT:
decode_modes_b(pbi, mi_row, mi_col, r, subsize);
- if ((mi_col + bs) < pc->mi_cols)
+ if (mi_col + bs < pc->mi_cols)
decode_modes_b(pbi, mi_row, mi_col + bs, r, subsize);
break;
case PARTITION_SPLIT:
@@ -818,9 +817,8 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) {
vpx_memset(&pc->left_context, 0, sizeof(pc->left_context));
vpx_memset(pc->left_seg_context, 0, sizeof(pc->left_seg_context));
for (mi_col = pc->cur_tile_mi_col_start;
- mi_col < pc->cur_tile_mi_col_end; mi_col += 8) {
+ mi_col < pc->cur_tile_mi_col_end; mi_col += 8)
decode_modes_sb(pbi, mi_row, mi_col, r, BLOCK_SIZE_SB64X64);
- }
}
}
diff --git a/vp9/encoder/vp9_boolhuff.c b/vp9/encoder/vp9_boolhuff.c
index 0d8a1b814..e9436af8b 100644
--- a/vp9/encoder/vp9_boolhuff.c
+++ b/vp9/encoder/vp9_boolhuff.c
@@ -52,7 +52,7 @@ void vp9_stop_encode(vp9_writer *br) {
int i;
for (i = 0; i < 32; i++)
- encode_bool(br, 0, 128);
+ vp9_write_bit(br, 0);
// Ensure there's no ambigous collision with any index marker bytes
if ((br->buffer[br->pos - 1] & 0xe0) == 0xc0)
@@ -60,17 +60,10 @@ void vp9_stop_encode(vp9_writer *br) {
}
-void vp9_encode_value(vp9_writer *br, int data, int bits) {
- int bit;
-
- for (bit = bits - 1; bit >= 0; bit--)
- encode_bool(br, (1 & (data >> bit)), 0x80);
-}
-
void vp9_encode_unsigned_max(vp9_writer *br, int data, int max) {
assert(data <= max);
while (max) {
- encode_bool(br, data & 1, 128);
+ vp9_write_bit(br, data & 1);
data >>= 1;
max >>= 1;
}
@@ -98,10 +91,10 @@ void vp9_encode_uniform(vp9_writer *br, int v, int n) {
if (l == 0) return;
m = (1 << l) - n;
if (v < m)
- vp9_encode_value(br, v, l - 1);
+ vp9_write_literal(br, v, l - 1);
else {
- vp9_encode_value(br, m + ((v - m) >> 1), l - 1);
- vp9_encode_value(br, (v - m) & 1, 1);
+ vp9_write_literal(br, m + ((v - m) >> 1), l - 1);
+ vp9_write_literal(br, (v - m) & 1, 1);
}
}
@@ -127,12 +120,12 @@ void vp9_encode_term_subexp(vp9_writer *br, int word, int k, int num_syms) {
break;
} else {
int t = (word >= mk + a);
- vp9_encode_value(br, t, 1);
+ vp9_write_literal(br, t, 1);
if (t) {
i = i + 1;
mk += a;
} else {
- vp9_encode_value(br, word - mk, b);
+ vp9_write_literal(br, word - mk, b);
break;
}
}
diff --git a/vp9/encoder/vp9_boolhuff.h b/vp9/encoder/vp9_boolhuff.h
index a31e7de1e..58b40fb39 100644
--- a/vp9/encoder/vp9_boolhuff.h
+++ b/vp9/encoder/vp9_boolhuff.h
@@ -32,15 +32,11 @@ typedef struct {
// Variables used to track bit costs without outputing to the bitstream
unsigned int measure_cost;
unsigned long bit_counter;
-} BOOL_CODER;
-
-typedef BOOL_CODER vp9_writer;
+} vp9_writer;
extern const unsigned int vp9_prob_cost[256];
void vp9_start_encode(vp9_writer *bc, uint8_t *buffer);
-
-void vp9_encode_value(vp9_writer *br, int data, int bits);
void vp9_encode_unsigned_max(vp9_writer *br, int data, int max);
void vp9_stop_encode(vp9_writer *bc);
@@ -54,7 +50,7 @@ int vp9_recenter_nonneg(int v, int m);
DECLARE_ALIGNED(16, extern const unsigned char, vp9_norm[256]);
-static void encode_bool(vp9_writer *br, int bit, int probability) {
+static void vp9_write(vp9_writer *br, int bit, int probability) {
unsigned int split;
int count = br->count;
unsigned int range = br->range;
@@ -113,4 +109,16 @@ static void encode_bool(vp9_writer *br, int bit, int probability) {
br->range = range;
}
+static void vp9_write_bit(vp9_writer *w, int bit) {
+ vp9_write(w, bit, 128); // vp9_prob_half
+}
+
+static void vp9_write_literal(vp9_writer *w, int data, int bits) {
+ int bit;
+
+ for (bit = bits - 1; bit >= 0; bit--)
+ vp9_write_bit(w, 1 & (data >> bit));
+}
+
+
#endif // VP9_ENCODER_VP9_BOOLHUFF_H_
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index cccd4887a..92e58f155 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1584,6 +1584,28 @@ static void store_coding_context(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
memcpy(ctx->txfm_rd_diff, txfm_size_diff, sizeof(ctx->txfm_rd_diff));
}
+static void setup_pred_block(const MACROBLOCKD *xd,
+ struct buf_2d dst[MAX_MB_PLANE],
+ const YV12_BUFFER_CONFIG *src,
+ int mi_row, int mi_col,
+ const struct scale_factors *scale,
+ const struct scale_factors *scale_uv) {
+ int i;
+
+ dst[0].buf = src->y_buffer;
+ dst[0].stride = src->y_stride;
+ dst[1].buf = src->u_buffer;
+ dst[2].buf = src->v_buffer;
+ dst[1].stride = dst[2].stride = src->uv_stride;
+
+ // TODO(jkoleszar): Make scale factors per-plane data
+ for (i = 0; i < MAX_MB_PLANE; i++) {
+ setup_pred_plane(dst + i, dst[i].buf, dst[i].stride, mi_row, mi_col,
+ i ? scale_uv : scale,
+ xd->plane[i].subsampling_x, xd->plane[i].subsampling_y);
+ }
+}
+
static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
int idx, MV_REFERENCE_FRAME frame_type,
enum BlockSize block_size,
@@ -1591,7 +1613,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
int_mv frame_nearest_mv[MAX_REF_FRAMES],
int_mv frame_near_mv[MAX_REF_FRAMES],
int frame_mdcounts[4][4],
- YV12_BUFFER_CONFIG yv12_mb[4],
+ struct buf_2d yv12_mb[4][MAX_MB_PLANE],
struct scale_factors scale[MAX_REF_FRAMES]) {
VP9_COMMON *cm = &cpi->common;
YV12_BUFFER_CONFIG *yv12 = &cm->yv12_fb[cpi->common.ref_frame_map[idx]];
@@ -1610,7 +1632,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
// TODO(jkoleszar): Is the UV buffer ever used here? If so, need to make this
// use the UV scaling factors.
- setup_pred_block(&yv12_mb[frame_type], yv12, mi_row, mi_col,
+ setup_pred_block(xd, yv12_mb[frame_type], yv12, mi_row, mi_col,
&scale[frame_type], &scale[frame_type]);
// Gets an initial list of candidate vectors from neighbours and orders them
@@ -1634,7 +1656,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
// The current implementation doesn't support scaling.
if (scale[frame_type].x_num == scale[frame_type].x_den &&
scale[frame_type].y_num == scale[frame_type].y_den)
- mv_pred(cpi, x, yv12_mb[frame_type].y_buffer, yv12->y_stride,
+ mv_pred(cpi, x, yv12_mb[frame_type][0].buf, yv12->y_stride,
frame_type, block_size);
}
@@ -1830,9 +1852,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
int_mv cur_mv[2];
int_mv ref_mv[2];
int64_t this_rd = 0;
- unsigned char tmp_ybuf[64 * 64];
- unsigned char tmp_ubuf[32 * 32];
- unsigned char tmp_vbuf[32 * 32];
+ unsigned char tmp_buf[MAX_MB_PLANE][64 * 64];
int pred_exists = 0;
int interpolating_intpel_seen = 0;
int intpel_mv;
@@ -2010,19 +2030,17 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if ((cm->mcomp_filter_type == SWITCHABLE && newbest) ||
(cm->mcomp_filter_type != SWITCHABLE &&
cm->mcomp_filter_type == mbmi->interp_filter)) {
- int i;
- for (i = 0; i < MI_SIZE * bh; ++i)
- vpx_memcpy(tmp_ybuf + i * MI_SIZE * bw,
- xd->plane[0].dst.buf + i * xd->plane[0].dst.stride,
- sizeof(unsigned char) * MI_SIZE * bw);
- for (i = 0; i < MI_UV_SIZE * bh; ++i)
- vpx_memcpy(tmp_ubuf + i * MI_UV_SIZE * bw,
- xd->plane[1].dst.buf + i * xd->plane[1].dst.stride,
- sizeof(unsigned char) * MI_UV_SIZE * bw);
- for (i = 0; i < MI_UV_SIZE * bh; ++i)
- vpx_memcpy(tmp_vbuf + i * MI_UV_SIZE * bw,
- xd->plane[2].dst.buf + i * xd->plane[2].dst.stride,
- sizeof(unsigned char) * MI_UV_SIZE * bw);
+ int p;
+
+ for (p = 0; p < MAX_MB_PLANE; p++) {
+ const int y = (MI_SIZE * bh) >> xd->plane[p].subsampling_y;
+ const int x = (MI_SIZE * bw) >> xd->plane[p].subsampling_x;
+ int i;
+
+ for (i = 0; i < y; i++)
+ vpx_memcpy(&tmp_buf[p][64 * i],
+ xd->plane[p].dst.buf + i * xd->plane[p].dst.stride, x);
+ }
pred_exists = 1;
}
interpolating_intpel_seen |= is_intpel_interp;
@@ -2036,18 +2054,17 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (pred_exists) {
- for (i = 0; i < bh * MI_SIZE; ++i)
- vpx_memcpy(xd->plane[0].dst.buf + i * xd->plane[0].dst.stride,
- tmp_ybuf + i * bw * MI_SIZE,
- sizeof(unsigned char) * bw * MI_SIZE);
- for (i = 0; i < bh * MI_UV_SIZE; ++i)
- vpx_memcpy(xd->plane[1].dst.buf + i * xd->plane[1].dst.stride,
- tmp_ubuf + i * bw * MI_UV_SIZE,
- sizeof(unsigned char) * bw * MI_UV_SIZE);
- for (i = 0; i < bh * MI_UV_SIZE; ++i)
- vpx_memcpy(xd->plane[2].dst.buf + i * xd->plane[2].dst.stride,
- tmp_vbuf + i * bw * MI_UV_SIZE,
- sizeof(unsigned char) * bw * MI_UV_SIZE);
+ int p;
+
+ for (p = 0; p < MAX_MB_PLANE; p++) {
+ const int y = (MI_SIZE * bh) >> xd->plane[p].subsampling_y;
+ const int x = (MI_SIZE * bw) >> xd->plane[p].subsampling_x;
+ int i;
+
+ for (i = 0; i < y; i++)
+ vpx_memcpy(xd->plane[p].dst.buf + i * xd->plane[p].dst.stride,
+ &tmp_buf[p][64 * i], x);
+ }
} else {
// Handles the special case when a filter that is not in the
// switchable list (ex. bilinear, 6-tap) is indicated at the frame level
@@ -2208,12 +2225,12 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
MB_PREDICTION_MODE this_mode;
MB_PREDICTION_MODE best_mode = DC_PRED;
- MV_REFERENCE_FRAME ref_frame, second_ref;
+ MV_REFERENCE_FRAME ref_frame, second_ref = INTRA_FRAME;
unsigned char segment_id = xd->mode_info_context->mbmi.segment_id;
int comp_pred, i;
int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES];
int frame_mdcounts[4][4];
- YV12_BUFFER_CONFIG yv12_mb[4];
+ struct buf_2d yv12_mb[4][MAX_MB_PLANE];
static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
VP9_ALT_FLAG };
int idx_list[4] = {0,
@@ -2366,14 +2383,18 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
// TODO(jingning, jkoleszar): scaling reference frame not supported for
// SPLITMV.
if (mbmi->ref_frame > 0 &&
- (yv12_mb[mbmi->ref_frame].y_width != cm->mb_cols * 16 ||
- yv12_mb[mbmi->ref_frame].y_height != cm->mb_rows * 16) &&
+ (scale_factor[mbmi->ref_frame].x_num !=
+ scale_factor[mbmi->ref_frame].x_den ||
+ scale_factor[mbmi->ref_frame].y_num !=
+ scale_factor[mbmi->ref_frame].y_den) &&
this_mode == SPLITMV)
continue;
if (mbmi->second_ref_frame > 0 &&
- (yv12_mb[mbmi->second_ref_frame].y_width != cm->mb_cols * 16 ||
- yv12_mb[mbmi->second_ref_frame].y_height != cm->mb_rows * 16) &&
+ (scale_factor[mbmi->second_ref_frame].x_num !=
+ scale_factor[mbmi->second_ref_frame].x_den ||
+ scale_factor[mbmi->second_ref_frame].y_num !=
+ scale_factor[mbmi->second_ref_frame].y_den) &&
this_mode == SPLITMV)
continue;
@@ -2418,8 +2439,12 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
}
- setup_pre_planes(xd, &yv12_mb[ref_frame],
- comp_pred ? &yv12_mb[second_ref] : NULL, 0, 0, NULL, NULL);
+ // Select predictors
+ for (i = 0; i < MAX_MB_PLANE; i++) {
+ xd->plane[i].pre[0] = yv12_mb[ref_frame][i];
+ if (comp_pred)
+ xd->plane[i].pre[1] = yv12_mb[second_ref][i];
+ }
vpx_memcpy(mdcounts, frame_mdcounts[ref_frame], sizeof(mdcounts));
diff --git a/vp9/encoder/vp9_treewriter.h b/vp9/encoder/vp9_treewriter.h
index 35059365a..eeda5cda7 100644
--- a/vp9/encoder/vp9_treewriter.h
+++ b/vp9/encoder/vp9_treewriter.h
@@ -19,9 +19,7 @@
#include "vp9/encoder/vp9_boolhuff.h" /* for now */
-#define vp9_write encode_bool
-#define vp9_write_literal vp9_encode_value
-#define vp9_write_bit(w, v) vp9_write((w), (v), vp9_prob_half)
+
#define vp9_write_prob(w, v) vp9_write_literal((w), (v), 8)
/* Approximate length of an encoded bool in 256ths of a bit at given prob */