/src/libvpx/vpx_dsp/subtract.c
Line | Count | Source (jump to first uncovered line) |
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 <stdlib.h> |
12 | | |
13 | | #include "./vpx_config.h" |
14 | | #include "./vpx_dsp_rtcd.h" |
15 | | |
16 | | #include "vpx/vpx_integer.h" |
17 | | #include "vpx_ports/mem.h" |
18 | | |
19 | | void vpx_subtract_block_c(int rows, int cols, int16_t *diff_ptr, |
20 | | ptrdiff_t diff_stride, const uint8_t *src_ptr, |
21 | | ptrdiff_t src_stride, const uint8_t *pred_ptr, |
22 | 0 | ptrdiff_t pred_stride) { |
23 | 0 | int r, c; |
24 | |
|
25 | 0 | for (r = 0; r < rows; r++) { |
26 | 0 | for (c = 0; c < cols; c++) diff_ptr[c] = src_ptr[c] - pred_ptr[c]; |
27 | |
|
28 | 0 | diff_ptr += diff_stride; |
29 | 0 | pred_ptr += pred_stride; |
30 | 0 | src_ptr += src_stride; |
31 | 0 | } |
32 | 0 | } |
33 | | |
34 | | #if CONFIG_VP9_HIGHBITDEPTH |
35 | | void vpx_highbd_subtract_block_c(int rows, int cols, int16_t *diff_ptr, |
36 | | ptrdiff_t diff_stride, const uint8_t *src8_ptr, |
37 | | ptrdiff_t src_stride, const uint8_t *pred8_ptr, |
38 | 0 | ptrdiff_t pred_stride, int bd) { |
39 | 0 | int r, c; |
40 | 0 | uint16_t *src = CONVERT_TO_SHORTPTR(src8_ptr); |
41 | 0 | uint16_t *pred = CONVERT_TO_SHORTPTR(pred8_ptr); |
42 | 0 | (void)bd; |
43 | |
|
44 | 0 | for (r = 0; r < rows; r++) { |
45 | 0 | for (c = 0; c < cols; c++) { |
46 | 0 | diff_ptr[c] = src[c] - pred[c]; |
47 | 0 | } |
48 | |
|
49 | 0 | diff_ptr += diff_stride; |
50 | 0 | pred += pred_stride; |
51 | 0 | src += src_stride; |
52 | 0 | } |
53 | 0 | } |
54 | | #endif // CONFIG_VP9_HIGHBITDEPTH |