Line data Source code
1 : /*
2 : * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3 : *
4 : * This source code is subject to the terms of the BSD 2 Clause License and
5 : * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 : * was not distributed with this source code in the LICENSE file, you can
7 : * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 : * Media Patent License 1.0 was not distributed with this source code in the
9 : * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10 : */
11 :
12 : #include <assert.h>
13 :
14 : #include "./aom_dsp_rtcd.h"
15 :
16 0 : uint64_t aom_sum_squares_2d_i16_c(const int16_t *src, int src_stride, int width,
17 : int height) {
18 : int r, c;
19 0 : uint64_t ss = 0;
20 :
21 0 : for (r = 0; r < height; r++) {
22 0 : for (c = 0; c < width; c++) {
23 0 : const int16_t v = src[c];
24 0 : ss += v * v;
25 : }
26 0 : src += src_stride;
27 : }
28 :
29 0 : return ss;
30 : }
31 :
32 0 : uint64_t aom_sum_squares_i16_c(const int16_t *src, uint32_t n) {
33 0 : uint64_t ss = 0;
34 : do {
35 0 : const int16_t v = *src++;
36 0 : ss += v * v;
37 0 : } while (--n);
38 :
39 0 : return ss;
40 : }
|