blend_a64_hmask.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) 2016, Alliance for Open Media. All rights reserved
  3. *
  4. * This source code is subject to the terms of the BSD 2 Clause License and
  5. * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
  6. * was not distributed with this source code in the LICENSE file, you can
  7. * obtain it at www.aomedia.org/license/software. If the Alliance for Open
  8. * Media Patent License 1.0 was not distributed with this source code in the
  9. * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  10. */
  11. #include <assert.h>
  12. #include "aom/aom_integer.h"
  13. #include "aom_ports/mem.h"
  14. #include "aom_dsp/aom_dsp_common.h"
  15. #include "aom_dsp/blend.h"
  16. #include "config/aom_dsp_rtcd.h"
  17. void aom_blend_a64_hmask_c(uint8_t *dst, uint32_t dst_stride,
  18. const uint8_t *src0, uint32_t src0_stride,
  19. const uint8_t *src1, uint32_t src1_stride,
  20. const uint8_t *mask, int w, int h) {
  21. int i, j;
  22. assert(IMPLIES(src0 == dst, src0_stride == dst_stride));
  23. assert(IMPLIES(src1 == dst, src1_stride == dst_stride));
  24. assert(h >= 1);
  25. assert(w >= 1);
  26. assert(IS_POWER_OF_TWO(h));
  27. assert(IS_POWER_OF_TWO(w));
  28. for (i = 0; i < h; ++i) {
  29. for (j = 0; j < w; ++j) {
  30. dst[i * dst_stride + j] = AOM_BLEND_A64(
  31. mask[j], src0[i * src0_stride + j], src1[i * src1_stride + j]);
  32. }
  33. }
  34. }
  35. #if CONFIG_AV1_HIGHBITDEPTH
  36. void aom_highbd_blend_a64_hmask_c(uint8_t *dst_8, uint32_t dst_stride,
  37. const uint8_t *src0_8, uint32_t src0_stride,
  38. const uint8_t *src1_8, uint32_t src1_stride,
  39. const uint8_t *mask, int w, int h, int bd) {
  40. int i, j;
  41. uint16_t *dst = CONVERT_TO_SHORTPTR(dst_8);
  42. const uint16_t *src0 = CONVERT_TO_SHORTPTR(src0_8);
  43. const uint16_t *src1 = CONVERT_TO_SHORTPTR(src1_8);
  44. (void)bd;
  45. assert(IMPLIES(src0 == dst, src0_stride == dst_stride));
  46. assert(IMPLIES(src1 == dst, src1_stride == dst_stride));
  47. assert(h >= 1);
  48. assert(w >= 1);
  49. assert(IS_POWER_OF_TWO(h));
  50. assert(IS_POWER_OF_TWO(w));
  51. assert(bd == 8 || bd == 10 || bd == 12);
  52. for (i = 0; i < h; ++i) {
  53. for (j = 0; j < w; ++j) {
  54. dst[i * dst_stride + j] = AOM_BLEND_A64(
  55. mask[j], src0[i * src0_stride + j], src1[i * src1_stride + j]);
  56. }
  57. }
  58. }
  59. #endif