Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: source/libvpx/vp8/encoder/denoising.c

Issue 756673003: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp8/encoder/block.h ('k') | source/libvpx/vp8/encoder/encodeframe.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 void vp8_denoiser_set_parameters(VP8_DENOISER *denoiser, int mode) { 368 void vp8_denoiser_set_parameters(VP8_DENOISER *denoiser, int mode) {
369 assert(mode > 0); // Denoiser is allocated only if mode > 0. 369 assert(mode > 0); // Denoiser is allocated only if mode > 0.
370 if (mode == 1) { 370 if (mode == 1) {
371 denoiser->denoiser_mode = kDenoiserOnYOnly; 371 denoiser->denoiser_mode = kDenoiserOnYOnly;
372 } else if (mode == 2) { 372 } else if (mode == 2) {
373 denoiser->denoiser_mode = kDenoiserOnYUV; 373 denoiser->denoiser_mode = kDenoiserOnYUV;
374 } else if (mode == 3) { 374 } else if (mode == 3) {
375 denoiser->denoiser_mode = kDenoiserOnYUVAggressive; 375 denoiser->denoiser_mode = kDenoiserOnYUVAggressive;
376 } else { 376 } else {
377 denoiser->denoiser_mode = kDenoiserOnAdaptive; 377 denoiser->denoiser_mode = kDenoiserOnYUV;
378 } 378 }
379 if (denoiser->denoiser_mode != kDenoiserOnYUVAggressive) { 379 if (denoiser->denoiser_mode != kDenoiserOnYUVAggressive) {
380 denoiser->denoise_pars.scale_sse_thresh = 1; 380 denoiser->denoise_pars.scale_sse_thresh = 1;
381 denoiser->denoise_pars.scale_motion_thresh = 8; 381 denoiser->denoise_pars.scale_motion_thresh = 8;
382 denoiser->denoise_pars.scale_increase_filter = 0; 382 denoiser->denoise_pars.scale_increase_filter = 0;
383 denoiser->denoise_pars.denoise_mv_bias = 95; 383 denoiser->denoise_pars.denoise_mv_bias = 95;
384 denoiser->denoise_pars.pickmode_mv_bias = 100; 384 denoiser->denoise_pars.pickmode_mv_bias = 100;
385 denoiser->denoise_pars.qp_thresh = 0; 385 denoiser->denoise_pars.qp_thresh = 0;
386 denoiser->denoise_pars.consec_zerolast = UINT_MAX; 386 denoiser->denoise_pars.consec_zerolast = UINT_MAX;
387 denoiser->denoise_pars.spatial_blur = 0; 387 denoiser->denoise_pars.spatial_blur = 0;
388 } else { 388 } else {
389 denoiser->denoise_pars.scale_sse_thresh = 2; 389 denoiser->denoise_pars.scale_sse_thresh = 2;
390 denoiser->denoise_pars.scale_motion_thresh = 16; 390 denoiser->denoise_pars.scale_motion_thresh = 16;
391 denoiser->denoise_pars.scale_increase_filter = 1; 391 denoiser->denoise_pars.scale_increase_filter = 1;
392 denoiser->denoise_pars.denoise_mv_bias = 60; 392 denoiser->denoise_pars.denoise_mv_bias = 60;
393 denoiser->denoise_pars.pickmode_mv_bias = 75; 393 denoiser->denoise_pars.pickmode_mv_bias = 75;
394 denoiser->denoise_pars.qp_thresh = 85; 394 denoiser->denoise_pars.qp_thresh = 85;
395 denoiser->denoise_pars.consec_zerolast = 15; 395 denoiser->denoise_pars.consec_zerolast = 15;
396 denoiser->denoise_pars.spatial_blur = 20; 396 denoiser->denoise_pars.spatial_blur = 0;
397 } 397 }
398 } 398 }
399 399
400 int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height, 400 int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height,
401 int num_mb_rows, int num_mb_cols, int mode) 401 int num_mb_rows, int num_mb_cols, int mode)
402 { 402 {
403 int i; 403 int i;
404 assert(denoiser); 404 assert(denoiser);
405 denoiser->num_mb_cols = num_mb_cols; 405 denoiser->num_mb_cols = num_mb_cols;
406 406
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 denoiser->nmse_source_diff_count = 0; 446 denoiser->nmse_source_diff_count = 0;
447 denoiser->qp_avg = 0; 447 denoiser->qp_avg = 0;
448 // QP threshold below which we can go up to aggressive mode. 448 // QP threshold below which we can go up to aggressive mode.
449 denoiser->qp_threshold_up = 80; 449 denoiser->qp_threshold_up = 80;
450 // QP threshold above which we can go back down to normal mode. 450 // QP threshold above which we can go back down to normal mode.
451 // For now keep this second threshold high, so not used currently. 451 // For now keep this second threshold high, so not used currently.
452 denoiser->qp_threshold_down = 128; 452 denoiser->qp_threshold_down = 128;
453 // Bitrate thresholds and noise metric (nmse) thresholds for switching to 453 // Bitrate thresholds and noise metric (nmse) thresholds for switching to
454 // aggressive mode. 454 // aggressive mode.
455 // TODO(marpan): Adjust thresholds, including effect on resolution. 455 // TODO(marpan): Adjust thresholds, including effect on resolution.
456 denoiser->bitrate_threshold = 300000; // (bits/sec). 456 denoiser->bitrate_threshold = 400000; // (bits/sec).
457 denoiser->threshold_aggressive_mode = 35; 457 denoiser->threshold_aggressive_mode = 80;
458 if (width * height > 1280 * 720) { 458 if (width * height > 1280 * 720) {
459 denoiser->bitrate_threshold = 2000000; 459 denoiser->bitrate_threshold = 2500000;
460 denoiser->threshold_aggressive_mode = 1400; 460 denoiser->threshold_aggressive_mode = 180;
461 } else if (width * height > 960 * 540) { 461 } else if (width * height > 960 * 540) {
462 denoiser->bitrate_threshold = 800000; 462 denoiser->bitrate_threshold = 1000000;
463 denoiser->threshold_aggressive_mode = 150; 463 denoiser->threshold_aggressive_mode = 120;
464 } else if (width * height > 640 * 480) { 464 } else if (width * height > 640 * 480) {
465 denoiser->bitrate_threshold = 500000; 465 denoiser->bitrate_threshold = 600000;
466 denoiser->threshold_aggressive_mode = 100; 466 denoiser->threshold_aggressive_mode = 100;
467 } 467 }
468 return 0; 468 return 0;
469 } 469 }
470 470
471 471
472 void vp8_denoiser_free(VP8_DENOISER *denoiser) 472 void vp8_denoiser_free(VP8_DENOISER *denoiser)
473 { 473 {
474 int i; 474 int i;
475 assert(denoiser); 475 assert(denoiser);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 } 729 }
730 if (apply_filter) { 730 if (apply_filter) {
731 // Update the signal block |x|. Pixel changes are only to top and/or 731 // Update the signal block |x|. Pixel changes are only to top and/or
732 // left boundary pixels: can we avoid full block copy here. 732 // left boundary pixels: can we avoid full block copy here.
733 vp8_copy_mem16x16( 733 vp8_copy_mem16x16(
734 denoiser->yv12_running_avg[INTRA_FRAME].y_buffer + recon_yoffset, 734 denoiser->yv12_running_avg[INTRA_FRAME].y_buffer + recon_yoffset,
735 y_stride, x->thismb, 16); 735 y_stride, x->thismb, 16);
736 } 736 }
737 } 737 }
738 } 738 }
OLDNEW
« no previous file with comments | « source/libvpx/vp8/encoder/block.h ('k') | source/libvpx/vp8/encoder/encodeframe.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698