Commit 1407bdc2 authored by Ronald S. Bultje's avatar Ronald S. Bultje

[WIP] Add column-based tiling.

This patch adds column-based tiling. The idea is to make each tile
independently decodable (after reading the common frame header) and
also independendly encodable (minus within-frame cost adjustments in
the RD loop) to speed-up hardware & software en/decoders if they used
multi-threading. Column-based tiling has the added advantage (over
other tiling methods) that it minimizes realtime use-case latency,
since all threads can start encoding data as soon as the first SB-row
worth of data is available to the encoder.

There is some test code that does random tile ordering in the decoder,
to confirm that each tile is indeed independently decodable from other
tiles in the same frame. At tile edges, all contexts assume default
values (i.e. 0, 0 motion vector, no coefficients, DC intra4x4 mode),
and motion vector search and ordering do not cross tiles in the same
frame.
t log

Tile independence is not maintained between frames ATM, i.e. tile 0 of
frame 1 is free to use motion vectors that point into any tile of frame
0. We support 1 (i.e. no tiling), 2 or 4 column-tiles.

The loopfilter crosses tile boundaries. I discussed this briefly with Aki
and he says that's OK. An in-loop loopfilter would need to do some sync
between tile threads, but that shouldn't be a big issue.

Resuls: with tiling disabled, we go up slightly because of improved edge
use in the intra4x4 prediction. With 2 tiles, we lose about ~1% on derf,
~0.35% on HD and ~0.55% on STD/HD. With 4 tiles, we lose another ~1.5%
on derf ~0.77% on HD and ~0.85% on STD/HD. Most of this loss is
concentrated in the low-bitrate end of clips, and most of it is because
of the loss of edges at tile boundaries and the resulting loss of intra
predictors.

TODO:
- more tiles (perhaps allow row-based tiling also, and max. 8 tiles)?
- maybe optionally (for EC purposes), motion vectors themselves
  should not cross tile edges, or we should emulate such borders as
  if they were off-frame, to limit error propagation to within one
  tile only. This doesn't have to be the default behaviour but could
  be an optional bitstream flag.

