diff options
author | Marco <marpan@google.com> | 2016-12-21 14:33:21 -0800 |
---|---|---|
committer | Marco <marpan@google.com> | 2017-01-10 17:23:58 -0800 |
commit | 7e3a82c3847c9f6f84f2a2f7cf3ea2aab0388053 (patch) | |
tree | 9dedd9f02804687c091ff8c5244a3e6928c4dd20 /vp9/encoder/vp9_denoiser.c | |
parent | 91fc730d831a46751fe5adb96f4897085b483313 (diff) | |
download | libvpx-7e3a82c3847c9f6f84f2a2f7cf3ea2aab0388053.tar libvpx-7e3a82c3847c9f6f84f2a2f7cf3ea2aab0388053.tar.gz libvpx-7e3a82c3847c9f6f84f2a2f7cf3ea2aab0388053.tar.bz2 libvpx-7e3a82c3847c9f6f84f2a2f7cf3ea2aab0388053.zip |
vp9: Make the denoiser work with spatial SVC.
If enabled denoiser will only denoise the top spatial layer for now.
Added unittest for SVC with denoising.
Change-Id: Ifa373771c4ecfa208615eb163cc38f1c22c6664b
Diffstat (limited to 'vp9/encoder/vp9_denoiser.c')
-rw-r--r-- | vp9/encoder/vp9_denoiser.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/vp9/encoder/vp9_denoiser.c b/vp9/encoder/vp9_denoiser.c index 1d9a6702d..336abb406 100644 --- a/vp9/encoder/vp9_denoiser.c +++ b/vp9/encoder/vp9_denoiser.c @@ -187,7 +187,8 @@ static uint8_t *block_start(uint8_t *framebuf, int stride, int mi_row, static VP9_DENOISER_DECISION perform_motion_compensation( VP9_DENOISER *denoiser, MACROBLOCK *mb, BLOCK_SIZE bs, int increase_denoising, int mi_row, int mi_col, PICK_MODE_CONTEXT *ctx, - int motion_magnitude, int is_skin, int *zeromv_filter, int consec_zeromv) { + int motion_magnitude, int is_skin, int *zeromv_filter, int consec_zeromv, + int num_spatial_layers) { int sse_diff = ctx->zeromv_sse - ctx->newmv_sse; MV_REFERENCE_FRAME frame; MACROBLOCKD *filter_mbd = &mb->e_mbd; @@ -211,7 +212,9 @@ static VP9_DENOISER_DECISION perform_motion_compensation( // If the best reference frame uses inter-prediction and there is enough of a // difference in sum-squared-error, use it. - if (frame != INTRA_FRAME && ctx->newmv_sse != UINT_MAX && + if (frame != INTRA_FRAME && + (frame != GOLDEN_FRAME || num_spatial_layers == 1) && + ctx->newmv_sse != UINT_MAX && sse_diff > sse_diff_thresh(bs, increase_denoising, motion_magnitude)) { mi->ref_frame[0] = ctx->best_reference_frame; mi->mode = ctx->best_sse_inter_mode; @@ -221,9 +224,10 @@ static VP9_DENOISER_DECISION perform_motion_compensation( frame = ctx->best_zeromv_reference_frame; ctx->newmv_sse = ctx->zeromv_sse; // Bias to last reference. - if (frame != LAST_FRAME && - ((ctx->zeromv_lastref_sse<(5 * ctx->zeromv_sse)>> 2) || - denoiser->denoising_level >= kDenHigh)) { + if (num_spatial_layers > 1 || + (frame != LAST_FRAME && + ((ctx->zeromv_lastref_sse<(5 * ctx->zeromv_sse)>> 2) || + denoiser->denoising_level >= kDenHigh))) { frame = LAST_FRAME; ctx->newmv_sse = ctx->zeromv_lastref_sse; } @@ -361,7 +365,8 @@ void vp9_denoiser_denoise(VP9_COMP *cpi, MACROBLOCK *mb, int mi_row, int mi_col, if (denoiser->denoising_level >= kDenLow) decision = perform_motion_compensation( denoiser, mb, bs, denoiser->increase_denoising, mi_row, mi_col, ctx, - motion_magnitude, is_skin, &zeromv_filter, consec_zeromv); + motion_magnitude, is_skin, &zeromv_filter, consec_zeromv, + cpi->svc.number_spatial_layers); if (decision == FILTER_BLOCK) { decision = vp9_denoiser_filter( |