| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 memset(ss_err, 0xFF, sizeof(ss_err)); | 85 memset(ss_err, 0xFF, sizeof(ss_err)); |
| 86 | 86 |
| 87 // Make a copy of the unfiltered / processed recon buffer | 87 // Make a copy of the unfiltered / processed recon buffer |
| 88 vpx_yv12_copy_y(cm->frame_to_show, &cpi->last_frame_uf); | 88 vpx_yv12_copy_y(cm->frame_to_show, &cpi->last_frame_uf); |
| 89 | 89 |
| 90 best_err = try_filter_frame(sd, cpi, filt_mid, partial_frame); | 90 best_err = try_filter_frame(sd, cpi, filt_mid, partial_frame); |
| 91 filt_best = filt_mid; | 91 filt_best = filt_mid; |
| 92 ss_err[filt_mid] = best_err; | 92 ss_err[filt_mid] = best_err; |
| 93 | 93 |
| 94 while (filter_step > 0) { | 94 while (filter_step > 0) { |
| 95 const int filt_high = MIN(filt_mid + filter_step, max_filter_level); | 95 const int filt_high = VPXMIN(filt_mid + filter_step, max_filter_level); |
| 96 const int filt_low = MAX(filt_mid - filter_step, min_filter_level); | 96 const int filt_low = VPXMAX(filt_mid - filter_step, min_filter_level); |
| 97 | 97 |
| 98 // Bias against raising loop filter in favor of lowering it. | 98 // Bias against raising loop filter in favor of lowering it. |
| 99 int64_t bias = (best_err >> (15 - (filt_mid / 8))) * filter_step; | 99 int64_t bias = (best_err >> (15 - (filt_mid / 8))) * filter_step; |
| 100 | 100 |
| 101 if ((cpi->oxcf.pass == 2) && (cpi->twopass.section_intra_rating < 20)) | 101 if ((cpi->oxcf.pass == 2) && (cpi->twopass.section_intra_rating < 20)) |
| 102 bias = (bias * cpi->twopass.section_intra_rating) / 20; | 102 bias = (bias * cpi->twopass.section_intra_rating) / 20; |
| 103 | 103 |
| 104 // yx, bias less for large block size | 104 // yx, bias less for large block size |
| 105 if (cm->tx_mode != ONLY_4X4) | 105 if (cm->tx_mode != ONLY_4X4) |
| 106 bias >>= 1; | 106 bias >>= 1; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 int filt_guess = ROUND_POWER_OF_TWO(q * 20723 + 1015158, 18); | 183 int filt_guess = ROUND_POWER_OF_TWO(q * 20723 + 1015158, 18); |
| 184 #endif // CONFIG_VP9_HIGHBITDEPTH | 184 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 185 if (cm->frame_type == KEY_FRAME) | 185 if (cm->frame_type == KEY_FRAME) |
| 186 filt_guess -= 4; | 186 filt_guess -= 4; |
| 187 lf->filter_level = clamp(filt_guess, min_filter_level, max_filter_level); | 187 lf->filter_level = clamp(filt_guess, min_filter_level, max_filter_level); |
| 188 } else { | 188 } else { |
| 189 lf->filter_level = search_filter_level(sd, cpi, | 189 lf->filter_level = search_filter_level(sd, cpi, |
| 190 method == LPF_PICK_FROM_SUBIMAGE); | 190 method == LPF_PICK_FROM_SUBIMAGE); |
| 191 } | 191 } |
| 192 } | 192 } |
| OLD | NEW |