subtract.c revision 7ce0a1d1337c01056ba24006efab21f00e179e04
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 19void vpx_subtract_block_c(int rows, int cols, 20 int16_t *diff, ptrdiff_t diff_stride, 21 const uint8_t *src, ptrdiff_t src_stride, 22 const uint8_t *pred, ptrdiff_t pred_stride) { 23 int r, c; 24 25 for (r = 0; r < rows; r++) { 26 for (c = 0; c < cols; c++) 27 diff[c] = src[c] - pred[c]; 28 29 diff += diff_stride; 30 pred += pred_stride; 31 src += src_stride; 32 } 33} 34 35#if CONFIG_VP9_HIGHBITDEPTH 36void vpx_highbd_subtract_block_c(int rows, int cols, 37 int16_t *diff, ptrdiff_t diff_stride, 38 const uint8_t *src8, ptrdiff_t src_stride, 39 const uint8_t *pred8, ptrdiff_t pred_stride, 40 int bd) { 41 int r, c; 42 uint16_t *src = CONVERT_TO_SHORTPTR(src8); 43 uint16_t *pred = CONVERT_TO_SHORTPTR(pred8); 44 (void) bd; 45 46 for (r = 0; r < rows; r++) { 47 for (c = 0; c < cols; c++) { 48 diff[c] = src[c] - pred[c]; 49 } 50 51 diff += diff_stride; 52 pred += pred_stride; 53 src += src_stride; 54 } 55} 56#endif // CONFIG_VP9_HIGHBITDEPTH 57