diff options
author | Jingning Han <jingning@google.com> | 2015-01-08 17:56:53 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit.golo.chromium.org> | 2015-01-08 17:56:53 -0800 |
commit | ae537c151b602ca6f110569abf0359df521d6f39 (patch) | |
tree | a30610f039b22f6b687d2ba042224e6da416f57e /vp9/encoder | |
parent | 4d6838627db5caf40396c31ef2ee36e89abfe8f6 (diff) | |
parent | a0be730eae34491a5569f941f04c7dd5c905486c (diff) | |
download | libvpx-ae537c151b602ca6f110569abf0359df521d6f39.tar libvpx-ae537c151b602ca6f110569abf0359df521d6f39.tar.gz libvpx-ae537c151b602ca6f110569abf0359df521d6f39.tar.bz2 libvpx-ae537c151b602ca6f110569abf0359df521d6f39.zip |
Merge "Refactor mc reference block fetch in denoiser"
Diffstat (limited to 'vp9/encoder')
-rw-r--r-- | vp9/encoder/vp9_denoiser.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/vp9/encoder/vp9_denoiser.c b/vp9/encoder/vp9_denoiser.c index 5a99ecade..ab8533703 100644 --- a/vp9/encoder/vp9_denoiser.c +++ b/vp9/encoder/vp9_denoiser.c @@ -190,7 +190,6 @@ static uint8_t *block_start(uint8_t *framebuf, int stride, return framebuf + (stride * mi_row * 8) + (mi_col * 8); } - static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser, MACROBLOCK *mb, BLOCK_SIZE bs, @@ -205,28 +204,18 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser, MV_REFERENCE_FRAME frame; MACROBLOCKD *filter_mbd = &mb->e_mbd; MB_MODE_INFO *mbmi = &filter_mbd->mi[0].src_mi->mbmi; - MB_MODE_INFO saved_mbmi; int i, j; struct buf_2d saved_dst[MAX_MB_PLANE]; struct buf_2d saved_pre[MAX_MB_PLANE][2]; // 2 pre buffers - // We will restore these after motion compensation. - saved_mbmi = *mbmi; - for (i = 0; i < MAX_MB_PLANE; ++i) { - for (j = 0; j < 2; ++j) { - saved_pre[i][j] = filter_mbd->plane[i].pre[j]; - } - saved_dst[i] = filter_mbd->plane[i].dst; - } - mv_col = ctx->best_sse_mv.as_mv.col; mv_row = ctx->best_sse_mv.as_mv.row; - *motion_magnitude = mv_row * mv_row + mv_col * mv_col; - frame = ctx->best_reference_frame; + saved_mbmi = *mbmi; + // 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 && @@ -247,6 +236,26 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser, ctx->newmv_sse = ctx->zeromv_sse; } + if (ctx->newmv_sse > sse_thresh(bs, increase_denoising)) { + // Restore everything to its original state + *mbmi = saved_mbmi; + return COPY_BLOCK; + } + if (mv_row * mv_row + mv_col * mv_col > + 8 * noise_motion_thresh(bs, increase_denoising)) { + // Restore everything to its original state + *mbmi = saved_mbmi; + return COPY_BLOCK; + } + + // We will restore these after motion compensation. + for (i = 0; i < MAX_MB_PLANE; ++i) { + for (j = 0; j < 2; ++j) { + saved_pre[i][j] = filter_mbd->plane[i].pre[j]; + } + saved_dst[i] = filter_mbd->plane[i].dst; + } + // Set the pointers in the MACROBLOCKD to point to the buffers in the denoiser // struct. for (j = 0; j < 2; ++j) { @@ -299,13 +308,6 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser, mv_row = ctx->best_sse_mv.as_mv.row; mv_col = ctx->best_sse_mv.as_mv.col; - if (ctx->newmv_sse > sse_thresh(bs, increase_denoising)) { - return COPY_BLOCK; - } - if (mv_row * mv_row + mv_col * mv_col > - 8 * noise_motion_thresh(bs, increase_denoising)) { - return COPY_BLOCK; - } return FILTER_BLOCK; } |