Commit 9bcff194 authored by Wei-Ting Lin's avatar Wei-Ting Lin Committed by Wei-ting Lin

ncobmc_adapt_weight: add motion mode cdf

Add a new default motion_mode_cdf supporting this
experiment.
Also define the costs for the ncobmc mode tokens.

Change-Id: Iebab044e4a34e3d2a94c18893107d82055cc9c77
parent 26897d10
......@@ -743,28 +743,7 @@ static const aom_prob default_motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1] =
#endif // CONFIG_EXT_PARTITION
{ 208 }, { 208 }, { 208 }, { 208 },
};
#else
// TODO(weitinglin): The default probability is copied from warped motion right
// now as a place holder. It needs to be fined tuned after
// NCOBMC_ADAPT_WEIGHT is actually implemented. Also needs to
// change this section appropriately once warped motion is
// supported.
const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
-SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, -NCOBMC_ADAPT_WEIGHT,
};
static const aom_prob default_motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1] =
{
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
{ 255, 200 }, { 255, 200 }, { 255, 200 },
#endif
{ 255, 200 }, { 255, 200 }, { 255, 200 }, { 151, 200 }, { 153, 200 },
{ 144, 200 }, { 178, 200 }, { 165, 200 }, { 160, 200 }, { 207, 200 },
{ 195, 200 }, { 168, 200 }, { 244, 200 },
#if CONFIG_EXT_PARTITION
{ 252, 200 }, { 252, 200 }, { 252, 200 },
#endif // CONFIG_EXT_PARTITION
};
#endif
static const aom_cdf_prob
default_motion_mode_cdf[BLOCK_SIZES][CDF_SIZE(MOTION_MODES)] = {
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
......@@ -796,6 +775,55 @@ static const aom_cdf_prob
{ AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
};
#else
// TODO(weitinglin): The default probability is copied from warped motion right
// now as a place holder. It needs to be fined tuned after
// NCOBMC_ADAPT_WEIGHT is actually implemented. Also needs to
// change this section appropriately once warped motion is
// supported.
const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
-SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, -NCOBMC_ADAPT_WEIGHT,
};
static const aom_prob default_motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1] =
{
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
{ 255, 200 }, { 255, 200 }, { 255, 200 },
#endif
{ 255, 200 }, { 255, 200 }, { 255, 200 }, { 151, 200 }, { 153, 200 },
{ 144, 200 }, { 178, 200 }, { 165, 200 }, { 160, 200 }, { 207, 200 },
{ 195, 200 }, { 168, 200 }, { 244, 200 },
#if CONFIG_EXT_PARTITION
{ 252, 200 }, { 252, 200 }, { 252, 200 },
#endif // CONFIG_EXT_PARTITION
};
static const aom_cdf_prob
default_motion_mode_cdf[BLOCK_SIZES][CDF_SIZE(MOTION_MODES)] = {
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
{ AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
{ AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
{ AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
#endif
{ AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
{ AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
{ AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
{ AOM_ICDF(7936), AOM_ICDF(19091), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4991), AOM_ICDF(19205), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4992), AOM_ICDF(19314), AOM_ICDF(32768), 0 },
{ AOM_ICDF(15104), AOM_ICDF(21590), AOM_ICDF(32768), 0 },
{ AOM_ICDF(9855), AOM_ICDF(21043), AOM_ICDF(32768), 0 },
{ AOM_ICDF(12800), AOM_ICDF(22238), AOM_ICDF(32768), 0 },
{ AOM_ICDF(24320), AOM_ICDF(26498), AOM_ICDF(32768), 0 },
{ AOM_ICDF(26496), AOM_ICDF(28995), AOM_ICDF(32768), 0 },
{ AOM_ICDF(25216), AOM_ICDF(28166), AOM_ICDF(32768), 0 },
{ AOM_ICDF(30592), AOM_ICDF(31238), AOM_ICDF(32768), 0 },
#if CONFIG_EXT_PARTITION
{ AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32768), 0 },
{ AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32768), 0 },
{ AOM_ICDF(32256), AOM_ICDF(32656), AOM_ICDF(32768), 0 },
#endif
};
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
#elif !CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
......
......@@ -220,6 +220,7 @@ typedef struct frame_contexts {
aom_cdf_prob motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)];
#if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR
aom_prob ncobmc_mode_prob[ADAPT_OVERLAP_BLOCKS][MAX_NCOBMC_MODES - 1];
aom_cdf_prob ncobmc_mode_cdf[BLOCK_SIZES][CDF_SIZE(MAX_NCOBMC_MODES)];
#endif
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
aom_prob obmc_prob[BLOCK_SIZES_ALL];
......
......@@ -4964,10 +4964,10 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR
for (i = 0; i < ADAPT_OVERLAP_BLOCKS; ++i) {
for (j = 0; j < MAX_NCOBMC_MODES - 1; ++j)
for (int j = 0; j < MAX_NCOBMC_MODES - 1; ++j)
av1_diff_update_prob(&r, &fc->ncobmc_mode_prob[i][j], ACCT_STR);
}
#endif
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR
#if !CONFIG_NEW_MULTISYMBOL
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
......
......@@ -562,6 +562,9 @@ typedef struct AV1_COMP {
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
int motion_mode_cost1[BLOCK_SIZES_ALL][2];
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR && CONFIG_NCOBMC_ADAPT_WEIGHT
int ncobmc_mode_cost[ADAPT_OVERLAP_BLOCKS][MAX_NCOBMC_MODES];
#endif // CONFIG_MOTION_VAR && CONFIG_NCOBMC_ADAPT_WEIGHT
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
int intra_uv_mode_cost[INTRA_MODES][INTRA_MODES];
int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
......
......@@ -469,6 +469,12 @@ void av1_initialize_rd_consts(AV1_COMP *cpi) {
cpi->motion_mode_cost1[i][1] = av1_cost_bit(cm->fc->obmc_prob[i], 1);
}
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR && CONFIG_NCOBMC_ADAPT_WEIGHT
for (i = ADAPT_OVERLAP_BLOCK_8X8; i < ADAPT_OVERLAP_BLOCKS; ++i) {
av1_cost_tokens((int *)cpi->ncobmc_mode_cost[i],
cm->fc->ncobmc_mode_prob[i], av1_ncobmc_mode_tree);
}
#endif
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
}
}
......
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