2016-02-12 19:04:35 +03:00
|
|
|
/*
|
2016-11-29 02:26:06 +03:00
|
|
|
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
|
2016-02-12 19:04:35 +03:00
|
|
|
*
|
2016-11-29 02:26:06 +03:00
|
|
|
* This source code is subject to the terms of the BSD 2 Clause License and
|
|
|
|
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
|
|
|
* was not distributed with this source code in the LICENSE file, you can
|
|
|
|
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
|
|
|
* Media Patent License 1.0 was not distributed with this source code in the
|
|
|
|
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
2016-02-12 19:04:35 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
#include "./aom_dsp_rtcd.h"
|
2016-02-12 19:04:35 +03:00
|
|
|
|
2017-03-30 01:48:40 +03:00
|
|
|
uint64_t aom_sum_squares_2d_i16_c(const int16_t *src, int src_stride, int width,
|
|
|
|
int height) {
|
2016-02-12 19:04:35 +03:00
|
|
|
int r, c;
|
|
|
|
uint64_t ss = 0;
|
|
|
|
|
2017-03-30 01:48:40 +03:00
|
|
|
for (r = 0; r < height; r++) {
|
|
|
|
for (c = 0; c < width; c++) {
|
2016-02-12 19:04:35 +03:00
|
|
|
const int16_t v = src[c];
|
2016-08-09 08:59:08 +03:00
|
|
|
ss += v * v;
|
2016-02-12 19:04:35 +03:00
|
|
|
}
|
2016-08-09 08:59:08 +03:00
|
|
|
src += src_stride;
|
2016-02-12 19:04:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return ss;
|
|
|
|
}
|
2016-06-21 22:22:25 +03:00
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
uint64_t aom_sum_squares_i16_c(const int16_t *src, uint32_t n) {
|
2016-06-21 22:22:25 +03:00
|
|
|
uint64_t ss = 0;
|
|
|
|
do {
|
|
|
|
const int16_t v = *src++;
|
2016-08-09 08:59:08 +03:00
|
|
|
ss += v * v;
|
2016-06-21 22:22:25 +03:00
|
|
|
} while (--n);
|
|
|
|
|
|
|
|
return ss;
|
|
|
|
}
|