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 ptrdiff_t pred_stride) { 23 int r, c; 24 25 for (r = 0; r < rows; r++) { 26 for (c = 0; c < cols; c++) diff_ptr[c] = src_ptr[c] - pred_ptr[c]; 27 28 diff_ptr += diff_stride; 29 pred_ptr += pred_stride; 30 src_ptr += src_stride; 31 } 32 } 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 ptrdiff_t pred_stride, int bd) { 39 int r, c; 40 uint16_t *src = CONVERT_TO_SHORTPTR(src8_ptr); 41 uint16_t *pred = CONVERT_TO_SHORTPTR(pred8_ptr); 42 (void)bd; 43 44 for (r = 0; r < rows; r++) { 45 for (c = 0; c < cols; c++) { 46 diff_ptr[c] = src[c] - pred[c]; 47 } 48 49 diff_ptr += diff_stride; 50 pred += pred_stride; 51 src += src_stride; 52 } 53 } 54 #endif // CONFIG_VP9_HIGHBITDEPTH 55