Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 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. |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 12 | #ifndef AOM_DSP_VARIANCE_H_ |
| 13 | #define AOM_DSP_VARIANCE_H_ |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 14 | |
Tom Finegan | 60e653d | 2018-05-22 11:34:58 -0700 | [diff] [blame] | 15 | #include "config/aom_config.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 16 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 17 | #include "aom/aom_integer.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
| 23 | #define FILTER_BITS 7 |
| 24 | #define FILTER_WEIGHT 128 |
| 25 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 26 | typedef unsigned int (*aom_sad_fn_t)(const uint8_t *a, int a_stride, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 27 | const uint8_t *b, int b_stride); |
| 28 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 29 | typedef unsigned int (*aom_sad_avg_fn_t)(const uint8_t *a, int a_stride, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 30 | const uint8_t *b, int b_stride, |
| 31 | const uint8_t *second_pred); |
| 32 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 33 | typedef void (*aom_copy32xn_fn_t)(const uint8_t *a, int a_stride, uint8_t *b, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 34 | int b_stride, int n); |
| 35 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 36 | typedef void (*aom_sad_multi_d_fn_t)(const uint8_t *a, int a_stride, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 37 | const uint8_t *const b_array[], |
| 38 | int b_stride, unsigned int *sad_array); |
| 39 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 40 | typedef unsigned int (*aom_variance_fn_t)(const uint8_t *a, int a_stride, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 41 | const uint8_t *b, int b_stride, |
| 42 | unsigned int *sse); |
| 43 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 44 | typedef unsigned int (*aom_subpixvariance_fn_t)(const uint8_t *a, int a_stride, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 45 | int xoffset, int yoffset, |
| 46 | const uint8_t *b, int b_stride, |
| 47 | unsigned int *sse); |
| 48 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 49 | typedef unsigned int (*aom_subp_avg_variance_fn_t)( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 50 | const uint8_t *a, int a_stride, int xoffset, int yoffset, const uint8_t *b, |
| 51 | int b_stride, unsigned int *sse, const uint8_t *second_pred); |
| 52 | |
Cheng Chen | f78632e | 2017-10-20 15:30:51 -0700 | [diff] [blame] | 53 | typedef unsigned int (*aom_jnt_sad_avg_fn_t)(const uint8_t *a, int a_stride, |
| 54 | const uint8_t *b, int b_stride, |
| 55 | const uint8_t *second_pred, |
| 56 | const JNT_COMP_PARAMS *jcp_param); |
| 57 | |
| 58 | typedef unsigned int (*aom_jnt_subp_avg_variance_fn_t)( |
| 59 | const uint8_t *a, int a_stride, int xoffset, int yoffset, const uint8_t *b, |
| 60 | int b_stride, unsigned int *sse, const uint8_t *second_pred, |
| 61 | const JNT_COMP_PARAMS *jcp_param); |
Cheng Chen | f78632e | 2017-10-20 15:30:51 -0700 | [diff] [blame] | 62 | |
David Barker | f19f35f | 2017-05-22 16:33:22 +0100 | [diff] [blame] | 63 | typedef unsigned int (*aom_masked_sad_fn_t)(const uint8_t *src, int src_stride, |
| 64 | const uint8_t *ref, int ref_stride, |
| 65 | const uint8_t *second_pred, |
| 66 | const uint8_t *msk, int msk_stride, |
| 67 | int invert_mask); |
| 68 | typedef unsigned int (*aom_masked_subpixvariance_fn_t)( |
David Barker | c155e01 | 2017-05-11 13:54:54 +0100 | [diff] [blame] | 69 | const uint8_t *src, int src_stride, int xoffset, int yoffset, |
| 70 | const uint8_t *ref, int ref_stride, const uint8_t *second_pred, |
| 71 | const uint8_t *msk, int msk_stride, int invert_mask, unsigned int *sse); |
Peng Bin | f8daa92 | 2018-01-31 16:22:27 +0800 | [diff] [blame] | 72 | |
Urvang Joshi | 52b6299 | 2018-02-02 14:43:07 -0800 | [diff] [blame] | 73 | void aom_comp_mask_upsampled_pred( |
| 74 | MACROBLOCKD *xd, const struct AV1Common *const cm, int mi_row, int mi_col, |
| 75 | const MV *const mv, uint8_t *comp_pred, const uint8_t *pred, int width, |
| 76 | int height, int subpel_x_q3, int subpel_y_q3, const uint8_t *ref, |
| 77 | int ref_stride, const uint8_t *mask, int mask_stride, int invert_mask); |
| 78 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 79 | typedef unsigned int (*aom_obmc_sad_fn_t)(const uint8_t *pred, int pred_stride, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 80 | const int32_t *wsrc, |
| 81 | const int32_t *msk); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 82 | typedef unsigned int (*aom_obmc_variance_fn_t)(const uint8_t *pred, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 83 | int pred_stride, |
| 84 | const int32_t *wsrc, |
| 85 | const int32_t *msk, |
| 86 | unsigned int *sse); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 87 | typedef unsigned int (*aom_obmc_subpixvariance_fn_t)( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 88 | const uint8_t *pred, int pred_stride, int xoffset, int yoffset, |
| 89 | const int32_t *wsrc, const int32_t *msk, unsigned int *sse); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 90 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 91 | typedef struct aom_variance_vtable { |
| 92 | aom_sad_fn_t sdf; |
| 93 | aom_sad_avg_fn_t sdaf; |
| 94 | aom_variance_fn_t vf; |
| 95 | aom_subpixvariance_fn_t svf; |
| 96 | aom_subp_avg_variance_fn_t svaf; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 97 | aom_sad_multi_d_fn_t sdx4df; |
David Barker | f19f35f | 2017-05-22 16:33:22 +0100 | [diff] [blame] | 98 | aom_masked_sad_fn_t msdf; |
| 99 | aom_masked_subpixvariance_fn_t msvf; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 100 | aom_obmc_sad_fn_t osdf; |
| 101 | aom_obmc_variance_fn_t ovf; |
| 102 | aom_obmc_subpixvariance_fn_t osvf; |
Cheng Chen | f78632e | 2017-10-20 15:30:51 -0700 | [diff] [blame] | 103 | aom_jnt_sad_avg_fn_t jsdaf; |
| 104 | aom_jnt_subp_avg_variance_fn_t jsvaf; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 105 | } aom_variance_fn_ptr_t; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 106 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 107 | void aom_highbd_var_filter_block2d_bil_first_pass( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 108 | const uint8_t *src_ptr8, uint16_t *output_ptr, |
| 109 | unsigned int src_pixels_per_line, int pixel_step, |
| 110 | unsigned int output_height, unsigned int output_width, |
| 111 | const uint8_t *filter); |
| 112 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 113 | void aom_highbd_var_filter_block2d_bil_second_pass( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 114 | const uint16_t *src_ptr, uint16_t *output_ptr, |
| 115 | unsigned int src_pixels_per_line, unsigned int pixel_step, |
| 116 | unsigned int output_height, unsigned int output_width, |
| 117 | const uint8_t *filter); |
| 118 | |
Alex Converse | 29608d8 | 2017-03-30 09:36:58 -0700 | [diff] [blame] | 119 | uint32_t aom_sse_odd_size(const uint8_t *a, int a_stride, const uint8_t *b, |
| 120 | int b_stride, int w, int h); |
| 121 | |
Alex Converse | 29608d8 | 2017-03-30 09:36:58 -0700 | [diff] [blame] | 122 | uint64_t aom_highbd_sse_odd_size(const uint8_t *a, int a_stride, |
| 123 | const uint8_t *b, int b_stride, int w, int h); |
Alex Converse | 29608d8 | 2017-03-30 09:36:58 -0700 | [diff] [blame] | 124 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 125 | #ifdef __cplusplus |
| 126 | } // extern "C" |
| 127 | #endif |
| 128 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 129 | #endif // AOM_DSP_VARIANCE_H_ |