2
0

subtract.c 1.7 KB

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