Change datatype of mb_mode_info structure members
Changed datatype of 'comp_group_idx', 'compound_idx', 'num_proj_ref'
and 'overlappable_neighbors[]' from int to uint8_t.
Observed memory footprint reduction with no impact on
encoder/decoder performance.
Stream Preset Encoder Decoder
BasketballDrill_832x480 1 ~0.3% ~2.3%
parkrun_720p50 3 ~1% ~2.7%
Change-Id: I6c49349618a754cdead34b68f53c8ac57c039b6f
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 225b1f1..053cacc 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -220,7 +220,6 @@
// TODO(debargha): Consolidate these flags
int interintra_wedge_index;
int interintra_wedge_sign;
- int overlappable_neighbors[2];
int current_qindex;
int delta_lf_from_base;
int delta_lf[FRAME_LF_COUNT];
@@ -229,17 +228,11 @@
int mi_row;
int mi_col;
#endif
- int num_proj_ref;
-
// Index of the alpha Cb and alpha Cr combination
int cfl_alpha_idx;
// Joint sign of alpha Cb and alpha Cr
int cfl_alpha_signs;
- // Indicate if masked compound is used(1) or not(0).
- int comp_group_idx;
- // If comp_group_idx=0, indicate if dist_wtd_comp(0) or avg_comp(1) is used.
- int compound_idx;
#if CONFIG_INSPECTION
int16_t tx_skip[TXK_TYPE_BUF_LEN];
#endif
@@ -267,6 +260,12 @@
/* deringing gain *per-superblock* */
int8_t cdef_strength;
uint8_t ref_mv_idx;
+ // Indicate if masked compound is used(1) or not(0).
+ uint8_t comp_group_idx;
+ // If comp_group_idx=0, indicate if dist_wtd_comp(0) or avg_comp(1) is used.
+ uint8_t compound_idx;
+ uint8_t num_proj_ref;
+ uint8_t overlappable_neighbors[2];
} MB_MODE_INFO;
static INLINE int is_intrabc_block(const MB_MODE_INFO *mbmi) {
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index 5191808..877c449 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -1105,14 +1105,14 @@
}
// Select samples according to the motion vector difference.
-int av1_selectSamples(MV *mv, int *pts, int *pts_inref, int len,
- BLOCK_SIZE bsize) {
+uint8_t av1_selectSamples(MV *mv, int *pts, int *pts_inref, int len,
+ BLOCK_SIZE bsize) {
const int bw = block_size_wide[bsize];
const int bh = block_size_high[bsize];
const int thresh = clamp(AOMMAX(bw, bh), 16, 112);
int pts_mvd[SAMPLES_ARRAY_SIZE] = { 0 };
int i, j, k, l = len;
- int ret = 0;
+ uint8_t ret = 0;
assert(len <= LEAST_SQUARES_SAMPLES_MAX);
// Obtain the motion vector difference.
@@ -1153,13 +1153,14 @@
// Note: Samples returned are at 1/8-pel precision
// Sample are the neighbor block center point's coordinates relative to the
// left-top pixel of current block.
-int av1_findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row,
- int mi_col, int *pts, int *pts_inref) {
+uint8_t av1_findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row,
+ int mi_col, int *pts, int *pts_inref) {
MB_MODE_INFO *const mbmi0 = xd->mi[0];
int ref_frame = mbmi0->ref_frame[0];
int up_available = xd->up_available;
int left_available = xd->left_available;
- int i, mi_step = 1, np = 0;
+ int i, mi_step = 1;
+ uint8_t np = 0;
const TileInfo *const tile = &xd->tile;
int do_tl = 1;
diff --git a/av1/common/mvref_common.h b/av1/common/mvref_common.h
index da0f903..482d5fd 100644
--- a/av1/common/mvref_common.h
+++ b/av1/common/mvref_common.h
@@ -261,10 +261,10 @@
void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
int_mv *near_mv, int is_integer);
-int av1_selectSamples(MV *mv, int *pts, int *pts_inref, int len,
- BLOCK_SIZE bsize);
-int av1_findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row,
- int mi_col, int *pts, int *pts_inref);
+uint8_t av1_selectSamples(MV *mv, int *pts, int *pts_inref, int len,
+ BLOCK_SIZE bsize);
+uint8_t av1_findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row,
+ int mi_col, int *pts, int *pts_inref);
#define INTRABC_DELAY_PIXELS 256 // Delay of 256 pixels
#define INTRABC_DELAY_SB64 (INTRABC_DELAY_PIXELS / 64)
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index a72fcd9..7eb5d12 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -1412,14 +1412,14 @@
if (masked_compound_used) {
const int ctx_comp_group_idx = get_comp_group_idx_context(xd);
- mbmi->comp_group_idx = aom_read_symbol(
+ mbmi->comp_group_idx = (uint8_t)aom_read_symbol(
r, ec_ctx->comp_group_idx_cdf[ctx_comp_group_idx], 2, ACCT_STR);
}
if (mbmi->comp_group_idx == 0) {
if (cm->seq_params.order_hint_info.enable_dist_wtd_comp) {
const int comp_index_ctx = get_comp_index_context(cm, xd);
- mbmi->compound_idx = aom_read_symbol(
+ mbmi->compound_idx = (uint8_t)aom_read_symbol(
r, ec_ctx->compound_index_cdf[comp_index_ctx], 2, ACCT_STR);
mbmi->interinter_comp.type =
mbmi->compound_idx ? COMPOUND_AVERAGE : COMPOUND_DISTWTD;
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index d5f702b..16ccc38 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -328,8 +328,6 @@
int skip_mode; // 0: off; 1: on
int skip_mode_cost[SKIP_CONTEXTS][2];
- int compound_idx;
-
LV_MAP_COEFF_COST coeff_costs[TX_SIZES][PLANE_TYPES];
LV_MAP_EOB_COST eob_costs[7][2];
uint16_t cb_offset;
@@ -426,6 +424,7 @@
// The strongest edge strength seen along the x/y axis.
uint16_t edge_strength_x;
uint16_t edge_strength_y;
+ uint8_t compound_idx;
// [Saved stat index]
COMP_RD_STATS comp_rd_stats[MAX_COMP_RD_STATS];