Change-Id: I5951c3a0742a767b20bc9fb5af685d9892c2c96f
parent 82286413
/*
* Copyright (c) 2012 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.
*/
#ifndef LIBVPX_TEST_MD5_HELPER_H_
#define LIBVPX_TEST_MD5_HELPER_H_
extern "C" {
#include "./md5_utils.h"
#include "vpx/vpx_decoder.h"
}
namespace libvpx_test {
class MD5 {
public:
MD5() {
MD5Init(&md5_);
}
void Add(const vpx_image_t *img) {
for (int plane = 0; plane < 3; ++plane) {
uint8_t *buf = img->planes[plane];
const int h = plane ? (img->d_h + 1) >> 1 : img->d_h;
const int w = plane ? (img->d_w + 1) >> 1 : img->d_w;
for (int y = 0; y < h; ++y) {
MD5Update(&md5_, buf, w);
buf += img->stride[plane];
}
}
}
const char *Get(void) {
static const char hex[16] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
};
uint8_t tmp[16];
MD5Context ctx_tmp = md5_;
MD5Final(tmp, &ctx_tmp);
for (int i = 0; i < 16; i++) {
res_[i * 2 + 0] = hex[tmp[i] >> 4];
res_[i * 2 + 1] = hex[tmp[i] & 0xf];
}
res_[32] = 0;
return res_;
}
protected:
char res_[33];
MD5Context md5_;
};
} // namespace libvpx_test
#endif // LIBVPX_TEST_MD5_HELPER_H_
LIBVPX_TEST_SRCS-yes += register_state_check.h
LIBVPX_TEST_SRCS-yes += test.mk
LIBVPX_TEST_SRCS-yes += acm_random.h
LIBVPX_TEST_SRCS-yes += md5_helper.h
LIBVPX_TEST_SRCS-yes += codec_factory.h
LIBVPX_TEST_SRCS-yes += test_libvpx.cc
LIBVPX_TEST_SRCS-yes += util.h
......@@ -66,6 +67,7 @@ LIBVPX_TEST_SRCS-yes += vp9_boolcoder_test.cc
# IDCT test currently depends on FDCT function
LIBVPX_TEST_SRCS-yes += idct8x8_test.cc
LIBVPX_TEST_SRCS-yes += tile_independence_test.cc
endif
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct4x4_test.cc
......
......@@ -16,15 +16,11 @@
#include "test/decode_test_driver.h"
#include "test/ivf_video_source.h"
#include "test/util.h"
#include "test/md5_helper.h"
extern "C" {
#include "./md5_utils.h"
#include "vpx_mem/vpx_mem.h"
}
#if defined(_MSC_VER)
#define snprintf sprintf_s
#endif
namespace {
// There are 61 test vectors in total.
const char *kTestVectors[] = {
......@@ -87,30 +83,9 @@ class TestVectorTest : public ::libvpx_test::DecoderTest,
ASSERT_NE(res, EOF) << "Read md5 data failed";
expected_md5[32] = '\0';
MD5Context md5;
MD5Init(&md5);
// Compute and update md5 for each raw in decompressed data.
for (int plane = 0; plane < 3; ++plane) {
uint8_t *buf = img.planes[plane];
for (unsigned int y = 0; y < (plane ? (img.d_h + 1) >> 1 : img.d_h);
++y) {
MD5Update(&md5, buf, (plane ? (img.d_w + 1) >> 1 : img.d_w));
buf += img.stride[plane];
}
}
uint8_t md5_sum[16];
MD5Final(md5_sum, &md5);
char actual_md5[33];
// Convert to get the actual md5.
for (int i = 0; i < 16; i++) {
snprintf(&actual_md5[i * 2], sizeof(actual_md5) - i * 2, "%02x",
md5_sum[i]);
}
actual_md5[32] = '\0';
::libvpx_test::MD5 md5_res;
md5_res.Add(&img);
const char *actual_md5 = md5_res.Get();
// Check md5 match.
ASSERT_STREQ(expected_md5, actual_md5)
......
/*
Copyright (c) 2012 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 <cstdio>
#include <cstdlib>
#include <string>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "test/codec_factory.h"
#include "test/encode_test_driver.h"
#include "test/i420_video_source.h"
#include "test/util.h"
#include "test/md5_helper.h"
extern "C" {
#include "vpx_mem/vpx_mem.h"
}
namespace {
class TileIndependenceTest : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<int> {
protected:
TileIndependenceTest() : EncoderTest(GET_PARAM(0)), n_tiles_(GET_PARAM(1)),
md5_fw_order_(), md5_inv_order_() {
init_flags_ = VPX_CODEC_USE_PSNR;
vpx_codec_dec_cfg_t cfg;
cfg.w = 352;
cfg.h = 288;
cfg.threads = 1;
cfg.inv_tile_order = 0;
fw_dec_ = codec_->CreateDecoder(cfg, 0);
cfg.inv_tile_order = 1;
inv_dec_ = codec_->CreateDecoder(cfg, 0);
}
virtual ~TileIndependenceTest() {
delete fw_dec_;
delete inv_dec_;
}
virtual void SetUp() {
InitializeConfig();
}
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
libvpx_test::Encoder *encoder) {
if (video->frame() == 1) {
encoder->Control(VP9E_SET_TILE_COLUMNS, n_tiles_);
}
}
void UpdateMD5(::libvpx_test::Decoder *dec, const vpx_codec_cx_pkt_t *pkt,
::libvpx_test::MD5 *md5) {
dec->DecodeFrame((uint8_t *) pkt->data.frame.buf, pkt->data.frame.sz);
const vpx_image_t *img = dec->GetDxData().Next();
md5->Add(img);
}
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
UpdateMD5(fw_dec_, pkt, &md5_fw_order_);
UpdateMD5(inv_dec_, pkt, &md5_inv_order_);
}
private:
int n_tiles_;
protected:
::libvpx_test::MD5 md5_fw_order_, md5_inv_order_;
::libvpx_test::Decoder *fw_dec_, *inv_dec_;
};
// run an encode with 2 or 4 tiles, and do the decode both in normal and
// inverted tile ordering. Ensure that the MD5 of the output in both cases
// is identical. If so, tiles are considered independent and the test passes.
TEST_P(TileIndependenceTest, MD5Match) {
const vpx_rational timebase = { 33333333, 1000000000 };
cfg_.g_timebase = timebase;
cfg_.rc_target_bitrate = 500;
cfg_.g_lag_in_frames = 25;
cfg_.rc_end_usage = VPX_VBR;
libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
timebase.den, timebase.num, 0, 30);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
const char *md5_fw_str = md5_fw_order_.Get();
const char *md5_inv_str = md5_inv_order_.Get();
// could use ASSERT_EQ(!memcmp(.., .., 16) here, but this gives nicer
// output if it fails. Not sure if it's helpful since it's really just
// a MD5...
ASSERT_STREQ(md5_fw_str, md5_inv_str);
}
VP9_INSTANTIATE_TEST_CASE(TileIndependenceTest,
::testing::Values(VP8_TWO_TILE_COLUMNS,
VP8_FOUR_TILE_COLUMNS));
} // namespace
......@@ -336,6 +336,7 @@ typedef struct macroblockd {
int up_available;
int left_available;
int right_available;
/* Y,U,V,Y2 */
ENTROPY_CONTEXT_PLANES *above_context;
......
......@@ -84,8 +84,12 @@ vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
extern const uint8_t vp9_mbsplit_offset[4][16];
static int left_block_mv(const MODE_INFO *cur_mb, int b) {
static int left_block_mv(const MACROBLOCKD *xd,
const MODE_INFO *cur_mb, int b) {
if (!(b & 3)) {
if (!xd->left_available)
return 0;
/* On L edge, get from MB to left of us */
--cur_mb;
......@@ -97,8 +101,12 @@ static int left_block_mv(const MODE_INFO *cur_mb, int b) {
return (cur_mb->bmi + b - 1)->as_mv.first.as_int;
}
static int left_block_second_mv(const MODE_INFO *cur_mb, int b) {
static int left_block_second_mv(const MACROBLOCKD *xd,
const MODE_INFO *cur_mb, int b) {
if (!(b & 3)) {
if (!xd->left_available)
return 0;
/* On L edge, get from MB to left of us */
--cur_mb;
......
......@@ -243,6 +243,7 @@ static void add_candidate_mv(
// list of candidate reference vectors.
//
void vp9_find_mv_refs(
VP9_COMMON *cm,
MACROBLOCKD *xd,
MODE_INFO *here,
MODE_INFO *lf_here,
......@@ -265,6 +266,7 @@ void vp9_find_mv_refs(
int (*mv_ref_search)[2];
int *ref_distance_weight;
int zero_seen = FALSE;
const int mb_col = (-xd->mb_to_left_edge) >> 7;
// Blank the reference vector lists and other local structures.
vpx_memset(mv_ref_list, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES);
......@@ -282,7 +284,10 @@ void vp9_find_mv_refs(
// We first scan for candidate vectors that match the current reference frame
// Look at nearest neigbours
for (i = 0; i < 2; ++i) {
if (((mv_ref_search[i][0] << 7) >= xd->mb_to_left_edge) &&
const int mb_search_col = mb_col + mv_ref_search[i][0];
if ((mb_search_col >= cm->cur_tile_mb_col_start) &&
(mb_search_col < cm->cur_tile_mb_col_end) &&
((mv_ref_search[i][1] << 7) >= xd->mb_to_top_edge)) {
candidate_mi = here + mv_ref_search[i][0] +
......@@ -306,7 +311,10 @@ void vp9_find_mv_refs(
// More distant neigbours
for (i = 2; (i < MVREF_NEIGHBOURS) &&
(refmv_count < (MAX_MV_REF_CANDIDATES - 1)); ++i) {
if (((mv_ref_search[i][0] << 7) >= xd->mb_to_left_edge) &&
const int mb_search_col = mb_col + mv_ref_search[i][0];
if ((mb_search_col >= cm->cur_tile_mb_col_start) &&
(mb_search_col < cm->cur_tile_mb_col_end) &&
((mv_ref_search[i][1] << 7) >= xd->mb_to_top_edge)) {
candidate_mi = here + mv_ref_search[i][0] +
(mv_ref_search[i][1] * xd->mode_info_stride);
......@@ -324,7 +332,10 @@ void vp9_find_mv_refs(
// Look first at spatial neighbours
if (refmv_count < (MAX_MV_REF_CANDIDATES - 1)) {
for (i = 0; i < MVREF_NEIGHBOURS; ++i) {
if (((mv_ref_search[i][0] << 7) >= xd->mb_to_left_edge) &&
const int mb_search_col = mb_col + mv_ref_search[i][0];
if ((mb_search_col >= cm->cur_tile_mb_col_start) &&
(mb_search_col < cm->cur_tile_mb_col_end) &&
((mv_ref_search[i][1] << 7) >= xd->mb_to_top_edge)) {
candidate_mi = here + mv_ref_search[i][0] +
......
......@@ -14,7 +14,8 @@
#ifndef VP9_COMMON_VP9_MVREF_COMMON_H_
#define VP9_COMMON_VP9_MVREF_COMMON_H_
void vp9_find_mv_refs(MACROBLOCKD *xd,
void vp9_find_mv_refs(VP9_COMMON *cm,
MACROBLOCKD *xd,
MODE_INFO *here,
MODE_INFO *lf_here,
MV_REFERENCE_FRAME ref_frame,
......
......@@ -175,6 +175,8 @@ extern "C"
int arnr_strength;
int arnr_type;
int tile_columns;
struct vpx_fixed_buf two_pass_stats_in;
struct vpx_codec_pkt_list *output_pkt_list;
......
......@@ -278,6 +278,9 @@ typedef struct VP9Common {
int error_resilient_mode;
int frame_parallel_decoding_mode;
int tile_columns;
int cur_tile_mb_col_start, cur_tile_mb_col_end, cur_tile_idx;
} VP9_COMMON;
static int get_free_fb(VP9_COMMON *cm) {
......
......@@ -29,14 +29,16 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
// The prediction flags in these dummy entries are initialised to 0.
switch (pred_id) {
case PRED_SEG_ID:
pred_context = (m - 1)->mbmi.seg_id_predicted +
(m - cm->mode_info_stride)->mbmi.seg_id_predicted;
pred_context = (m - cm->mode_info_stride)->mbmi.seg_id_predicted;
if (xd->left_available)
pred_context += (m - 1)->mbmi.seg_id_predicted;
break;
case PRED_REF:
pred_context = (m - 1)->mbmi.ref_predicted +
(m - cm->mode_info_stride)->mbmi.ref_predicted;
pred_context = (m - cm->mode_info_stride)->mbmi.ref_predicted;
if (xd->left_available)
pred_context += (m - 1)->mbmi.ref_predicted;
break;
case PRED_COMP:
......@@ -61,13 +63,14 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
break;
case PRED_MBSKIP:
pred_context = (m - 1)->mbmi.mb_skip_coeff +
(m - cm->mode_info_stride)->mbmi.mb_skip_coeff;
pred_context = (m - cm->mode_info_stride)->mbmi.mb_skip_coeff;
if (xd->left_available)
pred_context += (m - 1)->mbmi.mb_skip_coeff;
break;
case PRED_SWITCHABLE_INTERP:
{
int left_in_image = (m - 1)->mbmi.mb_in_image;
int left_in_image = xd->left_available && (m - 1)->mbmi.mb_in_image;
int above_in_image = (m - cm->mode_info_stride)->mbmi.mb_in_image;
int left_mode = (m - 1)->mbmi.mode;
int above_mode = (m - cm->mode_info_stride)->mbmi.mode;
......@@ -355,9 +358,10 @@ MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
above_left = (m - 1 - cm->mode_info_stride)->mbmi.ref_frame;
// Are neighbours in image
left_in_image = (m - 1)->mbmi.mb_in_image;
left_in_image = (m - 1)->mbmi.mb_in_image && xd->left_available;
above_in_image = (m - cm->mode_info_stride)->mbmi.mb_in_image;
above_left_in_image = (m - 1 - cm->mode_info_stride)->mbmi.mb_in_image;
above_left_in_image = (m - 1 - cm->mode_info_stride)->mbmi.mb_in_image &&
xd->left_available;
// Adjust scores for candidate reference frames based on neigbours
if (frame_allowed[left] && left_in_image) {
......
......@@ -251,16 +251,40 @@ void vp9_recon_intra_mbuv(MACROBLOCKD *xd) {
void vp9_build_intra_predictors_internal(uint8_t *src, int src_stride,
uint8_t *ypred_ptr,
int y_stride, int mode, int bsize,
int up_available, int left_available) {
uint8_t *yabove_row = src - src_stride;
uint8_t yleft_col[64];
uint8_t ytop_left = yabove_row[-1];
int up_available, int left_available,
int right_available) {
int r, c, i;
uint8_t yleft_col[64], yabove_data[65], ytop_left;
uint8_t *yabove_row = yabove_data + 1;
/*
* 127 127 127 .. 127 127 127 127 127 127
* 129 A B .. Y Z
* 129 C D .. W X
* 129 E F .. U V
* 129 G H .. S T T T T T
* ..
*/
for (i = 0; i < bsize; i++) {
yleft_col[i] = src[i * src_stride - 1];
if (left_available) {
for (i = 0; i < bsize; i++)
yleft_col[i] = src[i * src_stride - 1];
} else {
vpx_memset(yleft_col, 129, bsize);
}
if (up_available) {
uint8_t *yabove_ptr = src - src_stride;
vpx_memcpy(yabove_row, yabove_ptr, bsize);
if (left_available) {
ytop_left = yabove_ptr[-1];
} else {
ytop_left = 127;
}
} else {
vpx_memset(yabove_row, 127, bsize);
ytop_left = 127;
}
yabove_row[-1] = ytop_left;
/* for Y */
switch (mode) {
......@@ -514,7 +538,7 @@ void vp9_build_interintra_16x16_predictors_mby(MACROBLOCKD *xd,
xd->dst.y_buffer, xd->dst.y_stride,
intrapredictor, 16,
xd->mode_info_context->mbmi.interintra_mode, 16,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available, xd->right_available);
combine_interintra(xd->mode_info_context->mbmi.interintra_mode,
ypred, ystride, intrapredictor, 16, 16);
}
......@@ -529,12 +553,12 @@ void vp9_build_interintra_16x16_predictors_mbuv(MACROBLOCKD *xd,
xd->dst.u_buffer, xd->dst.uv_stride,
uintrapredictor, 8,
xd->mode_info_context->mbmi.interintra_uv_mode, 8,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available, xd->right_available);
vp9_build_intra_predictors_internal(
xd->dst.v_buffer, xd->dst.uv_stride,
vintrapredictor, 8,
xd->mode_info_context->mbmi.interintra_uv_mode, 8,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available, xd->right_available);
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
upred, uvstride, uintrapredictor, 8, 8);
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
......@@ -549,7 +573,7 @@ void vp9_build_interintra_32x32_predictors_sby(MACROBLOCKD *xd,
xd->dst.y_buffer, xd->dst.y_stride,
intrapredictor, 32,
xd->mode_info_context->mbmi.interintra_mode, 32,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available, xd->right_available);
combine_interintra(xd->mode_info_context->mbmi.interintra_mode,
ypred, ystride, intrapredictor, 32, 32);
}
......@@ -564,12 +588,12 @@ void vp9_build_interintra_32x32_predictors_sbuv(MACROBLOCKD *xd,
xd->dst.u_buffer, xd->dst.uv_stride,
uintrapredictor, 16,
xd->mode_info_context->mbmi.interintra_uv_mode, 16,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available, xd->right_available);
vp9_build_intra_predictors_internal(
xd->dst.v_buffer, xd->dst.uv_stride,
vintrapredictor, 16,
xd->mode_info_context->mbmi.interintra_uv_mode, 16,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available, xd->right_available);
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
upred, uvstride, uintrapredictor, 16, 16);
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
......@@ -593,7 +617,8 @@ void vp9_build_interintra_64x64_predictors_sby(MACROBLOCKD *xd,
const int mode = xd->mode_info_context->mbmi.interintra_mode;
vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
intrapredictor, 64, mode, 64,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available,
xd->right_available);
combine_interintra(xd->mode_info_context->mbmi.interintra_mode,
ypred, ystride, intrapredictor, 64, 64);
}
......@@ -607,10 +632,12 @@ void vp9_build_interintra_64x64_predictors_sbuv(MACROBLOCKD *xd,
const int mode = xd->mode_info_context->mbmi.interintra_uv_mode;
vp9_build_intra_predictors_internal(xd->dst.u_buffer, xd->dst.uv_stride,
uintrapredictor, 32, mode, 32,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available,
xd->right_available);
vp9_build_intra_predictors_internal(xd->dst.v_buffer, xd->dst.uv_stride,
vintrapredictor, 32, mode, 32,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available,
xd->right_available);
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
upred, uvstride, uintrapredictor, 32, 32);
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
......@@ -632,28 +659,32 @@ void vp9_build_intra_predictors_mby(MACROBLOCKD *xd) {
vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
xd->predictor, 16,
xd->mode_info_context->mbmi.mode, 16,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available,
xd->right_available);
}
void vp9_build_intra_predictors_mby_s(MACROBLOCKD *xd) {
vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
xd->dst.y_buffer, xd->dst.y_stride,
xd->mode_info_context->mbmi.mode, 16,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available,
xd->right_available);
}
void vp9_build_intra_predictors_sby_s(MACROBLOCKD *xd) {
vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
xd->dst.y_buffer, xd->dst.y_stride,
xd->mode_info_context->mbmi.mode, 32,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available,
xd->right_available);
}
void vp9_build_intra_predictors_sb64y_s(MACROBLOCKD *xd) {
vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
xd->dst.y_buffer, xd->dst.y_stride,
xd->mode_info_context->mbmi.mode, 64,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available,
xd->right_available);
}
void vp9_build_intra_predictors_mbuv_internal(MACROBLOCKD *xd,
......@@ -663,10 +694,12 @@ void vp9_build_intra_predictors_mbuv_internal(MACROBLOCKD *xd,
int mode, int bsize) {
vp9_build_intra_predictors_internal(xd->dst.u_buffer, xd->dst.uv_stride,
upred_ptr, uv_stride, mode, bsize,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available,
xd->right_available);
vp9_build_intra_predictors_internal(xd->dst.v_buffer, xd->dst.uv_stride,
vpred_ptr, uv_stride, mode, bsize,
xd->up_available, xd->left_available);
xd->up_available, xd->left_available,
xd->right_available);
}
void vp9_build_intra_predictors_mbuv(MACROBLOCKD *xd) {
......@@ -698,20 +731,35 @@ void vp9_build_intra_predictors_sb64uv_s(MACROBLOCKD *xd) {
32);
}
void vp9_intra8x8_predict(BLOCKD *xd,
void vp9_intra8x8_predict(MACROBLOCKD *xd,
BLOCKD *b,
int mode,
uint8_t *predictor) {
vp9_build_intra_predictors_internal(*(xd->base_dst) + xd->dst,
xd->dst_stride, predictor, 16,
mode, 8, 1, 1);
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_internal(*(b->base_dst) + b->dst,
b->dst_stride