Commit 4aa50c17 authored by hui su's avatar hui su

refactor ext-intra

Coding gain remains about the same, while overall speed is
substantially increased.

Change-Id: I2989bebcfd21092cd6a02653d4df4a3bf6780874
parent b49ac0b1
...@@ -89,7 +89,6 @@ typedef struct { ...@@ -89,7 +89,6 @@ typedef struct {
// 1: an ext intra mode is used; 0: otherwise. // 1: an ext intra mode is used; 0: otherwise.
uint8_t use_ext_intra_mode[PLANE_TYPES]; uint8_t use_ext_intra_mode[PLANE_TYPES];
EXT_INTRA_MODE ext_intra_mode[PLANE_TYPES]; EXT_INTRA_MODE ext_intra_mode[PLANE_TYPES];
uint8_t ext_intra_angle[PLANE_TYPES];
} EXT_INTRA_MODE_INFO; } EXT_INTRA_MODE_INFO;
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
...@@ -124,6 +123,7 @@ typedef struct { ...@@ -124,6 +123,7 @@ typedef struct {
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
EXT_INTRA_MODE_INFO ext_intra_mode_info; EXT_INTRA_MODE_INFO ext_intra_mode_info;
int8_t angle_delta[2];
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
// TODO(slavarnway): Delete and use bmi[3].as_mv[] instead. // TODO(slavarnway): Delete and use bmi[3].as_mv[] instead.
...@@ -328,14 +328,14 @@ static const int ext_tx_used_inter[EXT_TX_SETS_INTER][TX_TYPES] = { ...@@ -328,14 +328,14 @@ static const int ext_tx_used_inter[EXT_TX_SETS_INTER][TX_TYPES] = {
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
// 0: use both directional and filter modes; 1: use directional modes only. #define ALLOW_FILTER_INTRA_MODES 1
#define DR_ONLY 0 #define ANGLE_STEP 3
// 0: use slow exhaustive search; 1: use fast sub-optimal search. #define MAX_ANGLE_DELTAS 3
#define ANGLE_FAST_SEARCH 1 #define ANGLE_FAST_SEARCH 1
// A parameter to adjust early termination in the fast search of angles.
#define RD_ADJUSTER 1.4 static uint8_t mode_to_angle_map[INTRA_MODES] = {
// Number of different angles that are supported 0, 90, 180, 45, 135, 111, 157, 203, 67, 0,
#define EXT_INTRA_ANGLES 128 };
static const TX_TYPE filter_intra_mode_to_tx_type_lookup[FILTER_INTRA_MODES] = { static const TX_TYPE filter_intra_mode_to_tx_type_lookup[FILTER_INTRA_MODES] = {
DCT_DCT, // FILTER_DC DCT_DCT, // FILTER_DC
...@@ -349,13 +349,6 @@ static const TX_TYPE filter_intra_mode_to_tx_type_lookup[FILTER_INTRA_MODES] = { ...@@ -349,13 +349,6 @@ static const TX_TYPE filter_intra_mode_to_tx_type_lookup[FILTER_INTRA_MODES] = {
ADST_DCT, // FILTER_D63 ADST_DCT, // FILTER_D63
ADST_ADST, // FILTER_TM ADST_ADST, // FILTER_TM
}; };
// Maps the angle index to the actual prediction angle (in degrees).
// Angle index is in the range [0, EXT_INTRA_ANGLES); the actual prediction
// angle is in the range (0, 270).
static INLINE int prediction_angle_map(int angle_in) {
return (10 + 2 * angle_in);
}
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
...@@ -363,33 +356,44 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, ...@@ -363,33 +356,44 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
int block_idx, TX_SIZE tx_size) { int block_idx, TX_SIZE tx_size) {
const MODE_INFO *const mi = xd->mi[0]; const MODE_INFO *const mi = xd->mi[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi; const MB_MODE_INFO *const mbmi = &mi->mbmi;
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
const int use_ext_intra_mode_info = if (!is_inter_block(mbmi)) {
mbmi->ext_intra_mode_info.use_ext_intra_mode[plane_type]; const int use_ext_intra_mode_info =
const EXT_INTRA_MODE ext_intra_mode = mbmi->ext_intra_mode_info.use_ext_intra_mode[plane_type];
mbmi->ext_intra_mode_info.ext_intra_mode[plane_type]; const EXT_INTRA_MODE ext_intra_mode =
mbmi->ext_intra_mode_info.ext_intra_mode[plane_type];
const PREDICTION_MODE mode = (plane_type == PLANE_TYPE_Y) ?
get_y_mode(mi, block_idx) : mbmi->uv_mode;
if (xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32)
return DCT_DCT;
if (!is_inter_block(mbmi) && use_ext_intra_mode_info) {
if (!xd->lossless[mbmi->segment_id] && tx_size < TX_32X32
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
&& !(mbmi->sb_type >= BLOCK_8X8 && plane_type == PLANE_TYPE_Y) if (mbmi->sb_type >= BLOCK_8X8 && plane_type == PLANE_TYPE_Y)
return mbmi->tx_type;
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
) {
if (ext_intra_mode > FILTER_TM_PRED) { if (use_ext_intra_mode_info)
int angle = mbmi->ext_intra_mode_info.ext_intra_angle[plane_type]; return filter_intra_mode_to_tx_type_lookup[ext_intra_mode];
angle = prediction_angle_map(angle);
assert(angle > 0 && angle < 270); if (mode == DC_PRED) {
if (angle == 135) return DCT_DCT;
return ADST_ADST; } else if (mode == TM_PRED) {
else if (angle < 45 || angle > 225) return ADST_ADST;
return DCT_DCT; } else {
else if (angle < 135) int angle = mode_to_angle_map[mode];
return ADST_DCT; if (mbmi->sb_type >= BLOCK_8X8)
else angle += mbmi->angle_delta[plane_type] * ANGLE_STEP;
return DCT_ADST; assert(angle > 0 && angle < 270);
} else { if (angle == 135)
return filter_intra_mode_to_tx_type_lookup[ext_intra_mode]; return ADST_ADST;
} else if (angle < 45 || angle > 225)
return DCT_DCT;
else if (angle < 135)
return ADST_DCT;
else
return DCT_ADST;
} }
} }
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
......
...@@ -967,7 +967,7 @@ static const struct segmentation_probs default_seg_probs = { ...@@ -967,7 +967,7 @@ static const struct segmentation_probs default_seg_probs = {
#endif #endif
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
static const vpx_prob default_ext_intra_probs[2] = {200, 200}; static const vpx_prob default_ext_intra_probs[2] = {230, 230};
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
static void init_mode_probs(FRAME_CONTEXT *fc) { static void init_mode_probs(FRAME_CONTEXT *fc) {
......
...@@ -32,11 +32,6 @@ extern "C" { ...@@ -32,11 +32,6 @@ extern "C" {
#define PALETTE_BLOCK_SIZES (BLOCK_64X64 - BLOCK_8X8 + 1) #define PALETTE_BLOCK_SIZES (BLOCK_64X64 - BLOCK_8X8 + 1)
#define PALETTE_Y_MODE_CONTEXTS 3 #define PALETTE_Y_MODE_CONTEXTS 3
#if CONFIG_EXT_INTRA
// Probability that an ext_intra mode is a directional prediction mode
#define DR_EXT_INTRA_PROB 144
#endif // CONFIG_EXT_INTRA
struct VP10Common; struct VP10Common;
struct tx_probs { struct tx_probs {
......
...@@ -168,7 +168,6 @@ typedef enum { ...@@ -168,7 +168,6 @@ typedef enum {
FILTER_D207_PRED, FILTER_D207_PRED,
FILTER_D63_PRED, FILTER_D63_PRED,
FILTER_TM_PRED, FILTER_TM_PRED,
EXT_DR_PRED,
EXT_INTRA_MODES, EXT_INTRA_MODES,
} EXT_INTRA_MODE; } EXT_INTRA_MODE;
......
...@@ -405,32 +405,11 @@ static void dr_prediction_z3(uint8_t *dst, ptrdiff_t stride, int bs, ...@@ -405,32 +405,11 @@ static void dr_prediction_z3(uint8_t *dst, ptrdiff_t stride, int bs,
} }
} }
static INLINE void v_predictor(uint8_t *dst, ptrdiff_t stride, int bs, static void dr_predictor(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size,
const uint8_t *above, const uint8_t *left) {
int r;
(void) left;
for (r = 0; r < bs; r++) {
memcpy(dst, above, bs);
dst += stride;
}
}
static INLINE void h_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
int r;
(void) above;
for (r = 0; r < bs; r++) {
memset(dst, left[r], bs);
dst += stride;
}
}
static void dr_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left, int angle) { const uint8_t *above, const uint8_t *left, int angle) {
double t = 0; double t = 0;
int dx, dy; int dx, dy;
int bs = 4 << tx_size;
if (angle != 90 && angle != 180) if (angle != 90 && angle != 180)
t = tan(angle * PI / 180.0); t = tan(angle * PI / 180.0);
...@@ -448,9 +427,9 @@ static void dr_predictor(uint8_t *dst, ptrdiff_t stride, int bs, ...@@ -448,9 +427,9 @@ static void dr_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
dy = -((int)(256 * t)); dy = -((int)(256 * t));
dr_prediction_z3(dst, stride, bs, above, left, dx, dy); dr_prediction_z3(dst, stride, bs, above, left, dx, dy);
} else if (angle == 90) { } else if (angle == 90) {
v_predictor(dst, stride, bs, above, left); pred[V_PRED][tx_size](dst, stride, above, left);
} else if (angle == 180) { } else if (angle == 180) {
h_predictor(dst, stride, bs, above, left); pred[H_PRED][tx_size](dst, stride, above, left);
} }
} }
...@@ -915,11 +894,7 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd, ...@@ -915,11 +894,7 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
int i; int i;
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
#if CONFIG_MISC_FIXES
DECLARE_ALIGNED(16, uint16_t, left_col[32]);
#else
DECLARE_ALIGNED(16, uint16_t, left_col[64]); DECLARE_ALIGNED(16, uint16_t, left_col[64]);
#endif
DECLARE_ALIGNED(16, uint16_t, above_data[64 + 16]); DECLARE_ALIGNED(16, uint16_t, above_data[64 + 16]);
uint16_t *above_row = above_data + 16; uint16_t *above_row = above_data + 16;
const uint16_t *const_above_row = above_row; const uint16_t *const_above_row = above_row;
...@@ -946,37 +921,38 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd, ...@@ -946,37 +921,38 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
&xd->mi[0]->mbmi.ext_intra_mode_info; &xd->mi[0]->mbmi.ext_intra_mode_info;
const EXT_INTRA_MODE ext_intra_mode = const EXT_INTRA_MODE ext_intra_mode =
ext_intra_mode_info->ext_intra_mode[plane != 0]; ext_intra_mode_info->ext_intra_mode[plane != 0];
const int angle = int p_angle = 0;
prediction_angle_map(ext_intra_mode_info->ext_intra_angle[plane != 0]);
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) { if (mode != DC_PRED && mode != TM_PRED &&
EXT_INTRA_MODE ext_intra_mode = xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
ext_intra_mode_info->ext_intra_mode[plane != 0]; p_angle = mode_to_angle_map[mode] +
if (ext_intra_mode <= FILTER_TM_PRED) { xd->mi[0]->mbmi.angle_delta[plane != 0] * ANGLE_STEP;
need_left = ext_intra_extend_modes[ext_intra_mode] & NEED_LEFT;
need_above = ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVE;
need_aboveright =
ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVERIGHT;
} else {
assert(angle > 0 && angle < 270);
#if CONFIG_MISC_FIXES #if CONFIG_MISC_FIXES
if (angle <= 90) if (p_angle <= 90)
need_above = 1, need_left = 0; need_above = 1, need_left = 0;
else if (angle < 180) else if (p_angle < 180)
need_above = 1, need_left = 1; need_above = 1, need_left = 1;
else else
need_above = 0, need_left = 1; need_above = 0, need_left = 1;
#else #else
if (angle < 90) if (p_angle < 90)
need_above = 0, need_aboveright = 1, need_left = 0; need_above = 0, need_aboveright = 1, need_left = 0;
else if (angle == 90) else if (p_angle == 90)
need_above = 1, need_aboveright = 0, need_left = 0; need_above = 1, need_aboveright = 0, need_left = 0;
else if (angle < 180) else if (p_angle < 180)
need_above = 1, need_aboveright = 0, need_left = 1; need_above = 1, need_aboveright = 0, need_left = 1;
else else
need_above = 0, need_aboveright = 0, need_left = 1; need_above = 0, need_aboveright = 0, need_left = 1;
#endif // CONFIG_MISC_FIXES #endif // CONFIG_MISC_FIXES
} }
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
EXT_INTRA_MODE ext_intra_mode =
ext_intra_mode_info->ext_intra_mode[plane != 0];
need_left = ext_intra_extend_modes[ext_intra_mode] & NEED_LEFT;
need_above = ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVE;
need_aboveright =
ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVERIGHT;
} }
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
...@@ -993,10 +969,10 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd, ...@@ -993,10 +969,10 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
int need_bottom; int need_bottom;
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) { if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
if (ext_intra_mode <= FILTER_TM_PRED)
need_bottom = 0; need_bottom = 0;
else } else if (mode != DC_PRED && mode != TM_PRED &&
need_bottom = angle > 180; xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
need_bottom = p_angle > 180;
} else { } else {
need_bottom = !!(extend_modes[mode] & NEED_BOTTOMLEFT); need_bottom = !!(extend_modes[mode] & NEED_BOTTOMLEFT);
} }
...@@ -1024,10 +1000,10 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd, ...@@ -1024,10 +1000,10 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
int need_right; int need_right;
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) { if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
if (ext_intra_mode <= FILTER_TM_PRED) need_right = 1;
need_right = 1; } else if (mode != DC_PRED && mode != TM_PRED &&
else xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
need_right = angle < 90; need_right = p_angle < 90;
} else { } else {
need_right = !!(extend_modes[mode] & NEED_ABOVERIGHT); need_right = !!(extend_modes[mode] & NEED_ABOVERIGHT);
} }
...@@ -1052,7 +1028,9 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd, ...@@ -1052,7 +1028,9 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
(void)need_aboveright; (void)need_aboveright;
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0] || if (ext_intra_mode_info->use_ext_intra_mode[plane != 0] ||
(extend_modes[mode] & NEED_ABOVELEFT)) { (extend_modes[mode] & NEED_ABOVELEFT) ||
(mode != DC_PRED && mode != TM_PRED &&
xd->mi[0]->mbmi.sb_type >= BLOCK_8X8)) {
above_row[-1] = n_top_px > 0 ? above_row[-1] = n_top_px > 0 ?
(n_left_px > 0 ? above_ref[-1] : base + 1) : base - 1; (n_left_px > 0 ? above_ref[-1] : base + 1) : base - 1;
} }
...@@ -1185,13 +1163,15 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd, ...@@ -1185,13 +1163,15 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) { if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
if (ext_intra_mode <= FILTER_TM_PRED) highbd_filter_intra_predictors[ext_intra_mode](dst, dst_stride, bs,
highbd_filter_intra_predictors[ext_intra_mode](dst, dst_stride, bs, const_above_row, left_col, bd);
const_above_row, left_col, return;
bd); }
else
highbd_dr_predictor(dst, dst_stride, bs, const_above_row, left_col, if (mode != DC_PRED && mode != TM_PRED &&
angle, bd); xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
highbd_dr_predictor(dst, dst_stride, bs, const_above_row, left_col,
p_angle, bd);
return; return;
} }
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
...@@ -1247,37 +1227,39 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, ...@@ -1247,37 +1227,39 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
&xd->mi[0]->mbmi.ext_intra_mode_info; &xd->mi[0]->mbmi.ext_intra_mode_info;
const EXT_INTRA_MODE ext_intra_mode = const EXT_INTRA_MODE ext_intra_mode =
ext_intra_mode_info->ext_intra_mode[plane != 0]; ext_intra_mode_info->ext_intra_mode[plane != 0];
const int angle = int p_angle = 0;
prediction_angle_map(ext_intra_mode_info->ext_intra_angle[plane != 0]);
if (mode != DC_PRED && mode != TM_PRED &&
xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
p_angle = mode_to_angle_map[mode] +
xd->mi[0]->mbmi.angle_delta[plane != 0] * ANGLE_STEP;
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
EXT_INTRA_MODE ext_intra_mode =
ext_intra_mode_info->ext_intra_mode[plane != 0];
if (ext_intra_mode <= FILTER_TM_PRED) {
need_left = ext_intra_extend_modes[ext_intra_mode] & NEED_LEFT;
need_above = ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVE;
need_aboveright =
ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVERIGHT;
} else {
assert(angle > 0 && angle < 270);
#if CONFIG_MISC_FIXES #if CONFIG_MISC_FIXES
if (angle <= 90) if (p_angle <= 90)
need_above = 1, need_left = 0; need_above = 1, need_left = 0;
else if (angle < 180) else if (p_angle < 180)
need_above = 1, need_left = 1; need_above = 1, need_left = 1;
else else
need_above = 0, need_left = 1; need_above = 0, need_left = 1;
#else #else
if (angle < 90) if (p_angle < 90)
need_above = 0, need_aboveright = 1, need_left = 0; need_above = 0, need_aboveright = 1, need_left = 0;
else if (angle == 90) else if (p_angle == 90)
need_above = 1, need_aboveright = 0, need_left = 0; need_above = 1, need_aboveright = 0, need_left = 0;
else if (angle < 180) else if (p_angle < 180)
need_above = 1, need_aboveright = 0, need_left = 1; need_above = 1, need_aboveright = 0, need_left = 1;
else else
need_above = 0, need_aboveright = 0, need_left = 1; need_above = 0, need_aboveright = 0, need_left = 1;
#endif // CONFIG_MISC_FIXES #endif // CONFIG_MISC_FIXES
} }
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
EXT_INTRA_MODE ext_intra_mode =
ext_intra_mode_info->ext_intra_mode[plane != 0];
need_left = ext_intra_extend_modes[ext_intra_mode] & NEED_LEFT;
need_above = ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVE;
need_aboveright =
ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVERIGHT;
} }
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
...@@ -1318,10 +1300,10 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, ...@@ -1318,10 +1300,10 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
int need_bottom; int need_bottom;
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) { if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
if (ext_intra_mode <= FILTER_TM_PRED) need_bottom = 0;
need_bottom = 0; } else if (mode != DC_PRED && mode != TM_PRED &&
else xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
need_bottom = angle > 180; need_bottom = p_angle > 180;
} else { } else {
need_bottom = !!(extend_modes[mode] & NEED_BOTTOMLEFT); need_bottom = !!(extend_modes[mode] & NEED_BOTTOMLEFT);
} }
...@@ -1373,10 +1355,10 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, ...@@ -1373,10 +1355,10 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
int need_right; int need_right;
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) { if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
if (ext_intra_mode <= FILTER_TM_PRED) need_right = 1;
need_right = 1; } else if (mode != DC_PRED && mode != TM_PRED &&
else xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
need_right = angle < 90; need_right = p_angle < 90;
} else { } else {
need_right = !!(extend_modes[mode] & NEED_ABOVERIGHT); need_right = !!(extend_modes[mode] & NEED_ABOVERIGHT);
} }
...@@ -1428,7 +1410,9 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, ...@@ -1428,7 +1410,9 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
(void)need_aboveright; (void)need_aboveright;
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0] || if (ext_intra_mode_info->use_ext_intra_mode[plane != 0] ||
(extend_modes[mode] & NEED_ABOVELEFT)) { (extend_modes[mode] & NEED_ABOVELEFT) ||
(mode != DC_PRED && mode != TM_PRED &&
xd->mi[0]->mbmi.sb_type >= BLOCK_8X8)) {
above_row[-1] = n_top_px > 0 ? (n_left_px > 0 ? above_ref[-1] : 129) : 127; above_row[-1] = n_top_px > 0 ? (n_left_px > 0 ? above_ref[-1] : 129) : 127;
} }
#else #else
...@@ -1486,11 +1470,14 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, ...@@ -1486,11 +1470,14 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) { if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
if (ext_intra_mode <= FILTER_TM_PRED) filter_intra_predictors[ext_intra_mode](dst, dst_stride, bs,
filter_intra_predictors[ext_intra_mode](dst, dst_stride, bs, const_above_row, left_col);
const_above_row, left_col); return;
else }
dr_predictor(dst, dst_stride, bs, const_above_row, left_col, angle);
if (mode != DC_PRED && mode != TM_PRED &&
xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
dr_predictor(dst, dst_stride, tx_size, const_above_row, left_col, p_angle);
return; return;
} }
#endif // CONFIG_EXT_INTRA #endif // CONFIG_EXT_INTRA
...@@ -1510,10 +1497,10 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref, ...@@ -1510,10 +1497,10 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
} }
void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in, void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
TX_SIZE tx_size, PREDICTION_MODE mode, TX_SIZE tx_size, PREDICTION_MODE mode,
const uint8_t *ref, int ref_stride, const uint8_t *ref, int ref_stride,
uint8_t *dst, int dst_stride, uint8_t *dst, int dst_stride,
int aoff, int loff, int plane) { int aoff, int loff, int plane) {
const int txw = (1 << tx_size); const int txw = (1 << tx_size);
const int have_top = loff || xd->up_available; const int have_top = loff || xd->up_available;
const int have_left = aoff || xd->left_available; const int have_left = aoff || xd->left_available;
......
...@@ -346,18 +346,16 @@ static void read_ext_intra_mode_info(VP10_COMMON *const cm, ...@@ -346,18 +346,16 @@ static void read_ext_intra_mode_info(VP10_COMMON *const cm,
MODE_INFO *const mi = xd->mi[0]; MODE_INFO *const mi = xd->mi[0];
MB_MODE_INFO *const mbmi = &mi->mbmi; MB_MODE_INFO *const mbmi = &mi->mbmi;
FRAME_COUNTS *counts = xd->counts; FRAME_COUNTS *counts = xd->counts;
#if !ALLOW_FILTER_INTRA_MODES
return;
#endif
if (mbmi->mode == DC_PRED) { if (mbmi->mode == DC_PRED) {
mbmi->ext_intra_mode_info.use_ext_intra_mode[0] = mbmi->ext_intra_mode_info.use_ext_intra_mode[0] =
vpx_read(r, cm->fc->ext_intra_probs[0]); vpx_read(r, cm->fc->ext_intra_probs[0]);
if (mbmi->ext_intra_mode_info.use_ext_intra_mode[0]) { if (mbmi->ext_intra_mode_info.use_ext_intra_mode[0]) {
if (DR_ONLY ? 1 : vpx_read(r, DR_EXT_INTRA_PROB)) { mbmi->ext_intra_mode_info.ext_intra_mode[0] =
mbmi->ext_intra_mode_info.ext_intra_mode[0] = EXT_DR_PRED; read_uniform(r, FILTER_INTRA_MODES);
mbmi->ext_intra_mode_info.ext_intra_angle[0] =
read_uniform(r, EXT_INTRA_ANGLES);
} else {
mbmi->ext_intra_mode_info.ext_intra_mode[0] =
read_uniform(r, FILTER_INTRA_MODES);
}
} }
if (counts) if (counts)
++counts->ext_intra[0][mbmi->ext_intra_mode_info.use_ext_intra_mode[0]]; ++counts->ext_intra[0][mbmi->ext_intra_mode_info.use_ext_intra_mode[0]];
...@@ -366,14 +364,8 @@ static void read_ext_intra_mode_info(VP10_COMMON *const cm, ...@@ -366,14 +364,8 @@ static void read_ext_intra_mode_info(VP10_COMMON *const cm,
mbmi->ext_intra_mode_info.use_ext_intra_mode[1] = mbmi->ext_intra_mode_info.use_ext_intra_mode[1] =
vpx_read(r, cm->fc->ext_intra_probs[1]); vpx_read(r, cm->fc->ext_intra_probs[1]);
if (mbmi->ext_intra_mode_info.use_ext_intra_mode[1]) { if (mbmi->ext_intra_mode_info.use_ext_intra_mode[1]) {
if (DR_ONLY ? 1 : vpx_read(r, DR_EXT_INTRA_PROB)) { mbmi->ext_intra_mode_info.ext_intra_mode[1] =