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 |
11 #include "vp8/encoder/denoising.h" | 11 #include "vp8/encoder/denoising.h" |
12 #include "vp8/common/reconinter.h" | 12 #include "vp8/common/reconinter.h" |
13 #include "vpx/vpx_integer.h" | 13 #include "vpx/vpx_integer.h" |
14 #include "vpx_mem/vpx_mem.h" | 14 #include "vpx_mem/vpx_mem.h" |
15 #include "vp8_rtcd.h" | 15 #include "vp8_rtcd.h" |
16 | 16 |
17 #include <emmintrin.h> | 17 #include <emmintrin.h> |
18 #include "vpx_ports/emmintrin_compat.h" | 18 #include "vpx_ports/emmintrin_compat.h" |
19 | 19 |
20 union sum_union { | 20 union sum_union { |
21 __m128i v; | 21 __m128i v; |
22 signed char e[16]; | 22 signed char e[16]; |
23 }; | 23 }; |
24 | 24 |
25 int vp8_denoiser_filter_sse2(YV12_BUFFER_CONFIG *mc_running_avg, | 25 int vp8_denoiser_filter_sse2(unsigned char *mc_running_avg_y, |
26 YV12_BUFFER_CONFIG *running_avg, | 26 int mc_avg_y_stride, |
27 MACROBLOCK *signal, unsigned int motion_magnitude, | 27 unsigned char *running_avg_y, int avg_y_stride, |
28 int y_offset, int uv_offset) | 28 unsigned char *sig, int sig_stride, |
| 29 unsigned int motion_magnitude) |
29 { | 30 { |
30 unsigned char *sig = signal->thismb; | 31 unsigned char *running_avg_y_start = running_avg_y; |
31 int sig_stride = 16; | 32 unsigned char *sig_start = sig; |
32 unsigned char *mc_running_avg_y = mc_running_avg->y_buffer + y_offset; | |
33 int mc_avg_y_stride = mc_running_avg->y_stride; | |
34 unsigned char *running_avg_y = running_avg->y_buffer + y_offset; | |
35 int avg_y_stride = running_avg->y_stride; | |
36 int r; | 33 int r; |
37 __m128i acc_diff = _mm_setzero_si128(); | 34 __m128i acc_diff = _mm_setzero_si128(); |
38 const __m128i k_0 = _mm_setzero_si128(); | 35 const __m128i k_0 = _mm_setzero_si128(); |
39 const __m128i k_4 = _mm_set1_epi8(4); | 36 const __m128i k_4 = _mm_set1_epi8(4); |
40 const __m128i k_8 = _mm_set1_epi8(8); | 37 const __m128i k_8 = _mm_set1_epi8(8); |
41 const __m128i k_16 = _mm_set1_epi8(16); | 38 const __m128i k_16 = _mm_set1_epi8(16); |
42 /* Modify each level's adjustment according to motion_magnitude. */ | 39 /* Modify each level's adjustment according to motion_magnitude. */ |
43 const __m128i l3 = _mm_set1_epi8( | 40 const __m128i l3 = _mm_set1_epi8( |
44 (motion_magnitude <= MOTION_MAGNITUDE_THRESHOLD) ? 7 : 6); | 41 (motion_magnitude <= MOTION_MAGNITUDE_THRESHOLD) ? 7 : 6); |
45 /* Difference between level 3 and level 2 is 2. */ | 42 /* Difference between level 3 and level 2 is 2. */ |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 sum_diff = s.e[0] + s.e[1] + s.e[2] + s.e[3] + s.e[4] + s.e[5] | 104 sum_diff = s.e[0] + s.e[1] + s.e[2] + s.e[3] + s.e[4] + s.e[5] |
108 + s.e[6] + s.e[7] + s.e[8] + s.e[9] + s.e[10] + s.e[11] | 105 + s.e[6] + s.e[7] + s.e[8] + s.e[9] + s.e[10] + s.e[11] |
109 + s.e[12] + s.e[13] + s.e[14] + s.e[15]; | 106 + s.e[12] + s.e[13] + s.e[14] + s.e[15]; |
110 | 107 |
111 if (abs(sum_diff) > SUM_DIFF_THRESHOLD) | 108 if (abs(sum_diff) > SUM_DIFF_THRESHOLD) |
112 { | 109 { |
113 return COPY_BLOCK; | 110 return COPY_BLOCK; |
114 } | 111 } |
115 } | 112 } |
116 | 113 |
117 vp8_copy_mem16x16(running_avg->y_buffer + y_offset, avg_y_stride, | 114 vp8_copy_mem16x16(running_avg_y_start, avg_y_stride, sig_start, sig_stride); |
118 signal->thismb, sig_stride); | |
119 return FILTER_BLOCK; | 115 return FILTER_BLOCK; |
120 } | 116 } |
OLD | NEW |