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 <stddef.h>
12 #include <stdint.h>
13 #include "vpx_dsp_rtcd.h"
14
eb_vp9_subtract_block_c(int rows,int cols,int16_t * diff,ptrdiff_t diff_stride,const uint8_t * src,ptrdiff_t src_stride,const uint8_t * pred,ptrdiff_t pred_stride)15 void eb_vp9_subtract_block_c(int rows, int cols, int16_t *diff,
16 ptrdiff_t diff_stride, const uint8_t *src,
17 ptrdiff_t src_stride, const uint8_t *pred,
18 ptrdiff_t pred_stride) {
19 int r, c;
20
21 for (r = 0; r < rows; r++) {
22 for (c = 0; c < cols; c++) diff[c] = src[c] - pred[c];
23
24 diff += diff_stride;
25 pred += pred_stride;
26 src += src_stride;
27 }
28 }
29
30 #if CONFIG_VP9_HIGHBITDEPTH
vpx_highbd_subtract_block_c(int rows,int cols,int16_t * diff,ptrdiff_t diff_stride,const uint8_t * src8,ptrdiff_t src_stride,const uint8_t * pred8,ptrdiff_t pred_stride,int bd)31 void vpx_highbd_subtract_block_c(int rows, int cols, int16_t *diff,
32 ptrdiff_t diff_stride, const uint8_t *src8,
33 ptrdiff_t src_stride, const uint8_t *pred8,
34 ptrdiff_t pred_stride, int bd) {
35 int r, c;
36 uint16_t *src = CONVERT_TO_SHORTPTR(src8);
37 uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
38 (void)bd;
39
40 for (r = 0; r < rows; r++) {
41 for (c = 0; c < cols; c++) {
42 diff[c] = src[c] - pred[c];
43 }
44
45 diff += diff_stride;
46 pred += pred_stride;
47 src += src_stride;
48 }
49 }
50 #endif // CONFIG_VP9_HIGHBITDEPTH
51