OLD | NEW |
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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 { | 408 { |
409 denoiser->yv12_running_avg[i].flags = 0; | 409 denoiser->yv12_running_avg[i].flags = 0; |
410 | 410 |
411 if (vp8_yv12_alloc_frame_buffer(&(denoiser->yv12_running_avg[i]), width, | 411 if (vp8_yv12_alloc_frame_buffer(&(denoiser->yv12_running_avg[i]), width, |
412 height, VP8BORDERINPIXELS) | 412 height, VP8BORDERINPIXELS) |
413 < 0) | 413 < 0) |
414 { | 414 { |
415 vp8_denoiser_free(denoiser); | 415 vp8_denoiser_free(denoiser); |
416 return 1; | 416 return 1; |
417 } | 417 } |
418 vpx_memset(denoiser->yv12_running_avg[i].buffer_alloc, 0, | 418 memset(denoiser->yv12_running_avg[i].buffer_alloc, 0, |
419 denoiser->yv12_running_avg[i].frame_size); | 419 denoiser->yv12_running_avg[i].frame_size); |
420 | 420 |
421 } | 421 } |
422 denoiser->yv12_mc_running_avg.flags = 0; | 422 denoiser->yv12_mc_running_avg.flags = 0; |
423 | 423 |
424 if (vp8_yv12_alloc_frame_buffer(&(denoiser->yv12_mc_running_avg), width, | 424 if (vp8_yv12_alloc_frame_buffer(&(denoiser->yv12_mc_running_avg), width, |
425 height, VP8BORDERINPIXELS) < 0) | 425 height, VP8BORDERINPIXELS) < 0) |
426 { | 426 { |
427 vp8_denoiser_free(denoiser); | 427 vp8_denoiser_free(denoiser); |
428 return 1; | 428 return 1; |
429 } | 429 } |
430 | 430 |
431 vpx_memset(denoiser->yv12_mc_running_avg.buffer_alloc, 0, | 431 memset(denoiser->yv12_mc_running_avg.buffer_alloc, 0, |
432 denoiser->yv12_mc_running_avg.frame_size); | 432 denoiser->yv12_mc_running_avg.frame_size); |
433 | 433 |
434 if (vp8_yv12_alloc_frame_buffer(&denoiser->yv12_last_source, width, | 434 if (vp8_yv12_alloc_frame_buffer(&denoiser->yv12_last_source, width, |
435 height, VP8BORDERINPIXELS) < 0) { | 435 height, VP8BORDERINPIXELS) < 0) { |
436 vp8_denoiser_free(denoiser); | 436 vp8_denoiser_free(denoiser); |
437 return 1; | 437 return 1; |
438 } | 438 } |
439 vpx_memset(denoiser->yv12_last_source.buffer_alloc, 0, | 439 memset(denoiser->yv12_last_source.buffer_alloc, 0, |
440 denoiser->yv12_last_source.frame_size); | 440 denoiser->yv12_last_source.frame_size); |
441 | 441 |
442 denoiser->denoise_state = vpx_calloc((num_mb_rows * num_mb_cols), 1); | 442 denoiser->denoise_state = vpx_calloc((num_mb_rows * num_mb_cols), 1); |
443 vpx_memset(denoiser->denoise_state, 0, (num_mb_rows * num_mb_cols)); | 443 memset(denoiser->denoise_state, 0, (num_mb_rows * num_mb_cols)); |
444 vp8_denoiser_set_parameters(denoiser, mode); | 444 vp8_denoiser_set_parameters(denoiser, mode); |
445 denoiser->nmse_source_diff = 0; | 445 denoiser->nmse_source_diff = 0; |
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 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 } | 736 } |
737 if (apply_filter) { | 737 if (apply_filter) { |
738 // Update the signal block |x|. Pixel changes are only to top and/or | 738 // Update the signal block |x|. Pixel changes are only to top and/or |
739 // left boundary pixels: can we avoid full block copy here. | 739 // left boundary pixels: can we avoid full block copy here. |
740 vp8_copy_mem16x16( | 740 vp8_copy_mem16x16( |
741 denoiser->yv12_running_avg[INTRA_FRAME].y_buffer + recon_yoffset, | 741 denoiser->yv12_running_avg[INTRA_FRAME].y_buffer + recon_yoffset, |
742 y_stride, x->thismb, 16); | 742 y_stride, x->thismb, 16); |
743 } | 743 } |
744 } | 744 } |
745 } | 745 } |
OLD | NEW |