| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 hbuf += 8; | 105 hbuf += 8; |
| 106 _mm_storeu_si128((__m128i *)hbuf, s1); | 106 _mm_storeu_si128((__m128i *)hbuf, s1); |
| 107 } | 107 } |
| 108 | 108 |
| 109 int16_t vp9_int_pro_col_sse2(uint8_t const *ref, const int width) { | 109 int16_t vp9_int_pro_col_sse2(uint8_t const *ref, const int width) { |
| 110 __m128i zero = _mm_setzero_si128(); | 110 __m128i zero = _mm_setzero_si128(); |
| 111 __m128i src_line = _mm_load_si128((const __m128i *)ref); | 111 __m128i src_line = _mm_load_si128((const __m128i *)ref); |
| 112 __m128i s0 = _mm_sad_epu8(src_line, zero); | 112 __m128i s0 = _mm_sad_epu8(src_line, zero); |
| 113 __m128i s1; | 113 __m128i s1; |
| 114 int i; | 114 int i; |
| 115 const int norm_factor = 3 + (width >> 5); | |
| 116 | 115 |
| 117 for (i = 16; i < width; i += 16) { | 116 for (i = 16; i < width; i += 16) { |
| 118 ref += 16; | 117 ref += 16; |
| 119 src_line = _mm_load_si128((const __m128i *)ref); | 118 src_line = _mm_load_si128((const __m128i *)ref); |
| 120 s1 = _mm_sad_epu8(src_line, zero); | 119 s1 = _mm_sad_epu8(src_line, zero); |
| 121 s0 = _mm_adds_epu16(s0, s1); | 120 s0 = _mm_adds_epu16(s0, s1); |
| 122 } | 121 } |
| 123 | 122 |
| 124 s1 = _mm_srli_si128(s0, 8); | 123 s1 = _mm_srli_si128(s0, 8); |
| 125 s0 = _mm_adds_epu16(s0, s1); | 124 s0 = _mm_adds_epu16(s0, s1); |
| 126 | 125 |
| 127 return _mm_extract_epi16(s0, 0) >> norm_factor; | 126 return _mm_extract_epi16(s0, 0); |
| 128 } | 127 } |
| 129 | 128 |
| 130 int vp9_vector_var_sse2(int16_t const *ref, int16_t const *src, | 129 int vp9_vector_var_sse2(int16_t const *ref, int16_t const *src, |
| 131 const int bwl) { | 130 const int bwl) { |
| 132 int idx; | 131 int idx; |
| 133 int width = 4 << bwl; | 132 int width = 4 << bwl; |
| 134 int16_t mean; | 133 int16_t mean; |
| 135 __m128i v0 = _mm_loadu_si128((const __m128i *)ref); | 134 __m128i v0 = _mm_loadu_si128((const __m128i *)ref); |
| 136 __m128i v1 = _mm_load_si128((const __m128i *)src); | 135 __m128i v1 = _mm_load_si128((const __m128i *)src); |
| 137 __m128i diff = _mm_subs_epi16(v0, v1); | 136 __m128i diff = _mm_subs_epi16(v0, v1); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 163 | 162 |
| 164 v1 = _mm_srli_si128(sse, 8); | 163 v1 = _mm_srli_si128(sse, 8); |
| 165 sse = _mm_add_epi32(sse, v1); | 164 sse = _mm_add_epi32(sse, v1); |
| 166 v1 = _mm_srli_epi64(sse, 32); | 165 v1 = _mm_srli_epi64(sse, 32); |
| 167 sse = _mm_add_epi32(sse, v1); | 166 sse = _mm_add_epi32(sse, v1); |
| 168 | 167 |
| 169 mean = _mm_extract_epi16(sum, 0); | 168 mean = _mm_extract_epi16(sum, 0); |
| 170 | 169 |
| 171 return _mm_cvtsi128_si32(sse) - ((mean * mean) >> (bwl + 2)); | 170 return _mm_cvtsi128_si32(sse) - ((mean * mean) >> (bwl + 2)); |
| 172 } | 171 } |
| OLD | NEW |