/src/aom/aom_dsp/blend_a64_hmask.c
Line | Count | Source |
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 | | |
12 | | #include <assert.h> |
13 | | |
14 | | #include "aom/aom_integer.h" |
15 | | #include "aom_ports/mem.h" |
16 | | #include "aom_dsp/aom_dsp_common.h" |
17 | | #include "aom_dsp/blend.h" |
18 | | |
19 | | #include "config/aom_dsp_rtcd.h" |
20 | | |
21 | | void aom_blend_a64_hmask_c(uint8_t *dst, uint32_t dst_stride, |
22 | | const uint8_t *src0, uint32_t src0_stride, |
23 | | const uint8_t *src1, uint32_t src1_stride, |
24 | 2.78k | const uint8_t *mask, int w, int h) { |
25 | 2.78k | int i, j; |
26 | | |
27 | 2.78k | assert(IMPLIES(src0 == dst, src0_stride == dst_stride)); |
28 | 2.78k | assert(IMPLIES(src1 == dst, src1_stride == dst_stride)); |
29 | | |
30 | 2.78k | assert(h >= 1); |
31 | 2.78k | assert(w >= 1); |
32 | 2.78k | assert(IS_POWER_OF_TWO(h)); |
33 | 2.78k | assert(IS_POWER_OF_TWO(w)); |
34 | | |
35 | 26.1k | for (i = 0; i < h; ++i) { |
36 | 147k | for (j = 0; j < w; ++j) { |
37 | 124k | dst[i * dst_stride + j] = AOM_BLEND_A64( |
38 | 124k | mask[j], src0[i * src0_stride + j], src1[i * src1_stride + j]); |
39 | 124k | } |
40 | 23.4k | } |
41 | 2.78k | } |
42 | | |
43 | | #if CONFIG_AV1_HIGHBITDEPTH |
44 | | void aom_highbd_blend_a64_hmask_c(uint8_t *dst_8, uint32_t dst_stride, |
45 | | const uint8_t *src0_8, uint32_t src0_stride, |
46 | | const uint8_t *src1_8, uint32_t src1_stride, |
47 | 3.70k | const uint8_t *mask, int w, int h, int bd) { |
48 | 3.70k | int i, j; |
49 | 3.70k | uint16_t *dst = CONVERT_TO_SHORTPTR(dst_8); |
50 | 3.70k | const uint16_t *src0 = CONVERT_TO_SHORTPTR(src0_8); |
51 | 3.70k | const uint16_t *src1 = CONVERT_TO_SHORTPTR(src1_8); |
52 | 3.70k | (void)bd; |
53 | | |
54 | 3.70k | assert(IMPLIES(src0 == dst, src0_stride == dst_stride)); |
55 | 3.70k | assert(IMPLIES(src1 == dst, src1_stride == dst_stride)); |
56 | | |
57 | 3.70k | assert(h >= 1); |
58 | 3.70k | assert(w >= 1); |
59 | 3.70k | assert(IS_POWER_OF_TWO(h)); |
60 | 3.70k | assert(IS_POWER_OF_TWO(w)); |
61 | | |
62 | 3.70k | assert(bd == 8 || bd == 10 || bd == 12); |
63 | | |
64 | 33.9k | for (i = 0; i < h; ++i) { |
65 | 195k | for (j = 0; j < w; ++j) { |
66 | 165k | dst[i * dst_stride + j] = AOM_BLEND_A64( |
67 | 165k | mask[j], src0[i * src0_stride + j], src1[i * src1_stride + j]); |
68 | 165k | } |
69 | 30.2k | } |
70 | 3.70k | } |
71 | | #endif |