hadamard: Add 4x4 test.
[aom.git] / aom_dsp / blend.h
blobfd87dc18109b81b27473fa4df0d1b52bb0b8245f
1 /*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
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.
12 #ifndef AOM_AOM_DSP_BLEND_H_
13 #define AOM_AOM_DSP_BLEND_H_
15 #include "aom_ports/mem.h"
17 // Various blending functions and macros.
18 // See also the aom_blend_* functions in aom_dsp_rtcd.h
20 // Alpha blending with alpha values from the range [0, 64], where 64
21 // means use the first input and 0 means use the second input.
23 #define AOM_BLEND_A64_ROUND_BITS 6
24 #define AOM_BLEND_A64_MAX_ALPHA (1 << AOM_BLEND_A64_ROUND_BITS) // 64
26 #define AOM_BLEND_A64(a, v0, v1) \
27 ROUND_POWER_OF_TWO((a) * (v0) + (AOM_BLEND_A64_MAX_ALPHA - (a)) * (v1), \
28 AOM_BLEND_A64_ROUND_BITS)
30 // Alpha blending with alpha values from the range [0, 256], where 256
31 // means use the first input and 0 means use the second input.
32 #define AOM_BLEND_A256_ROUND_BITS 8
33 #define AOM_BLEND_A256_MAX_ALPHA (1 << AOM_BLEND_A256_ROUND_BITS) // 256
35 #define AOM_BLEND_A256(a, v0, v1) \
36 ROUND_POWER_OF_TWO((a) * (v0) + (AOM_BLEND_A256_MAX_ALPHA - (a)) * (v1), \
37 AOM_BLEND_A256_ROUND_BITS)
39 // Blending by averaging.
40 #define AOM_BLEND_AVG(v0, v1) ROUND_POWER_OF_TWO((v0) + (v1), 1)
42 #define DIFF_FACTOR_LOG2 4
43 #define DIFF_FACTOR (1 << DIFF_FACTOR_LOG2)
45 #endif // AOM_AOM_DSP_BLEND_H_