blob: 6afd49b805063a9b4220bfe333bd0d8b1a11a82c [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * 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.
Yaowu Xuc27fc142016-08-22 16:08:15 -070010 */
11
12#include <stdlib.h>
13
Yaowu Xuf883b422016-08-30 14:01:10 -070014#include "./aom_config.h"
15#include "./aom_dsp_rtcd.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070016
Yaowu Xuf883b422016-08-30 14:01:10 -070017#include "aom/aom_integer.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070018#include "aom_ports/mem.h"
19
Yaowu Xuf883b422016-08-30 14:01:10 -070020void aom_subtract_block_c(int rows, int cols, int16_t *diff,
Yaowu Xuc27fc142016-08-22 16:08:15 -070021 ptrdiff_t diff_stride, const uint8_t *src,
22 ptrdiff_t src_stride, const uint8_t *pred,
23 ptrdiff_t pred_stride) {
24 int r, c;
25
26 for (r = 0; r < rows; r++) {
27 for (c = 0; c < cols; c++) diff[c] = src[c] - pred[c];
28
29 diff += diff_stride;
30 pred += pred_stride;
31 src += src_stride;
32 }
33}
34
Yaowu Xuf883b422016-08-30 14:01:10 -070035void aom_highbd_subtract_block_c(int rows, int cols, int16_t *diff,
Yaowu Xuc27fc142016-08-22 16:08:15 -070036 ptrdiff_t diff_stride, const uint8_t *src8,
37 ptrdiff_t src_stride, const uint8_t *pred8,
38 ptrdiff_t pred_stride, int bd) {
39 int r, c;
40 uint16_t *src = CONVERT_TO_SHORTPTR(src8);
41 uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
42 (void)bd;
43
44 for (r = 0; r < rows; r++) {
45 for (c = 0; c < cols; c++) {
46 diff[c] = src[c] - pred[c];
47 }
48
49 diff += diff_stride;
50 pred += pred_stride;
51 src += src_stride;
52 }
53}