blob: cdb1df0017c52362d5a06a885202f5abf1124ca3 [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * 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.
Yaowu Xuc27fc142016-08-22 16:08:15 -070010 */
11
12#include <assert.h>
13
Yaowu Xuf883b422016-08-30 14:01:10 -070014#include "aom/aom_integer.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070015#include "aom_ports/mem.h"
Yaowu Xuf883b422016-08-30 14:01:10 -070016#include "aom_dsp/aom_dsp_common.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070017#include "aom_dsp/blend.h"
18
Yaowu Xuf883b422016-08-30 14:01:10 -070019#include "./aom_dsp_rtcd.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070020
Yaowu Xuf883b422016-08-30 14:01:10 -070021void aom_blend_a64_vmask_c(uint8_t *dst, uint32_t dst_stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -070022 const uint8_t *src0, uint32_t src0_stride,
23 const uint8_t *src1, uint32_t src1_stride,
24 const uint8_t *mask, int h, int w) {
25 int i, j;
26
27 assert(IMPLIES(src0 == dst, src0_stride == dst_stride));
28 assert(IMPLIES(src1 == dst, src1_stride == dst_stride));
29
30 assert(h >= 1);
31 assert(w >= 1);
32 assert(IS_POWER_OF_TWO(h));
33 assert(IS_POWER_OF_TWO(w));
34
35 for (i = 0; i < h; ++i) {
36 const int m = mask[i];
37 for (j = 0; j < w; ++j) {
Yaowu Xuf883b422016-08-30 14:01:10 -070038 dst[i * dst_stride + j] = AOM_BLEND_A64(m, src0[i * src0_stride + j],
Yaowu Xuc27fc142016-08-22 16:08:15 -070039 src1[i * src1_stride + j]);
40 }
41 }
42}
43
Yaowu Xuf883b422016-08-30 14:01:10 -070044void aom_highbd_blend_a64_vmask_c(uint8_t *dst_8, uint32_t dst_stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -070045 const uint8_t *src0_8, uint32_t src0_stride,
46 const uint8_t *src1_8, uint32_t src1_stride,
47 const uint8_t *mask, int h, int w, int bd) {
48 int i, j;
49 uint16_t *dst = CONVERT_TO_SHORTPTR(dst_8);
50 const uint16_t *src0 = CONVERT_TO_SHORTPTR(src0_8);
51 const uint16_t *src1 = CONVERT_TO_SHORTPTR(src1_8);
Yaowu Xu9c01aa12016-09-01 14:32:49 -070052 (void)bd;
Yaowu Xuc27fc142016-08-22 16:08:15 -070053
54 assert(IMPLIES(src0 == dst, src0_stride == dst_stride));
55 assert(IMPLIES(src1 == dst, src1_stride == dst_stride));
56
57 assert(h >= 1);
58 assert(w >= 1);
59 assert(IS_POWER_OF_TWO(h));
60 assert(IS_POWER_OF_TWO(w));
61
62 assert(bd == 8 || bd == 10 || bd == 12);
63
64 for (i = 0; i < h; ++i) {
65 const int m = mask[i];
66 for (j = 0; j < w; ++j) {
Yaowu Xuf883b422016-08-30 14:01:10 -070067 dst[i * dst_stride + j] = AOM_BLEND_A64(m, src0[i * src0_stride + j],
Yaowu Xuc27fc142016-08-22 16:08:15 -070068 src1[i * src1_stride + j]);
69 }
70 }
71}