Commit ed8bddaa authored by Yaowu Xu's avatar Yaowu Xu Committed by Gerrit Code Review

Merge "Merge branch 'masterbase' into nextgenv2" into nextgenv2

parents df33be4b 37d17b65
......@@ -268,7 +268,6 @@ EXPERIMENT_LIST="
ext_tx
misc_fixes
ext_intra
universal_hp
"
CONFIG_LIST="
dependency_tracking
......
......@@ -16,8 +16,13 @@
namespace {
const int kTestMode = 0;
const int kSuperframeSyntax = 1;
typedef std::tr1::tuple<libvpx_test::TestMode,int> SuperframeTestParam;
class SuperframeTest : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
public ::libvpx_test::CodecTestWithParam<SuperframeTestParam> {
protected:
SuperframeTest() : EncoderTest(GET_PARAM(0)), modified_buf_(NULL),
last_sf_pts_(0) {}
......@@ -25,9 +30,13 @@ class SuperframeTest : public ::libvpx_test::EncoderTest,
virtual void SetUp() {
InitializeConfig();
SetMode(GET_PARAM(1));
const SuperframeTestParam input = GET_PARAM(1);
const libvpx_test::TestMode mode = std::tr1::get<kTestMode>(input);
const int syntax = std::tr1::get<kSuperframeSyntax>(input);
SetMode(mode);
sf_count_ = 0;
sf_count_max_ = INT_MAX;
is_vp10_style_superframe_ = syntax;
}
virtual void TearDown() {
......@@ -50,7 +59,8 @@ class SuperframeTest : public ::libvpx_test::EncoderTest,
const uint8_t marker = buffer[pkt->data.frame.sz - 1];
const int frames = (marker & 0x7) + 1;
const int mag = ((marker >> 3) & 3) + 1;
const unsigned int index_sz = 2 + mag * frames;
const unsigned int index_sz =
2 + mag * (frames - is_vp10_style_superframe_);
if ((marker & 0xe0) == 0xc0 &&
pkt->data.frame.sz >= index_sz &&
buffer[pkt->data.frame.sz - index_sz] == marker) {
......@@ -75,6 +85,7 @@ class SuperframeTest : public ::libvpx_test::EncoderTest,
return pkt;
}
int is_vp10_style_superframe_;
int sf_count_;
int sf_count_max_;
vpx_codec_cx_pkt_t modified_pkt_;
......@@ -92,9 +103,11 @@ TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) {
EXPECT_EQ(sf_count_, 1);
}
VP9_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Values(
::libvpx_test::kTwoPassGood));
VP9_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Combine(
::testing::Values(::libvpx_test::kTwoPassGood),
::testing::Values(0)));
VP10_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Values(
::libvpx_test::kTwoPassGood));
VP10_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Combine(
::testing::Values(::libvpx_test::kTwoPassGood),
::testing::Values(CONFIG_MISC_FIXES)));
} // namespace
......@@ -985,7 +985,7 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
#endif // CONFIG_EXT_TX
#if CONFIG_MISC_FIXES
if (cm->seg.temporal_update) {
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
for (i = 0; i < PREDICTION_PROBS; i++)
fc->seg.pred_probs[i] = mode_mv_merge_probs(pre_fc->seg.pred_probs[i],
counts->seg.pred[i]);
......
......@@ -128,7 +128,7 @@ MV_CLASS_TYPE vp10_get_mv_class(int z, int *offset) {
}
int vp10_use_mv_hp(const MV *ref) {
#if CONFIG_UNIVERSAL_HP
#if CONFIG_MISC_FIXES
(void) ref;
return 1;
#else
......
......@@ -30,8 +30,10 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type] << 3;
const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type] << 3;
#if !CONFIG_MISC_FIXES
// Blank the reference vector list
memset(mv_ref_list, 0, sizeof(*mv_ref_list) * MAX_MV_REF_CANDIDATES);
#endif
// The nearest 2 blocks are treated differently
// if the size < 8x8 we get the mv from the bmi substructure,
......@@ -48,10 +50,10 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
if (candidate->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0, mv_ref->col, block),
refmv_count, mv_ref_list, Done);
refmv_count, mv_ref_list, bw, bh, xd, Done);
else if (candidate->ref_frame[1] == ref_frame)
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 1, mv_ref->col, block),
refmv_count, mv_ref_list, Done);
refmv_count, mv_ref_list, bw, bh, xd, Done);
}
}
......@@ -66,9 +68,11 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(candidate->mv[0], refmv_count, mv_ref_list, Done);
ADD_MV_REF_LIST(candidate->mv[0], refmv_count, mv_ref_list,
bw, bh, xd, Done);
else if (candidate->ref_frame[1] == ref_frame)
ADD_MV_REF_LIST(candidate->mv[1], refmv_count, mv_ref_list, Done);
ADD_MV_REF_LIST(candidate->mv[1], refmv_count, mv_ref_list,
bw, bh, xd, Done);
}
}
......@@ -90,9 +94,11 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
}
if (prev_frame_mvs->ref_frame[0] == ref_frame) {
ADD_MV_REF_LIST(prev_frame_mvs->mv[0], refmv_count, mv_ref_list, Done);
ADD_MV_REF_LIST(prev_frame_mvs->mv[0], refmv_count, mv_ref_list,
bw, bh, xd, Done);
} else if (prev_frame_mvs->ref_frame[1] == ref_frame) {
ADD_MV_REF_LIST(prev_frame_mvs->mv[1], refmv_count, mv_ref_list, Done);
ADD_MV_REF_LIST(prev_frame_mvs->mv[1], refmv_count, mv_ref_list,
bw, bh, xd, Done);
}
}
......@@ -108,7 +114,7 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
// If the candidate is INTRA we don't want to consider its mv.
IF_DIFF_REF_FRAME_ADD_MV(candidate, ref_frame, ref_sign_bias,
refmv_count, mv_ref_list, Done);
refmv_count, mv_ref_list, bw, bh, xd, Done);
}
}
}
......@@ -123,7 +129,7 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
mv.as_mv.row *= -1;
mv.as_mv.col *= -1;
}
ADD_MV_REF_LIST(mv, refmv_count, mv_ref_list, Done);
ADD_MV_REF_LIST(mv, refmv_count, mv_ref_list, bw, bh, xd, Done);
}
if (prev_frame_mvs->ref_frame[1] > INTRA_FRAME &&
......@@ -137,7 +143,7 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
mv.as_mv.row *= -1;
mv.as_mv.col *= -1;
}
ADD_MV_REF_LIST(mv, refmv_count, mv_ref_list, Done);
ADD_MV_REF_LIST(mv, refmv_count, mv_ref_list, bw, bh, xd, Done);
}
}
......@@ -145,9 +151,14 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
mode_context[ref_frame] = counter_to_context[context_counter];
#if CONFIG_MISC_FIXES
for (i = refmv_count; i < MAX_MV_REF_CANDIDATES; ++i)
mv_ref_list[i].as_int = 0;
#else
// Clamp vectors
for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i)
clamp_mv_ref(&mv_ref_list[i].as_mv, bw, bh, xd);
#endif
}
void vp10_find_mv_refs(const VP10_COMMON *cm, const MACROBLOCKD *xd,
......
......@@ -164,36 +164,41 @@ static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
return mv;
}
#if CONFIG_MISC_FIXES
#define CLIP_IN_ADD(mv, bw, bh, xd) clamp_mv_ref(mv, bw, bh, xd)
#else
#define CLIP_IN_ADD(mv, bw, bh, xd) do {} while (0)
#endif
// This macro is used to add a motion vector mv_ref list if it isn't
// already in the list. If it's the second motion vector it will also
// skip all additional processing and jump to done!
#define ADD_MV_REF_LIST(mv, refmv_count, mv_ref_list, Done) \
#define ADD_MV_REF_LIST(mv, refmv_count, mv_ref_list, bw, bh, xd, Done) \
do { \
if (refmv_count) { \
if ((mv).as_int != (mv_ref_list)[0].as_int) { \
(mv_ref_list)[(refmv_count)] = (mv); \
(mv_ref_list)[(refmv_count)] = (mv); \
CLIP_IN_ADD(&(mv_ref_list)[(refmv_count)].as_mv, (bw), (bh), (xd)); \
if (refmv_count && (mv_ref_list)[1].as_int != (mv_ref_list)[0].as_int) { \
(refmv_count) = 2; \
goto Done; \
} \
} else { \
(mv_ref_list)[(refmv_count)++] = (mv); \
} \
(refmv_count) = 1; \
} while (0)
// If either reference frame is different, not INTRA, and they
// are different from each other scale and add the mv to our list.
#define IF_DIFF_REF_FRAME_ADD_MV(mbmi, ref_frame, ref_sign_bias, refmv_count, \
mv_ref_list, Done) \
mv_ref_list, bw, bh, xd, Done) \
do { \
if (is_inter_block(mbmi)) { \
if ((mbmi)->ref_frame[0] != ref_frame) \
ADD_MV_REF_LIST(scale_mv((mbmi), 0, ref_frame, ref_sign_bias), \
refmv_count, mv_ref_list, Done); \
refmv_count, mv_ref_list, bw, bh, xd, Done); \
if (has_second_ref(mbmi) && \
(CONFIG_MISC_FIXES || \
(mbmi)->mv[1].as_int != (mbmi)->mv[0].as_int) && \
(mbmi)->ref_frame[1] != ref_frame) \
ADD_MV_REF_LIST(scale_mv((mbmi), 1, ref_frame, ref_sign_bias), \
refmv_count, mv_ref_list, Done); \
refmv_count, mv_ref_list, bw, bh, xd, Done); \
} \
} while (0)
......
......@@ -21,7 +21,7 @@
#include "vp10/common/reconintra.h"
#include "vp10/common/onyxc_int.h"
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
enum {
NEED_LEFT = 1 << 1,
NEED_ABOVE = 1 << 2,
......@@ -63,7 +63,7 @@ static const uint8_t extend_modes[INTRA_MODES] = {
};
#endif
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
static const uint8_t orders_64x64[1] = { 0 };
static const uint8_t orders_64x32[2] = { 0, 1 };
static const uint8_t orders_32x64[2] = { 0, 1 };
......@@ -216,18 +216,13 @@ static void vp10_init_intra_predictors_internal(void) {
INIT_ALL_SIZES(pred[V_PRED], v);
INIT_ALL_SIZES(pred[H_PRED], h);
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
INIT_ALL_SIZES(pred[D207_PRED], d207e);
INIT_ALL_SIZES(pred[D45_PRED], d45e);
INIT_ALL_SIZES(pred[D63_PRED], d63e);
#else
INIT_ALL_SIZES(pred[D207_PRED], d207);
#if CONFIG_MISC_FIXES
pred[D45_PRED][TX_4X4] = vpx_d45e_predictor_4x4;
INIT_NO_4X4(pred[D45_PRED], d45);
#else
INIT_ALL_SIZES(pred[D45_PRED], d45);
#endif
INIT_ALL_SIZES(pred[D63_PRED], d63);
#endif
INIT_ALL_SIZES(pred[D117_PRED], d117);
......@@ -243,18 +238,13 @@ static void vp10_init_intra_predictors_internal(void) {
#if CONFIG_VP9_HIGHBITDEPTH
INIT_ALL_SIZES(pred_high[V_PRED], highbd_v);
INIT_ALL_SIZES(pred_high[H_PRED], highbd_h);
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
INIT_ALL_SIZES(pred_high[D207_PRED], highbd_d207e);
INIT_ALL_SIZES(pred_high[D45_PRED], highbd_d45e);
INIT_ALL_SIZES(pred_high[D63_PRED], highbd_d63);
#else
INIT_ALL_SIZES(pred_high[D207_PRED], highbd_d207);
#if CONFIG_MISC_FIXES
pred_high[D45_PRED][TX_4X4] = vpx_highbd_d45e_predictor_4x4;
INIT_NO_4X4(pred_high[D45_PRED], highbd_d45);
#else
INIT_ALL_SIZES(pred_high[D45_PRED], highbd_d45);
#endif
INIT_ALL_SIZES(pred_high[D63_PRED], highbd_d63);
#endif
INIT_ALL_SIZES(pred_high[D117_PRED], highbd_d117);
......@@ -271,7 +261,7 @@ static void vp10_init_intra_predictors_internal(void) {
#undef intra_pred_allsizes
}
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
static inline void memset16(uint16_t *dst, int val, int n) {
while (n--)
*dst++ = val;
......@@ -286,7 +276,7 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
int dst_stride,
PREDICTION_MODE mode,
TX_SIZE tx_size,
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
int n_top_px, int n_topright_px,
int n_left_px, int n_bottomleft_px,
#else
......@@ -299,7 +289,7 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
int i;
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
DECLARE_ALIGNED(16, uint16_t, left_col[32]);
#else
DECLARE_ALIGNED(16, uint16_t, left_col[64]);
......@@ -308,7 +298,7 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
uint16_t *above_row = above_data + 16;
const uint16_t *const_above_row = above_row;
const int bs = 4 << tx_size;
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
const uint16_t *above_ref = ref - ref_stride;
#else
int frame_width, frame_height;
......@@ -322,7 +312,7 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
// 129 E F .. U V
// 129 G H .. S T T T T T
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
(void) x;
(void) y;
(void) plane;
......@@ -460,7 +450,7 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
// predict
if (mode == DC_PRED) {
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
dc_pred_high[n_left_px > 0][n_top_px > 0][tx_size](dst, dst_stride,
const_above_row,
left_col, xd->bd);
......@@ -479,7 +469,7 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
int ref_stride, uint8_t *dst, int dst_stride,
PREDICTION_MODE mode, TX_SIZE tx_size,
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
int n_top_px, int n_topright_px,
int n_left_px, int n_bottomleft_px,
#else
......@@ -488,7 +478,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
#endif
int x, int y, int plane) {
int i;
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
DECLARE_ALIGNED(16, uint8_t, left_col[64]);
const uint8_t *above_ref = ref - ref_stride;
#else
......@@ -509,7 +499,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
// 129 G H .. S T T T T T
// ..
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
(void) xd;
(void) x;
(void) y;
......@@ -535,7 +525,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
// NEED_LEFT
if (extend_modes[mode] & NEED_LEFT) {
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
const int need_bottom = !!(extend_modes[mode] & NEED_BOTTOMLEFT);
i = 0;
if (n_left_px > 0) {
......@@ -578,7 +568,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
// NEED_ABOVE
if (extend_modes[mode] & NEED_ABOVE) {
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
const int need_right = !!(extend_modes[mode] & NEED_ABOVERIGHT);
if (n_top_px > 0) {
memcpy(above_row, above_ref, n_top_px);
......@@ -621,7 +611,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
#endif
}
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
if (extend_modes[mode] & NEED_ABOVELEFT) {
above_row[-1] = n_top_px > 0 ? (n_left_px > 0 ? above_ref[-1] : 129) : 127;
}
......@@ -675,7 +665,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
// predict
if (mode == DC_PRED) {
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
dc_pred[n_left_px > 0][n_top_px > 0][tx_size](dst, dst_stride,
const_above_row, left_col);
#else
......@@ -695,21 +685,23 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
const int txw = (1 << tx_size);
const int have_top = loff || xd->up_available;
const int have_left = aoff || xd->left_available;
#if !CONFIG_EXT_IPRED_BLTR
#if !CONFIG_MISC_FIXES
const int bw = (1 << bwl_in);
const int have_right = (aoff + txw) < bw;
#endif
const int x = aoff * 4;
const int y = loff * 4;
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
const int bw = VPXMAX(2, 1 << bwl_in);
const int bh = VPXMAX(2, 1 << bhl_in);
const int mi_row = -xd->mb_to_top_edge >> 6;
const int mi_col = -xd->mb_to_left_edge >> 6;
const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
const struct macroblockd_plane *const pd = &xd->plane[plane];
const int right_available =
mi_col + (bw >> !pd->subsampling_x) < xd->tile.mi_col_end;
const int have_right = vp10_has_right(bsize, mi_row, mi_col,
xd->mb_to_right_edge > 0,
right_available,
tx_size, loff, aoff,
pd->subsampling_x);
const int have_bottom = vp10_has_bottom(bsize, mi_row, mi_col,
......
......@@ -47,6 +47,8 @@
static int is_compound_reference_allowed(const VP10_COMMON *cm) {
int i;
if (frame_is_intra_only(cm))
return 0;
for (i = 1; i < REFS_PER_FRAME; ++i)
if (cm->ref_frame_sign_bias[i + 1] != cm->ref_frame_sign_bias[1])
return 1;
......
......@@ -1635,17 +1635,17 @@ static int remux_tiles(uint8_t *dest, const int sz,
if (n == n_tiles - 1) {
tile_sz = sz - rpos;
} else {
tile_sz = mem_get_le32(&dest[rpos]);
tile_sz = mem_get_le32(&dest[rpos]) + 1;
rpos += 4;
switch (mag) {
case 0:
dest[wpos] = tile_sz;
dest[wpos] = tile_sz - 1;
break;
case 1:
mem_put_le16(&dest[wpos], tile_sz);
mem_put_le16(&dest[wpos], tile_sz - 1);
break;
case 2:
mem_put_le24(&dest[wpos], tile_sz);
mem_put_le24(&dest[wpos], tile_sz - 1);
break;
case 3: // remuxing should only happen if mag < 3
default:
......
......@@ -2807,6 +2807,8 @@ void vp10_encode_frame(VP10_COMP *cpi) {
cm->comp_var_ref[0] = LAST_FRAME;
cm->comp_var_ref[1] = GOLDEN_FRAME;
}
} else {
cpi->allow_comp_inter_inter = 0;
}
if (cpi->sf.frame_parameter_update) {
......
......@@ -832,7 +832,7 @@ static INLINE void highbd_dc_predictor(uint16_t *dst, ptrdiff_t stride,
intra_pred_no_4x4(d207)
intra_pred_no_4x4(d63)
intra_pred_no_4x4(d45)
#if CONFIG_EXT_IPRED_BLTR
#if CONFIG_MISC_FIXES
intra_pred_allsizes(d207e)
intra_pred_allsizes(d63e)
intra_pred_no_4x4(d45e)
......@@ -847,7 +847,4 @@ intra_pred_allsizes(dc_128)
intra_pred_allsizes(dc_left)
intra_pred_allsizes(dc_top)
intra_pred_allsizes(dc)
#if CONFIG_VP9_HIGHBITDEPTH && CONFIG_MISC_FIXES && !CONFIG_EXT_IPRED_BLTR
intra_pred_highbd_sized(d45e, 4)
#endif
#undef intra_pred_allsizes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment