Commit 060f7f2c authored by Wei-Ting Lin's avatar Wei-Ting Lin Committed by Wei-ting Lin
Browse files

Fill ncobmc mode and motion mode costs using cdf

Also remove cost update in encodeframe.c as the cost
is now updated through the function av1_fill_mode_rates
in rd.c

Change-Id: Ib670fd078320c706747429bb86e0265bc08356fd
parent a506eb61
......@@ -1794,8 +1794,12 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
ADAPT_OVERLAP_BLOCK ao_block =
adapt_overlap_block_lookup[mbmi->sb_type];
++counts->ncobmc_mode[ao_block][mbmi->ncobmc_mode[0]];
update_cdf(xd->tile_ctx->ncobmc_mode_cdf[ao_block],
mbmi->ncobmc_mode[0], MAX_NCOBMC_MODES);
if (mi_size_wide[mbmi->sb_type] != mi_size_high[mbmi->sb_type]) {
++counts->ncobmc_mode[ao_block][mbmi->ncobmc_mode[1]];
update_cdf(xd->tile_ctx->ncobmc_mode_cdf[ao_block],
mbmi->ncobmc_mode[1], MAX_NCOBMC_MODES);
}
}
#endif
......@@ -4654,13 +4658,6 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
#endif // CONFIG_SPEED_REFS
}
}
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
// TODO(yuec) Suboptimal fix. Need to implement per-block update
for (int i = BLOCK_8X8; i < BLOCK_SIZES_ALL; i++) {
av1_cost_tokens_from_cdf(x->motion_mode_cost[i],
xd->tile_ctx->motion_mode_cdf[i], NULL);
}
#endif
}
static void init_encode_frame_mb_context(AV1_COMP *cpi) {
......@@ -4909,12 +4906,6 @@ void av1_encode_tile(AV1_COMP *cpi, ThreadData *td, int tile_row,
av1_setup_across_tile_boundary_info(cm, tile_info);
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
for (int i = BLOCK_8X8; i < BLOCK_SIZES_ALL; i++) {
av1_cost_tokens_from_cdf(td->mb.motion_mode_cost[i],
cm->fc->motion_mode_cdf[i], NULL);
}
#endif
for (mi_row = tile_info->mi_row_start; mi_row < tile_info->mi_row_end;
mi_row += cm->mib_size) {
encode_rd_sb_row(cpi, td, this_tile, mi_row, &tok);
......
......@@ -228,8 +228,8 @@ void av1_fill_mode_rates(AV1_COMMON *const cm, MACROBLOCK *x,
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; i++) {
av1_cost_tokens(x->motion_mode_cost[i], fc->motion_mode_prob[i],
av1_motion_mode_tree);
av1_cost_tokens_from_cdf(x->motion_mode_cost[i], fc->motion_mode_cdf[i],
NULL);
}
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; i++) {
......@@ -239,8 +239,8 @@ void av1_fill_mode_rates(AV1_COMMON *const cm, MACROBLOCK *x,
#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(x->ncobmc_mode_cost[i], fc->ncobmc_mode_prob[i],
av1_ncobmc_mode_tree);
av1_cost_tokens_from_cdf(x->ncobmc_mode_cost[i], fc->ncobmc_mode_cdf[i],
NULL);
}
#endif // CONFIG_MOTION_VAR && CONFIG_NCOBMC_ADAPT_WEIGHT
#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