diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-07-14 17:41:05 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-08-04 12:37:36 +0000 |
commit | 399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (patch) | |
tree | 6b06b60ff365abef0e13b3503d593a0df48d20e8 /chromium/third_party/libvpx/source/libvpx/vp8/encoder | |
parent | 7366110654eec46f21b6824f302356426f48cd74 (diff) | |
download | qtwebengine-chromium-399c965b6064c440ddcf4015f5f8e9d131c7a0a6.tar.gz |
BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1
Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/libvpx/source/libvpx/vp8/encoder')
6 files changed, 76 insertions, 63 deletions
diff --git a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/denoising.c b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/denoising.c index 5ae44e82e1c..cff99c01229 100644 --- a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/denoising.c +++ b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/denoising.c @@ -497,7 +497,8 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, loop_filter_info_n *lfi_n, int mb_row, int mb_col, - int block_index) + int block_index, + int consec_zero_last) { int mv_row; @@ -571,58 +572,69 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, best_sse = zero_mv_sse; } - saved_pre = filter_xd->pre; - saved_dst = filter_xd->dst; - - /* Compensate the running average. */ - filter_xd->pre.y_buffer = src->y_buffer + recon_yoffset; - filter_xd->pre.u_buffer = src->u_buffer + recon_uvoffset; - filter_xd->pre.v_buffer = src->v_buffer + recon_uvoffset; - /* Write the compensated running average to the destination buffer. */ - filter_xd->dst.y_buffer = dst->y_buffer + recon_yoffset; - filter_xd->dst.u_buffer = dst->u_buffer + recon_uvoffset; - filter_xd->dst.v_buffer = dst->v_buffer + recon_uvoffset; - - if (!x->skip) - { - vp8_build_inter_predictors_mb(filter_xd); - } - else - { - vp8_build_inter16x16_predictors_mb(filter_xd, - filter_xd->dst.y_buffer, - filter_xd->dst.u_buffer, - filter_xd->dst.v_buffer, - filter_xd->dst.y_stride, - filter_xd->dst.uv_stride); + mv_row = x->best_sse_mv.as_mv.row; + mv_col = x->best_sse_mv.as_mv.col; + motion_magnitude2 = mv_row * mv_row + mv_col * mv_col; + motion_threshold = denoiser->denoise_pars.scale_motion_thresh * + NOISE_MOTION_THRESHOLD; + + if (motion_magnitude2 < + denoiser->denoise_pars.scale_increase_filter * NOISE_MOTION_THRESHOLD) + x->increase_denoising = 1; + + sse_thresh = denoiser->denoise_pars.scale_sse_thresh * SSE_THRESHOLD; + if (x->increase_denoising) + sse_thresh = + denoiser->denoise_pars.scale_sse_thresh * SSE_THRESHOLD_HIGH; + + if (best_sse > sse_thresh || motion_magnitude2 > motion_threshold) + decision = COPY_BLOCK; + + // If block is considered skin, don't denoise if the block + // (1) is selected as non-zero motion for current frame, or + // (2) has not been selected as ZERO_LAST mode at least x past frames + // in a row. + // TODO(marpan): Parameter "x" should be varied with framerate. + // In particualar, should be reduced for layers (base layer/LAST). + if (x->is_skin && (consec_zero_last < 2 || motion_magnitude2 > 0)) + decision = COPY_BLOCK; + + if (decision == FILTER_BLOCK) { + saved_pre = filter_xd->pre; + saved_dst = filter_xd->dst; + + /* Compensate the running average. */ + filter_xd->pre.y_buffer = src->y_buffer + recon_yoffset; + filter_xd->pre.u_buffer = src->u_buffer + recon_uvoffset; + filter_xd->pre.v_buffer = src->v_buffer + recon_uvoffset; + /* Write the compensated running average to the destination buffer. */ + filter_xd->dst.y_buffer = dst->y_buffer + recon_yoffset; + filter_xd->dst.u_buffer = dst->u_buffer + recon_uvoffset; + filter_xd->dst.v_buffer = dst->v_buffer + recon_uvoffset; + + if (!x->skip) + { + vp8_build_inter_predictors_mb(filter_xd); + } + else + { + vp8_build_inter16x16_predictors_mb(filter_xd, + filter_xd->dst.y_buffer, + filter_xd->dst.u_buffer, + filter_xd->dst.v_buffer, + filter_xd->dst.y_stride, + filter_xd->dst.uv_stride); + } + filter_xd->pre = saved_pre; + filter_xd->dst = saved_dst; + *mbmi = saved_mbmi; } - filter_xd->pre = saved_pre; - filter_xd->dst = saved_dst; - *mbmi = saved_mbmi; - - } - - mv_row = x->best_sse_mv.as_mv.row; - mv_col = x->best_sse_mv.as_mv.col; - motion_magnitude2 = mv_row * mv_row + mv_col * mv_col; - motion_threshold = denoiser->denoise_pars.scale_motion_thresh * - NOISE_MOTION_THRESHOLD; - - // If block is considered to be skin area, lower the motion threshold. - // In current version set threshold = 0, so only denoise zero mv on skin. - if (x->is_skin) - motion_threshold = 0; - - if (motion_magnitude2 < - denoiser->denoise_pars.scale_increase_filter * NOISE_MOTION_THRESHOLD) - x->increase_denoising = 1; - - sse_thresh = denoiser->denoise_pars.scale_sse_thresh * SSE_THRESHOLD; - if (x->increase_denoising) - sse_thresh = denoiser->denoise_pars.scale_sse_thresh * SSE_THRESHOLD_HIGH; - - if (best_sse > sse_thresh || motion_magnitude2 > motion_threshold) + } else { + // zero_frame should always be 1 for real-time mode, as the + // ZEROMV mode is always checked, so we should never go into this branch. + // If case ZEROMV is not checked, then we will force no denoise (COPY). decision = COPY_BLOCK; + } if (decision == FILTER_BLOCK) { diff --git a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/denoising.h b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/denoising.h index 148ccdafe4e..8c126c1cb1b 100644 --- a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/denoising.h +++ b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/denoising.h @@ -18,8 +18,8 @@ extern "C" { #endif -#define SUM_DIFF_THRESHOLD 448 -#define SUM_DIFF_THRESHOLD_HIGH 512 +#define SUM_DIFF_THRESHOLD 512 +#define SUM_DIFF_THRESHOLD_HIGH 600 #define MOTION_MAGNITUDE_THRESHOLD (8*3) #define SUM_DIFF_THRESHOLD_UV (96) // (8 * 8 * 1.5) @@ -108,7 +108,8 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, loop_filter_info_n *lfi_n, int mb_row, int mb_col, - int block_index); + int block_index, + int consec_zero_last); #ifdef __cplusplus } // extern "C" diff --git a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/mcomp.c b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/mcomp.c index 768c764ceb3..e20c1ea7b74 100644 --- a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/mcomp.c +++ b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/mcomp.c @@ -1591,7 +1591,6 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, int col_min = ref_col - distance; int col_max = ref_col + distance; - // TODO(johannkoenig): check if this alignment is necessary. DECLARE_ALIGNED(16, unsigned int, sad_array8[8]); unsigned int sad_array[3]; diff --git a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/pickinter.c b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/pickinter.c index 51fbe541c77..24b332dcdb0 100644 --- a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/pickinter.c +++ b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/pickinter.c @@ -36,7 +36,7 @@ extern unsigned int cnt_pm; #endif -#define MODEL_MODE 0 +#define MODEL_MODE 1 extern const int vp8_ref_frame_order[MAX_MODES]; extern const MB_PREDICTION_MODE vp8_mode_order[MAX_MODES]; @@ -90,7 +90,7 @@ static int is_skin_color(int y, int cb, int cr, int consec_zeromv) { int i = 0; // No skin if block has been zero motion for long consecutive time. - if (consec_zeromv > 80) + if (consec_zeromv > 60) return 0; // Exit on grey. if (cb == 128 && cr == 128) @@ -103,7 +103,7 @@ static int is_skin_color(int y, int cb, int cr, int consec_zeromv) if (skin_color_diff < skin_threshold[i + 1]) { if (y < 60 && skin_color_diff > 3 * (skin_threshold[i + 1] >> 2)) return 0; - else if (consec_zeromv > 30 && + else if (consec_zeromv > 25 && skin_color_diff > (skin_threshold[i + 1] >> 1)) return 0; else @@ -1477,7 +1477,8 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, vp8_denoiser_denoise_mb(&cpi->denoiser, x, best_sse, zero_mv_sse, recon_yoffset, recon_uvoffset, &cpi->common.lf_info, mb_row, mb_col, - block_index); + block_index, + cpi->consec_zero_last_mvbias[block_index]); // Reevaluate ZEROMV after denoising: for large noise content // (i.e., cpi->mse_source_denoised is above threshold), do this for all diff --git a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/rdopt.c b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/rdopt.c index ab0ad15990b..9063cea7663 100644 --- a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/rdopt.c +++ b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/rdopt.c @@ -2530,7 +2530,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, vp8_denoiser_denoise_mb(&cpi->denoiser, x, best_sse, zero_mv_sse, recon_yoffset, recon_uvoffset, &cpi->common.lf_info, mb_row, mb_col, - block_index); + block_index, 0); /* Reevaluate ZEROMV after denoising. */ if (best_mode.mbmode.ref_frame == INTRA_FRAME && diff --git a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/vp8_quantize.c b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/vp8_quantize.c index ee922c9d697..0d101ba5ab5 100644 --- a/chromium/third_party/libvpx/source/libvpx/vp8/encoder/vp8_quantize.c +++ b/chromium/third_party/libvpx/source/libvpx/vp8/encoder/vp8_quantize.c @@ -227,12 +227,12 @@ static void invert_quant(int improved_quant, short *quant, if(improved_quant) { unsigned t; - int l; + int l, m; t = d; for(l = 0; t > 1; l++) t>>=1; - t = 1 + (1<<(16+l))/d; - *quant = (short)(t - (1<<16)); + m = 1 + (1<<(16+l))/d; + *quant = (short)(m - (1<<16)); *shift = l; /* use multiplication and constant shift by 16 */ *shift = 1 << (16 - *shift); |