Commit eda3d764 authored by hui su's avatar hui su Committed by Hui Su

Add intra-interp experiment flag

intra-interp experiment allows intra prediction to use different
interpolation filters. It was part of the ext-intra in the nextgenv2
branch.

Change-Id: I27ab692494dc79bb92e457dbf9a72988577f1c6d
parent c016df86
......@@ -223,6 +223,7 @@ const int16_t dr_intra_derivative[90] = {
54, 49, 45, 40, 35, 31, 26, 22, 17, 13, 8, 4,
};
#if CONFIG_INTRA_INTERP
int av1_is_intra_filter_switchable(int angle) {
assert(angle > 0 && angle < 270);
if (angle % 45 == 0) return 0;
......@@ -234,4 +235,5 @@ int av1_is_intra_filter_switchable(int angle) {
0xFF) > 0;
}
}
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
......@@ -302,9 +302,12 @@ typedef struct {
FILTER_INTRA_MODE_INFO filter_intra_mode_info;
#endif // CONFIG_FILTER_INTRA
#if CONFIG_EXT_INTRA
// The actual prediction angle is the base angle + (angle_delta * step).
int8_t angle_delta[2];
#if CONFIG_INTRA_INTERP
// To-Do (huisu): this may be replaced by interp_filter
INTRA_FILTER intra_filter;
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
......@@ -697,9 +700,11 @@ static const uint8_t mode_to_angle_map[INTRA_MODES] = {
0, 90, 180, 45, 135, 111, 157, 203, 67, 0,
};
#if CONFIG_INTRA_INTERP
// Returns whether filter selection is needed for a given
// intra prediction angle.
int av1_is_intra_filter_switchable(int angle);
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_TILE
......
......@@ -1636,6 +1636,7 @@ static const aom_prob default_inter_ext_tx_prob[EXT_TX_SIZES][TX_TYPES - 1] = {
#endif // CONFIG_EXT_TX
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
static const aom_prob default_intra_filter_probs[INTRA_FILTERS + 1]
[INTRA_FILTERS - 1] = {
{ 98, 63, 60 },
......@@ -1648,6 +1649,7 @@ const aom_tree_index av1_intra_filter_tree[TREE_SIZE(INTRA_FILTERS)] = {
-INTRA_FILTER_LINEAR, 2, -INTRA_FILTER_8TAP, 4, -INTRA_FILTER_8TAP_SHARP,
-INTRA_FILTER_8TAP_SMOOTH,
};
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_FILTER_INTRA
......@@ -1723,7 +1725,9 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy(fc->seg.tree_probs, default_segment_tree_probs);
av1_copy(fc->seg.pred_probs, default_segment_pred_probs);
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
av1_copy(fc->intra_filter_probs, default_intra_filter_probs);
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_FILTER_INTRA
av1_copy(fc->filter_intra_probs, default_filter_intra_probs);
......@@ -2036,10 +2040,12 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
mode_mv_merge_probs(pre_fc->delta_q_prob[i], counts->delta_q[i]);
#endif
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
for (i = 0; i < INTRA_FILTERS + 1; ++i) {
aom_tree_merge_probs(av1_intra_filter_tree, pre_fc->intra_filter_probs[i],
counts->intra_filter[i], fc->intra_filter_probs[i]);
}
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_FILTER_INTRA
for (i = 0; i < PLANE_TYPES; ++i) {
......
......@@ -152,7 +152,9 @@ typedef struct frame_contexts {
#endif // CONFIG_SUPERTX
struct segmentation_probs seg;
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
aom_prob intra_filter_probs[INTRA_FILTERS + 1][INTRA_FILTERS - 1];
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_FILTER_INTRA
aom_prob filter_intra_probs[PLANE_TYPES];
......@@ -271,7 +273,9 @@ typedef struct FRAME_COUNTS {
#endif // CONFIG_SUPERTX
struct seg_counts seg;
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
unsigned int intra_filter[INTRA_FILTERS + 1][INTRA_FILTERS];
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_FILTER_INTRA
unsigned int filter_intra[PLANE_TYPES][2];
......@@ -328,7 +332,9 @@ extern const aom_tree_index av1_palette_color_tree[PALETTE_MAX_SIZE - 1]
#endif // CONFIG_PALETTE
extern const aom_tree_index av1_tx_size_tree[MAX_TX_DEPTH][TREE_SIZE(TX_SIZES)];
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
extern const aom_tree_index av1_intra_filter_tree[TREE_SIZE(INTRA_FILTERS)];
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_TX
extern const aom_tree_index av1_ext_tx_inter_tree[EXT_TX_SETS_INTER]
......
......@@ -194,12 +194,14 @@ DECLARE_ALIGNED(256, static const InterpKernel,
#endif // CONFIG_EXT_INTERP
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS] = {
bilinear_filters, // INTRA_FILTER_LINEAR
sub_pel_filters_8, // INTRA_FILTER_8TAP
sub_pel_filters_8sharp, // INTRA_FILTER_8TAP_SHARP
sub_pel_filters_8smooth, // INTRA_FILTER_8TAP_SMOOTH
};
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTERP
......
......@@ -64,6 +64,7 @@ extern "C" {
typedef uint8_t InterpFilter;
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
typedef enum {
INTRA_FILTER_LINEAR,
INTRA_FILTER_8TAP,
......@@ -73,6 +74,7 @@ typedef enum {
} INTRA_FILTER;
extern const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS];
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
typedef struct InterpFilterParams {
......
......@@ -96,6 +96,7 @@ int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
#endif
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
// Obtain the reference filter type from the above/left neighbor blocks.
static INTRA_FILTER get_ref_intra_filter(const MB_MODE_INFO *ref_mbmi) {
INTRA_FILTER ref_type = INTRA_FILTERS;
......@@ -143,6 +144,7 @@ int av1_get_pred_context_intra_interp(const MACROBLOCKD *xd) {
else
return INTRA_FILTERS;
}
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
// The mode info data structure has a one element border above and to the
......
......@@ -74,7 +74,9 @@ int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd);
#endif
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
int av1_get_pred_context_intra_interp(const MACROBLOCKD *xd);
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
int av1_get_intra_inter_context(const MACROBLOCKD *xd);
......
This diff is collapsed.
......@@ -4237,9 +4237,11 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#endif // CONFIG_EXT_PARTITION_TYPES
#endif // EC_ADAPT, DAALA_EC
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
for (i = 0; i < INTRA_FILTERS + 1; ++i)
for (j = 0; j < INTRA_FILTERS - 1; ++j)
av1_diff_update_prob(&r, &fc->intra_filter_probs[i][j], ACCT_STR);
#endif // CONFIG_INTRA_INTERP
#endif // EC_ADAPT, DAALA_EC
if (frame_is_intra_only(cm)) {
......
......@@ -653,14 +653,18 @@ static void read_intra_angle_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
aom_reader *r) {
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
#if CONFIG_INTRA_INTERP
const int ctx = av1_get_pred_context_intra_interp(xd);
int p_angle;
#endif // CONFIG_INTRA_INTERP
(void)cm;
if (bsize < BLOCK_8X8) return;
if (mbmi->mode != DC_PRED && mbmi->mode != TM_PRED) {
mbmi->angle_delta[0] =
read_uniform(r, 2 * MAX_ANGLE_DELTAS + 1) - MAX_ANGLE_DELTAS;
#if CONFIG_INTRA_INTERP
p_angle = mode_to_angle_map[mbmi->mode] + mbmi->angle_delta[0] * ANGLE_STEP;
if (av1_is_intra_filter_switchable(p_angle)) {
FRAME_COUNTS *counts = xd->counts;
......@@ -670,6 +674,7 @@ static void read_intra_angle_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
} else {
mbmi->intra_filter = INTRA_FILTER_LINEAR;
}
#endif // CONFIG_INTRA_INTERP
}
if (mbmi->uv_mode != DC_PRED && mbmi->uv_mode != TM_PRED) {
......@@ -1786,7 +1791,9 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
#if CONFIG_EXT_INTRA
mbmi->angle_delta[0] = 0;
mbmi->angle_delta[1] = 0;
#if CONFIG_INTRA_INTERP
mbmi->intra_filter = INTRA_FILTER_LINEAR;
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_FILTER_INTRA
mbmi->filter_intra_mode_info.use_filter_intra_mode[0] = 0;
......
......@@ -110,7 +110,9 @@ static struct av1_token ext_tx_encodings[TX_TYPES];
static struct av1_token global_motion_types_encodings[GLOBAL_TRANS_TYPES];
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
static struct av1_token intra_filter_encodings[INTRA_FILTERS];
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
static struct av1_token interintra_mode_encodings[INTERINTRA_MODES];
......@@ -155,7 +157,9 @@ void av1_encode_token_init(void) {
#endif // CONFIG_PALETTE
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
av1_tokens_from_tree(intra_filter_encodings, av1_intra_filter_tree);
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
av1_tokens_from_tree(interintra_mode_encodings, av1_interintra_mode_tree);
......@@ -1031,20 +1035,25 @@ static void write_intra_angle_info(const AV1_COMMON *cm, const MACROBLOCKD *xd,
aom_writer *w) {
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
#if CONFIG_INTRA_INTERP
const int intra_filter_ctx = av1_get_pred_context_intra_interp(xd);
int p_angle;
#endif // CONFIG_INTRA_INTERP
(void)cm;
if (bsize < BLOCK_8X8) return;
if (mbmi->mode != DC_PRED && mbmi->mode != TM_PRED) {
write_uniform(w, 2 * MAX_ANGLE_DELTAS + 1,
MAX_ANGLE_DELTAS + mbmi->angle_delta[0]);
#if CONFIG_INTRA_INTERP
p_angle = mode_to_angle_map[mbmi->mode] + mbmi->angle_delta[0] * ANGLE_STEP;
if (av1_is_intra_filter_switchable(p_angle)) {
av1_write_token(w, av1_intra_filter_tree,
cm->fc->intra_filter_probs[intra_filter_ctx],
&intra_filter_encodings[mbmi->intra_filter]);
}
#endif // CONFIG_INTRA_INTERP
}
if (mbmi->uv_mode != DC_PRED && mbmi->uv_mode != TM_PRED) {
......@@ -4201,9 +4210,11 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
#endif // CONFIG_EC_ADAPT, CONFIG_DAALA_EC
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
for (i = 0; i < INTRA_FILTERS + 1; ++i)
prob_diff_update(av1_intra_filter_tree, fc->intra_filter_probs[i],
counts->intra_filter[i], INTRA_FILTERS, probwt, header_bc);
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#endif // CONFIG_EC_ADAPT, CONFIG_DAALA_EC
if (frame_is_intra_only(cm)) {
......
......@@ -5493,6 +5493,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
}
#endif // CONFIG_FILTER_INTRA
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
if (mbmi->mode != DC_PRED && mbmi->mode != TM_PRED) {
int p_angle;
const int intra_filter_ctx = av1_get_pred_context_intra_interp(xd);
......@@ -5501,6 +5502,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
if (av1_is_intra_filter_switchable(p_angle))
++counts->intra_filter[intra_filter_ctx][mbmi->intra_filter];
}
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
}
......
......@@ -565,7 +565,9 @@ typedef struct AV1_COMP {
int inter_tx_type_costs[EXT_TX_SIZES][TX_TYPES];
#endif // CONFIG_EXT_TX
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
int intra_filter_cost[INTRA_FILTERS + 1][INTRA_FILTERS];
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_LOOP_RESTORATION
int switchable_restore_cost[RESTORE_SWITCHABLE_TYPES];
......
......@@ -148,9 +148,11 @@ static void fill_mode_costs(AV1_COMP *cpi) {
}
#endif // CONFIG_EXT_TX
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
for (i = 0; i < INTRA_FILTERS + 1; ++i)
av1_cost_tokens(cpi->intra_filter_cost[i], fc->intra_filter_probs[i],
av1_intra_filter_tree);
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_LOOP_RESTORATION
av1_cost_tokens(cpi->switchable_restore_cost, fc->switchable_restore_prob,
......
This diff is collapsed.
......@@ -263,6 +263,7 @@ EXPERIMENT_LIST="
tx64x64
sub8x8_mc
ext_intra
intra_interp
filter_intra
ext_inter
ext_interp
......
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