Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -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 | 2ab7ff0 | 2016-09-02 12:04:54 -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 AV1_COMMON_RECONINTER_H_ |
| 13 | #define AV1_COMMON_RECONINTER_H_ |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 14 | |
| 15 | #include "av1/common/filter.h" |
| 16 | #include "av1/common/onyxc_int.h" |
Yaowu Xu | 6557ea9 | 2016-10-31 16:33:36 -0700 | [diff] [blame] | 17 | #include "av1/common/convolve.h" |
Sarah Parker | c2d3871 | 2017-01-24 15:15:41 -0800 | [diff] [blame^] | 18 | #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION |
| 19 | #include "av1/common/warped_motion.h" |
| 20 | #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 21 | #include "aom/aom_integer.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | static INLINE void inter_predictor(const uint8_t *src, int src_stride, |
| 28 | uint8_t *dst, int dst_stride, |
| 29 | const int subpel_x, const int subpel_y, |
| 30 | const struct scale_factors *sf, int w, int h, |
Angie Chiang | 9f45bc4 | 2017-01-13 16:27:54 -0800 | [diff] [blame] | 31 | ConvolveParams *conv_params, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 32 | #if CONFIG_DUAL_FILTER |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 33 | const InterpFilter *interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 34 | #else |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 35 | const InterpFilter interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 36 | #endif |
| 37 | int xs, int ys) { |
| 38 | #if CONFIG_DUAL_FILTER |
| 39 | InterpFilterParams interp_filter_params_x = |
Angie Chiang | 9f45bc4 | 2017-01-13 16:27:54 -0800 | [diff] [blame] | 40 | av1_get_interp_filter_params(interp_filter[1 + 2 * conv_params->ref]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 41 | InterpFilterParams interp_filter_params_y = |
Angie Chiang | 9f45bc4 | 2017-01-13 16:27:54 -0800 | [diff] [blame] | 42 | av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 43 | #else |
| 44 | InterpFilterParams interp_filter_params = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 45 | av1_get_interp_filter_params(interp_filter); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 46 | #endif |
| 47 | |
| 48 | #if CONFIG_DUAL_FILTER |
| 49 | if (interp_filter_params_x.taps == SUBPEL_TAPS && |
Angie Chiang | 117aa0d | 2017-01-18 15:27:03 -0800 | [diff] [blame] | 50 | interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2 && |
| 51 | conv_params->round == CONVOLVE_OPT_ROUND) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 52 | const int16_t *kernel_x = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 53 | av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 54 | const int16_t *kernel_y = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 55 | av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 56 | #else |
Angie Chiang | 117aa0d | 2017-01-18 15:27:03 -0800 | [diff] [blame] | 57 | if (interp_filter_params.taps == SUBPEL_TAPS && w > 2 && h > 2 && |
| 58 | conv_params->round == CONVOLVE_OPT_ROUND) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 59 | const int16_t *kernel_x = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 60 | av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_x); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 61 | const int16_t *kernel_y = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 62 | av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_y); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 63 | #endif |
Angie Chiang | 9f45bc4 | 2017-01-13 16:27:54 -0800 | [diff] [blame] | 64 | sf->predict[subpel_x != 0][subpel_y != 0][conv_params->ref]( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 65 | src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 66 | } else { |
| 67 | // ref_idx > 0 means this is the second reference frame |
| 68 | // first reference frame's prediction result is already in dst |
| 69 | // therefore we need to average the first and second results |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 70 | av1_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter, |
Angie Chiang | 9f45bc4 | 2017-01-13 16:27:54 -0800 | [diff] [blame] | 71 | subpel_x, xs, subpel_y, ys, conv_params); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 72 | } |
| 73 | } |
| 74 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 75 | #if CONFIG_AOM_HIGHBITDEPTH |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 76 | static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride, |
| 77 | uint8_t *dst, int dst_stride, |
| 78 | const int subpel_x, |
| 79 | const int subpel_y, |
| 80 | const struct scale_factors *sf, int w, |
| 81 | int h, int ref, |
| 82 | #if CONFIG_DUAL_FILTER |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 83 | const InterpFilter *interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 84 | #else |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 85 | const InterpFilter interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 86 | #endif |
| 87 | int xs, int ys, int bd) { |
| 88 | #if CONFIG_DUAL_FILTER |
| 89 | InterpFilterParams interp_filter_params_x = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 90 | av1_get_interp_filter_params(interp_filter[1 + 2 * ref]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 91 | InterpFilterParams interp_filter_params_y = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 92 | av1_get_interp_filter_params(interp_filter[0 + 2 * ref]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 93 | #else |
| 94 | InterpFilterParams interp_filter_params = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 95 | av1_get_interp_filter_params(interp_filter); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 96 | #endif |
| 97 | |
| 98 | #if CONFIG_DUAL_FILTER |
| 99 | if (interp_filter_params_x.taps == SUBPEL_TAPS && |
| 100 | interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) { |
| 101 | const int16_t *kernel_x = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 102 | av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 103 | const int16_t *kernel_y = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 104 | av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 105 | #else |
Jingning Han | e29ea12 | 2016-06-21 17:47:30 -0700 | [diff] [blame] | 106 | if (interp_filter_params.taps == SUBPEL_TAPS && w > 2 && h > 2) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 107 | const int16_t *kernel_x = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 108 | av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_x); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 109 | const int16_t *kernel_y = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 110 | av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_y); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 111 | #endif // CONFIG_DUAL_FILTER |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 112 | sf->highbd_predict[subpel_x != 0][subpel_y != 0][ref]( |
| 113 | src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h, bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 114 | } else { |
| 115 | // ref > 0 means this is the second reference frame |
| 116 | // first reference frame's prediction result is already in dst |
| 117 | // therefore we need to average the first and second results |
| 118 | int avg = ref > 0; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 119 | av1_highbd_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter, |
| 120 | subpel_x, xs, subpel_y, ys, avg, bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 121 | } |
| 122 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 123 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 124 | |
| 125 | #if CONFIG_EXT_INTER |
| 126 | // Set to one to use larger codebooks |
| 127 | #define USE_LARGE_WEDGE_CODEBOOK 0 |
| 128 | |
| 129 | #if USE_LARGE_WEDGE_CODEBOOK |
| 130 | #define MAX_WEDGE_TYPES (1 << 5) |
| 131 | #else |
| 132 | #define MAX_WEDGE_TYPES (1 << 4) |
| 133 | #endif |
| 134 | |
| 135 | #define MAX_WEDGE_SIZE_LOG2 5 // 32x32 |
| 136 | #define MAX_WEDGE_SIZE (1 << MAX_WEDGE_SIZE_LOG2) |
| 137 | #define MAX_WEDGE_SQUARE (MAX_WEDGE_SIZE * MAX_WEDGE_SIZE) |
| 138 | |
| 139 | #define WEDGE_WEIGHT_BITS 6 |
| 140 | |
| 141 | #define WEDGE_NONE -1 |
| 142 | |
| 143 | // Angles are with respect to horizontal anti-clockwise |
| 144 | typedef enum { |
| 145 | WEDGE_HORIZONTAL = 0, |
| 146 | WEDGE_VERTICAL = 1, |
| 147 | WEDGE_OBLIQUE27 = 2, |
| 148 | WEDGE_OBLIQUE63 = 3, |
| 149 | WEDGE_OBLIQUE117 = 4, |
| 150 | WEDGE_OBLIQUE153 = 5, |
| 151 | WEDGE_DIRECTIONS |
| 152 | } WedgeDirectionType; |
| 153 | |
| 154 | // 3-tuple: {direction, x_offset, y_offset} |
| 155 | typedef struct { |
| 156 | WedgeDirectionType direction; |
| 157 | int x_offset; |
| 158 | int y_offset; |
| 159 | } wedge_code_type; |
| 160 | |
| 161 | typedef uint8_t *wedge_masks_type[MAX_WEDGE_TYPES]; |
| 162 | |
| 163 | typedef struct { |
| 164 | int bits; |
| 165 | const wedge_code_type *codebook; |
| 166 | uint8_t *signflip; |
| 167 | int smoother; |
| 168 | wedge_masks_type *masks; |
| 169 | } wedge_params_type; |
| 170 | |
| 171 | extern const wedge_params_type wedge_params_lookup[BLOCK_SIZES]; |
| 172 | |
| 173 | static INLINE int get_wedge_bits_lookup(BLOCK_SIZE sb_type) { |
| 174 | return wedge_params_lookup[sb_type].bits; |
| 175 | } |
| 176 | |
| 177 | static INLINE int is_interinter_wedge_used(BLOCK_SIZE sb_type) { |
| 178 | (void)sb_type; |
| 179 | return wedge_params_lookup[sb_type].bits > 0; |
| 180 | } |
| 181 | |
| 182 | static INLINE int get_interinter_wedge_bits(BLOCK_SIZE sb_type) { |
| 183 | const int wbits = wedge_params_lookup[sb_type].bits; |
| 184 | return (wbits > 0) ? wbits + 1 : 0; |
| 185 | } |
| 186 | |
| 187 | static INLINE int is_interintra_wedge_used(BLOCK_SIZE sb_type) { |
| 188 | (void)sb_type; |
| 189 | return wedge_params_lookup[sb_type].bits > 0; |
| 190 | } |
| 191 | |
| 192 | static INLINE int get_interintra_wedge_bits(BLOCK_SIZE sb_type) { |
| 193 | return wedge_params_lookup[sb_type].bits; |
| 194 | } |
Sarah Parker | 569edda | 2016-12-14 14:57:38 -0800 | [diff] [blame] | 195 | |
| 196 | #if CONFIG_COMPOUND_SEGMENT |
Sarah Parker | b9f757c | 2017-01-06 17:12:24 -0800 | [diff] [blame] | 197 | void build_compound_seg_mask(uint8_t *mask, SEG_MASK_TYPE mask_type, |
Sarah Parker | 569edda | 2016-12-14 14:57:38 -0800 | [diff] [blame] | 198 | const uint8_t *src0, int src0_stride, |
| 199 | const uint8_t *src1, int src1_stride, |
| 200 | BLOCK_SIZE sb_type, int h, int w); |
Debargha Mukherjee | 1edf9a3 | 2017-01-07 18:54:20 -0800 | [diff] [blame] | 201 | #if CONFIG_AOM_HIGHBITDEPTH |
| 202 | void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type, |
| 203 | const uint8_t *src0, int src0_stride, |
| 204 | const uint8_t *src1, int src1_stride, |
| 205 | BLOCK_SIZE sb_type, int h, int w, int bd); |
| 206 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Sarah Parker | 569edda | 2016-12-14 14:57:38 -0800 | [diff] [blame] | 207 | #endif // CONFIG_COMPOUND_SEGMENT |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 208 | #endif // CONFIG_EXT_INTER |
| 209 | |
| 210 | void build_inter_predictors(MACROBLOCKD *xd, int plane, |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 211 | #if CONFIG_MOTION_VAR |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 212 | int mi_col_offset, int mi_row_offset, |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 213 | #endif // CONFIG_MOTION_VAR |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 214 | int block, int bw, int bh, int x, int y, int w, |
| 215 | int h, |
| 216 | #if CONFIG_SUPERTX && CONFIG_EXT_INTER |
| 217 | int wedge_offset_x, int wedge_offset_y, |
| 218 | #endif // CONFIG_SUPERTX && CONFIG_EXT_INTER |
| 219 | int mi_x, int mi_y); |
| 220 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 221 | static INLINE void av1_make_inter_predictor( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 222 | const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, |
| 223 | const int subpel_x, const int subpel_y, const struct scale_factors *sf, |
Angie Chiang | 9f45bc4 | 2017-01-13 16:27:54 -0800 | [diff] [blame] | 224 | int w, int h, ConvolveParams *conv_params, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 225 | #if CONFIG_DUAL_FILTER |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 226 | const InterpFilter *interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 227 | #else |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 228 | const InterpFilter interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 229 | #endif |
Sarah Parker | c2d3871 | 2017-01-24 15:15:41 -0800 | [diff] [blame^] | 230 | #if CONFIG_GLOBAL_MOTION |
| 231 | int is_global, int p_col, int p_row, int plane, int ref, |
| 232 | #endif // CONFIG_GLOBAL_MOTION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 233 | int xs, int ys, const MACROBLOCKD *xd) { |
| 234 | (void)xd; |
Sarah Parker | c2d3871 | 2017-01-24 15:15:41 -0800 | [diff] [blame^] | 235 | #if CONFIG_GLOBAL_MOTION |
| 236 | if (is_global) { |
| 237 | const MODE_INFO *mi = xd->mi[0]; |
| 238 | const struct macroblockd_plane *const pd = &xd->plane[plane]; |
| 239 | const struct buf_2d *const pre_buf = &pd->pre[ref]; |
| 240 | WarpedMotionParams *gm = &xd->global_motion[mi->mbmi.ref_frame[ref]]; |
| 241 | |
| 242 | av1_warp_plane(gm, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 243 | #if CONFIG_AOM_HIGHBITDEPTH |
Sarah Parker | c2d3871 | 2017-01-24 15:15:41 -0800 | [diff] [blame^] | 244 | xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd, |
| 245 | #endif // CONFIG_AOM_HIGHBITDEPTH |
| 246 | pre_buf->buf0, pre_buf->width, pre_buf->height, |
| 247 | pre_buf->stride, dst, p_col, p_row, w, h, dst_stride, |
| 248 | pd->subsampling_x, pd->subsampling_y, xs, ys, ref); |
| 249 | return; |
| 250 | } |
| 251 | #endif // CONFIG_GLOBAL_MOTION |
| 252 | #if CONFIG_AOM_HIGHBITDEPTH |
| 253 | if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 254 | highbd_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, |
Angie Chiang | 9f45bc4 | 2017-01-13 16:27:54 -0800 | [diff] [blame] | 255 | sf, w, h, conv_params->ref, interp_filter, xs, ys, |
| 256 | xd->bd); |
Sarah Parker | c2d3871 | 2017-01-24 15:15:41 -0800 | [diff] [blame^] | 257 | return; |
| 258 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 259 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Sarah Parker | c2d3871 | 2017-01-24 15:15:41 -0800 | [diff] [blame^] | 260 | inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, sf, w, |
| 261 | h, conv_params, interp_filter, xs, ys); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | #if CONFIG_EXT_INTER |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 265 | void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride, |
| 266 | uint8_t *dst, int dst_stride, |
| 267 | const int subpel_x, const int subpel_y, |
| 268 | const struct scale_factors *sf, int w, |
| 269 | int h, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 270 | #if CONFIG_DUAL_FILTER |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 271 | const InterpFilter *interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 272 | #else |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 273 | const InterpFilter interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 274 | #endif |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 275 | int xs, int ys, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 276 | #if CONFIG_SUPERTX |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 277 | int wedge_offset_x, int wedge_offset_y, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 278 | #endif // CONFIG_SUPERTX |
Sarah Parker | c2d3871 | 2017-01-24 15:15:41 -0800 | [diff] [blame^] | 279 | #if CONFIG_COMPOUND_SEGMENT || CONFIG_GLOBAL_MOTION |
Sarah Parker | 569edda | 2016-12-14 14:57:38 -0800 | [diff] [blame] | 280 | int plane, |
Sarah Parker | c2d3871 | 2017-01-24 15:15:41 -0800 | [diff] [blame^] | 281 | #endif // CONFIG_COMPOUND_SEGMENT || CONFIG_GLOBAL_MOTION |
| 282 | #if CONFIG_GLOBAL_MOTION |
| 283 | int is_global, int p_col, int p_row, |
| 284 | int ref, |
| 285 | #endif // CONFIG_GLOBAL_MOTION |
Sarah Parker | 569edda | 2016-12-14 14:57:38 -0800 | [diff] [blame] | 286 | MACROBLOCKD *xd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 287 | #endif // CONFIG_EXT_INTER |
| 288 | |
| 289 | static INLINE int round_mv_comp_q4(int value) { |
| 290 | return (value < 0 ? value - 2 : value + 2) / 4; |
| 291 | } |
| 292 | |
| 293 | static MV mi_mv_pred_q4(const MODE_INFO *mi, int idx) { |
| 294 | MV res = { |
| 295 | round_mv_comp_q4( |
| 296 | mi->bmi[0].as_mv[idx].as_mv.row + mi->bmi[1].as_mv[idx].as_mv.row + |
| 297 | mi->bmi[2].as_mv[idx].as_mv.row + mi->bmi[3].as_mv[idx].as_mv.row), |
| 298 | round_mv_comp_q4( |
| 299 | mi->bmi[0].as_mv[idx].as_mv.col + mi->bmi[1].as_mv[idx].as_mv.col + |
| 300 | mi->bmi[2].as_mv[idx].as_mv.col + mi->bmi[3].as_mv[idx].as_mv.col) |
| 301 | }; |
| 302 | return res; |
| 303 | } |
| 304 | |
| 305 | static INLINE int round_mv_comp_q2(int value) { |
| 306 | return (value < 0 ? value - 1 : value + 1) / 2; |
| 307 | } |
| 308 | |
| 309 | static MV mi_mv_pred_q2(const MODE_INFO *mi, int idx, int block0, int block1) { |
| 310 | MV res = { round_mv_comp_q2(mi->bmi[block0].as_mv[idx].as_mv.row + |
| 311 | mi->bmi[block1].as_mv[idx].as_mv.row), |
| 312 | round_mv_comp_q2(mi->bmi[block0].as_mv[idx].as_mv.col + |
| 313 | mi->bmi[block1].as_mv[idx].as_mv.col) }; |
| 314 | return res; |
| 315 | } |
| 316 | |
| 317 | // TODO(jkoleszar): yet another mv clamping function :-( |
| 318 | static INLINE MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd, |
| 319 | const MV *src_mv, int bw, int bh, |
| 320 | int ss_x, int ss_y) { |
| 321 | // If the MV points so far into the UMV border that no visible pixels |
| 322 | // are used for reconstruction, the subpel part of the MV can be |
| 323 | // discarded and the MV limited to 16 pixels with equivalent results. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 324 | const int spel_left = (AOM_INTERP_EXTEND + bw) << SUBPEL_BITS; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 325 | const int spel_right = spel_left - SUBPEL_SHIFTS; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 326 | const int spel_top = (AOM_INTERP_EXTEND + bh) << SUBPEL_BITS; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 327 | const int spel_bottom = spel_top - SUBPEL_SHIFTS; |
| 328 | MV clamped_mv = { src_mv->row * (1 << (1 - ss_y)), |
| 329 | src_mv->col * (1 << (1 - ss_x)) }; |
| 330 | assert(ss_x <= 1); |
| 331 | assert(ss_y <= 1); |
| 332 | |
| 333 | clamp_mv(&clamped_mv, xd->mb_to_left_edge * (1 << (1 - ss_x)) - spel_left, |
| 334 | xd->mb_to_right_edge * (1 << (1 - ss_x)) + spel_right, |
| 335 | xd->mb_to_top_edge * (1 << (1 - ss_y)) - spel_top, |
| 336 | xd->mb_to_bottom_edge * (1 << (1 - ss_y)) + spel_bottom); |
| 337 | |
| 338 | return clamped_mv; |
| 339 | } |
| 340 | |
| 341 | static INLINE MV average_split_mvs(const struct macroblockd_plane *pd, |
| 342 | const MODE_INFO *mi, int ref, int block) { |
| 343 | const int ss_idx = ((pd->subsampling_x > 0) << 1) | (pd->subsampling_y > 0); |
| 344 | MV res = { 0, 0 }; |
| 345 | switch (ss_idx) { |
| 346 | case 0: res = mi->bmi[block].as_mv[ref].as_mv; break; |
| 347 | case 1: res = mi_mv_pred_q2(mi, ref, block, block + 2); break; |
| 348 | case 2: res = mi_mv_pred_q2(mi, ref, block, block + 1); break; |
| 349 | case 3: res = mi_mv_pred_q4(mi, ref); break; |
| 350 | default: assert(ss_idx <= 3 && ss_idx >= 0); |
| 351 | } |
| 352 | return res; |
| 353 | } |
| 354 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 355 | void av1_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, int i, int ir, |
| 356 | int ic, int mi_row, int mi_col); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 357 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 358 | void av1_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col, |
David Barker | ac37fa3 | 2016-12-02 12:30:21 +0000 | [diff] [blame] | 359 | BUFFER_SET *ctx, BLOCK_SIZE bsize); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 360 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 361 | void av1_build_inter_predictors_sbp(MACROBLOCKD *xd, int mi_row, int mi_col, |
David Barker | ac37fa3 | 2016-12-02 12:30:21 +0000 | [diff] [blame] | 362 | BUFFER_SET *ctx, BLOCK_SIZE bsize, |
| 363 | int plane); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 364 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 365 | void av1_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col, |
David Barker | ac37fa3 | 2016-12-02 12:30:21 +0000 | [diff] [blame] | 366 | BUFFER_SET *ctx, BLOCK_SIZE bsize); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 367 | |
| 368 | void av1_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col, |
David Barker | ac37fa3 | 2016-12-02 12:30:21 +0000 | [diff] [blame] | 369 | BUFFER_SET *ctx, BLOCK_SIZE bsize); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 370 | |
| 371 | #if CONFIG_SUPERTX |
| 372 | void av1_build_inter_predictors_sb_sub8x8_extend(MACROBLOCKD *xd, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 373 | #if CONFIG_EXT_INTER |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 374 | int mi_row_ori, int mi_col_ori, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 375 | #endif // CONFIG_EXT_INTER |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 376 | int mi_row, int mi_col, |
| 377 | BLOCK_SIZE bsize, int block); |
| 378 | |
| 379 | void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd, |
| 380 | #if CONFIG_EXT_INTER |
| 381 | int mi_row_ori, int mi_col_ori, |
| 382 | #endif // CONFIG_EXT_INTER |
| 383 | int mi_row, int mi_col, |
| 384 | BLOCK_SIZE bsize); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 385 | struct macroblockd_plane; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 386 | void av1_build_masked_inter_predictor_complex( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 387 | MACROBLOCKD *xd, uint8_t *dst, int dst_stride, const uint8_t *pre, |
| 388 | int pre_stride, int mi_row, int mi_col, int mi_row_ori, int mi_col_ori, |
| 389 | BLOCK_SIZE bsize, BLOCK_SIZE top_bsize, PARTITION_TYPE partition, |
| 390 | int plane); |
| 391 | #endif // CONFIG_SUPERTX |
| 392 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 393 | void av1_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst, |
| 394 | int dst_stride, const MV *mv_q3, |
| 395 | const struct scale_factors *sf, int w, int h, |
Angie Chiang | 9f45bc4 | 2017-01-13 16:27:54 -0800 | [diff] [blame] | 396 | ConvolveParams *conv_params, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 397 | #if CONFIG_DUAL_FILTER |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 398 | const InterpFilter *interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 399 | #else |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 400 | const InterpFilter interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 401 | #endif |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 402 | enum mv_precision precision, int x, int y); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 403 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 404 | #if CONFIG_AOM_HIGHBITDEPTH |
| 405 | void av1_highbd_build_inter_predictor( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 406 | const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, |
| 407 | const MV *mv_q3, const struct scale_factors *sf, int w, int h, int do_avg, |
| 408 | #if CONFIG_DUAL_FILTER |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 409 | const InterpFilter *interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 410 | #else |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 411 | const InterpFilter interp_filter, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 412 | #endif |
| 413 | enum mv_precision precision, int x, int y, int bd); |
| 414 | #endif |
| 415 | |
| 416 | static INLINE int scaled_buffer_offset(int x_offset, int y_offset, int stride, |
| 417 | const struct scale_factors *sf) { |
| 418 | const int x = sf ? sf->scale_value_x(x_offset, sf) : x_offset; |
| 419 | const int y = sf ? sf->scale_value_y(y_offset, sf) : y_offset; |
| 420 | return y * stride + x; |
| 421 | } |
| 422 | |
| 423 | static INLINE void setup_pred_plane(struct buf_2d *dst, uint8_t *src, int width, |
| 424 | int height, int stride, int mi_row, |
| 425 | int mi_col, |
| 426 | const struct scale_factors *scale, |
| 427 | int subsampling_x, int subsampling_y) { |
| 428 | const int x = (MI_SIZE * mi_col) >> subsampling_x; |
| 429 | const int y = (MI_SIZE * mi_row) >> subsampling_y; |
| 430 | dst->buf = src + scaled_buffer_offset(x, y, stride, scale); |
| 431 | dst->buf0 = src; |
| 432 | dst->width = width; |
| 433 | dst->height = height; |
| 434 | dst->stride = stride; |
| 435 | } |
| 436 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 437 | void av1_setup_dst_planes(struct macroblockd_plane planes[MAX_MB_PLANE], |
| 438 | const YV12_BUFFER_CONFIG *src, int mi_row, |
| 439 | int mi_col); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 440 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 441 | void av1_setup_pre_planes(MACROBLOCKD *xd, int idx, |
| 442 | const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col, |
| 443 | const struct scale_factors *sf); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 444 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 445 | // Detect if the block have sub-pixel level motion vectors |
| 446 | // per component. |
| 447 | static INLINE int has_subpel_mv_component(const MODE_INFO *const mi, |
| 448 | const MACROBLOCKD *const xd, |
| 449 | int dir) { |
| 450 | const MB_MODE_INFO *const mbmi = &mi->mbmi; |
| 451 | const BLOCK_SIZE bsize = mbmi->sb_type; |
| 452 | int plane; |
| 453 | int ref = (dir >> 1); |
Jingning Han | b46540c | 2016-12-14 10:59:20 -0800 | [diff] [blame] | 454 | #if CONFIG_CB4X4 |
| 455 | const int unify_bsize = 1; |
| 456 | #else |
| 457 | const int unify_bsize = 0; |
| 458 | #endif |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 459 | |
Jingning Han | b46540c | 2016-12-14 10:59:20 -0800 | [diff] [blame] | 460 | if (bsize >= BLOCK_8X8 || unify_bsize) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 461 | if (dir & 0x01) { |
| 462 | if (mbmi->mv[ref].as_mv.col & SUBPEL_MASK) return 1; |
| 463 | } else { |
| 464 | if (mbmi->mv[ref].as_mv.row & SUBPEL_MASK) return 1; |
| 465 | } |
| 466 | } else { |
| 467 | for (plane = 0; plane < MAX_MB_PLANE; ++plane) { |
| 468 | const PARTITION_TYPE bp = BLOCK_8X8 - bsize; |
| 469 | const struct macroblockd_plane *const pd = &xd->plane[plane]; |
| 470 | const int have_vsplit = bp != PARTITION_HORZ; |
| 471 | const int have_hsplit = bp != PARTITION_VERT; |
| 472 | const int num_4x4_w = 2 >> ((!have_vsplit) | pd->subsampling_x); |
| 473 | const int num_4x4_h = 2 >> ((!have_hsplit) | pd->subsampling_y); |
| 474 | |
| 475 | int x, y; |
| 476 | for (y = 0; y < num_4x4_h; ++y) { |
| 477 | for (x = 0; x < num_4x4_w; ++x) { |
| 478 | const MV mv = average_split_mvs(pd, mi, ref, y * 2 + x); |
| 479 | if (dir & 0x01) { |
| 480 | if (mv.col & SUBPEL_MASK) return 1; |
| 481 | } else { |
| 482 | if (mv.row & SUBPEL_MASK) return 1; |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | return 0; |
| 490 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 491 | |
Angie Chiang | a69ce1b | 2016-10-07 10:57:45 -0700 | [diff] [blame] | 492 | #define CHECK_SUBPEL 0 |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 493 | static INLINE int av1_is_interp_needed(const MACROBLOCKD *const xd) { |
Angie Chiang | a69ce1b | 2016-10-07 10:57:45 -0700 | [diff] [blame] | 494 | #if CHECK_SUBPEL |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 495 | MODE_INFO *const mi = xd->mi[0]; |
Angie Chiang | b135deb | 2016-10-25 16:56:48 -0700 | [diff] [blame] | 496 | const int is_compound = has_second_ref(&mi->mbmi); |
| 497 | int ref; |
| 498 | for (ref = 0; ref < 1 + is_compound; ++ref) { |
| 499 | int row_col; |
| 500 | for (row_col = 0; row_col < 2; ++row_col) { |
| 501 | const int dir = (ref << 1) + row_col; |
| 502 | if (has_subpel_mv_component(mi, xd, dir)) { |
| 503 | return 1; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 504 | } |
| 505 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 506 | } |
Angie Chiang | b135deb | 2016-10-25 16:56:48 -0700 | [diff] [blame] | 507 | return 0; |
Angie Chiang | a69ce1b | 2016-10-07 10:57:45 -0700 | [diff] [blame] | 508 | #else |
| 509 | (void)xd; |
| 510 | return 1; |
| 511 | #endif |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 512 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 513 | |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 514 | #if CONFIG_MOTION_VAR |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 515 | const uint8_t *av1_get_obmc_mask(int length); |
Urvang Joshi | 5264844 | 2016-10-13 17:27:51 -0700 | [diff] [blame] | 516 | void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 517 | int mi_row, int mi_col, |
| 518 | uint8_t *above[MAX_MB_PLANE], |
| 519 | int above_stride[MAX_MB_PLANE], |
| 520 | uint8_t *left[MAX_MB_PLANE], |
| 521 | int left_stride[MAX_MB_PLANE]); |
Urvang Joshi | 5264844 | 2016-10-13 17:27:51 -0700 | [diff] [blame] | 522 | void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 523 | int mi_row, int mi_col, |
| 524 | uint8_t *tmp_buf[MAX_MB_PLANE], |
| 525 | int tmp_width[MAX_MB_PLANE], |
| 526 | int tmp_height[MAX_MB_PLANE], |
| 527 | int tmp_stride[MAX_MB_PLANE]); |
Urvang Joshi | 5264844 | 2016-10-13 17:27:51 -0700 | [diff] [blame] | 528 | void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 529 | int mi_row, int mi_col, |
| 530 | uint8_t *tmp_buf[MAX_MB_PLANE], |
| 531 | int tmp_width[MAX_MB_PLANE], |
| 532 | int tmp_height[MAX_MB_PLANE], |
| 533 | int tmp_stride[MAX_MB_PLANE]); |
Yue Chen | 894fcce | 2016-10-21 16:50:52 -0700 | [diff] [blame] | 534 | void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd, |
| 535 | int mi_row, int mi_col); |
Yue Chen | 86ae7b1 | 2017-01-11 17:04:29 -0800 | [diff] [blame] | 536 | #if CONFIG_NCOBMC |
| 537 | void av1_build_ncobmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd, |
| 538 | int mi_row, int mi_col); |
| 539 | #endif |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 540 | #endif // CONFIG_MOTION_VAR |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 541 | |
| 542 | #if CONFIG_EXT_INTER |
| 543 | #define MASK_MASTER_SIZE (2 * MAX_SB_SIZE) |
| 544 | #define MASK_MASTER_STRIDE (2 * MAX_SB_SIZE) |
| 545 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 546 | void av1_init_wedge_masks(); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 547 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 548 | static INLINE const uint8_t *av1_get_contiguous_soft_mask(int wedge_index, |
| 549 | int wedge_sign, |
| 550 | BLOCK_SIZE sb_type) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 551 | return wedge_params_lookup[sb_type].masks[wedge_sign][wedge_index]; |
| 552 | } |
| 553 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 554 | const uint8_t *av1_get_soft_mask(int wedge_index, int wedge_sign, |
| 555 | BLOCK_SIZE sb_type, int wedge_offset_x, |
| 556 | int wedge_offset_y); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 557 | |
Sarah Parker | b9f757c | 2017-01-06 17:12:24 -0800 | [diff] [blame] | 558 | const uint8_t *av1_get_compound_type_mask_inverse( |
| 559 | const INTERINTER_COMPOUND_DATA *const comp_data, |
| 560 | #if CONFIG_COMPOUND_SEGMENT |
| 561 | uint8_t *mask_buffer, int h, int w, int stride, |
| 562 | #endif |
| 563 | BLOCK_SIZE sb_type); |
| 564 | |
| 565 | const uint8_t *av1_get_compound_type_mask( |
| 566 | const INTERINTER_COMPOUND_DATA *const comp_data, BLOCK_SIZE sb_type); |
Sarah Parker | 6fdc853 | 2016-11-16 17:47:13 -0800 | [diff] [blame] | 567 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 568 | void av1_build_interintra_predictors(MACROBLOCKD *xd, uint8_t *ypred, |
| 569 | uint8_t *upred, uint8_t *vpred, |
| 570 | int ystride, int ustride, int vstride, |
David Barker | ac37fa3 | 2016-12-02 12:30:21 +0000 | [diff] [blame] | 571 | BUFFER_SET *ctx, BLOCK_SIZE bsize); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 572 | void av1_build_interintra_predictors_sby(MACROBLOCKD *xd, uint8_t *ypred, |
David Barker | ac37fa3 | 2016-12-02 12:30:21 +0000 | [diff] [blame] | 573 | int ystride, BUFFER_SET *ctx, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 574 | BLOCK_SIZE bsize); |
David Barker | ac37fa3 | 2016-12-02 12:30:21 +0000 | [diff] [blame] | 575 | void av1_build_interintra_predictors_sbc(MACROBLOCKD *xd, uint8_t *upred, |
| 576 | int ustride, BUFFER_SET *ctx, |
| 577 | int plane, BLOCK_SIZE bsize); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 578 | void av1_build_interintra_predictors_sbuv(MACROBLOCKD *xd, uint8_t *upred, |
| 579 | uint8_t *vpred, int ustride, |
David Barker | ac37fa3 | 2016-12-02 12:30:21 +0000 | [diff] [blame] | 580 | int vstride, BUFFER_SET *ctx, |
| 581 | BLOCK_SIZE bsize); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 582 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 583 | void av1_build_intra_predictors_for_interintra(MACROBLOCKD *xd, |
| 584 | BLOCK_SIZE bsize, int plane, |
David Barker | ac37fa3 | 2016-12-02 12:30:21 +0000 | [diff] [blame] | 585 | BUFFER_SET *ctx, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 586 | uint8_t *intra_pred, |
| 587 | int intra_stride); |
| 588 | void av1_combine_interintra(MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane, |
| 589 | const uint8_t *inter_pred, int inter_stride, |
| 590 | const uint8_t *intra_pred, int intra_stride); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 591 | |
| 592 | // Encoder only |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 593 | void av1_build_inter_predictors_for_planes_single_buf( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 594 | MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane_from, int plane_to, int mi_row, |
| 595 | int mi_col, int ref, uint8_t *ext_dst[3], int ext_dst_stride[3]); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 596 | void av1_build_wedge_inter_predictor_from_buf(MACROBLOCKD *xd, BLOCK_SIZE bsize, |
| 597 | int plane_from, int plane_to, |
| 598 | uint8_t *ext_dst0[3], |
| 599 | int ext_dst_stride0[3], |
| 600 | uint8_t *ext_dst1[3], |
| 601 | int ext_dst_stride1[3]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 602 | #endif // CONFIG_EXT_INTER |
| 603 | |
| 604 | #ifdef __cplusplus |
| 605 | } // extern "C" |
| 606 | #endif |
| 607 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 608 | #endif // AV1_COMMON_RECONINTER_H_ |