OLD | NEW |
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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 | 746 |
747 int near_sadidx[8] = {0, 1, 2, 3, 4, 5, 6, 7}; | 747 int near_sadidx[8] = {0, 1, 2, 3, 4, 5, 6, 7}; |
748 int saddone=0; | 748 int saddone=0; |
749 /* search range got from mv_pred(). It uses step_param levels. (0-7) */ | 749 /* search range got from mv_pred(). It uses step_param levels. (0-7) */ |
750 int sr=0; | 750 int sr=0; |
751 | 751 |
752 unsigned char *plane[4][3]; | 752 unsigned char *plane[4][3]; |
753 int ref_frame_map[4]; | 753 int ref_frame_map[4]; |
754 int sign_bias = 0; | 754 int sign_bias = 0; |
755 int dot_artifact_candidate = 0; | 755 int dot_artifact_candidate = 0; |
756 // For detecting dot artifact. | |
757 unsigned char* target = x->src.y_buffer; | |
758 unsigned char* target_u = x->block[16].src + *x->block[16].base_src; | |
759 unsigned char* target_v = x->block[20].src + *x->block[20].base_src; | |
760 int stride = x->src.y_stride; | |
761 int stride_uv = x->block[16].src_stride; | |
762 #if CONFIG_TEMPORAL_DENOISING | |
763 if (cpi->oxcf.noise_sensitivity) { | |
764 int uv_denoise = (cpi->oxcf.noise_sensitivity >= 2) ? 1 : 0; | |
765 target = | |
766 cpi->denoiser.yv12_running_avg[LAST_FRAME].y_buffer + recon_yoffset; | |
767 stride = cpi->denoiser.yv12_running_avg[LAST_FRAME].y_stride; | |
768 if (uv_denoise) { | |
769 target_u = | |
770 cpi->denoiser.yv12_running_avg[LAST_FRAME].u_buffer + recon_uvoffset
; | |
771 target_v = | |
772 cpi->denoiser.yv12_running_avg[LAST_FRAME].v_buffer + recon_uvoffset
; | |
773 stride_uv = cpi->denoiser.yv12_running_avg[LAST_FRAME].uv_stride; | |
774 } | |
775 } | |
776 #endif | |
777 | |
778 get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset); | 756 get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset); |
779 | 757 |
780 dot_artifact_candidate = | 758 // If the current frame is using LAST as a reference, check for |
781 check_dot_artifact_candidate(cpi, x, | 759 // biasing the mode selection for dot artifacts. |
782 target, stride, | 760 if (cpi->ref_frame_flags & VP8_LAST_FRAME) { |
783 plane[LAST_FRAME][0], mb_row, mb_col, 0); | 761 unsigned char* target_y = x->src.y_buffer; |
784 // If not found in Y channel, check UV channel. | 762 unsigned char* target_u = x->block[16].src + *x->block[16].base_src; |
785 if (!dot_artifact_candidate) { | 763 unsigned char* target_v = x->block[20].src + *x->block[20].base_src; |
| 764 int stride = x->src.y_stride; |
| 765 int stride_uv = x->block[16].src_stride; |
| 766 #if CONFIG_TEMPORAL_DENOISING |
| 767 if (cpi->oxcf.noise_sensitivity) { |
| 768 const int uv_denoise = (cpi->oxcf.noise_sensitivity >= 2) ? 1 : 0; |
| 769 target_y = |
| 770 cpi->denoiser.yv12_running_avg[LAST_FRAME].y_buffer + recon_yoffset; |
| 771 stride = cpi->denoiser.yv12_running_avg[LAST_FRAME].y_stride; |
| 772 if (uv_denoise) { |
| 773 target_u = |
| 774 cpi->denoiser.yv12_running_avg[LAST_FRAME].u_buffer + |
| 775 recon_uvoffset; |
| 776 target_v = |
| 777 cpi->denoiser.yv12_running_avg[LAST_FRAME].v_buffer + |
| 778 recon_uvoffset; |
| 779 stride_uv = cpi->denoiser.yv12_running_avg[LAST_FRAME].uv_stride; |
| 780 } |
| 781 } |
| 782 #endif |
786 dot_artifact_candidate = | 783 dot_artifact_candidate = |
787 check_dot_artifact_candidate(cpi, x, | 784 check_dot_artifact_candidate(cpi, x, target_y, stride, |
788 target_u, stride_uv, | 785 plane[LAST_FRAME][0], mb_row, mb_col, 0); |
789 plane[LAST_FRAME][1], mb_row, mb_col, 1); | 786 // If not found in Y channel, check UV channel. |
790 if (!dot_artifact_candidate) { | 787 if (!dot_artifact_candidate) { |
791 dot_artifact_candidate = | 788 dot_artifact_candidate = |
792 check_dot_artifact_candidate(cpi, x, | 789 check_dot_artifact_candidate(cpi, x, target_u, stride_uv, |
793 target_v, stride_uv, | 790 plane[LAST_FRAME][1], mb_row, mb_col, 1); |
794 plane[LAST_FRAME][2], mb_row, mb_col, 2); | 791 if (!dot_artifact_candidate) { |
| 792 dot_artifact_candidate = |
| 793 check_dot_artifact_candidate(cpi, x, target_v, stride_uv, |
| 794 plane[LAST_FRAME][2], mb_row, mb_col, 2); |
| 795 } |
795 } | 796 } |
796 } | 797 } |
797 | 798 |
798 #if CONFIG_MULTI_RES_ENCODING | 799 #if CONFIG_MULTI_RES_ENCODING |
799 // |parent_ref_valid| will be set here if potentially we can do mv resue for | 800 // |parent_ref_valid| will be set here if potentially we can do mv resue for |
800 // this higher resol (|cpi->oxcf.mr_encoder_id| > 0) frame. | 801 // this higher resol (|cpi->oxcf.mr_encoder_id| > 0) frame. |
801 // |parent_ref_valid| may be reset depending on |parent_ref_frame| for | 802 // |parent_ref_valid| may be reset depending on |parent_ref_frame| for |
802 // the current macroblock below. | 803 // the current macroblock below. |
803 parent_ref_valid = cpi->oxcf.mr_encoder_id && cpi->mr_low_res_mv_avail; | 804 parent_ref_valid = cpi->oxcf.mr_encoder_id && cpi->mr_low_res_mv_avail; |
804 if (parent_ref_valid) | 805 if (parent_ref_valid) |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1568 error4x4 = pick_intra4x4mby_modes(x, &rate, | 1569 error4x4 = pick_intra4x4mby_modes(x, &rate, |
1569 &best_sse); | 1570 &best_sse); |
1570 if (error4x4 < error16x16) | 1571 if (error4x4 < error16x16) |
1571 { | 1572 { |
1572 xd->mode_info_context->mbmi.mode = B_PRED; | 1573 xd->mode_info_context->mbmi.mode = B_PRED; |
1573 best_rate = rate; | 1574 best_rate = rate; |
1574 } | 1575 } |
1575 | 1576 |
1576 *rate_ = best_rate; | 1577 *rate_ = best_rate; |
1577 } | 1578 } |
OLD | NEW |