Commit 9010e20d authored by Jingning Han's avatar Jingning Han

Clean up intra mode context fetch functions

Following the cb4x4 design, the logic related to sub8x8 handling
can be simplifed.

Change-Id: I1ed0c0327a4498614408320a583ad37607bde4af
parent 1a5ab9f2
......@@ -16,28 +16,14 @@
#include "av1/common/blockd.h"
#include "av1/common/onyxc_int.h"
PREDICTION_MODE av1_left_block_mode(const MODE_INFO *cur_mi,
const MODE_INFO *left_mi, int b) {
if (b == 0 || b == 2) {
if (!left_mi || is_inter_block(&left_mi->mbmi)) return DC_PRED;
return left_mi->mbmi.mode;
} else {
assert(b == 1 || b == 3);
return cur_mi->bmi[b - 1].as_mode;
}
PREDICTION_MODE av1_left_block_mode(const MODE_INFO *left_mi) {
if (!left_mi || is_inter_block(&left_mi->mbmi)) return DC_PRED;
return left_mi->mbmi.mode;
}
PREDICTION_MODE av1_above_block_mode(const MODE_INFO *cur_mi,
const MODE_INFO *above_mi, int b) {
if (b == 0 || b == 1) {
if (!above_mi || is_inter_block(&above_mi->mbmi)) return DC_PRED;
return above_mi->mbmi.mode;
} else {
assert(b == 2 || b == 3);
return cur_mi->bmi[b - 2].as_mode;
}
PREDICTION_MODE av1_above_block_mode(const MODE_INFO *above_mi) {
if (!above_mi || is_inter_block(&above_mi->mbmi)) return DC_PRED;
return above_mi->mbmi.mode;
}
void av1_foreach_transformed_block_in_plane(
......
......@@ -432,11 +432,9 @@ static INLINE MV_REFERENCE_FRAME comp_ref1(int ref_idx) {
}
#endif // CONFIG_EXT_COMP_REFS
PREDICTION_MODE av1_left_block_mode(const MODE_INFO *cur_mi,
const MODE_INFO *left_mi, int b);
PREDICTION_MODE av1_left_block_mode(const MODE_INFO *left_mi);
PREDICTION_MODE av1_above_block_mode(const MODE_INFO *cur_mi,
const MODE_INFO *above_mi, int b);
PREDICTION_MODE av1_above_block_mode(const MODE_INFO *above_mi);
static INLINE int is_global_mv_block(const MODE_INFO *mi,
TransformationType type) {
......
......@@ -863,23 +863,11 @@ static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile,
if (mi_row & (xd->n8_w - 1)) xd->is_sec_rect = 1;
}
static INLINE const aom_prob *get_y_mode_probs(const AV1_COMMON *cm,
const MODE_INFO *mi,
const MODE_INFO *above_mi,
const MODE_INFO *left_mi,
int block) {
const PREDICTION_MODE above = av1_above_block_mode(mi, above_mi, block);
const PREDICTION_MODE left = av1_left_block_mode(mi, left_mi, block);
return cm->kf_y_prob[above][left];
}
static INLINE aom_cdf_prob *get_y_mode_cdf(FRAME_CONTEXT *tile_ctx,
const MODE_INFO *mi,
const MODE_INFO *above_mi,
const MODE_INFO *left_mi,
int block) {
const PREDICTION_MODE above = av1_above_block_mode(mi, above_mi, block);
const PREDICTION_MODE left = av1_left_block_mode(mi, left_mi, block);
const MODE_INFO *left_mi) {
const PREDICTION_MODE above = av1_above_block_mode(above_mi);
const PREDICTION_MODE left = av1_left_block_mode(left_mi);
#if CONFIG_KF_CTX
int above_ctx = intra_mode_context[above];
......
......@@ -1186,8 +1186,7 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
set_txfm_ctxs(mbmi->tx_size, xd->n8_w, xd->n8_h, mbmi->skip, xd);
#endif // CONFIG_INTRABC
mbmi->mode =
read_intra_mode(r, get_y_mode_cdf(ec_ctx, mi, above_mi, left_mi, 0));
mbmi->mode = read_intra_mode(r, get_y_mode_cdf(ec_ctx, above_mi, left_mi));
if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
xd->plane[1].subsampling_y)) {
......
......@@ -110,8 +110,9 @@ static void write_intra_mode_kf(const AV1_COMMON *cm, FRAME_CONTEXT *frame_ctx,
#if CONFIG_INTRABC
assert(!is_intrabc_block(&mi->mbmi));
#endif // CONFIG_INTRABC
aom_write_symbol(w, mode,
get_y_mode_cdf(frame_ctx, mi, above_mi, left_mi, block),
(void)mi;
(void)block;
aom_write_symbol(w, mode, get_y_mode_cdf(frame_ctx, above_mi, left_mi),
INTRA_MODES);
(void)cm;
}
......
......@@ -4308,8 +4308,8 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
if (intraonly) {
#if CONFIG_ENTROPY_STATS
const PREDICTION_MODE above = av1_above_block_mode(mi, above_mi, 0);
const PREDICTION_MODE left = av1_left_block_mode(mi, left_mi, 0);
const PREDICTION_MODE above = av1_above_block_mode(above_mi);
const PREDICTION_MODE left = av1_left_block_mode(left_mi);
#if CONFIG_KF_CTX
int above_ctx = intra_mode_context[above];
int left_ctx = intra_mode_context[left];
......@@ -4319,8 +4319,7 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
#endif
#endif // CONFIG_ENTROPY_STATS
if (allow_update_cdf)
update_cdf(get_y_mode_cdf(fc, mi, above_mi, left_mi, 0), y_mode,
INTRA_MODES);
update_cdf(get_y_mode_cdf(fc, above_mi, left_mi), y_mode, INTRA_MODES);
} else {
#if CONFIG_ENTROPY_STATS
++counts->y_mode[size_group_lookup[bsize]][y_mode];
......@@ -4336,8 +4335,8 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
mbmi->filter_intra_mode_info.use_filter_intra_mode[0];
#if CONFIG_ENTROPY_STATS
if (use_filter_intra_mode) {
const PREDICTION_MODE above = av1_above_block_mode(mi, above_mi, 0);
const PREDICTION_MODE left = av1_left_block_mode(mi, left_mi, 0);
const PREDICTION_MODE above = av1_above_block_mode(above_mi);
const PREDICTION_MODE left = av1_left_block_mode(left_mi);
#if CONFIG_KF_CTX
int above_ctx = intra_mode_context[above];
int left_ctx = intra_mode_context[left];
......
......@@ -3419,8 +3419,8 @@ static int64_t rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
try_palette ? x->palette_buffer->best_palette_color_map : NULL;
const MODE_INFO *above_mi = xd->above_mi;
const MODE_INFO *left_mi = xd->left_mi;
const PREDICTION_MODE A = av1_above_block_mode(mic, above_mi, 0);
const PREDICTION_MODE L = av1_left_block_mode(mic, left_mi, 0);
const PREDICTION_MODE A = av1_above_block_mode(above_mi);
const PREDICTION_MODE L = av1_left_block_mode(left_mi);
const PREDICTION_MODE FINAL_MODE_SEARCH = PAETH_PRED + 1;
#if CONFIG_KF_CTX
......
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