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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 running_avg_y += avg_y_stride; | 114 running_avg_y += avg_y_stride; |
115 } | 115 } |
116 | 116 |
117 { | 117 { |
118 /* Compute the sum of all pixel differences of this MB. */ | 118 /* Compute the sum of all pixel differences of this MB. */ |
119 unsigned int abs_sum_diff = abs_sum_diff_16x1(acc_diff); | 119 unsigned int abs_sum_diff = abs_sum_diff_16x1(acc_diff); |
120 sum_diff_thresh = SUM_DIFF_THRESHOLD; | 120 sum_diff_thresh = SUM_DIFF_THRESHOLD; |
121 if (increase_denoising) sum_diff_thresh = SUM_DIFF_THRESHOLD_HIGH; | 121 if (increase_denoising) sum_diff_thresh = SUM_DIFF_THRESHOLD_HIGH; |
122 if (abs_sum_diff > sum_diff_thresh) { | 122 if (abs_sum_diff > sum_diff_thresh) { |
123 // Before returning to copy the block (i.e., apply no denoising), | 123 // Before returning to copy the block (i.e., apply no denoising), |
124 // checK if we can still apply some (weaker) temporal filtering to | 124 // check if we can still apply some (weaker) temporal filtering to |
125 // this block, that would otherwise not be denoised at all. Simplest | 125 // this block, that would otherwise not be denoised at all. Simplest |
126 // is to apply an additional adjustment to running_avg_y to bring it | 126 // is to apply an additional adjustment to running_avg_y to bring it |
127 // closer to sig. The adjustment is capped by a maximum delta, and | 127 // closer to sig. The adjustment is capped by a maximum delta, and |
128 // chosen such that in most cases the resulting sum_diff will be | 128 // chosen such that in most cases the resulting sum_diff will be |
129 // within the accceptable range given by sum_diff_thresh. | 129 // within the acceptable range given by sum_diff_thresh. |
130 | 130 |
131 // The delta is set by the excess of absolute pixel diff over the | 131 // The delta is set by the excess of absolute pixel diff over the |
132 // threshold. | 132 // threshold. |
133 int delta = ((abs_sum_diff - sum_diff_thresh) >> 8) + 1; | 133 int delta = ((abs_sum_diff - sum_diff_thresh) >> 8) + 1; |
134 // Only apply the adjustment for max delta up to 3. | 134 // Only apply the adjustment for max delta up to 3. |
135 if (delta < 4) { | 135 if (delta < 4) { |
136 const __m128i k_delta = _mm_set1_epi8(delta); | 136 const __m128i k_delta = _mm_set1_epi8(delta); |
137 sig -= sig_stride * 16; | 137 sig -= sig_stride * 16; |
138 mc_running_avg_y -= mc_avg_y_stride * 16; | 138 mc_running_avg_y -= mc_avg_y_stride * 16; |
139 running_avg_y -= avg_y_stride * 16; | 139 running_avg_y -= avg_y_stride * 16; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 mc_running_avg += mc_avg_stride * 2; | 295 mc_running_avg += mc_avg_stride * 2; |
296 running_avg += avg_stride * 2; | 296 running_avg += avg_stride * 2; |
297 } | 297 } |
298 | 298 |
299 { | 299 { |
300 unsigned int abs_sum_diff = abs_sum_diff_16x1(acc_diff); | 300 unsigned int abs_sum_diff = abs_sum_diff_16x1(acc_diff); |
301 sum_diff_thresh = SUM_DIFF_THRESHOLD_UV; | 301 sum_diff_thresh = SUM_DIFF_THRESHOLD_UV; |
302 if (increase_denoising) sum_diff_thresh = SUM_DIFF_THRESHOLD_HIGH_UV; | 302 if (increase_denoising) sum_diff_thresh = SUM_DIFF_THRESHOLD_HIGH_UV; |
303 if (abs_sum_diff > sum_diff_thresh) { | 303 if (abs_sum_diff > sum_diff_thresh) { |
304 // Before returning to copy the block (i.e., apply no denoising), | 304 // Before returning to copy the block (i.e., apply no denoising), |
305 // checK if we can still apply some (weaker) temporal filtering to | 305 // check if we can still apply some (weaker) temporal filtering to |
306 // this block, that would otherwise not be denoised at all. Simplest | 306 // this block, that would otherwise not be denoised at all. Simplest |
307 // is to apply an additional adjustment to running_avg_y to bring it | 307 // is to apply an additional adjustment to running_avg_y to bring it |
308 // closer to sig. The adjustment is capped by a maximum delta, and | 308 // closer to sig. The adjustment is capped by a maximum delta, and |
309 // chosen such that in most cases the resulting sum_diff will be | 309 // chosen such that in most cases the resulting sum_diff will be |
310 // within the accceptable range given by sum_diff_thresh. | 310 // within the acceptable range given by sum_diff_thresh. |
311 | 311 |
312 // The delta is set by the excess of absolute pixel diff over the | 312 // The delta is set by the excess of absolute pixel diff over the |
313 // threshold. | 313 // threshold. |
314 int delta = ((abs_sum_diff - sum_diff_thresh) >> 8) + 1; | 314 int delta = ((abs_sum_diff - sum_diff_thresh) >> 8) + 1; |
315 // Only apply the adjustment for max delta up to 3. | 315 // Only apply the adjustment for max delta up to 3. |
316 if (delta < 4) { | 316 if (delta < 4) { |
317 const __m128i k_delta = _mm_set1_epi8(delta); | 317 const __m128i k_delta = _mm_set1_epi8(delta); |
318 sig -= sig_stride * 8; | 318 sig -= sig_stride * 8; |
319 mc_running_avg -= mc_avg_stride * 8; | 319 mc_running_avg -= mc_avg_stride * 8; |
320 running_avg -= avg_stride * 8; | 320 running_avg -= avg_stride * 8; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 } | 370 } |
371 } else { | 371 } else { |
372 return COPY_BLOCK; | 372 return COPY_BLOCK; |
373 } | 373 } |
374 } | 374 } |
375 } | 375 } |
376 | 376 |
377 vp8_copy_mem8x8(running_avg_start, avg_stride, sig_start, sig_stride); | 377 vp8_copy_mem8x8(running_avg_start, avg_stride, sig_start, sig_stride); |
378 return FILTER_BLOCK; | 378 return FILTER_BLOCK; |
379 } | 379 } |
OLD | NEW |