Commit 999bd6ea authored by Marco's avatar Marco

vp9: Fix denoising condition when pickmode partition is used.

When the superblock partition is based on the nonrd-pickmode,
we need to avoid the denoising. Current condition was based on
the speed level. This change is to make the condition at the
superblock level, as the switch in partitioning may be done at
sb level based on source_sad (e.g., in speed 6).

Change-Id: I12ece4f60b93ed34ee65ff2d6cdce1213c36de04
parent facb1249
......@@ -178,6 +178,8 @@ struct macroblock {
int sb_mvrow_part;
int sb_pickmode_part;
// For each superblock: saves the content value (e.g., low/high sad/sumdiff)
// based on source sad, prior to encoding the frame.
uint8_t content_state_sb;
......
......@@ -65,6 +65,7 @@ typedef struct {
int_mv best_sse_mv;
MV_REFERENCE_FRAME best_reference_frame;
MV_REFERENCE_FRAME best_zeromv_reference_frame;
int sb_skip_denoising;
#endif
// motion vector cache for adaptive motion search control in partition
......
......@@ -366,10 +366,7 @@ void vp9_denoiser_denoise(VP9_COMP *cpi, MACROBLOCK *mb, int mi_row, int mi_col,
}
if (!is_skin && denoiser->denoising_level == kDenHigh) increase_denoising = 1;
// TODO(marpan): There is an issue with denoising for speed 5,
// due to the partitioning scheme based on pickmode.
// Remove this speed constraint when issue is resolved.
if (denoiser->denoising_level >= kDenLow && cpi->oxcf.speed > 5)
if (denoiser->denoising_level >= kDenLow && !ctx->sb_skip_denoising)
decision = perform_motion_compensation(
&cpi->common, denoiser, mb, bs, increase_denoising, mi_row, mi_col, ctx,
motion_magnitude, is_skin, &zeromv_filter, consec_zeromv,
......
......@@ -4154,6 +4154,7 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, ThreadData *td,
x->sb_use_mv_part = 0;
x->sb_mvcol_part = 0;
x->sb_mvrow_part = 0;
x->sb_pickmode_part = 0;
if (seg->enabled) {
const uint8_t *const map =
......@@ -4194,6 +4195,7 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, ThreadData *td,
BLOCK_64X64, 1, &dummy_rdc, td->pc_root);
break;
case REFERENCE_PARTITION:
x->sb_pickmode_part = 1;
set_offsets(cpi, tile_info, x, mi_row, mi_col, BLOCK_64X64);
// Use nonrd_pick_partition on scene-cut for VBR mode.
// nonrd_pick_partition does not support 4x4 partition, so avoid it
......
......@@ -2250,6 +2250,11 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
denoise_svc_pickmode && cpi->denoiser.denoising_level > kDenLowLow &&
cpi->denoiser.reset == 0) {
VP9_DENOISER_DECISION decision = COPY_BLOCK;
ctx->sb_skip_denoising = 0;
// TODO(marpan): There is an issue with denoising when the
// superblock partitioning scheme is based on the pickmode.
// Remove this condition when the issue is resolved.
if (x->sb_pickmode_part) ctx->sb_skip_denoising = 1;
vp9_pickmode_ctx_den_update(&ctx_den, zero_last_cost_orig, ref_frame_cost,
frame_mv, reuse_inter_pred, best_tx_size,
best_mode, best_ref_frame, best_pred_filter,
......
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