Geza Lore | abd0050 | 2016-02-12 16:04:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 The WebM project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include <assert.h> |
| 12 | |
| 13 | #include "./vpx_dsp_rtcd.h" |
| 14 | |
| 15 | uint64_t vpx_sum_squares_2d_i16_c(const int16_t *src, int src_stride, |
James Zern | 5e831c5 | 2016-06-09 23:38:31 -0700 | [diff] [blame] | 16 | int size) { |
Geza Lore | abd0050 | 2016-02-12 16:04:35 +0000 | [diff] [blame] | 17 | int r, c; |
| 18 | uint64_t ss = 0; |
| 19 | |
| 20 | for (r = 0; r < size; r++) { |
| 21 | for (c = 0; c < size; c++) { |
| 22 | const int16_t v = src[c]; |
| 23 | ss += v*v; |
| 24 | } |
| 25 | src += src_stride; |
| 26 | } |
| 27 | |
| 28 | return ss; |
| 29 | } |
Geza Lore | 52141c9 | 2016-06-21 20:22:25 +0100 | [diff] [blame^] | 30 | |
| 31 | uint64_t vpx_sum_squares_i16_c(const int16_t *src, uint32_t n) { |
| 32 | uint64_t ss = 0; |
| 33 | do { |
| 34 | const int16_t v = *src++; |
| 35 | ss += v*v; |
| 36 | } while (--n); |
| 37 | |
| 38 | return ss; |
| 39 | } |