Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020, 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 | #ifndef AOM_AV1_ENCODER_ENCODER_UTILS_H_ |
| 13 | #define AOM_AV1_ENCODER_ENCODER_UTILS_H_ |
| 14 | |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 15 | #include "config/aom_dsp_rtcd.h" |
| 16 | #include "config/aom_scale_rtcd.h" |
| 17 | |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 18 | #include "av1/encoder/encoder.h" |
| 19 | #include "av1/encoder/encodetxb.h" |
| 20 | |
| 21 | #ifdef __cplusplus |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
| 25 | #define AM_SEGMENT_ID_INACTIVE 7 |
| 26 | #define AM_SEGMENT_ID_ACTIVE 0 |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 27 | #define DUMP_RECON_FRAMES 0 |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 28 | |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 29 | extern const int default_tx_type_probs[FRAME_UPDATE_TYPES][TX_SIZES_ALL] |
| 30 | [TX_TYPES]; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 31 | |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 32 | extern const int default_obmc_probs[FRAME_UPDATE_TYPES][BLOCK_SIZES_ALL]; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 33 | |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 34 | extern const int default_warped_probs[FRAME_UPDATE_TYPES]; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 35 | |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 36 | extern const int default_switchable_interp_probs[FRAME_UPDATE_TYPES] |
| 37 | [SWITCHABLE_FILTER_CONTEXTS] |
| 38 | [SWITCHABLE_FILTERS]; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 39 | |
| 40 | // Mark all inactive blocks as active. Other segmentation features may be set |
| 41 | // so memset cannot be used, instead only inactive blocks should be reset. |
| 42 | static AOM_INLINE void suppress_active_map(AV1_COMP *cpi) { |
| 43 | unsigned char *const seg_map = cpi->enc_seg.map; |
| 44 | int i; |
chiyotsai | ae4339f | 2022-11-16 10:44:11 -0800 | [diff] [blame] | 45 | const int num_mis = |
| 46 | cpi->common.mi_params.mi_rows * cpi->common.mi_params.mi_cols; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 47 | if (cpi->active_map.enabled || cpi->active_map.update) |
chiyotsai | ae4339f | 2022-11-16 10:44:11 -0800 | [diff] [blame] | 48 | for (i = 0; i < num_mis; ++i) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 49 | if (seg_map[i] == AM_SEGMENT_ID_INACTIVE) |
| 50 | seg_map[i] = AM_SEGMENT_ID_ACTIVE; |
| 51 | } |
| 52 | |
Wan-Teh Chang | 071e379 | 2022-09-02 13:28:50 -0700 | [diff] [blame] | 53 | // Returns 'size' in the number of Mode Info (MI) units. 'size' is either the |
| 54 | // width or height. |
| 55 | static AOM_INLINE int size_in_mi(int size) { |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 56 | // Ensure that the decoded width and height are both multiples of |
| 57 | // 8 luma pixels (note: this may only be a multiple of 4 chroma pixels if |
| 58 | // subsampling is used). |
| 59 | // This simplifies the implementation of various experiments, |
| 60 | // eg. cdef, which operates on units of 8x8 luma pixels. |
Wan-Teh Chang | 071e379 | 2022-09-02 13:28:50 -0700 | [diff] [blame] | 61 | const int aligned_size = ALIGN_POWER_OF_TWO(size, 3); |
| 62 | return aligned_size >> MI_SIZE_LOG2; |
| 63 | } |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 64 | |
Wan-Teh Chang | 071e379 | 2022-09-02 13:28:50 -0700 | [diff] [blame] | 65 | static AOM_INLINE void set_mb_mi(CommonModeInfoParams *mi_params, int width, |
| 66 | int height) { |
| 67 | mi_params->mi_cols = size_in_mi(width); |
| 68 | mi_params->mi_rows = size_in_mi(height); |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 69 | mi_params->mi_stride = calc_mi_size(mi_params->mi_cols); |
| 70 | |
Wan-Teh Chang | ee8848a | 2022-09-07 16:49:38 -0700 | [diff] [blame] | 71 | mi_params->mb_cols = ROUND_POWER_OF_TWO(mi_params->mi_cols, 2); |
| 72 | mi_params->mb_rows = ROUND_POWER_OF_TWO(mi_params->mi_rows, 2); |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 73 | mi_params->MBs = mi_params->mb_rows * mi_params->mb_cols; |
| 74 | |
| 75 | const int mi_alloc_size_1d = mi_size_wide[mi_params->mi_alloc_bsize]; |
| 76 | mi_params->mi_alloc_stride = |
| 77 | (mi_params->mi_stride + mi_alloc_size_1d - 1) / mi_alloc_size_1d; |
| 78 | |
| 79 | assert(mi_size_wide[mi_params->mi_alloc_bsize] == |
| 80 | mi_size_high[mi_params->mi_alloc_bsize]); |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | static AOM_INLINE void enc_free_mi(CommonModeInfoParams *mi_params) { |
| 84 | aom_free(mi_params->mi_alloc); |
| 85 | mi_params->mi_alloc = NULL; |
| 86 | aom_free(mi_params->mi_grid_base); |
| 87 | mi_params->mi_grid_base = NULL; |
| 88 | mi_params->mi_alloc_size = 0; |
| 89 | aom_free(mi_params->tx_type_map); |
| 90 | mi_params->tx_type_map = NULL; |
| 91 | } |
| 92 | |
| 93 | static AOM_INLINE void enc_set_mb_mi(CommonModeInfoParams *mi_params, int width, |
Jayasanker J | fb66696 | 2022-03-29 18:56:42 +0530 | [diff] [blame] | 94 | int height, |
Aniket Wanare | b7d5529 | 2021-11-02 14:07:51 +0530 | [diff] [blame] | 95 | BLOCK_SIZE min_partition_size) { |
Jayasanker J | fb66696 | 2022-03-29 18:56:42 +0530 | [diff] [blame] | 96 | mi_params->mi_alloc_bsize = min_partition_size; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 97 | |
| 98 | set_mb_mi(mi_params, width, height); |
| 99 | } |
| 100 | |
| 101 | static AOM_INLINE void stat_stage_set_mb_mi(CommonModeInfoParams *mi_params, |
Jayasanker J | fb66696 | 2022-03-29 18:56:42 +0530 | [diff] [blame] | 102 | int width, int height, |
Aniket Wanare | b7d5529 | 2021-11-02 14:07:51 +0530 | [diff] [blame] | 103 | BLOCK_SIZE min_partition_size) { |
Aniket Wanare | b7d5529 | 2021-11-02 14:07:51 +0530 | [diff] [blame] | 104 | (void)min_partition_size; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 105 | mi_params->mi_alloc_bsize = BLOCK_16X16; |
| 106 | |
| 107 | set_mb_mi(mi_params, width, height); |
| 108 | } |
| 109 | |
| 110 | static AOM_INLINE void enc_setup_mi(CommonModeInfoParams *mi_params) { |
| 111 | const int mi_grid_size = |
| 112 | mi_params->mi_stride * calc_mi_size(mi_params->mi_rows); |
| 113 | memset(mi_params->mi_alloc, 0, |
| 114 | mi_params->mi_alloc_size * sizeof(*mi_params->mi_alloc)); |
| 115 | memset(mi_params->mi_grid_base, 0, |
| 116 | mi_grid_size * sizeof(*mi_params->mi_grid_base)); |
| 117 | memset(mi_params->tx_type_map, 0, |
| 118 | mi_grid_size * sizeof(*mi_params->tx_type_map)); |
| 119 | } |
| 120 | |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 121 | static AOM_INLINE void init_buffer_indices( |
| 122 | ForceIntegerMVInfo *const force_intpel_info, int *const remapped_ref_idx) { |
| 123 | int fb_idx; |
| 124 | for (fb_idx = 0; fb_idx < REF_FRAMES; ++fb_idx) |
| 125 | remapped_ref_idx[fb_idx] = fb_idx; |
| 126 | force_intpel_info->rate_index = 0; |
| 127 | force_intpel_info->rate_size = 0; |
| 128 | } |
| 129 | |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 130 | #define HIGHBD_BFP(BT, SDF, SDAF, VF, SVF, SVAF, SDX4DF, SDX3DF, JSDAF, JSVAF) \ |
| 131 | ppi->fn_ptr[BT].sdf = SDF; \ |
| 132 | ppi->fn_ptr[BT].sdaf = SDAF; \ |
| 133 | ppi->fn_ptr[BT].vf = VF; \ |
| 134 | ppi->fn_ptr[BT].svf = SVF; \ |
| 135 | ppi->fn_ptr[BT].svaf = SVAF; \ |
| 136 | ppi->fn_ptr[BT].sdx4df = SDX4DF; \ |
| 137 | ppi->fn_ptr[BT].sdx3df = SDX3DF; \ |
| 138 | ppi->fn_ptr[BT].jsdaf = JSDAF; \ |
Mufaddal Chakera | 1679627 | 2021-02-24 14:03:29 +0530 | [diff] [blame] | 139 | ppi->fn_ptr[BT].jsvaf = JSVAF; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 140 | |
Satish Kumar Suman | e52cc7d | 2020-06-12 11:51:06 +0530 | [diff] [blame] | 141 | #define HIGHBD_BFP_WRAPPER(WIDTH, HEIGHT, BD) \ |
| 142 | HIGHBD_BFP( \ |
| 143 | BLOCK_##WIDTH##X##HEIGHT, aom_highbd_sad##WIDTH##x##HEIGHT##_bits##BD, \ |
| 144 | aom_highbd_sad##WIDTH##x##HEIGHT##_avg_bits##BD, \ |
| 145 | aom_highbd_##BD##_variance##WIDTH##x##HEIGHT, \ |
| 146 | aom_highbd_##BD##_sub_pixel_variance##WIDTH##x##HEIGHT, \ |
| 147 | aom_highbd_##BD##_sub_pixel_avg_variance##WIDTH##x##HEIGHT, \ |
| 148 | aom_highbd_sad##WIDTH##x##HEIGHT##x4d_bits##BD, \ |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 149 | aom_highbd_sad##WIDTH##x##HEIGHT##x3d_bits##BD, \ |
Satish Kumar Suman | e52cc7d | 2020-06-12 11:51:06 +0530 | [diff] [blame] | 150 | aom_highbd_dist_wtd_sad##WIDTH##x##HEIGHT##_avg_bits##BD, \ |
| 151 | aom_highbd_##BD##_dist_wtd_sub_pixel_avg_variance##WIDTH##x##HEIGHT) |
| 152 | |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 153 | #define MAKE_BFP_SAD_WRAPPER(fnname) \ |
| 154 | static unsigned int fnname##_bits8(const uint8_t *src_ptr, \ |
| 155 | int source_stride, \ |
| 156 | const uint8_t *ref_ptr, int ref_stride) { \ |
| 157 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride); \ |
| 158 | } \ |
| 159 | static unsigned int fnname##_bits10( \ |
| 160 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 161 | int ref_stride) { \ |
| 162 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride) >> 2; \ |
| 163 | } \ |
| 164 | static unsigned int fnname##_bits12( \ |
| 165 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 166 | int ref_stride) { \ |
| 167 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride) >> 4; \ |
| 168 | } |
| 169 | |
| 170 | #define MAKE_BFP_SADAVG_WRAPPER(fnname) \ |
| 171 | static unsigned int fnname##_bits8( \ |
| 172 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 173 | int ref_stride, const uint8_t *second_pred) { \ |
| 174 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride, second_pred); \ |
| 175 | } \ |
| 176 | static unsigned int fnname##_bits10( \ |
| 177 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 178 | int ref_stride, const uint8_t *second_pred) { \ |
| 179 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride, second_pred) >> \ |
| 180 | 2; \ |
| 181 | } \ |
| 182 | static unsigned int fnname##_bits12( \ |
| 183 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 184 | int ref_stride, const uint8_t *second_pred) { \ |
| 185 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride, second_pred) >> \ |
| 186 | 4; \ |
| 187 | } |
| 188 | |
| 189 | #define MAKE_BFP_SAD4D_WRAPPER(fnname) \ |
| 190 | static void fnname##_bits8(const uint8_t *src_ptr, int source_stride, \ |
| 191 | const uint8_t *const ref_ptr[], int ref_stride, \ |
| 192 | unsigned int *sad_array) { \ |
| 193 | fnname(src_ptr, source_stride, ref_ptr, ref_stride, sad_array); \ |
| 194 | } \ |
| 195 | static void fnname##_bits10(const uint8_t *src_ptr, int source_stride, \ |
| 196 | const uint8_t *const ref_ptr[], int ref_stride, \ |
| 197 | unsigned int *sad_array) { \ |
| 198 | int i; \ |
| 199 | fnname(src_ptr, source_stride, ref_ptr, ref_stride, sad_array); \ |
| 200 | for (i = 0; i < 4; i++) sad_array[i] >>= 2; \ |
| 201 | } \ |
| 202 | static void fnname##_bits12(const uint8_t *src_ptr, int source_stride, \ |
| 203 | const uint8_t *const ref_ptr[], int ref_stride, \ |
| 204 | unsigned int *sad_array) { \ |
| 205 | int i; \ |
| 206 | fnname(src_ptr, source_stride, ref_ptr, ref_stride, sad_array); \ |
| 207 | for (i = 0; i < 4; i++) sad_array[i] >>= 4; \ |
| 208 | } |
| 209 | |
| 210 | #define MAKE_BFP_JSADAVG_WRAPPER(fnname) \ |
| 211 | static unsigned int fnname##_bits8( \ |
| 212 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 213 | int ref_stride, const uint8_t *second_pred, \ |
| 214 | const DIST_WTD_COMP_PARAMS *jcp_param) { \ |
| 215 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride, second_pred, \ |
| 216 | jcp_param); \ |
| 217 | } \ |
| 218 | static unsigned int fnname##_bits10( \ |
| 219 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 220 | int ref_stride, const uint8_t *second_pred, \ |
| 221 | const DIST_WTD_COMP_PARAMS *jcp_param) { \ |
| 222 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride, second_pred, \ |
| 223 | jcp_param) >> \ |
| 224 | 2; \ |
| 225 | } \ |
| 226 | static unsigned int fnname##_bits12( \ |
| 227 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 228 | int ref_stride, const uint8_t *second_pred, \ |
| 229 | const DIST_WTD_COMP_PARAMS *jcp_param) { \ |
| 230 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride, second_pred, \ |
| 231 | jcp_param) >> \ |
| 232 | 4; \ |
| 233 | } |
| 234 | |
| 235 | #if CONFIG_AV1_HIGHBITDEPTH |
| 236 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad128x128) |
| 237 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad128x128_avg) |
| 238 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad128x128x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 239 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad128x128x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 240 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad128x64) |
| 241 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad128x64_avg) |
| 242 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad128x64x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 243 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad128x64x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 244 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad64x128) |
| 245 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad64x128_avg) |
| 246 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad64x128x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 247 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad64x128x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 248 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad32x16) |
| 249 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad32x16_avg) |
| 250 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x16x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 251 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x16x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 252 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad16x32) |
| 253 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad16x32_avg) |
| 254 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x32x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 255 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x32x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 256 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad64x32) |
| 257 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad64x32_avg) |
| 258 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad64x32x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 259 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad64x32x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 260 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad32x64) |
| 261 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad32x64_avg) |
| 262 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x64x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 263 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x64x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 264 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad32x32) |
| 265 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad32x32_avg) |
| 266 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x32x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 267 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x32x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 268 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad64x64) |
| 269 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad64x64_avg) |
| 270 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad64x64x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 271 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad64x64x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 272 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad16x16) |
| 273 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad16x16_avg) |
| 274 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x16x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 275 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x16x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 276 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad16x8) |
| 277 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad16x8_avg) |
| 278 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x8x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 279 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x8x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 280 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad8x16) |
| 281 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad8x16_avg) |
| 282 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x16x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 283 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x16x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 284 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad8x8) |
| 285 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad8x8_avg) |
| 286 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x8x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 287 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x8x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 288 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad8x4) |
| 289 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad8x4_avg) |
| 290 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x4x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 291 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x4x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 292 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad4x8) |
| 293 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad4x8_avg) |
| 294 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad4x8x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 295 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad4x8x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 296 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad4x4) |
| 297 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad4x4_avg) |
| 298 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad4x4x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 299 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad4x4x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 300 | |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 301 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 302 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad4x16) |
| 303 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad4x16_avg) |
| 304 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad4x16x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 305 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad4x16x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 306 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad16x4) |
| 307 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad16x4_avg) |
| 308 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x4x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 309 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x4x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 310 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad8x32) |
| 311 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad8x32_avg) |
| 312 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x32x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 313 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad8x32x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 314 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad32x8) |
| 315 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad32x8_avg) |
| 316 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x8x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 317 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad32x8x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 318 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad16x64) |
| 319 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad16x64_avg) |
| 320 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x64x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 321 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad16x64x3d) |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 322 | MAKE_BFP_SAD_WRAPPER(aom_highbd_sad64x16) |
| 323 | MAKE_BFP_SADAVG_WRAPPER(aom_highbd_sad64x16_avg) |
| 324 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad64x16x4d) |
chiyotsai | a4c4f18 | 2022-12-05 14:41:05 -0800 | [diff] [blame] | 325 | MAKE_BFP_SAD4D_WRAPPER(aom_highbd_sad64x16x3d) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 326 | #endif |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 327 | |
| 328 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad128x128_avg) |
| 329 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad128x64_avg) |
| 330 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad64x128_avg) |
| 331 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad32x16_avg) |
| 332 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad16x32_avg) |
| 333 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad64x32_avg) |
| 334 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad32x64_avg) |
| 335 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad32x32_avg) |
| 336 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad64x64_avg) |
| 337 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad16x16_avg) |
| 338 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad16x8_avg) |
| 339 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad8x16_avg) |
| 340 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad8x8_avg) |
| 341 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad8x4_avg) |
| 342 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad4x8_avg) |
| 343 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad4x4_avg) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 344 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 345 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad4x16_avg) |
| 346 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad16x4_avg) |
| 347 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad8x32_avg) |
| 348 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad32x8_avg) |
| 349 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad16x64_avg) |
| 350 | MAKE_BFP_JSADAVG_WRAPPER(aom_highbd_dist_wtd_sad64x16_avg) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 351 | #endif |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 352 | #endif // CONFIG_AV1_HIGHBITDEPTH |
| 353 | |
| 354 | #define HIGHBD_MBFP(BT, MCSDF, MCSVF) \ |
Mufaddal Chakera | 1679627 | 2021-02-24 14:03:29 +0530 | [diff] [blame] | 355 | ppi->fn_ptr[BT].msdf = MCSDF; \ |
| 356 | ppi->fn_ptr[BT].msvf = MCSVF; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 357 | |
Satish Kumar Suman | e52cc7d | 2020-06-12 11:51:06 +0530 | [diff] [blame] | 358 | #define HIGHBD_MBFP_WRAPPER(WIDTH, HEIGHT, BD) \ |
| 359 | HIGHBD_MBFP(BLOCK_##WIDTH##X##HEIGHT, \ |
| 360 | aom_highbd_masked_sad##WIDTH##x##HEIGHT##_bits##BD, \ |
| 361 | aom_highbd_##BD##_masked_sub_pixel_variance##WIDTH##x##HEIGHT) |
| 362 | |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 363 | #define MAKE_MBFP_COMPOUND_SAD_WRAPPER(fnname) \ |
| 364 | static unsigned int fnname##_bits8( \ |
| 365 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 366 | int ref_stride, const uint8_t *second_pred_ptr, const uint8_t *m, \ |
| 367 | int m_stride, int invert_mask) { \ |
| 368 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride, \ |
| 369 | second_pred_ptr, m, m_stride, invert_mask); \ |
| 370 | } \ |
| 371 | static unsigned int fnname##_bits10( \ |
| 372 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 373 | int ref_stride, const uint8_t *second_pred_ptr, const uint8_t *m, \ |
| 374 | int m_stride, int invert_mask) { \ |
| 375 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride, \ |
| 376 | second_pred_ptr, m, m_stride, invert_mask) >> \ |
| 377 | 2; \ |
| 378 | } \ |
| 379 | static unsigned int fnname##_bits12( \ |
| 380 | const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, \ |
| 381 | int ref_stride, const uint8_t *second_pred_ptr, const uint8_t *m, \ |
| 382 | int m_stride, int invert_mask) { \ |
| 383 | return fnname(src_ptr, source_stride, ref_ptr, ref_stride, \ |
| 384 | second_pred_ptr, m, m_stride, invert_mask) >> \ |
| 385 | 4; \ |
| 386 | } |
| 387 | |
| 388 | #if CONFIG_AV1_HIGHBITDEPTH |
| 389 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad128x128) |
| 390 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad128x64) |
| 391 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad64x128) |
| 392 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad64x64) |
| 393 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad64x32) |
| 394 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad32x64) |
| 395 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad32x32) |
| 396 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad32x16) |
| 397 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad16x32) |
| 398 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad16x16) |
| 399 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad16x8) |
| 400 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad8x16) |
| 401 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad8x8) |
| 402 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad8x4) |
| 403 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad4x8) |
| 404 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad4x4) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 405 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 406 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad4x16) |
| 407 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad16x4) |
| 408 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad8x32) |
| 409 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad32x8) |
| 410 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad16x64) |
| 411 | MAKE_MBFP_COMPOUND_SAD_WRAPPER(aom_highbd_masked_sad64x16) |
| 412 | #endif |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 413 | #endif |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 414 | |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 415 | #define HIGHBD_SDSFP(BT, SDSF, SDSX4DF) \ |
Mufaddal Chakera | 1679627 | 2021-02-24 14:03:29 +0530 | [diff] [blame] | 416 | ppi->fn_ptr[BT].sdsf = SDSF; \ |
| 417 | ppi->fn_ptr[BT].sdsx4df = SDSX4DF; |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 418 | |
| 419 | #define HIGHBD_SDSFP_WRAPPER(WIDTH, HEIGHT, BD) \ |
| 420 | HIGHBD_SDSFP(BLOCK_##WIDTH##X##HEIGHT, \ |
| 421 | aom_highbd_sad_skip_##WIDTH##x##HEIGHT##_bits##BD, \ |
| 422 | aom_highbd_sad_skip_##WIDTH##x##HEIGHT##x4d##_bits##BD) |
| 423 | |
| 424 | #define MAKE_SDSF_SKIP_SAD_WRAPPER(fnname) \ |
| 425 | static unsigned int fnname##_bits8(const uint8_t *src, int src_stride, \ |
| 426 | const uint8_t *ref, int ref_stride) { \ |
| 427 | return fnname(src, src_stride, ref, ref_stride); \ |
| 428 | } \ |
| 429 | static unsigned int fnname##_bits10(const uint8_t *src, int src_stride, \ |
| 430 | const uint8_t *ref, int ref_stride) { \ |
| 431 | return fnname(src, src_stride, ref, ref_stride) >> 2; \ |
| 432 | } \ |
| 433 | static unsigned int fnname##_bits12(const uint8_t *src, int src_stride, \ |
| 434 | const uint8_t *ref, int ref_stride) { \ |
| 435 | return fnname(src, src_stride, ref, ref_stride) >> 4; \ |
| 436 | } |
| 437 | |
| 438 | #define MAKE_SDSF_SKIP_SAD_4D_WRAPPER(fnname) \ |
| 439 | static void fnname##_bits8(const uint8_t *src_ptr, int source_stride, \ |
| 440 | const uint8_t *const ref_ptr[], int ref_stride, \ |
| 441 | unsigned int *sad_array) { \ |
| 442 | fnname(src_ptr, source_stride, ref_ptr, ref_stride, sad_array); \ |
| 443 | } \ |
| 444 | static void fnname##_bits10(const uint8_t *src_ptr, int source_stride, \ |
| 445 | const uint8_t *const ref_ptr[], int ref_stride, \ |
| 446 | unsigned int *sad_array) { \ |
| 447 | int i; \ |
| 448 | fnname(src_ptr, source_stride, ref_ptr, ref_stride, sad_array); \ |
| 449 | for (i = 0; i < 4; i++) sad_array[i] >>= 2; \ |
| 450 | } \ |
| 451 | static void fnname##_bits12(const uint8_t *src_ptr, int source_stride, \ |
| 452 | const uint8_t *const ref_ptr[], int ref_stride, \ |
| 453 | unsigned int *sad_array) { \ |
| 454 | int i; \ |
| 455 | fnname(src_ptr, source_stride, ref_ptr, ref_stride, sad_array); \ |
| 456 | for (i = 0; i < 4; i++) sad_array[i] >>= 4; \ |
| 457 | } |
| 458 | |
| 459 | #if CONFIG_AV1_HIGHBITDEPTH |
| 460 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_128x128) |
| 461 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_128x64) |
| 462 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_64x128) |
| 463 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_64x64) |
| 464 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_64x32) |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 465 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_32x64) |
| 466 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_32x32) |
| 467 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_32x16) |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 468 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_16x32) |
| 469 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_16x16) |
| 470 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_16x8) |
| 471 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_8x16) |
| 472 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_8x8) |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 473 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_4x8) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 474 | |
| 475 | #if !CONFIG_REALTIME_ONLY |
| 476 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_64x16) |
| 477 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_32x8) |
| 478 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_16x64) |
| 479 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_4x16) |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 480 | MAKE_SDSF_SKIP_SAD_WRAPPER(aom_highbd_sad_skip_8x32) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 481 | #endif |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 482 | |
| 483 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_128x128x4d) |
| 484 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_128x64x4d) |
| 485 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_64x128x4d) |
| 486 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_64x64x4d) |
| 487 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_64x32x4d) |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 488 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_32x64x4d) |
| 489 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_32x32x4d) |
| 490 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_32x16x4d) |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 491 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_16x32x4d) |
| 492 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_16x16x4d) |
| 493 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_16x8x4d) |
| 494 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_8x16x4d) |
| 495 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_8x8x4d) |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 496 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_4x8x4d) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 497 | |
| 498 | #if !CONFIG_REALTIME_ONLY |
| 499 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_64x16x4d) |
| 500 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_32x8x4d) |
| 501 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_16x64x4d) |
| 502 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_4x16x4d) |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 503 | MAKE_SDSF_SKIP_SAD_4D_WRAPPER(aom_highbd_sad_skip_8x32x4d) |
| 504 | #endif |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 505 | #endif |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 506 | |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 507 | #if !CONFIG_REALTIME_ONLY |
| 508 | |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 509 | #if CONFIG_AV1_HIGHBITDEPTH |
Jerome Jiang | 5a1b33b | 2021-02-10 11:37:44 -0800 | [diff] [blame] | 510 | #define HIGHBD_OBFP_WRAPPER_8(WIDTH, HEIGHT) \ |
| 511 | HIGHBD_OBFP(BLOCK_##WIDTH##X##HEIGHT, \ |
| 512 | aom_highbd_obmc_sad##WIDTH##x##HEIGHT##_bits8, \ |
Gerda Zsejke More | 476a764 | 2023-07-14 15:36:42 +0200 | [diff] [blame] | 513 | aom_highbd_8_obmc_variance##WIDTH##x##HEIGHT, \ |
| 514 | aom_highbd_8_obmc_sub_pixel_variance##WIDTH##x##HEIGHT) |
Jerome Jiang | 5a1b33b | 2021-02-10 11:37:44 -0800 | [diff] [blame] | 515 | |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 516 | #define HIGHBD_OBFP(BT, OSDF, OVF, OSVF) \ |
Mufaddal Chakera | 1679627 | 2021-02-24 14:03:29 +0530 | [diff] [blame] | 517 | ppi->fn_ptr[BT].osdf = OSDF; \ |
| 518 | ppi->fn_ptr[BT].ovf = OVF; \ |
| 519 | ppi->fn_ptr[BT].osvf = OSVF; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 520 | |
Satish Kumar Suman | e52cc7d | 2020-06-12 11:51:06 +0530 | [diff] [blame] | 521 | #define HIGHBD_OBFP_WRAPPER(WIDTH, HEIGHT, BD) \ |
| 522 | HIGHBD_OBFP(BLOCK_##WIDTH##X##HEIGHT, \ |
| 523 | aom_highbd_obmc_sad##WIDTH##x##HEIGHT##_bits##BD, \ |
| 524 | aom_highbd_##BD##_obmc_variance##WIDTH##x##HEIGHT, \ |
| 525 | aom_highbd_##BD##_obmc_sub_pixel_variance##WIDTH##x##HEIGHT) |
| 526 | |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 527 | #define MAKE_OBFP_SAD_WRAPPER(fnname) \ |
Jerome Jiang | 5a1b33b | 2021-02-10 11:37:44 -0800 | [diff] [blame] | 528 | static unsigned int fnname##_bits8(const uint8_t *ref, int ref_stride, \ |
| 529 | const int32_t *wsrc, \ |
| 530 | const int32_t *msk) { \ |
| 531 | return fnname(ref, ref_stride, wsrc, msk); \ |
| 532 | } \ |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 533 | static unsigned int fnname##_bits10(const uint8_t *ref, int ref_stride, \ |
| 534 | const int32_t *wsrc, \ |
| 535 | const int32_t *msk) { \ |
| 536 | return fnname(ref, ref_stride, wsrc, msk) >> 2; \ |
| 537 | } \ |
| 538 | static unsigned int fnname##_bits12(const uint8_t *ref, int ref_stride, \ |
| 539 | const int32_t *wsrc, \ |
| 540 | const int32_t *msk) { \ |
| 541 | return fnname(ref, ref_stride, wsrc, msk) >> 4; \ |
| 542 | } |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 543 | #endif // CONFIG_AV1_HIGHBITDEPTH |
| 544 | #endif // !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 545 | |
| 546 | #if CONFIG_AV1_HIGHBITDEPTH |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 547 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 548 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad128x128) |
| 549 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad128x64) |
| 550 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad64x128) |
| 551 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad64x64) |
| 552 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad64x32) |
| 553 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad32x64) |
| 554 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad32x32) |
| 555 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad32x16) |
| 556 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad16x32) |
| 557 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad16x16) |
| 558 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad16x8) |
| 559 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad8x16) |
| 560 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad8x8) |
| 561 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad8x4) |
| 562 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad4x8) |
| 563 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad4x4) |
| 564 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad4x16) |
| 565 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad16x4) |
| 566 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad8x32) |
| 567 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad32x8) |
| 568 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad16x64) |
| 569 | MAKE_OBFP_SAD_WRAPPER(aom_highbd_obmc_sad64x16) |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 570 | #endif |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 571 | |
Mufaddal Chakera | 1679627 | 2021-02-24 14:03:29 +0530 | [diff] [blame] | 572 | static AOM_INLINE void highbd_set_var_fns(AV1_PRIMARY *const ppi) { |
| 573 | SequenceHeader *const seq_params = &ppi->seq_params; |
| 574 | if (seq_params->use_highbitdepth) { |
| 575 | switch (seq_params->bit_depth) { |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 576 | case AOM_BITS_8: |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 577 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 578 | HIGHBD_BFP_WRAPPER(64, 16, 8) |
| 579 | HIGHBD_BFP_WRAPPER(16, 64, 8) |
| 580 | HIGHBD_BFP_WRAPPER(32, 8, 8) |
| 581 | HIGHBD_BFP_WRAPPER(8, 32, 8) |
| 582 | HIGHBD_BFP_WRAPPER(16, 4, 8) |
| 583 | HIGHBD_BFP_WRAPPER(4, 16, 8) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 584 | #endif |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 585 | HIGHBD_BFP_WRAPPER(32, 16, 8) |
| 586 | HIGHBD_BFP_WRAPPER(16, 32, 8) |
| 587 | HIGHBD_BFP_WRAPPER(64, 32, 8) |
| 588 | HIGHBD_BFP_WRAPPER(32, 64, 8) |
| 589 | HIGHBD_BFP_WRAPPER(32, 32, 8) |
| 590 | HIGHBD_BFP_WRAPPER(64, 64, 8) |
| 591 | HIGHBD_BFP_WRAPPER(16, 16, 8) |
| 592 | HIGHBD_BFP_WRAPPER(16, 8, 8) |
| 593 | HIGHBD_BFP_WRAPPER(8, 16, 8) |
| 594 | HIGHBD_BFP_WRAPPER(8, 8, 8) |
| 595 | HIGHBD_BFP_WRAPPER(8, 4, 8) |
| 596 | HIGHBD_BFP_WRAPPER(4, 8, 8) |
| 597 | HIGHBD_BFP_WRAPPER(4, 4, 8) |
| 598 | HIGHBD_BFP_WRAPPER(128, 128, 8) |
| 599 | HIGHBD_BFP_WRAPPER(128, 64, 8) |
| 600 | HIGHBD_BFP_WRAPPER(64, 128, 8) |
| 601 | |
| 602 | HIGHBD_MBFP_WRAPPER(128, 128, 8) |
| 603 | HIGHBD_MBFP_WRAPPER(128, 64, 8) |
| 604 | HIGHBD_MBFP_WRAPPER(64, 128, 8) |
| 605 | HIGHBD_MBFP_WRAPPER(64, 64, 8) |
| 606 | HIGHBD_MBFP_WRAPPER(64, 32, 8) |
| 607 | HIGHBD_MBFP_WRAPPER(32, 64, 8) |
| 608 | HIGHBD_MBFP_WRAPPER(32, 32, 8) |
| 609 | HIGHBD_MBFP_WRAPPER(32, 16, 8) |
| 610 | HIGHBD_MBFP_WRAPPER(16, 32, 8) |
| 611 | HIGHBD_MBFP_WRAPPER(16, 16, 8) |
| 612 | HIGHBD_MBFP_WRAPPER(8, 16, 8) |
| 613 | HIGHBD_MBFP_WRAPPER(16, 8, 8) |
| 614 | HIGHBD_MBFP_WRAPPER(8, 8, 8) |
| 615 | HIGHBD_MBFP_WRAPPER(4, 8, 8) |
| 616 | HIGHBD_MBFP_WRAPPER(8, 4, 8) |
| 617 | HIGHBD_MBFP_WRAPPER(4, 4, 8) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 618 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 619 | HIGHBD_MBFP_WRAPPER(64, 16, 8) |
| 620 | HIGHBD_MBFP_WRAPPER(16, 64, 8) |
| 621 | HIGHBD_MBFP_WRAPPER(32, 8, 8) |
| 622 | HIGHBD_MBFP_WRAPPER(8, 32, 8) |
| 623 | HIGHBD_MBFP_WRAPPER(16, 4, 8) |
| 624 | HIGHBD_MBFP_WRAPPER(4, 16, 8) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 625 | #endif |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 626 | |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 627 | // OBMC excluded from realtime only build. |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 628 | #if !CONFIG_REALTIME_ONLY |
Jerome Jiang | 5a1b33b | 2021-02-10 11:37:44 -0800 | [diff] [blame] | 629 | HIGHBD_OBFP_WRAPPER_8(128, 128) |
| 630 | HIGHBD_OBFP_WRAPPER_8(128, 64) |
| 631 | HIGHBD_OBFP_WRAPPER_8(64, 128) |
| 632 | HIGHBD_OBFP_WRAPPER_8(64, 64) |
| 633 | HIGHBD_OBFP_WRAPPER_8(64, 32) |
| 634 | HIGHBD_OBFP_WRAPPER_8(32, 64) |
| 635 | HIGHBD_OBFP_WRAPPER_8(32, 32) |
| 636 | HIGHBD_OBFP_WRAPPER_8(32, 16) |
| 637 | HIGHBD_OBFP_WRAPPER_8(16, 32) |
| 638 | HIGHBD_OBFP_WRAPPER_8(16, 16) |
| 639 | HIGHBD_OBFP_WRAPPER_8(8, 16) |
| 640 | HIGHBD_OBFP_WRAPPER_8(16, 8) |
| 641 | HIGHBD_OBFP_WRAPPER_8(8, 8) |
| 642 | HIGHBD_OBFP_WRAPPER_8(4, 8) |
| 643 | HIGHBD_OBFP_WRAPPER_8(8, 4) |
| 644 | HIGHBD_OBFP_WRAPPER_8(4, 4) |
| 645 | HIGHBD_OBFP_WRAPPER_8(64, 16) |
| 646 | HIGHBD_OBFP_WRAPPER_8(16, 64) |
| 647 | HIGHBD_OBFP_WRAPPER_8(32, 8) |
| 648 | HIGHBD_OBFP_WRAPPER_8(8, 32) |
| 649 | HIGHBD_OBFP_WRAPPER_8(16, 4) |
| 650 | HIGHBD_OBFP_WRAPPER_8(4, 16) |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 651 | #endif |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 652 | |
James Zern | f2658a3 | 2022-02-09 10:18:38 -0800 | [diff] [blame] | 653 | HIGHBD_SDSFP_WRAPPER(128, 128, 8) |
| 654 | HIGHBD_SDSFP_WRAPPER(128, 64, 8) |
| 655 | HIGHBD_SDSFP_WRAPPER(64, 128, 8) |
| 656 | HIGHBD_SDSFP_WRAPPER(64, 64, 8) |
| 657 | HIGHBD_SDSFP_WRAPPER(64, 32, 8) |
| 658 | HIGHBD_SDSFP_WRAPPER(32, 64, 8) |
| 659 | HIGHBD_SDSFP_WRAPPER(32, 32, 8) |
| 660 | HIGHBD_SDSFP_WRAPPER(32, 16, 8) |
| 661 | HIGHBD_SDSFP_WRAPPER(16, 32, 8) |
| 662 | HIGHBD_SDSFP_WRAPPER(16, 16, 8) |
| 663 | HIGHBD_SDSFP_WRAPPER(16, 8, 8) |
| 664 | HIGHBD_SDSFP_WRAPPER(8, 16, 8) |
| 665 | HIGHBD_SDSFP_WRAPPER(8, 8, 8) |
| 666 | HIGHBD_SDSFP_WRAPPER(4, 8, 8) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 667 | #if !CONFIG_REALTIME_ONLY |
James Zern | f2658a3 | 2022-02-09 10:18:38 -0800 | [diff] [blame] | 668 | HIGHBD_SDSFP_WRAPPER(64, 16, 8) |
| 669 | HIGHBD_SDSFP_WRAPPER(32, 8, 8) |
| 670 | HIGHBD_SDSFP_WRAPPER(16, 64, 8) |
| 671 | HIGHBD_SDSFP_WRAPPER(8, 32, 8) |
| 672 | HIGHBD_SDSFP_WRAPPER(4, 16, 8) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 673 | #endif |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 674 | break; |
| 675 | |
| 676 | case AOM_BITS_10: |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 677 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 678 | HIGHBD_BFP_WRAPPER(64, 16, 10) |
| 679 | HIGHBD_BFP_WRAPPER(16, 64, 10) |
| 680 | HIGHBD_BFP_WRAPPER(32, 8, 10) |
| 681 | HIGHBD_BFP_WRAPPER(8, 32, 10) |
| 682 | HIGHBD_BFP_WRAPPER(16, 4, 10) |
| 683 | HIGHBD_BFP_WRAPPER(4, 16, 10) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 684 | #endif |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 685 | HIGHBD_BFP_WRAPPER(32, 16, 10) |
| 686 | HIGHBD_BFP_WRAPPER(16, 32, 10) |
| 687 | HIGHBD_BFP_WRAPPER(64, 32, 10) |
| 688 | HIGHBD_BFP_WRAPPER(32, 64, 10) |
| 689 | HIGHBD_BFP_WRAPPER(32, 32, 10) |
| 690 | HIGHBD_BFP_WRAPPER(64, 64, 10) |
| 691 | HIGHBD_BFP_WRAPPER(16, 16, 10) |
| 692 | HIGHBD_BFP_WRAPPER(16, 8, 10) |
| 693 | HIGHBD_BFP_WRAPPER(8, 16, 10) |
| 694 | HIGHBD_BFP_WRAPPER(8, 8, 10) |
| 695 | HIGHBD_BFP_WRAPPER(8, 4, 10) |
| 696 | HIGHBD_BFP_WRAPPER(4, 8, 10) |
| 697 | HIGHBD_BFP_WRAPPER(4, 4, 10) |
| 698 | HIGHBD_BFP_WRAPPER(128, 128, 10) |
| 699 | HIGHBD_BFP_WRAPPER(128, 64, 10) |
| 700 | HIGHBD_BFP_WRAPPER(64, 128, 10) |
| 701 | |
| 702 | HIGHBD_MBFP_WRAPPER(128, 128, 10) |
| 703 | HIGHBD_MBFP_WRAPPER(128, 64, 10) |
| 704 | HIGHBD_MBFP_WRAPPER(64, 128, 10) |
| 705 | HIGHBD_MBFP_WRAPPER(64, 64, 10) |
| 706 | HIGHBD_MBFP_WRAPPER(64, 32, 10) |
| 707 | HIGHBD_MBFP_WRAPPER(32, 64, 10) |
| 708 | HIGHBD_MBFP_WRAPPER(32, 32, 10) |
| 709 | HIGHBD_MBFP_WRAPPER(32, 16, 10) |
| 710 | HIGHBD_MBFP_WRAPPER(16, 32, 10) |
| 711 | HIGHBD_MBFP_WRAPPER(16, 16, 10) |
| 712 | HIGHBD_MBFP_WRAPPER(8, 16, 10) |
| 713 | HIGHBD_MBFP_WRAPPER(16, 8, 10) |
| 714 | HIGHBD_MBFP_WRAPPER(8, 8, 10) |
| 715 | HIGHBD_MBFP_WRAPPER(4, 8, 10) |
| 716 | HIGHBD_MBFP_WRAPPER(8, 4, 10) |
| 717 | HIGHBD_MBFP_WRAPPER(4, 4, 10) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 718 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 719 | HIGHBD_MBFP_WRAPPER(64, 16, 10) |
| 720 | HIGHBD_MBFP_WRAPPER(16, 64, 10) |
| 721 | HIGHBD_MBFP_WRAPPER(32, 8, 10) |
| 722 | HIGHBD_MBFP_WRAPPER(8, 32, 10) |
| 723 | HIGHBD_MBFP_WRAPPER(16, 4, 10) |
| 724 | HIGHBD_MBFP_WRAPPER(4, 16, 10) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 725 | #endif |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 726 | |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 727 | // OBMC excluded from realtime only build. |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 728 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 729 | HIGHBD_OBFP_WRAPPER(128, 128, 10) |
| 730 | HIGHBD_OBFP_WRAPPER(128, 64, 10) |
| 731 | HIGHBD_OBFP_WRAPPER(64, 128, 10) |
| 732 | HIGHBD_OBFP_WRAPPER(64, 64, 10) |
| 733 | HIGHBD_OBFP_WRAPPER(64, 32, 10) |
| 734 | HIGHBD_OBFP_WRAPPER(32, 64, 10) |
| 735 | HIGHBD_OBFP_WRAPPER(32, 32, 10) |
| 736 | HIGHBD_OBFP_WRAPPER(32, 16, 10) |
| 737 | HIGHBD_OBFP_WRAPPER(16, 32, 10) |
| 738 | HIGHBD_OBFP_WRAPPER(16, 16, 10) |
| 739 | HIGHBD_OBFP_WRAPPER(8, 16, 10) |
| 740 | HIGHBD_OBFP_WRAPPER(16, 8, 10) |
| 741 | HIGHBD_OBFP_WRAPPER(8, 8, 10) |
| 742 | HIGHBD_OBFP_WRAPPER(4, 8, 10) |
| 743 | HIGHBD_OBFP_WRAPPER(8, 4, 10) |
| 744 | HIGHBD_OBFP_WRAPPER(4, 4, 10) |
| 745 | HIGHBD_OBFP_WRAPPER(64, 16, 10) |
| 746 | HIGHBD_OBFP_WRAPPER(16, 64, 10) |
| 747 | HIGHBD_OBFP_WRAPPER(32, 8, 10) |
| 748 | HIGHBD_OBFP_WRAPPER(8, 32, 10) |
| 749 | HIGHBD_OBFP_WRAPPER(16, 4, 10) |
| 750 | HIGHBD_OBFP_WRAPPER(4, 16, 10) |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 751 | #endif |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 752 | |
James Zern | f2658a3 | 2022-02-09 10:18:38 -0800 | [diff] [blame] | 753 | HIGHBD_SDSFP_WRAPPER(128, 128, 10) |
| 754 | HIGHBD_SDSFP_WRAPPER(128, 64, 10) |
| 755 | HIGHBD_SDSFP_WRAPPER(64, 128, 10) |
| 756 | HIGHBD_SDSFP_WRAPPER(64, 64, 10) |
| 757 | HIGHBD_SDSFP_WRAPPER(64, 32, 10) |
| 758 | HIGHBD_SDSFP_WRAPPER(32, 64, 10) |
| 759 | HIGHBD_SDSFP_WRAPPER(32, 32, 10) |
| 760 | HIGHBD_SDSFP_WRAPPER(32, 16, 10) |
| 761 | HIGHBD_SDSFP_WRAPPER(16, 32, 10) |
| 762 | HIGHBD_SDSFP_WRAPPER(16, 16, 10) |
| 763 | HIGHBD_SDSFP_WRAPPER(16, 8, 10) |
| 764 | HIGHBD_SDSFP_WRAPPER(8, 16, 10) |
| 765 | HIGHBD_SDSFP_WRAPPER(8, 8, 10) |
| 766 | HIGHBD_SDSFP_WRAPPER(4, 8, 10) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 767 | |
| 768 | #if !CONFIG_REALTIME_ONLY |
James Zern | f2658a3 | 2022-02-09 10:18:38 -0800 | [diff] [blame] | 769 | HIGHBD_SDSFP_WRAPPER(64, 16, 10) |
| 770 | HIGHBD_SDSFP_WRAPPER(32, 8, 10) |
| 771 | HIGHBD_SDSFP_WRAPPER(16, 64, 10) |
| 772 | HIGHBD_SDSFP_WRAPPER(8, 32, 10) |
| 773 | HIGHBD_SDSFP_WRAPPER(4, 16, 10) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 774 | #endif |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 775 | break; |
| 776 | |
| 777 | case AOM_BITS_12: |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 778 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 779 | HIGHBD_BFP_WRAPPER(64, 16, 12) |
| 780 | HIGHBD_BFP_WRAPPER(16, 64, 12) |
| 781 | HIGHBD_BFP_WRAPPER(32, 8, 12) |
| 782 | HIGHBD_BFP_WRAPPER(8, 32, 12) |
| 783 | HIGHBD_BFP_WRAPPER(16, 4, 12) |
| 784 | HIGHBD_BFP_WRAPPER(4, 16, 12) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 785 | #endif |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 786 | HIGHBD_BFP_WRAPPER(32, 16, 12) |
| 787 | HIGHBD_BFP_WRAPPER(16, 32, 12) |
| 788 | HIGHBD_BFP_WRAPPER(64, 32, 12) |
| 789 | HIGHBD_BFP_WRAPPER(32, 64, 12) |
| 790 | HIGHBD_BFP_WRAPPER(32, 32, 12) |
| 791 | HIGHBD_BFP_WRAPPER(64, 64, 12) |
| 792 | HIGHBD_BFP_WRAPPER(16, 16, 12) |
| 793 | HIGHBD_BFP_WRAPPER(16, 8, 12) |
| 794 | HIGHBD_BFP_WRAPPER(8, 16, 12) |
| 795 | HIGHBD_BFP_WRAPPER(8, 8, 12) |
| 796 | HIGHBD_BFP_WRAPPER(8, 4, 12) |
| 797 | HIGHBD_BFP_WRAPPER(4, 8, 12) |
| 798 | HIGHBD_BFP_WRAPPER(4, 4, 12) |
| 799 | HIGHBD_BFP_WRAPPER(128, 128, 12) |
| 800 | HIGHBD_BFP_WRAPPER(128, 64, 12) |
| 801 | HIGHBD_BFP_WRAPPER(64, 128, 12) |
| 802 | |
| 803 | HIGHBD_MBFP_WRAPPER(128, 128, 12) |
| 804 | HIGHBD_MBFP_WRAPPER(128, 64, 12) |
| 805 | HIGHBD_MBFP_WRAPPER(64, 128, 12) |
| 806 | HIGHBD_MBFP_WRAPPER(64, 64, 12) |
| 807 | HIGHBD_MBFP_WRAPPER(64, 32, 12) |
| 808 | HIGHBD_MBFP_WRAPPER(32, 64, 12) |
| 809 | HIGHBD_MBFP_WRAPPER(32, 32, 12) |
| 810 | HIGHBD_MBFP_WRAPPER(32, 16, 12) |
| 811 | HIGHBD_MBFP_WRAPPER(16, 32, 12) |
| 812 | HIGHBD_MBFP_WRAPPER(16, 16, 12) |
| 813 | HIGHBD_MBFP_WRAPPER(8, 16, 12) |
| 814 | HIGHBD_MBFP_WRAPPER(16, 8, 12) |
| 815 | HIGHBD_MBFP_WRAPPER(8, 8, 12) |
| 816 | HIGHBD_MBFP_WRAPPER(4, 8, 12) |
| 817 | HIGHBD_MBFP_WRAPPER(8, 4, 12) |
| 818 | HIGHBD_MBFP_WRAPPER(4, 4, 12) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 819 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 820 | HIGHBD_MBFP_WRAPPER(64, 16, 12) |
| 821 | HIGHBD_MBFP_WRAPPER(16, 64, 12) |
| 822 | HIGHBD_MBFP_WRAPPER(32, 8, 12) |
| 823 | HIGHBD_MBFP_WRAPPER(8, 32, 12) |
| 824 | HIGHBD_MBFP_WRAPPER(16, 4, 12) |
| 825 | HIGHBD_MBFP_WRAPPER(4, 16, 12) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 826 | #endif |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 827 | |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 828 | // OBMC excluded from realtime only build. |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 829 | #if !CONFIG_REALTIME_ONLY |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 830 | HIGHBD_OBFP_WRAPPER(128, 128, 12) |
| 831 | HIGHBD_OBFP_WRAPPER(128, 64, 12) |
| 832 | HIGHBD_OBFP_WRAPPER(64, 128, 12) |
| 833 | HIGHBD_OBFP_WRAPPER(64, 64, 12) |
| 834 | HIGHBD_OBFP_WRAPPER(64, 32, 12) |
| 835 | HIGHBD_OBFP_WRAPPER(32, 64, 12) |
| 836 | HIGHBD_OBFP_WRAPPER(32, 32, 12) |
| 837 | HIGHBD_OBFP_WRAPPER(32, 16, 12) |
| 838 | HIGHBD_OBFP_WRAPPER(16, 32, 12) |
| 839 | HIGHBD_OBFP_WRAPPER(16, 16, 12) |
| 840 | HIGHBD_OBFP_WRAPPER(8, 16, 12) |
| 841 | HIGHBD_OBFP_WRAPPER(16, 8, 12) |
| 842 | HIGHBD_OBFP_WRAPPER(8, 8, 12) |
| 843 | HIGHBD_OBFP_WRAPPER(4, 8, 12) |
| 844 | HIGHBD_OBFP_WRAPPER(8, 4, 12) |
| 845 | HIGHBD_OBFP_WRAPPER(4, 4, 12) |
| 846 | HIGHBD_OBFP_WRAPPER(64, 16, 12) |
| 847 | HIGHBD_OBFP_WRAPPER(16, 64, 12) |
| 848 | HIGHBD_OBFP_WRAPPER(32, 8, 12) |
| 849 | HIGHBD_OBFP_WRAPPER(8, 32, 12) |
| 850 | HIGHBD_OBFP_WRAPPER(16, 4, 12) |
| 851 | HIGHBD_OBFP_WRAPPER(4, 16, 12) |
Jerome Jiang | 4567c35 | 2020-10-29 13:10:31 -0700 | [diff] [blame] | 852 | #endif |
Aasaipriya C | da788c7 | 2020-09-17 13:40:55 +0530 | [diff] [blame] | 853 | |
James Zern | f2658a3 | 2022-02-09 10:18:38 -0800 | [diff] [blame] | 854 | HIGHBD_SDSFP_WRAPPER(128, 128, 12) |
| 855 | HIGHBD_SDSFP_WRAPPER(128, 64, 12) |
| 856 | HIGHBD_SDSFP_WRAPPER(64, 128, 12) |
| 857 | HIGHBD_SDSFP_WRAPPER(64, 64, 12) |
| 858 | HIGHBD_SDSFP_WRAPPER(64, 32, 12) |
| 859 | HIGHBD_SDSFP_WRAPPER(32, 64, 12) |
| 860 | HIGHBD_SDSFP_WRAPPER(32, 32, 12) |
| 861 | HIGHBD_SDSFP_WRAPPER(32, 16, 12) |
| 862 | HIGHBD_SDSFP_WRAPPER(16, 32, 12) |
| 863 | HIGHBD_SDSFP_WRAPPER(16, 16, 12) |
| 864 | HIGHBD_SDSFP_WRAPPER(16, 8, 12) |
| 865 | HIGHBD_SDSFP_WRAPPER(8, 16, 12) |
| 866 | HIGHBD_SDSFP_WRAPPER(8, 8, 12) |
| 867 | HIGHBD_SDSFP_WRAPPER(4, 8, 12) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 868 | |
| 869 | #if !CONFIG_REALTIME_ONLY |
James Zern | f2658a3 | 2022-02-09 10:18:38 -0800 | [diff] [blame] | 870 | HIGHBD_SDSFP_WRAPPER(64, 16, 12) |
| 871 | HIGHBD_SDSFP_WRAPPER(32, 8, 12) |
| 872 | HIGHBD_SDSFP_WRAPPER(16, 64, 12) |
| 873 | HIGHBD_SDSFP_WRAPPER(8, 32, 12) |
| 874 | HIGHBD_SDSFP_WRAPPER(4, 16, 12) |
Jerome Jiang | c381ba8 | 2020-10-30 14:55:57 -0700 | [diff] [blame] | 875 | #endif |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 876 | break; |
| 877 | |
| 878 | default: |
| 879 | assert(0 && |
Tarundeep Singh | 4243e62 | 2021-04-20 16:10:22 +0530 | [diff] [blame] | 880 | "cm->seq_params->bit_depth should be AOM_BITS_8, " |
Satish Kumar Suman | ee14de9 | 2020-06-12 15:42:05 +0530 | [diff] [blame] | 881 | "AOM_BITS_10 or AOM_BITS_12"); |
| 882 | } |
| 883 | } |
| 884 | } |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 885 | #endif // CONFIG_AV1_HIGHBITDEPTH |
| 886 | |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 887 | static AOM_INLINE void copy_frame_prob_info(AV1_COMP *cpi) { |
Aasaipriya | e2ac66e | 2021-07-06 17:38:12 +0530 | [diff] [blame] | 888 | FrameProbInfo *const frame_probs = &cpi->ppi->frame_probs; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 889 | if (cpi->sf.tx_sf.tx_type_search.prune_tx_type_using_stats) { |
| 890 | av1_copy(frame_probs->tx_type_probs, default_tx_type_probs); |
| 891 | } |
Akshata Jadhav | 26b751a | 2021-01-18 16:58:46 +0530 | [diff] [blame] | 892 | if (cpi->sf.inter_sf.prune_obmc_prob_thresh > 0 && |
| 893 | cpi->sf.inter_sf.prune_obmc_prob_thresh < INT_MAX) { |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 894 | av1_copy(frame_probs->obmc_probs, default_obmc_probs); |
| 895 | } |
| 896 | if (cpi->sf.inter_sf.prune_warped_prob_thresh > 0) { |
| 897 | av1_copy(frame_probs->warped_probs, default_warped_probs); |
| 898 | } |
| 899 | if (cpi->sf.interp_sf.adaptive_interp_filter_search == 2) { |
| 900 | av1_copy(frame_probs->switchable_interp_probs, |
| 901 | default_switchable_interp_probs); |
| 902 | } |
Remya Prakasan | 6566bc8 | 2021-11-05 23:21:12 +0530 | [diff] [blame] | 903 | |
Remya Prakasan | ffeb497 | 2022-06-21 20:00:28 +0530 | [diff] [blame] | 904 | #if CONFIG_FPMT_TEST |
Remya Prakasan | 6566bc8 | 2021-11-05 23:21:12 +0530 | [diff] [blame] | 905 | if (cpi->ppi->fpmt_unit_test_cfg == PARALLEL_SIMULATION_ENCODE) { |
| 906 | FrameProbInfo *const temp_frame_probs = &cpi->ppi->temp_frame_probs; |
| 907 | if (cpi->sf.tx_sf.tx_type_search.prune_tx_type_using_stats) { |
| 908 | av1_copy(temp_frame_probs->tx_type_probs, default_tx_type_probs); |
| 909 | } |
| 910 | if (cpi->sf.inter_sf.prune_obmc_prob_thresh > 0 && |
| 911 | cpi->sf.inter_sf.prune_obmc_prob_thresh < INT_MAX) { |
| 912 | av1_copy(temp_frame_probs->obmc_probs, default_obmc_probs); |
| 913 | } |
| 914 | if (cpi->sf.inter_sf.prune_warped_prob_thresh > 0) { |
| 915 | av1_copy(temp_frame_probs->warped_probs, default_warped_probs); |
| 916 | } |
| 917 | if (cpi->sf.interp_sf.adaptive_interp_filter_search == 2) { |
| 918 | av1_copy(temp_frame_probs->switchable_interp_probs, |
| 919 | default_switchable_interp_probs); |
| 920 | } |
| 921 | |
| 922 | FrameProbInfo *const temp_frame_probs_simulation = |
| 923 | &cpi->ppi->temp_frame_probs_simulation; |
| 924 | if (cpi->sf.tx_sf.tx_type_search.prune_tx_type_using_stats) { |
| 925 | av1_copy(temp_frame_probs_simulation->tx_type_probs, |
| 926 | default_tx_type_probs); |
| 927 | } |
| 928 | if (cpi->sf.inter_sf.prune_obmc_prob_thresh > 0 && |
| 929 | cpi->sf.inter_sf.prune_obmc_prob_thresh < INT_MAX) { |
| 930 | av1_copy(temp_frame_probs_simulation->obmc_probs, default_obmc_probs); |
| 931 | } |
| 932 | if (cpi->sf.inter_sf.prune_warped_prob_thresh > 0) { |
| 933 | av1_copy(temp_frame_probs_simulation->warped_probs, default_warped_probs); |
| 934 | } |
| 935 | if (cpi->sf.interp_sf.adaptive_interp_filter_search == 2) { |
| 936 | av1_copy(temp_frame_probs_simulation->switchable_interp_probs, |
| 937 | default_switchable_interp_probs); |
| 938 | } |
| 939 | } |
| 940 | #endif |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 941 | } |
| 942 | |
Vishnu Teja Manyam | 1d17bfe | 2021-03-10 18:23:29 +0530 | [diff] [blame] | 943 | static AOM_INLINE void restore_cdef_coding_context(CdefInfo *const dst, |
| 944 | const CdefInfo *const src) { |
| 945 | dst->cdef_bits = src->cdef_bits; |
| 946 | dst->cdef_damping = src->cdef_damping; |
| 947 | av1_copy(dst->cdef_strengths, src->cdef_strengths); |
| 948 | av1_copy(dst->cdef_uv_strengths, src->cdef_uv_strengths); |
| 949 | dst->nb_cdef_strengths = src->nb_cdef_strengths; |
| 950 | } |
| 951 | |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 952 | // Coding context that only needs to be restored when recode loop includes |
| 953 | // filtering (deblocking, CDEF, superres post-encode upscale and/or loop |
| 954 | // restoraton). |
| 955 | static AOM_INLINE void restore_extra_coding_context(AV1_COMP *cpi) { |
| 956 | CODING_CONTEXT *const cc = &cpi->coding_context; |
| 957 | AV1_COMMON *cm = &cpi->common; |
| 958 | cm->lf = cc->lf; |
Vishnu Teja Manyam | 1d17bfe | 2021-03-10 18:23:29 +0530 | [diff] [blame] | 959 | restore_cdef_coding_context(&cm->cdef_info, &cc->cdef_info); |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 960 | cpi->rc = cc->rc; |
Aasaipriya Chandran | be8ccad | 2021-05-25 20:37:01 +0530 | [diff] [blame] | 961 | cpi->ppi->mv_stats = cc->mv_stats; |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 962 | } |
| 963 | |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 964 | static AOM_INLINE int equal_dimensions_and_border(const YV12_BUFFER_CONFIG *a, |
| 965 | const YV12_BUFFER_CONFIG *b) { |
| 966 | return a->y_height == b->y_height && a->y_width == b->y_width && |
| 967 | a->uv_height == b->uv_height && a->uv_width == b->uv_width && |
| 968 | a->y_stride == b->y_stride && a->uv_stride == b->uv_stride && |
| 969 | a->border == b->border && |
| 970 | (a->flags & YV12_FLAG_HIGHBITDEPTH) == |
| 971 | (b->flags & YV12_FLAG_HIGHBITDEPTH); |
| 972 | } |
| 973 | |
Satish Kumar Suman | 329de4d | 2020-06-16 10:48:32 +0530 | [diff] [blame] | 974 | static AOM_INLINE int update_entropy(bool *ext_refresh_frame_context, |
| 975 | bool *ext_refresh_frame_context_pending, |
| 976 | bool update) { |
| 977 | *ext_refresh_frame_context = update; |
| 978 | *ext_refresh_frame_context_pending = 1; |
| 979 | return 0; |
| 980 | } |
| 981 | |
| 982 | #if !CONFIG_REALTIME_ONLY |
| 983 | static AOM_INLINE int combine_prior_with_tpl_boost(double min_factor, |
| 984 | double max_factor, |
| 985 | int prior_boost, |
| 986 | int tpl_boost, |
| 987 | int frames_to_key) { |
| 988 | double factor = sqrt((double)frames_to_key); |
| 989 | double range = max_factor - min_factor; |
| 990 | factor = AOMMIN(factor, max_factor); |
| 991 | factor = AOMMAX(factor, min_factor); |
| 992 | factor -= min_factor; |
| 993 | int boost = |
| 994 | (int)((factor * prior_boost + (range - factor) * tpl_boost) / range); |
| 995 | return boost; |
| 996 | } |
| 997 | #endif |
| 998 | |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 999 | static AOM_INLINE void set_size_independent_vars(AV1_COMP *cpi) { |
| 1000 | int i; |
| 1001 | AV1_COMMON *const cm = &cpi->common; |
Ranjit Kumar Tulabandu | 19b1f44 | 2022-09-07 17:14:54 +0530 | [diff] [blame] | 1002 | FeatureFlags *const features = &cm->features; |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1003 | for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) { |
| 1004 | cm->global_motion[i] = default_warp_params; |
| 1005 | } |
| 1006 | cpi->gm_info.search_done = 0; |
| 1007 | |
| 1008 | av1_set_speed_features_framesize_independent(cpi, cpi->speed); |
| 1009 | av1_set_rd_speed_thresholds(cpi); |
Ranjit Kumar Tulabandu | 19b1f44 | 2022-09-07 17:14:54 +0530 | [diff] [blame] | 1010 | features->interp_filter = SWITCHABLE; |
| 1011 | features->switchable_motion_mode = is_switchable_motion_mode_allowed( |
| 1012 | features->allow_warped_motion, cpi->oxcf.motion_mode_cfg.enable_obmc); |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1013 | } |
| 1014 | |
| 1015 | static AOM_INLINE void release_scaled_references(AV1_COMP *cpi) { |
| 1016 | // TODO(isbs): only refresh the necessary frames, rather than all of them |
| 1017 | for (int i = 0; i < INTER_REFS_PER_FRAME; ++i) { |
| 1018 | RefCntBuffer *const buf = cpi->scaled_ref_buf[i]; |
| 1019 | if (buf != NULL) { |
| 1020 | --buf->ref_count; |
| 1021 | cpi->scaled_ref_buf[i] = NULL; |
| 1022 | } |
| 1023 | } |
| 1024 | } |
| 1025 | |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1026 | static AOM_INLINE void restore_all_coding_context(AV1_COMP *cpi) { |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1027 | restore_extra_coding_context(cpi); |
| 1028 | if (!frame_is_intra_only(&cpi->common)) release_scaled_references(cpi); |
| 1029 | } |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1030 | |
Deepa K G | 10058f6 | 2022-07-15 13:36:44 +0530 | [diff] [blame] | 1031 | static AOM_INLINE int reduce_num_ref_buffers(const AV1_COMP *cpi) { |
| 1032 | const SequenceHeader *const seq_params = cpi->common.seq_params; |
| 1033 | return is_one_pass_rt_params(cpi) && |
Marco Paniconi | 1a3a74a | 2022-08-28 22:26:48 -0700 | [diff] [blame] | 1034 | use_rtc_reference_structure_one_layer(cpi) && |
Deepa K G | 10058f6 | 2022-07-15 13:36:44 +0530 | [diff] [blame] | 1035 | (seq_params->order_hint_info.enable_order_hint == 0) && |
| 1036 | cpi->rt_reduce_num_ref_buffers; |
| 1037 | } |
| 1038 | |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1039 | // Refresh reference frame buffers according to refresh_frame_flags. |
| 1040 | static AOM_INLINE void refresh_reference_frames(AV1_COMP *cpi) { |
| 1041 | AV1_COMMON *const cm = &cpi->common; |
| 1042 | // All buffers are refreshed for shown keyframes and S-frames. |
Deepa K G | 10058f6 | 2022-07-15 13:36:44 +0530 | [diff] [blame] | 1043 | // In case of RT, golden frame refreshes the 6th slot and other reference |
| 1044 | // frames refresh slots 0 to 5. Slot 7 is not refreshed by any reference |
| 1045 | // frame. Thus, only 7 buffers are refreshed for keyframes and S-frames |
| 1046 | // instead of 8. |
| 1047 | int num_ref_buffers = REF_FRAMES; |
| 1048 | if (reduce_num_ref_buffers(cpi)) { |
| 1049 | const int refresh_all_bufs = |
| 1050 | (cpi->ppi->gf_group.refbuf_state[cpi->gf_frame_index] == REFBUF_RESET || |
| 1051 | frame_is_sframe(cm)); |
| 1052 | assert(IMPLIES(((cm->current_frame.refresh_frame_flags >> 7) & 1) == 1, |
| 1053 | refresh_all_bufs)); |
| 1054 | (void)refresh_all_bufs; |
| 1055 | num_ref_buffers--; |
| 1056 | } |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1057 | |
Deepa K G | 10058f6 | 2022-07-15 13:36:44 +0530 | [diff] [blame] | 1058 | for (int ref_frame = 0; ref_frame < num_ref_buffers; ref_frame++) { |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1059 | if (((cm->current_frame.refresh_frame_flags >> ref_frame) & 1) == 1) { |
| 1060 | assign_frame_buffer_p(&cm->ref_frame_map[ref_frame], cm->cur_frame); |
| 1061 | } |
| 1062 | } |
| 1063 | } |
| 1064 | |
Tarundeep Singh | 9e77b30 | 2021-03-19 16:07:48 +0530 | [diff] [blame] | 1065 | void av1_update_film_grain_parameters_seq(struct AV1_PRIMARY *ppi, |
| 1066 | const AV1EncoderConfig *oxcf); |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1067 | void av1_update_film_grain_parameters(struct AV1_COMP *cpi, |
| 1068 | const AV1EncoderConfig *oxcf); |
| 1069 | |
| 1070 | void av1_scale_references(AV1_COMP *cpi, const InterpFilter filter, |
| 1071 | const int phase, const int use_optimized_scaler); |
| 1072 | |
| 1073 | void av1_setup_frame(AV1_COMP *cpi); |
| 1074 | |
Tarundeep Singh | 4912869 | 2021-04-07 12:37:21 +0530 | [diff] [blame] | 1075 | BLOCK_SIZE av1_select_sb_size(const AV1EncoderConfig *const oxcf, int width, |
| 1076 | int height, int number_spatial_layers); |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1077 | |
| 1078 | void av1_apply_active_map(AV1_COMP *cpi); |
| 1079 | |
| 1080 | #if !CONFIG_REALTIME_ONLY |
| 1081 | uint16_t av1_setup_interp_filter_search_mask(AV1_COMP *cpi); |
| 1082 | |
| 1083 | void av1_determine_sc_tools_with_encoding(AV1_COMP *cpi, const int q_orig); |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1084 | #endif |
| 1085 | |
| 1086 | void av1_set_size_dependent_vars(AV1_COMP *cpi, int *q, int *bottom_index, |
| 1087 | int *top_index); |
| 1088 | |
| 1089 | void av1_finalize_encoded_frame(AV1_COMP *const cpi); |
| 1090 | |
| 1091 | int av1_is_integer_mv(const YV12_BUFFER_CONFIG *cur_picture, |
| 1092 | const YV12_BUFFER_CONFIG *last_picture, |
| 1093 | ForceIntegerMVInfo *const force_intpel_info); |
| 1094 | |
| 1095 | void av1_set_mb_ssim_rdmult_scaling(AV1_COMP *cpi); |
| 1096 | |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1097 | void av1_save_all_coding_context(AV1_COMP *cpi); |
Jayasanker J | dee179d | 2020-07-10 23:47:37 +0530 | [diff] [blame] | 1098 | |
| 1099 | #if DUMP_RECON_FRAMES == 1 |
| 1100 | void av1_dump_filtered_recon_frames(AV1_COMP *cpi); |
| 1101 | #endif |
| 1102 | |
chiyotsai | b6daca7 | 2022-05-25 11:01:09 -0700 | [diff] [blame] | 1103 | static AOM_INLINE int av1_get_enc_border_size(bool resize, bool all_intra, |
| 1104 | BLOCK_SIZE sb_size) { |
| 1105 | // For allintra encoding mode, inter-frame motion search is not applicable and |
| 1106 | // the intraBC motion vectors are restricted within the tile boundaries. Hence |
| 1107 | // a smaller frame border size (AOM_ENC_ALLINTRA_BORDER) is used in this case. |
| 1108 | if (resize) { |
| 1109 | return AOM_BORDER_IN_PIXELS; |
chiyotsai | b6daca7 | 2022-05-25 11:01:09 -0700 | [diff] [blame] | 1110 | } |
Wan-Teh Chang | ba460b4 | 2022-06-23 11:43:40 -0700 | [diff] [blame] | 1111 | if (all_intra) { |
| 1112 | return AOM_ENC_ALLINTRA_BORDER; |
| 1113 | } |
| 1114 | return block_size_wide[sb_size] + 32; |
chiyotsai | b6daca7 | 2022-05-25 11:01:09 -0700 | [diff] [blame] | 1115 | } |
| 1116 | |
| 1117 | static AOM_INLINE bool av1_is_resize_needed(const AV1EncoderConfig *oxcf) { |
| 1118 | const ResizeCfg *resize_cfg = &oxcf->resize_cfg; |
| 1119 | const SuperResCfg *superres_cfg = &oxcf->superres_cfg; |
| 1120 | return resize_cfg->resize_mode || superres_cfg->superres_mode; |
| 1121 | } |
| 1122 | |
Satish Kumar Suman | 897b794 | 2020-06-11 11:44:29 +0530 | [diff] [blame] | 1123 | #ifdef __cplusplus |
| 1124 | } // extern "C" |
| 1125 | #endif |
| 1126 | |
| 1127 | #endif // AOM_AV1_ENCODER_ENCODER_UTILS_H_ |