1 /* 2 * Copyright (c) 2022, 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_MCOMP_STRUCTS_H_ 13 #define AOM_AV1_ENCODER_MCOMP_STRUCTS_H_ 14 15 #include "av1/common/mv.h" 16 17 // The maximum number of steps in a step search given the largest 18 // allowed initial step 19 #define MAX_MVSEARCH_STEPS 11 20 // Max full pel mv specified in the unit of full pixel 21 // Enable the use of motion vector in range [-1023, 1023]. 22 #define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS - 1)) - 1) 23 // Maximum size of the first step in full pel units 24 #define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS - 1)) 25 26 #define SEARCH_RANGE_8P 3 27 #define SEARCH_GRID_STRIDE_8P (2 * SEARCH_RANGE_8P + 1) 28 #define SEARCH_GRID_CENTER_8P \ 29 (SEARCH_RANGE_8P * SEARCH_GRID_STRIDE_8P + SEARCH_RANGE_8P) 30 31 typedef struct { 32 FULLPEL_MV coord; 33 int coord_offset; 34 } search_neighbors; 35 // motion search site 36 typedef struct search_site { 37 FULLPEL_MV mv; 38 int offset; 39 } search_site; 40 41 typedef struct search_site_config { 42 search_site site[MAX_MVSEARCH_STEPS * 2][16 + 1]; 43 // Number of search steps. 44 int num_search_steps; 45 int searches_per_step[MAX_MVSEARCH_STEPS * 2]; 46 int radius[MAX_MVSEARCH_STEPS * 2]; 47 int stride; 48 } search_site_config; 49 50 enum { 51 // Search 8-points in the radius grid around center, up to 11 search stages. 52 DIAMOND = 0, 53 // Search 12-points in the radius/tan_radius grid around center, 54 // up to 15 search stages. 55 NSTEP = 1, 56 // Search 8-points in the radius grid around center, up to 16 search stages. 57 NSTEP_8PT = 2, 58 // Search 8-points in the radius grid around center, upto 11 search stages 59 // with clamping of search radius. 60 CLAMPED_DIAMOND = 3, 61 // Search maximum 8-points in the radius grid around center, 62 // up to 11 search stages. First stage consists of 8 search points 63 // and the rest with 6 search points each in hex shape. 64 HEX = 4, 65 // Search maximum 8-points in the radius grid around center, 66 // up to 11 search stages. First stage consists of 4 search 67 // points and the rest with 8 search points each. 68 BIGDIA = 5, 69 // Search 8-points in the square grid around center, up to 11 search stages. 70 SQUARE = 6, 71 // HEX search with up to 2 stages. 72 FAST_HEX = 7, 73 // BIGDIA search with up to 2 stages. 74 FAST_DIAMOND = 8, 75 // BIGDIA search with up to 3 stages. 76 FAST_BIGDIA = 9, 77 // BIGDIA search with up to 1 stage. 78 VFAST_DIAMOND = 10, 79 // Total number of search methods. 80 NUM_SEARCH_METHODS, 81 // Number of distinct search methods. 82 NUM_DISTINCT_SEARCH_METHODS = SQUARE + 1, 83 } UENUM1BYTE(SEARCH_METHODS); 84 85 #endif // AOM_AV1_ENCODER_MCOMP_STRUCTS_H_ 86