| 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 #include "./vpx_config.h" | 10 #include "./vpx_config.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 void vp9_get32x32var_avx2 | 35 void vp9_get32x32var_avx2 |
| 36 ( | 36 ( |
| 37 const unsigned char *src_ptr, | 37 const unsigned char *src_ptr, |
| 38 int source_stride, | 38 int source_stride, |
| 39 const unsigned char *ref_ptr, | 39 const unsigned char *ref_ptr, |
| 40 int recon_stride, | 40 int recon_stride, |
| 41 unsigned int *SSE, | 41 unsigned int *SSE, |
| 42 int *Sum | 42 int *Sum |
| 43 ); | 43 ); |
| 44 | 44 |
| 45 unsigned int vp9_sub_pixel_variance32xh_avx2 |
| 46 ( |
| 47 const uint8_t *src, |
| 48 int src_stride, |
| 49 int x_offset, |
| 50 int y_offset, |
| 51 const uint8_t *dst, |
| 52 int dst_stride, |
| 53 int height, |
| 54 unsigned int *sse |
| 55 ); |
| 56 |
| 57 unsigned int vp9_sub_pixel_avg_variance32xh_avx2 |
| 58 ( |
| 59 const uint8_t *src, |
| 60 int src_stride, |
| 61 int x_offset, |
| 62 int y_offset, |
| 63 const uint8_t *dst, |
| 64 int dst_stride, |
| 65 const uint8_t *sec, |
| 66 int sec_stride, |
| 67 int height, |
| 68 unsigned int *sseptr |
| 69 ); |
| 70 |
| 45 static void variance_avx2(const unsigned char *src_ptr, int source_stride, | 71 static void variance_avx2(const unsigned char *src_ptr, int source_stride, |
| 46 const unsigned char *ref_ptr, int recon_stride, | 72 const unsigned char *ref_ptr, int recon_stride, |
| 47 int w, int h, unsigned int *sse, int *sum, | 73 int w, int h, unsigned int *sse, int *sum, |
| 48 get_var_avx2 var_fn, int block_size) { | 74 get_var_avx2 var_fn, int block_size) { |
| 49 unsigned int sse0; | 75 unsigned int sse0; |
| 50 int sum0; | 76 int sum0; |
| 51 int i, j; | 77 int i, j; |
| 52 | 78 |
| 53 *sse = 0; | 79 *sse = 0; |
| 54 *sum = 0; | 80 *sum = 0; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 unsigned int var; | 174 unsigned int var; |
| 149 int avg; | 175 int avg; |
| 150 | 176 |
| 151 // processing 32 elements vertically in parallel | 177 // processing 32 elements vertically in parallel |
| 152 variance_avx2(src_ptr, source_stride, ref_ptr, recon_stride, 64, 32, | 178 variance_avx2(src_ptr, source_stride, ref_ptr, recon_stride, 64, 32, |
| 153 &var, &avg, vp9_get32x32var_avx2, 32); | 179 &var, &avg, vp9_get32x32var_avx2, 32); |
| 154 | 180 |
| 155 *sse = var; | 181 *sse = var; |
| 156 return (var - (((int64_t)avg * avg) >> 11)); | 182 return (var - (((int64_t)avg * avg) >> 11)); |
| 157 } | 183 } |
| 184 |
| 185 unsigned int vp9_sub_pixel_variance64x64_avx2(const uint8_t *src, |
| 186 int src_stride, |
| 187 int x_offset, |
| 188 int y_offset, |
| 189 const uint8_t *dst, |
| 190 int dst_stride, |
| 191 unsigned int *sse_ptr) { |
| 192 // processing 32 elements in parallel |
| 193 unsigned int sse; |
| 194 int se = vp9_sub_pixel_variance32xh_avx2(src, src_stride, x_offset, |
| 195 y_offset, dst, dst_stride, |
| 196 64, &sse); |
| 197 // processing the next 32 elements in parallel |
| 198 unsigned int sse2; |
| 199 int se2 = vp9_sub_pixel_variance32xh_avx2(src + 32, src_stride, |
| 200 x_offset, y_offset, |
| 201 dst + 32, dst_stride, |
| 202 64, &sse2); |
| 203 se += se2; |
| 204 sse += sse2; |
| 205 *sse_ptr = sse; |
| 206 return sse - (((int64_t)se * se) >> 12); |
| 207 } |
| 208 |
| 209 unsigned int vp9_sub_pixel_variance32x32_avx2(const uint8_t *src, |
| 210 int src_stride, |
| 211 int x_offset, |
| 212 int y_offset, |
| 213 const uint8_t *dst, |
| 214 int dst_stride, |
| 215 unsigned int *sse_ptr) { |
| 216 // processing 32 element in parallel |
| 217 unsigned int sse; |
| 218 int se = vp9_sub_pixel_variance32xh_avx2(src, src_stride, x_offset, |
| 219 y_offset, dst, dst_stride, |
| 220 32, &sse); |
| 221 *sse_ptr = sse; |
| 222 return sse - (((int64_t)se * se) >> 10); |
| 223 } |
| 224 |
| 225 unsigned int vp9_sub_pixel_avg_variance64x64_avx2(const uint8_t *src, |
| 226 int src_stride, |
| 227 int x_offset, |
| 228 int y_offset, |
| 229 const uint8_t *dst, |
| 230 int dst_stride, |
| 231 unsigned int *sseptr, |
| 232 const uint8_t *sec) { |
| 233 // processing 32 elements in parallel |
| 234 unsigned int sse; |
| 235 |
| 236 int se = vp9_sub_pixel_avg_variance32xh_avx2(src, src_stride, x_offset, |
| 237 y_offset, dst, dst_stride, |
| 238 sec, 64, 64, &sse); |
| 239 unsigned int sse2; |
| 240 // processing the next 32 elements in parallel |
| 241 int se2 = vp9_sub_pixel_avg_variance32xh_avx2(src + 32, src_stride, x_offset, |
| 242 y_offset, dst + 32, dst_stride, |
| 243 sec + 32, 64, 64, &sse2); |
| 244 se += se2; |
| 245 sse += sse2; |
| 246 *sseptr = sse; |
| 247 |
| 248 return sse - (((int64_t)se * se) >> 12); |
| 249 } |
| 250 |
| 251 unsigned int vp9_sub_pixel_avg_variance32x32_avx2(const uint8_t *src, |
| 252 int src_stride, |
| 253 int x_offset, |
| 254 int y_offset, |
| 255 const uint8_t *dst, |
| 256 int dst_stride, |
| 257 unsigned int *sseptr, |
| 258 const uint8_t *sec) { |
| 259 // processing 32 element in parallel |
| 260 unsigned int sse; |
| 261 int se = vp9_sub_pixel_avg_variance32xh_avx2(src, src_stride, x_offset, |
| 262 y_offset, dst, dst_stride, |
| 263 sec, 32, 32, &sse); |
| 264 *sseptr = sse; |
| 265 return sse - (((int64_t)se * se) >> 10); |
| 266 } |
| 267 |
| 268 |
| OLD | NEW |