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

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

Issue 484923003: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 i++; 608 i++;
609 if (i == mbs_in_frame) 609 if (i == mbs_in_frame)
610 i = 0; 610 i = 0;
611 611
612 } 612 }
613 while(block_count && i != cpi->cyclic_refresh_mode_index); 613 while(block_count && i != cpi->cyclic_refresh_mode_index);
614 614
615 cpi->cyclic_refresh_mode_index = i; 615 cpi->cyclic_refresh_mode_index = i;
616 616
617 #if CONFIG_TEMPORAL_DENOISING 617 #if CONFIG_TEMPORAL_DENOISING
618 if (cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive && 618 if (cpi->oxcf.noise_sensitivity > 0) {
619 Q < (int)cpi->denoiser.denoise_pars.qp_thresh) { 619 if (cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive &&
620 // Under aggressive denoising mode, use segmentation to turn off loop 620 Q < (int)cpi->denoiser.denoise_pars.qp_thresh) {
621 // filter below some qp thresh. The loop filter is turned off for all 621 // Under aggressive denoising, use segmentation to turn off loop
622 // blocks that have been encoded as ZEROMV LAST x frames in a row, 622 // filter below some qp thresh. The filter is turned off for all
623 // where x is set by cpi->denoiser.denoise_pars.consec_zerolast. 623 // blocks that have been encoded as ZEROMV LAST x frames in a row,
624 // This is to avoid "dot" artifacts that can occur from repeated 624 // where x is set by cpi->denoiser.denoise_pars.consec_zerolast.
625 // loop filtering on noisy input source. 625 // This is to avoid "dot" artifacts that can occur from repeated
626 cpi->cyclic_refresh_q = Q; 626 // loop filtering on noisy input source.
627 lf_adjustment = -MAX_LOOP_FILTER; 627 cpi->cyclic_refresh_q = Q;
628 for (i = 0; i < mbs_in_frame; ++i) { 628 lf_adjustment = -MAX_LOOP_FILTER;
629 seg_map[i] = (cpi->consec_zero_last[i] > 629 for (i = 0; i < mbs_in_frame; ++i) {
630 cpi->denoiser.denoise_pars.consec_zerolast) ? 1 : 0; 630 seg_map[i] = (cpi->consec_zero_last[i] >
631 cpi->denoiser.denoise_pars.consec_zerolast) ? 1 : 0;
632 }
631 } 633 }
632 } 634 }
633 #endif 635 #endif
634 } 636 }
635 637
636 /* Activate segmentation. */ 638 /* Activate segmentation. */
637 cpi->mb.e_mbd.update_mb_segmentation_map = 1; 639 cpi->mb.e_mbd.update_mb_segmentation_map = 1;
638 cpi->mb.e_mbd.update_mb_segmentation_data = 1; 640 cpi->mb.e_mbd.update_mb_segmentation_data = 1;
639 enable_segmentation(cpi); 641 enable_segmentation(cpi);
640 642
(...skipping 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after
3294 static void process_denoiser_mode_change(VP8_COMP *cpi) { 3296 static void process_denoiser_mode_change(VP8_COMP *cpi) {
3295 const VP8_COMMON *const cm = &cpi->common; 3297 const VP8_COMMON *const cm = &cpi->common;
3296 int i, j; 3298 int i, j;
3297 int total = 0; 3299 int total = 0;
3298 int num_blocks = 0; 3300 int num_blocks = 0;
3299 // Number of blocks skipped along row/column in computing the 3301 // Number of blocks skipped along row/column in computing the
3300 // nmse (normalized mean square error) of source. 3302 // nmse (normalized mean square error) of source.
3301 int skip = 2; 3303 int skip = 2;
3302 // Only select blocks for computing nmse that have been encoded 3304 // Only select blocks for computing nmse that have been encoded
3303 // as ZERO LAST min_consec_zero_last frames in a row. 3305 // as ZERO LAST min_consec_zero_last frames in a row.
3304 int min_consec_zero_last = 10; 3306 // Scale with number of temporal layers.
3307 int min_consec_zero_last = 8 / cpi->oxcf.number_of_layers;
3305 // Decision is tested for changing the denoising mode every 3308 // Decision is tested for changing the denoising mode every
3306 // num_mode_change times this function is called. Note that this 3309 // num_mode_change times this function is called. Note that this
3307 // function called every 8 frames, so (8 * num_mode_change) is number 3310 // function called every 8 frames, so (8 * num_mode_change) is number
3308 // of frames where denoising mode change is tested for switch. 3311 // of frames where denoising mode change is tested for switch.
3309 int num_mode_change = 15; 3312 int num_mode_change = 15;
3310 // Framerate factor, to compensate for larger mse at lower framerates. 3313 // Framerate factor, to compensate for larger mse at lower framerates.
3311 // TODO(marpan): Adjust this factor, 3314 // Use ref_framerate, which is full source framerate for temporal layers.
3312 int fac_framerate = cpi->output_framerate < 25.0f ? 80 : 100; 3315 // TODO(marpan): Adjust this factor.
3316 int fac_framerate = cpi->ref_framerate < 25.0f ? 80 : 100;
3313 int tot_num_blocks = cm->mb_rows * cm->mb_cols; 3317 int tot_num_blocks = cm->mb_rows * cm->mb_cols;
3314 int ystride = cpi->Source->y_stride; 3318 int ystride = cpi->Source->y_stride;
3315 unsigned char *src = cpi->Source->y_buffer; 3319 unsigned char *src = cpi->Source->y_buffer;
3316 unsigned char *dst = cpi->denoiser.yv12_last_source.y_buffer; 3320 unsigned char *dst = cpi->denoiser.yv12_last_source.y_buffer;
3317 static const unsigned char const_source[16] = { 3321 static const unsigned char const_source[16] = {
3318 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 3322 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
3319 128, 128, 128}; 3323 128, 128, 128};
3320 3324
3321 // Loop through the Y plane, every skip blocks along rows and columns, 3325 // Loop through the Y plane, every skip blocks along rows and columns,
3322 // summing the normalized mean square error, only for blocks that have 3326 // summing the normalized mean square error, only for blocks that have
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 else 3375 else
3372 // For subsequent samples, use average with weight ~1/4 for new sample. 3376 // For subsequent samples, use average with weight ~1/4 for new sample.
3373 cpi->denoiser.nmse_source_diff = (int)((total >> 2) + 3377 cpi->denoiser.nmse_source_diff = (int)((total >> 2) +
3374 3 * (cpi->denoiser.nmse_source_diff >> 2)); 3378 3 * (cpi->denoiser.nmse_source_diff >> 2));
3375 cpi->denoiser.nmse_source_diff_count++; 3379 cpi->denoiser.nmse_source_diff_count++;
3376 } 3380 }
3377 // Check for changing the denoiser mode, when we have obtained #samples = 3381 // Check for changing the denoiser mode, when we have obtained #samples =
3378 // num_mode_change. 3382 // num_mode_change.
3379 if (cpi->denoiser.nmse_source_diff_count == num_mode_change) { 3383 if (cpi->denoiser.nmse_source_diff_count == num_mode_change) {
3380 // Check for going up: from normal to aggressive mode. 3384 // Check for going up: from normal to aggressive mode.
3381 if ((cpi->denoiser.denoiser_mode = kDenoiserOnYUV) && 3385 if ((cpi->denoiser.denoiser_mode == kDenoiserOnYUV) &&
3382 (cpi->denoiser.nmse_source_diff > 3386 (cpi->denoiser.nmse_source_diff >
3383 cpi->denoiser.threshold_aggressive_mode)) { 3387 cpi->denoiser.threshold_aggressive_mode)) {
3384 vp8_denoiser_set_parameters(&cpi->denoiser, kDenoiserOnYUVAggressive); 3388 vp8_denoiser_set_parameters(&cpi->denoiser, kDenoiserOnYUVAggressive);
3385 } else { 3389 } else {
3386 // Check for going down: from aggressive to normal mode. 3390 // Check for going down: from aggressive to normal mode.
3387 if ((cpi->denoiser.denoiser_mode = kDenoiserOnYUVAggressive) && 3391 if ((cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive) &&
3388 (cpi->denoiser.nmse_source_diff < 3392 (cpi->denoiser.nmse_source_diff <
3389 cpi->denoiser.threshold_aggressive_mode)) { 3393 cpi->denoiser.threshold_aggressive_mode)) {
3390 vp8_denoiser_set_parameters(&cpi->denoiser, kDenoiserOnYUV); 3394 vp8_denoiser_set_parameters(&cpi->denoiser, kDenoiserOnYUV);
3391 } 3395 }
3392 } 3396 }
3393 // Reset metric and counter for next interval. 3397 // Reset metric and counter for next interval.
3394 cpi->denoiser.nmse_source_diff = 0; 3398 cpi->denoiser.nmse_source_diff = 0;
3395 cpi->denoiser.nmse_source_diff_count = 0; 3399 cpi->denoiser.nmse_source_diff_count = 0;
3396 } 3400 }
3397 } 3401 }
(...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after
5726 } 5730 }
5727 5731
5728 return Total; 5732 return Total;
5729 } 5733 }
5730 5734
5731 5735
5732 int vp8_get_quantizer(VP8_COMP *cpi) 5736 int vp8_get_quantizer(VP8_COMP *cpi)
5733 { 5737 {
5734 return cpi->common.base_qindex; 5738 return cpi->common.base_qindex;
5735 } 5739 }
OLDNEW
« no previous file with comments | « source/libvpx/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.c ('k') | source/libvpx/vp8/vp8_cx_iface.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698