1*77c1e3ccSAndroid Build Coastguard Worker /* 2*77c1e3ccSAndroid Build Coastguard Worker * Copyright (c) 2016, Alliance for Open Media. All rights reserved. 3*77c1e3ccSAndroid Build Coastguard Worker * 4*77c1e3ccSAndroid Build Coastguard Worker * This source code is subject to the terms of the BSD 2 Clause License and 5*77c1e3ccSAndroid Build Coastguard Worker * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6*77c1e3ccSAndroid Build Coastguard Worker * was not distributed with this source code in the LICENSE file, you can 7*77c1e3ccSAndroid Build Coastguard Worker * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8*77c1e3ccSAndroid Build Coastguard Worker * Media Patent License 1.0 was not distributed with this source code in the 9*77c1e3ccSAndroid Build Coastguard Worker * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10*77c1e3ccSAndroid Build Coastguard Worker */ 11*77c1e3ccSAndroid Build Coastguard Worker 12*77c1e3ccSAndroid Build Coastguard Worker #ifndef AOM_AV1_ENCODER_SPEED_FEATURES_H_ 13*77c1e3ccSAndroid Build Coastguard Worker #define AOM_AV1_ENCODER_SPEED_FEATURES_H_ 14*77c1e3ccSAndroid Build Coastguard Worker 15*77c1e3ccSAndroid Build Coastguard Worker #include "av1/common/enums.h" 16*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/enc_enums.h" 17*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/mcomp.h" 18*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/encodemb.h" 19*77c1e3ccSAndroid Build Coastguard Worker 20*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus 21*77c1e3ccSAndroid Build Coastguard Worker extern "C" { 22*77c1e3ccSAndroid Build Coastguard Worker #endif 23*77c1e3ccSAndroid Build Coastguard Worker 24*77c1e3ccSAndroid Build Coastguard Worker /*! @file */ 25*77c1e3ccSAndroid Build Coastguard Worker 26*77c1e3ccSAndroid Build Coastguard Worker /*!\cond */ 27*77c1e3ccSAndroid Build Coastguard Worker #define MAX_MESH_STEP 4 28*77c1e3ccSAndroid Build Coastguard Worker 29*77c1e3ccSAndroid Build Coastguard Worker typedef struct MESH_PATTERN { 30*77c1e3ccSAndroid Build Coastguard Worker int range; 31*77c1e3ccSAndroid Build Coastguard Worker int interval; 32*77c1e3ccSAndroid Build Coastguard Worker } MESH_PATTERN; 33*77c1e3ccSAndroid Build Coastguard Worker 34*77c1e3ccSAndroid Build Coastguard Worker enum { 35*77c1e3ccSAndroid Build Coastguard Worker GM_FULL_SEARCH, 36*77c1e3ccSAndroid Build Coastguard Worker GM_REDUCED_REF_SEARCH_SKIP_L2_L3, 37*77c1e3ccSAndroid Build Coastguard Worker GM_REDUCED_REF_SEARCH_SKIP_L2_L3_ARF2, 38*77c1e3ccSAndroid Build Coastguard Worker 39*77c1e3ccSAndroid Build Coastguard Worker // Same as GM_REDUCED_REF_SEARCH_SKIP_L2_L3_ARF2 but with extra filtering 40*77c1e3ccSAndroid Build Coastguard Worker // to keep at most two ref frames 41*77c1e3ccSAndroid Build Coastguard Worker GM_SEARCH_CLOSEST_REFS_ONLY, 42*77c1e3ccSAndroid Build Coastguard Worker 43*77c1e3ccSAndroid Build Coastguard Worker GM_DISABLE_SEARCH 44*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(GM_SEARCH_TYPE); 45*77c1e3ccSAndroid Build Coastguard Worker 46*77c1e3ccSAndroid Build Coastguard Worker enum { 47*77c1e3ccSAndroid Build Coastguard Worker DIST_WTD_COMP_ENABLED, 48*77c1e3ccSAndroid Build Coastguard Worker DIST_WTD_COMP_SKIP_MV_SEARCH, 49*77c1e3ccSAndroid Build Coastguard Worker DIST_WTD_COMP_DISABLED, 50*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(DIST_WTD_COMP_FLAG); 51*77c1e3ccSAndroid Build Coastguard Worker 52*77c1e3ccSAndroid Build Coastguard Worker enum { 53*77c1e3ccSAndroid Build Coastguard Worker INTRA_ALL = (1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED) | (1 << D45_PRED) | 54*77c1e3ccSAndroid Build Coastguard Worker (1 << D135_PRED) | (1 << D113_PRED) | (1 << D157_PRED) | 55*77c1e3ccSAndroid Build Coastguard Worker (1 << D203_PRED) | (1 << D67_PRED) | (1 << SMOOTH_PRED) | 56*77c1e3ccSAndroid Build Coastguard Worker (1 << SMOOTH_V_PRED) | (1 << SMOOTH_H_PRED) | (1 << PAETH_PRED), 57*77c1e3ccSAndroid Build Coastguard Worker UV_INTRA_ALL = 58*77c1e3ccSAndroid Build Coastguard Worker (1 << UV_DC_PRED) | (1 << UV_V_PRED) | (1 << UV_H_PRED) | 59*77c1e3ccSAndroid Build Coastguard Worker (1 << UV_D45_PRED) | (1 << UV_D135_PRED) | (1 << UV_D113_PRED) | 60*77c1e3ccSAndroid Build Coastguard Worker (1 << UV_D157_PRED) | (1 << UV_D203_PRED) | (1 << UV_D67_PRED) | 61*77c1e3ccSAndroid Build Coastguard Worker (1 << UV_SMOOTH_PRED) | (1 << UV_SMOOTH_V_PRED) | 62*77c1e3ccSAndroid Build Coastguard Worker (1 << UV_SMOOTH_H_PRED) | (1 << UV_PAETH_PRED) | (1 << UV_CFL_PRED), 63*77c1e3ccSAndroid Build Coastguard Worker UV_INTRA_DC = (1 << UV_DC_PRED), 64*77c1e3ccSAndroid Build Coastguard Worker UV_INTRA_DC_CFL = (1 << UV_DC_PRED) | (1 << UV_CFL_PRED), 65*77c1e3ccSAndroid Build Coastguard Worker UV_INTRA_DC_TM = (1 << UV_DC_PRED) | (1 << UV_PAETH_PRED), 66*77c1e3ccSAndroid Build Coastguard Worker UV_INTRA_DC_PAETH_CFL = 67*77c1e3ccSAndroid Build Coastguard Worker (1 << UV_DC_PRED) | (1 << UV_PAETH_PRED) | (1 << UV_CFL_PRED), 68*77c1e3ccSAndroid Build Coastguard Worker UV_INTRA_DC_H_V = (1 << UV_DC_PRED) | (1 << UV_V_PRED) | (1 << UV_H_PRED), 69*77c1e3ccSAndroid Build Coastguard Worker UV_INTRA_DC_H_V_CFL = (1 << UV_DC_PRED) | (1 << UV_V_PRED) | 70*77c1e3ccSAndroid Build Coastguard Worker (1 << UV_H_PRED) | (1 << UV_CFL_PRED), 71*77c1e3ccSAndroid Build Coastguard Worker UV_INTRA_DC_PAETH_H_V = (1 << UV_DC_PRED) | (1 << UV_PAETH_PRED) | 72*77c1e3ccSAndroid Build Coastguard Worker (1 << UV_V_PRED) | (1 << UV_H_PRED), 73*77c1e3ccSAndroid Build Coastguard Worker UV_INTRA_DC_PAETH_H_V_CFL = (1 << UV_DC_PRED) | (1 << UV_PAETH_PRED) | 74*77c1e3ccSAndroid Build Coastguard Worker (1 << UV_V_PRED) | (1 << UV_H_PRED) | 75*77c1e3ccSAndroid Build Coastguard Worker (1 << UV_CFL_PRED), 76*77c1e3ccSAndroid Build Coastguard Worker INTRA_DC = (1 << DC_PRED), 77*77c1e3ccSAndroid Build Coastguard Worker INTRA_DC_TM = (1 << DC_PRED) | (1 << PAETH_PRED), 78*77c1e3ccSAndroid Build Coastguard Worker INTRA_DC_H_V = (1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED), 79*77c1e3ccSAndroid Build Coastguard Worker INTRA_DC_H_V_SMOOTH = 80*77c1e3ccSAndroid Build Coastguard Worker (1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED) | (1 << SMOOTH_PRED), 81*77c1e3ccSAndroid Build Coastguard Worker INTRA_DC_PAETH_H_V = 82*77c1e3ccSAndroid Build Coastguard Worker (1 << DC_PRED) | (1 << PAETH_PRED) | (1 << V_PRED) | (1 << H_PRED) 83*77c1e3ccSAndroid Build Coastguard Worker }; 84*77c1e3ccSAndroid Build Coastguard Worker 85*77c1e3ccSAndroid Build Coastguard Worker enum { 86*77c1e3ccSAndroid Build Coastguard Worker INTER_ALL = (1 << NEARESTMV) | (1 << NEARMV) | (1 << GLOBALMV) | 87*77c1e3ccSAndroid Build Coastguard Worker (1 << NEWMV) | (1 << NEAREST_NEARESTMV) | (1 << NEAR_NEARMV) | 88*77c1e3ccSAndroid Build Coastguard Worker (1 << NEW_NEWMV) | (1 << NEAREST_NEWMV) | (1 << NEAR_NEWMV) | 89*77c1e3ccSAndroid Build Coastguard Worker (1 << NEW_NEARMV) | (1 << NEW_NEARESTMV) | (1 << GLOBAL_GLOBALMV), 90*77c1e3ccSAndroid Build Coastguard Worker INTER_NEAREST_NEAR_ZERO = (1 << NEARESTMV) | (1 << NEARMV) | (1 << GLOBALMV) | 91*77c1e3ccSAndroid Build Coastguard Worker (1 << NEAREST_NEARESTMV) | (1 << GLOBAL_GLOBALMV) | 92*77c1e3ccSAndroid Build Coastguard Worker (1 << NEAREST_NEWMV) | (1 << NEW_NEARESTMV) | 93*77c1e3ccSAndroid Build Coastguard Worker (1 << NEW_NEARMV) | (1 << NEAR_NEWMV) | 94*77c1e3ccSAndroid Build Coastguard Worker (1 << NEAR_NEARMV), 95*77c1e3ccSAndroid Build Coastguard Worker INTER_SINGLE_ALL = 96*77c1e3ccSAndroid Build Coastguard Worker (1 << NEARESTMV) | (1 << NEARMV) | (1 << GLOBALMV) | (1 << NEWMV), 97*77c1e3ccSAndroid Build Coastguard Worker }; 98*77c1e3ccSAndroid Build Coastguard Worker 99*77c1e3ccSAndroid Build Coastguard Worker enum { 100*77c1e3ccSAndroid Build Coastguard Worker DISABLE_ALL_INTER_SPLIT = (1 << THR_COMP_GA) | (1 << THR_COMP_LA) | 101*77c1e3ccSAndroid Build Coastguard Worker (1 << THR_ALTR) | (1 << THR_GOLD) | (1 << THR_LAST), 102*77c1e3ccSAndroid Build Coastguard Worker 103*77c1e3ccSAndroid Build Coastguard Worker DISABLE_ALL_SPLIT = (1 << THR_INTRA) | DISABLE_ALL_INTER_SPLIT, 104*77c1e3ccSAndroid Build Coastguard Worker 105*77c1e3ccSAndroid Build Coastguard Worker DISABLE_COMPOUND_SPLIT = (1 << THR_COMP_GA) | (1 << THR_COMP_LA), 106*77c1e3ccSAndroid Build Coastguard Worker 107*77c1e3ccSAndroid Build Coastguard Worker LAST_AND_INTRA_SPLIT_ONLY = (1 << THR_COMP_GA) | (1 << THR_COMP_LA) | 108*77c1e3ccSAndroid Build Coastguard Worker (1 << THR_ALTR) | (1 << THR_GOLD) 109*77c1e3ccSAndroid Build Coastguard Worker }; 110*77c1e3ccSAndroid Build Coastguard Worker 111*77c1e3ccSAndroid Build Coastguard Worker enum { 112*77c1e3ccSAndroid Build Coastguard Worker TXFM_CODING_SF = 1, 113*77c1e3ccSAndroid Build Coastguard Worker INTER_PRED_SF = 2, 114*77c1e3ccSAndroid Build Coastguard Worker INTRA_PRED_SF = 4, 115*77c1e3ccSAndroid Build Coastguard Worker PARTITION_SF = 8, 116*77c1e3ccSAndroid Build Coastguard Worker LOOP_FILTER_SF = 16, 117*77c1e3ccSAndroid Build Coastguard Worker RD_SKIP_SF = 32, 118*77c1e3ccSAndroid Build Coastguard Worker RESERVE_2_SF = 64, 119*77c1e3ccSAndroid Build Coastguard Worker RESERVE_3_SF = 128, 120*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(DEV_SPEED_FEATURES); 121*77c1e3ccSAndroid Build Coastguard Worker 122*77c1e3ccSAndroid Build Coastguard Worker /* This enumeration defines when the rate control recode loop will be 123*77c1e3ccSAndroid Build Coastguard Worker * enabled. 124*77c1e3ccSAndroid Build Coastguard Worker */ 125*77c1e3ccSAndroid Build Coastguard Worker enum { 126*77c1e3ccSAndroid Build Coastguard Worker /* 127*77c1e3ccSAndroid Build Coastguard Worker * No recodes allowed 128*77c1e3ccSAndroid Build Coastguard Worker */ 129*77c1e3ccSAndroid Build Coastguard Worker DISALLOW_RECODE = 0, 130*77c1e3ccSAndroid Build Coastguard Worker /* 131*77c1e3ccSAndroid Build Coastguard Worker * Allow recode only for KF/ARF/GF frames 132*77c1e3ccSAndroid Build Coastguard Worker */ 133*77c1e3ccSAndroid Build Coastguard Worker ALLOW_RECODE_KFARFGF = 1, 134*77c1e3ccSAndroid Build Coastguard Worker /* 135*77c1e3ccSAndroid Build Coastguard Worker * Allow recode for all frame types based on bitrate constraints. 136*77c1e3ccSAndroid Build Coastguard Worker */ 137*77c1e3ccSAndroid Build Coastguard Worker ALLOW_RECODE = 2, 138*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(RECODE_LOOP_TYPE); 139*77c1e3ccSAndroid Build Coastguard Worker 140*77c1e3ccSAndroid Build Coastguard Worker enum { 141*77c1e3ccSAndroid Build Coastguard Worker SUBPEL_TREE = 0, 142*77c1e3ccSAndroid Build Coastguard Worker SUBPEL_TREE_PRUNED = 1, // Prunes 1/2-pel searches 143*77c1e3ccSAndroid Build Coastguard Worker SUBPEL_TREE_PRUNED_MORE = 2, // Prunes 1/2-pel searches more aggressively 144*77c1e3ccSAndroid Build Coastguard Worker SUBPEL_SEARCH_METHODS 145*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(SUBPEL_SEARCH_METHOD); 146*77c1e3ccSAndroid Build Coastguard Worker 147*77c1e3ccSAndroid Build Coastguard Worker enum { 148*77c1e3ccSAndroid Build Coastguard Worker // Try the full image with different values. 149*77c1e3ccSAndroid Build Coastguard Worker LPF_PICK_FROM_FULL_IMAGE, 150*77c1e3ccSAndroid Build Coastguard Worker // Try the full image filter search with non-dual filter only. 151*77c1e3ccSAndroid Build Coastguard Worker LPF_PICK_FROM_FULL_IMAGE_NON_DUAL, 152*77c1e3ccSAndroid Build Coastguard Worker // Try a small portion of the image with different values. 153*77c1e3ccSAndroid Build Coastguard Worker LPF_PICK_FROM_SUBIMAGE, 154*77c1e3ccSAndroid Build Coastguard Worker // Estimate the level based on quantizer and frame type 155*77c1e3ccSAndroid Build Coastguard Worker LPF_PICK_FROM_Q, 156*77c1e3ccSAndroid Build Coastguard Worker // Pick 0 to disable LPF if LPF was enabled last frame 157*77c1e3ccSAndroid Build Coastguard Worker LPF_PICK_MINIMAL_LPF 158*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(LPF_PICK_METHOD); 159*77c1e3ccSAndroid Build Coastguard Worker /*!\endcond */ 160*77c1e3ccSAndroid Build Coastguard Worker 161*77c1e3ccSAndroid Build Coastguard Worker /*!\enum CDEF_PICK_METHOD 162*77c1e3ccSAndroid Build Coastguard Worker * \brief This enumeration defines a variety of CDEF pick methods 163*77c1e3ccSAndroid Build Coastguard Worker */ 164*77c1e3ccSAndroid Build Coastguard Worker typedef enum { 165*77c1e3ccSAndroid Build Coastguard Worker CDEF_FULL_SEARCH, /**< Full search */ 166*77c1e3ccSAndroid Build Coastguard Worker CDEF_FAST_SEARCH_LVL1, /**< Search among a subset of all possible filters. */ 167*77c1e3ccSAndroid Build Coastguard Worker CDEF_FAST_SEARCH_LVL2, /**< Search reduced subset of filters than Level 1. */ 168*77c1e3ccSAndroid Build Coastguard Worker CDEF_FAST_SEARCH_LVL3, /**< Search reduced subset of secondary filters than 169*77c1e3ccSAndroid Build Coastguard Worker Level 2. */ 170*77c1e3ccSAndroid Build Coastguard Worker CDEF_FAST_SEARCH_LVL4, /**< Search reduced subset of filters than Level 3. */ 171*77c1e3ccSAndroid Build Coastguard Worker CDEF_FAST_SEARCH_LVL5, /**< Search reduced subset of filters than Level 4. */ 172*77c1e3ccSAndroid Build Coastguard Worker CDEF_PICK_FROM_Q, /**< Estimate filter strength based on quantizer. */ 173*77c1e3ccSAndroid Build Coastguard Worker CDEF_PICK_METHODS 174*77c1e3ccSAndroid Build Coastguard Worker } CDEF_PICK_METHOD; 175*77c1e3ccSAndroid Build Coastguard Worker 176*77c1e3ccSAndroid Build Coastguard Worker /*!\cond */ 177*77c1e3ccSAndroid Build Coastguard Worker enum { 178*77c1e3ccSAndroid Build Coastguard Worker // Terminate search early based on distortion so far compared to 179*77c1e3ccSAndroid Build Coastguard Worker // qp step, distortion in the neighborhood of the frame, etc. 180*77c1e3ccSAndroid Build Coastguard Worker FLAG_EARLY_TERMINATE = 1 << 0, 181*77c1e3ccSAndroid Build Coastguard Worker 182*77c1e3ccSAndroid Build Coastguard Worker // Skips comp inter modes if the best so far is an intra mode. 183*77c1e3ccSAndroid Build Coastguard Worker FLAG_SKIP_COMP_BESTINTRA = 1 << 1, 184*77c1e3ccSAndroid Build Coastguard Worker 185*77c1e3ccSAndroid Build Coastguard Worker // Skips oblique intra modes if the best so far is an inter mode. 186*77c1e3ccSAndroid Build Coastguard Worker FLAG_SKIP_INTRA_BESTINTER = 1 << 3, 187*77c1e3ccSAndroid Build Coastguard Worker 188*77c1e3ccSAndroid Build Coastguard Worker // Skips oblique intra modes at angles 27, 63, 117, 153 if the best 189*77c1e3ccSAndroid Build Coastguard Worker // intra so far is not one of the neighboring directions. 190*77c1e3ccSAndroid Build Coastguard Worker FLAG_SKIP_INTRA_DIRMISMATCH = 1 << 4, 191*77c1e3ccSAndroid Build Coastguard Worker 192*77c1e3ccSAndroid Build Coastguard Worker // Skips intra modes other than DC_PRED if the source variance is small 193*77c1e3ccSAndroid Build Coastguard Worker FLAG_SKIP_INTRA_LOWVAR = 1 << 5, 194*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(MODE_SEARCH_SKIP_LOGIC); 195*77c1e3ccSAndroid Build Coastguard Worker 196*77c1e3ccSAndroid Build Coastguard Worker enum { 197*77c1e3ccSAndroid Build Coastguard Worker // No tx type pruning 198*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE_PRUNE_0 = 0, 199*77c1e3ccSAndroid Build Coastguard Worker // adaptively prunes the least perspective tx types out of all 16 200*77c1e3ccSAndroid Build Coastguard Worker // (tuned to provide negligible quality loss) 201*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE_PRUNE_1 = 1, 202*77c1e3ccSAndroid Build Coastguard Worker // similar, but applies much more aggressive pruning to get better speed-up 203*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE_PRUNE_2 = 2, 204*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE_PRUNE_3 = 3, 205*77c1e3ccSAndroid Build Coastguard Worker // More aggressive pruning based on tx type score and allowed tx count 206*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE_PRUNE_4 = 4, 207*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE_PRUNE_5 = 5, 208*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(TX_TYPE_PRUNE_MODE); 209*77c1e3ccSAndroid Build Coastguard Worker 210*77c1e3ccSAndroid Build Coastguard Worker enum { 211*77c1e3ccSAndroid Build Coastguard Worker // No reaction to rate control on a detected slide/scene change. 212*77c1e3ccSAndroid Build Coastguard Worker NO_DETECTION = 0, 213*77c1e3ccSAndroid Build Coastguard Worker 214*77c1e3ccSAndroid Build Coastguard Worker // Set to larger Q based only on the detected slide/scene change and 215*77c1e3ccSAndroid Build Coastguard Worker // current/past Q. 216*77c1e3ccSAndroid Build Coastguard Worker FAST_DETECTION_MAXQ = 1, 217*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(OVERSHOOT_DETECTION_CBR); 218*77c1e3ccSAndroid Build Coastguard Worker 219*77c1e3ccSAndroid Build Coastguard Worker enum { 220*77c1e3ccSAndroid Build Coastguard Worker // Turns off multi-winner mode. So we will do txfm search on either all modes 221*77c1e3ccSAndroid Build Coastguard Worker // if winner mode is off, or we will only on txfm search on a single winner 222*77c1e3ccSAndroid Build Coastguard Worker // mode. 223*77c1e3ccSAndroid Build Coastguard Worker MULTI_WINNER_MODE_OFF = 0, 224*77c1e3ccSAndroid Build Coastguard Worker 225*77c1e3ccSAndroid Build Coastguard Worker // Limits the number of winner modes to at most 2 226*77c1e3ccSAndroid Build Coastguard Worker MULTI_WINNER_MODE_FAST = 1, 227*77c1e3ccSAndroid Build Coastguard Worker 228*77c1e3ccSAndroid Build Coastguard Worker // Uses the default number of winner modes, which is 3 for intra mode, and 1 229*77c1e3ccSAndroid Build Coastguard Worker // for inter mode. 230*77c1e3ccSAndroid Build Coastguard Worker MULTI_WINNER_MODE_DEFAULT = 2, 231*77c1e3ccSAndroid Build Coastguard Worker 232*77c1e3ccSAndroid Build Coastguard Worker // Maximum number of winner modes allowed. 233*77c1e3ccSAndroid Build Coastguard Worker MULTI_WINNER_MODE_LEVELS, 234*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(MULTI_WINNER_MODE_TYPE); 235*77c1e3ccSAndroid Build Coastguard Worker 236*77c1e3ccSAndroid Build Coastguard Worker enum { 237*77c1e3ccSAndroid Build Coastguard Worker PRUNE_NEARMV_OFF = 0, // Turn off nearmv pruning 238*77c1e3ccSAndroid Build Coastguard Worker PRUNE_NEARMV_LEVEL1 = 1, // Prune nearmv for qindex (0-85) 239*77c1e3ccSAndroid Build Coastguard Worker PRUNE_NEARMV_LEVEL2 = 2, // Prune nearmv for qindex (0-170) 240*77c1e3ccSAndroid Build Coastguard Worker PRUNE_NEARMV_LEVEL3 = 3, // Prune nearmv more aggressively for qindex (0-170) 241*77c1e3ccSAndroid Build Coastguard Worker PRUNE_NEARMV_MAX = PRUNE_NEARMV_LEVEL3, 242*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(PRUNE_NEARMV_LEVEL); 243*77c1e3ccSAndroid Build Coastguard Worker 244*77c1e3ccSAndroid Build Coastguard Worker enum { 245*77c1e3ccSAndroid Build Coastguard Worker // Default transform search used in evaluation of best inter candidates 246*77c1e3ccSAndroid Build Coastguard Worker // (MODE_EVAL stage) and motion mode winner processing (WINNER_MODE_EVAL 247*77c1e3ccSAndroid Build Coastguard Worker // stage). 248*77c1e3ccSAndroid Build Coastguard Worker TX_SEARCH_DEFAULT = 0, 249*77c1e3ccSAndroid Build Coastguard Worker // Transform search in motion mode rd during MODE_EVAL stage. 250*77c1e3ccSAndroid Build Coastguard Worker TX_SEARCH_MOTION_MODE, 251*77c1e3ccSAndroid Build Coastguard Worker // Transform search in compound type mode rd during MODE_EVAL stage. 252*77c1e3ccSAndroid Build Coastguard Worker TX_SEARCH_COMP_TYPE_MODE, 253*77c1e3ccSAndroid Build Coastguard Worker // All transform search cases 254*77c1e3ccSAndroid Build Coastguard Worker TX_SEARCH_CASES 255*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(TX_SEARCH_CASE); 256*77c1e3ccSAndroid Build Coastguard Worker 257*77c1e3ccSAndroid Build Coastguard Worker typedef struct { 258*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE_PRUNE_MODE prune_2d_txfm_mode; 259*77c1e3ccSAndroid Build Coastguard Worker int fast_intra_tx_type_search; 260*77c1e3ccSAndroid Build Coastguard Worker 261*77c1e3ccSAndroid Build Coastguard Worker // INT_MAX: Disable fast search. 262*77c1e3ccSAndroid Build Coastguard Worker // 1 - 1024: Probability threshold used for conditionally forcing tx type, 263*77c1e3ccSAndroid Build Coastguard Worker // during mode search. 264*77c1e3ccSAndroid Build Coastguard Worker // 0: Force tx type to be DCT_DCT unconditionally, during 265*77c1e3ccSAndroid Build Coastguard Worker // mode search. 266*77c1e3ccSAndroid Build Coastguard Worker int fast_inter_tx_type_prob_thresh; 267*77c1e3ccSAndroid Build Coastguard Worker 268*77c1e3ccSAndroid Build Coastguard Worker // Prune less likely chosen transforms for each intra mode. The speed 269*77c1e3ccSAndroid Build Coastguard Worker // feature ranges from 0 to 2, for different speed / compression trade offs. 270*77c1e3ccSAndroid Build Coastguard Worker int use_reduced_intra_txset; 271*77c1e3ccSAndroid Build Coastguard Worker 272*77c1e3ccSAndroid Build Coastguard Worker // Use a skip flag prediction model to detect blocks with skip = 1 early 273*77c1e3ccSAndroid Build Coastguard Worker // and avoid doing full TX type search for such blocks. 274*77c1e3ccSAndroid Build Coastguard Worker int use_skip_flag_prediction; 275*77c1e3ccSAndroid Build Coastguard Worker 276*77c1e3ccSAndroid Build Coastguard Worker // Threshold used by the ML based method to predict TX block split decisions. 277*77c1e3ccSAndroid Build Coastguard Worker int ml_tx_split_thresh; 278*77c1e3ccSAndroid Build Coastguard Worker 279*77c1e3ccSAndroid Build Coastguard Worker // skip remaining transform type search when we found the rdcost of skip is 280*77c1e3ccSAndroid Build Coastguard Worker // better than applying transform 281*77c1e3ccSAndroid Build Coastguard Worker int skip_tx_search; 282*77c1e3ccSAndroid Build Coastguard Worker 283*77c1e3ccSAndroid Build Coastguard Worker // Prune tx type search using previous frame stats. 284*77c1e3ccSAndroid Build Coastguard Worker int prune_tx_type_using_stats; 285*77c1e3ccSAndroid Build Coastguard Worker // Prune tx type search using estimated RDcost 286*77c1e3ccSAndroid Build Coastguard Worker int prune_tx_type_est_rd; 287*77c1e3ccSAndroid Build Coastguard Worker 288*77c1e3ccSAndroid Build Coastguard Worker // Flag used to control the winner mode processing for tx type pruning for 289*77c1e3ccSAndroid Build Coastguard Worker // inter blocks. It enables further tx type mode pruning based on ML model for 290*77c1e3ccSAndroid Build Coastguard Worker // mode evaluation and disables tx type mode pruning for winner mode 291*77c1e3ccSAndroid Build Coastguard Worker // processing. 292*77c1e3ccSAndroid Build Coastguard Worker int winner_mode_tx_type_pruning; 293*77c1e3ccSAndroid Build Coastguard Worker } TX_TYPE_SEARCH; 294*77c1e3ccSAndroid Build Coastguard Worker 295*77c1e3ccSAndroid Build Coastguard Worker enum { 296*77c1e3ccSAndroid Build Coastguard Worker // Search partitions using RD criterion 297*77c1e3ccSAndroid Build Coastguard Worker SEARCH_PARTITION, 298*77c1e3ccSAndroid Build Coastguard Worker 299*77c1e3ccSAndroid Build Coastguard Worker // Always use a fixed size partition 300*77c1e3ccSAndroid Build Coastguard Worker FIXED_PARTITION, 301*77c1e3ccSAndroid Build Coastguard Worker 302*77c1e3ccSAndroid Build Coastguard Worker // Partition using source variance 303*77c1e3ccSAndroid Build Coastguard Worker VAR_BASED_PARTITION, 304*77c1e3ccSAndroid Build Coastguard Worker 305*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_RT_ML_PARTITIONING 306*77c1e3ccSAndroid Build Coastguard Worker // Partition using ML model 307*77c1e3ccSAndroid Build Coastguard Worker ML_BASED_PARTITION 308*77c1e3ccSAndroid Build Coastguard Worker #endif 309*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(PARTITION_SEARCH_TYPE); 310*77c1e3ccSAndroid Build Coastguard Worker 311*77c1e3ccSAndroid Build Coastguard Worker enum { 312*77c1e3ccSAndroid Build Coastguard Worker NOT_IN_USE, 313*77c1e3ccSAndroid Build Coastguard Worker DIRECT_PRED, 314*77c1e3ccSAndroid Build Coastguard Worker RELAXED_PRED, 315*77c1e3ccSAndroid Build Coastguard Worker ADAPT_PRED 316*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(MAX_PART_PRED_MODE); 317*77c1e3ccSAndroid Build Coastguard Worker 318*77c1e3ccSAndroid Build Coastguard Worker enum { 319*77c1e3ccSAndroid Build Coastguard Worker LAST_MV_DATA, 320*77c1e3ccSAndroid Build Coastguard Worker CURRENT_Q, 321*77c1e3ccSAndroid Build Coastguard Worker QTR_ONLY, 322*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(MV_PREC_LOGIC); 323*77c1e3ccSAndroid Build Coastguard Worker 324*77c1e3ccSAndroid Build Coastguard Worker enum { 325*77c1e3ccSAndroid Build Coastguard Worker SUPERRES_AUTO_ALL, // Tries all possible superres ratios 326*77c1e3ccSAndroid Build Coastguard Worker SUPERRES_AUTO_DUAL, // Tries no superres and q-based superres ratios 327*77c1e3ccSAndroid Build Coastguard Worker SUPERRES_AUTO_SOLO, // Only apply the q-based superres ratio 328*77c1e3ccSAndroid Build Coastguard Worker } UENUM1BYTE(SUPERRES_AUTO_SEARCH_TYPE); 329*77c1e3ccSAndroid Build Coastguard Worker /*!\endcond */ 330*77c1e3ccSAndroid Build Coastguard Worker 331*77c1e3ccSAndroid Build Coastguard Worker /*!\enum INTERNAL_COST_UPDATE_TYPE 332*77c1e3ccSAndroid Build Coastguard Worker * \brief This enum decides internally how often to update the entropy costs 333*77c1e3ccSAndroid Build Coastguard Worker * 334*77c1e3ccSAndroid Build Coastguard Worker * INTERNAL_COST_UPD_TYPE is similar to \ref COST_UPDATE_TYPE but has slightly 335*77c1e3ccSAndroid Build Coastguard Worker * more flexibility in update frequency. This enum is separate from \ref 336*77c1e3ccSAndroid Build Coastguard Worker * COST_UPDATE_TYPE because although \ref COST_UPDATE_TYPE is not exposed, its 337*77c1e3ccSAndroid Build Coastguard Worker * values are public so it cannot be modified without breaking public API. 338*77c1e3ccSAndroid Build Coastguard Worker * Due to the use of AOMMIN() in populate_unified_cost_update_freq() to 339*77c1e3ccSAndroid Build Coastguard Worker * compute the unified cost update frequencies (out of COST_UPDATE_TYPE and 340*77c1e3ccSAndroid Build Coastguard Worker * INTERNAL_COST_UPDATE_TYPE), the values of this enum type must be listed in 341*77c1e3ccSAndroid Build Coastguard Worker * the order of increasing frequencies. 342*77c1e3ccSAndroid Build Coastguard Worker * 343*77c1e3ccSAndroid Build Coastguard Worker * \warning In case of any updates/modifications to the enum COST_UPDATE_TYPE, 344*77c1e3ccSAndroid Build Coastguard Worker * update the enum INTERNAL_COST_UPDATE_TYPE as well. 345*77c1e3ccSAndroid Build Coastguard Worker */ 346*77c1e3ccSAndroid Build Coastguard Worker typedef enum { 347*77c1e3ccSAndroid Build Coastguard Worker INTERNAL_COST_UPD_OFF, /*!< Turn off cost updates. */ 348*77c1e3ccSAndroid Build Coastguard Worker INTERNAL_COST_UPD_TILE, /*!< Update every tile. */ 349*77c1e3ccSAndroid Build Coastguard Worker INTERNAL_COST_UPD_SBROW_SET, /*!< Update every row_set of height 256 pixs. */ 350*77c1e3ccSAndroid Build Coastguard Worker INTERNAL_COST_UPD_SBROW, /*!< Update every sb rows inside a tile. */ 351*77c1e3ccSAndroid Build Coastguard Worker INTERNAL_COST_UPD_SB, /*!< Update every sb. */ 352*77c1e3ccSAndroid Build Coastguard Worker } INTERNAL_COST_UPDATE_TYPE; 353*77c1e3ccSAndroid Build Coastguard Worker 354*77c1e3ccSAndroid Build Coastguard Worker /*!\enum SIMPLE_MOTION_SEARCH_PRUNE_LEVEL 355*77c1e3ccSAndroid Build Coastguard Worker * \brief This enumeration defines a variety of simple motion search based 356*77c1e3ccSAndroid Build Coastguard Worker * partition prune levels 357*77c1e3ccSAndroid Build Coastguard Worker */ 358*77c1e3ccSAndroid Build Coastguard Worker typedef enum { 359*77c1e3ccSAndroid Build Coastguard Worker NO_PRUNING = -1, 360*77c1e3ccSAndroid Build Coastguard Worker SIMPLE_AGG_LVL0, /*!< Simple prune aggressiveness level 0. */ 361*77c1e3ccSAndroid Build Coastguard Worker SIMPLE_AGG_LVL1, /*!< Simple prune aggressiveness level 1. */ 362*77c1e3ccSAndroid Build Coastguard Worker SIMPLE_AGG_LVL2, /*!< Simple prune aggressiveness level 2. */ 363*77c1e3ccSAndroid Build Coastguard Worker SIMPLE_AGG_LVL3, /*!< Simple prune aggressiveness level 3. */ 364*77c1e3ccSAndroid Build Coastguard Worker QIDX_BASED_AGG_LVL1, /*!< Qindex based prune aggressiveness level, aggressive 365*77c1e3ccSAndroid Build Coastguard Worker level maps to simple agg level 1 or 2 based on qindex. 366*77c1e3ccSAndroid Build Coastguard Worker */ 367*77c1e3ccSAndroid Build Coastguard Worker TOTAL_SIMPLE_AGG_LVLS = QIDX_BASED_AGG_LVL1, /*!< Total number of simple prune 368*77c1e3ccSAndroid Build Coastguard Worker aggressiveness levels. */ 369*77c1e3ccSAndroid Build Coastguard Worker TOTAL_QINDEX_BASED_AGG_LVLS = 370*77c1e3ccSAndroid Build Coastguard Worker QIDX_BASED_AGG_LVL1 - 371*77c1e3ccSAndroid Build Coastguard Worker SIMPLE_AGG_LVL3, /*!< Total number of qindex based simple prune 372*77c1e3ccSAndroid Build Coastguard Worker aggressiveness levels. */ 373*77c1e3ccSAndroid Build Coastguard Worker TOTAL_AGG_LVLS = TOTAL_SIMPLE_AGG_LVLS + 374*77c1e3ccSAndroid Build Coastguard Worker TOTAL_QINDEX_BASED_AGG_LVLS, /*!< Total number of levels. */ 375*77c1e3ccSAndroid Build Coastguard Worker } SIMPLE_MOTION_SEARCH_PRUNE_LEVEL; 376*77c1e3ccSAndroid Build Coastguard Worker 377*77c1e3ccSAndroid Build Coastguard Worker /*!\enum PRUNE_MESH_SEARCH_LEVEL 378*77c1e3ccSAndroid Build Coastguard Worker * \brief This enumeration defines a variety of mesh search prune levels. 379*77c1e3ccSAndroid Build Coastguard Worker */ 380*77c1e3ccSAndroid Build Coastguard Worker typedef enum { 381*77c1e3ccSAndroid Build Coastguard Worker PRUNE_MESH_SEARCH_DISABLED = 0, /*!< Prune mesh search level 0. */ 382*77c1e3ccSAndroid Build Coastguard Worker PRUNE_MESH_SEARCH_LVL_1 = 1, /*!< Prune mesh search level 1. */ 383*77c1e3ccSAndroid Build Coastguard Worker PRUNE_MESH_SEARCH_LVL_2 = 2, /*!< Prune mesh search level 2. */ 384*77c1e3ccSAndroid Build Coastguard Worker } PRUNE_MESH_SEARCH_LEVEL; 385*77c1e3ccSAndroid Build Coastguard Worker 386*77c1e3ccSAndroid Build Coastguard Worker /*!\enum INTER_SEARCH_EARLY_TERM_IDX 387*77c1e3ccSAndroid Build Coastguard Worker * \brief This enumeration defines inter search early termination index in 388*77c1e3ccSAndroid Build Coastguard Worker * non-rd path based on sse value. 389*77c1e3ccSAndroid Build Coastguard Worker */ 390*77c1e3ccSAndroid Build Coastguard Worker typedef enum { 391*77c1e3ccSAndroid Build Coastguard Worker EARLY_TERM_DISABLED = 392*77c1e3ccSAndroid Build Coastguard Worker 0, /*!< Early terminate inter mode search based on sse disabled. */ 393*77c1e3ccSAndroid Build Coastguard Worker EARLY_TERM_IDX_1 = 394*77c1e3ccSAndroid Build Coastguard Worker 1, /*!< Early terminate inter mode search based on sse, index 1. */ 395*77c1e3ccSAndroid Build Coastguard Worker EARLY_TERM_IDX_2 = 396*77c1e3ccSAndroid Build Coastguard Worker 2, /*!< Early terminate inter mode search based on sse, index 2. */ 397*77c1e3ccSAndroid Build Coastguard Worker EARLY_TERM_IDX_3 = 398*77c1e3ccSAndroid Build Coastguard Worker 3, /*!< Early terminate inter mode search based on sse, index 3. */ 399*77c1e3ccSAndroid Build Coastguard Worker EARLY_TERM_IDX_4 = 400*77c1e3ccSAndroid Build Coastguard Worker 4, /*!< Early terminate inter mode search based on sse, index 4. */ 401*77c1e3ccSAndroid Build Coastguard Worker EARLY_TERM_INDICES, /*!< Total number of early terminate indices */ 402*77c1e3ccSAndroid Build Coastguard Worker } INTER_SEARCH_EARLY_TERM_IDX; 403*77c1e3ccSAndroid Build Coastguard Worker 404*77c1e3ccSAndroid Build Coastguard Worker /*! 405*77c1e3ccSAndroid Build Coastguard Worker * \brief Sequence/frame level speed vs quality features 406*77c1e3ccSAndroid Build Coastguard Worker */ 407*77c1e3ccSAndroid Build Coastguard Worker typedef struct HIGH_LEVEL_SPEED_FEATURES { 408*77c1e3ccSAndroid Build Coastguard Worker /*! Frame level coding parameter update. */ 409*77c1e3ccSAndroid Build Coastguard Worker int frame_parameter_update; 410*77c1e3ccSAndroid Build Coastguard Worker 411*77c1e3ccSAndroid Build Coastguard Worker /*! 412*77c1e3ccSAndroid Build Coastguard Worker * Cases and frame types for which the recode loop is enabled. 413*77c1e3ccSAndroid Build Coastguard Worker */ 414*77c1e3ccSAndroid Build Coastguard Worker RECODE_LOOP_TYPE recode_loop; 415*77c1e3ccSAndroid Build Coastguard Worker 416*77c1e3ccSAndroid Build Coastguard Worker /*! 417*77c1e3ccSAndroid Build Coastguard Worker * Controls the tolerance vs target rate used in deciding whether to 418*77c1e3ccSAndroid Build Coastguard Worker * recode a frame. It has no meaning if recode is disabled. 419*77c1e3ccSAndroid Build Coastguard Worker */ 420*77c1e3ccSAndroid Build Coastguard Worker int recode_tolerance; 421*77c1e3ccSAndroid Build Coastguard Worker 422*77c1e3ccSAndroid Build Coastguard Worker /*! 423*77c1e3ccSAndroid Build Coastguard Worker * Determine how motion vector precision is chosen. The possibilities are: 424*77c1e3ccSAndroid Build Coastguard Worker * LAST_MV_DATA: use the mv data from the last coded frame 425*77c1e3ccSAndroid Build Coastguard Worker * CURRENT_Q: use the current q as a threshold 426*77c1e3ccSAndroid Build Coastguard Worker * QTR_ONLY: use quarter pel precision only. 427*77c1e3ccSAndroid Build Coastguard Worker */ 428*77c1e3ccSAndroid Build Coastguard Worker MV_PREC_LOGIC high_precision_mv_usage; 429*77c1e3ccSAndroid Build Coastguard Worker 430*77c1e3ccSAndroid Build Coastguard Worker /*! 431*77c1e3ccSAndroid Build Coastguard Worker * Always set to 0. If on it enables 0 cost background transmission 432*77c1e3ccSAndroid Build Coastguard Worker * (except for the initial transmission of the segmentation). The feature is 433*77c1e3ccSAndroid Build Coastguard Worker * disabled because the addition of very large block sizes make the 434*77c1e3ccSAndroid Build Coastguard Worker * backgrounds very to cheap to encode, and the segmentation we have 435*77c1e3ccSAndroid Build Coastguard Worker * adds overhead. 436*77c1e3ccSAndroid Build Coastguard Worker */ 437*77c1e3ccSAndroid Build Coastguard Worker int static_segmentation; 438*77c1e3ccSAndroid Build Coastguard Worker 439*77c1e3ccSAndroid Build Coastguard Worker /*! 440*77c1e3ccSAndroid Build Coastguard Worker * Superres-auto mode search type: 441*77c1e3ccSAndroid Build Coastguard Worker */ 442*77c1e3ccSAndroid Build Coastguard Worker SUPERRES_AUTO_SEARCH_TYPE superres_auto_search_type; 443*77c1e3ccSAndroid Build Coastguard Worker 444*77c1e3ccSAndroid Build Coastguard Worker /*! 445*77c1e3ccSAndroid Build Coastguard Worker * Enable/disable extra screen content test by encoding key frame twice. 446*77c1e3ccSAndroid Build Coastguard Worker */ 447*77c1e3ccSAndroid Build Coastguard Worker int disable_extra_sc_testing; 448*77c1e3ccSAndroid Build Coastguard Worker 449*77c1e3ccSAndroid Build Coastguard Worker /*! 450*77c1e3ccSAndroid Build Coastguard Worker * Enable/disable second_alt_ref temporal filtering. 451*77c1e3ccSAndroid Build Coastguard Worker */ 452*77c1e3ccSAndroid Build Coastguard Worker int second_alt_ref_filtering; 453*77c1e3ccSAndroid Build Coastguard Worker 454*77c1e3ccSAndroid Build Coastguard Worker /*! 455*77c1e3ccSAndroid Build Coastguard Worker * The number of frames to be used during temporal filtering of an ARF frame 456*77c1e3ccSAndroid Build Coastguard Worker * is adjusted based on noise level of the current frame. The sf has three 457*77c1e3ccSAndroid Build Coastguard Worker * levels to decide number of frames to be considered for filtering: 458*77c1e3ccSAndroid Build Coastguard Worker * 0 : Use default number of frames 459*77c1e3ccSAndroid Build Coastguard Worker * 1 and 2 : Reduce the number of frames based on noise level with varied 460*77c1e3ccSAndroid Build Coastguard Worker * aggressiveness 461*77c1e3ccSAndroid Build Coastguard Worker */ 462*77c1e3ccSAndroid Build Coastguard Worker int adjust_num_frames_for_arf_filtering; 463*77c1e3ccSAndroid Build Coastguard Worker 464*77c1e3ccSAndroid Build Coastguard Worker /*! 465*77c1e3ccSAndroid Build Coastguard Worker * Decide the bit estimation approach used in qindex decision. 466*77c1e3ccSAndroid Build Coastguard Worker * 0: estimate bits based on a constant value; 467*77c1e3ccSAndroid Build Coastguard Worker * 1: estimate bits more accurately based on the frame complexity. 468*77c1e3ccSAndroid Build Coastguard Worker */ 469*77c1e3ccSAndroid Build Coastguard Worker int accurate_bit_estimate; 470*77c1e3ccSAndroid Build Coastguard Worker 471*77c1e3ccSAndroid Build Coastguard Worker /*! 472*77c1e3ccSAndroid Build Coastguard Worker * Decide the approach for weight calculation during temporal filtering. 473*77c1e3ccSAndroid Build Coastguard Worker * 0: Calculate weight using exp() 474*77c1e3ccSAndroid Build Coastguard Worker * 1: Calculate weight using a lookup table that approximates exp(). 475*77c1e3ccSAndroid Build Coastguard Worker */ 476*77c1e3ccSAndroid Build Coastguard Worker int weight_calc_level_in_tf; 477*77c1e3ccSAndroid Build Coastguard Worker 478*77c1e3ccSAndroid Build Coastguard Worker /*! 479*77c1e3ccSAndroid Build Coastguard Worker * Decide whether to perform motion estimation at split block (i.e. 16x16) 480*77c1e3ccSAndroid Build Coastguard Worker * level or not. 481*77c1e3ccSAndroid Build Coastguard Worker * 0: Always allow motion estimation. 482*77c1e3ccSAndroid Build Coastguard Worker * 1: Conditionally allow motion estimation based on 4x4 sub-blocks variance. 483*77c1e3ccSAndroid Build Coastguard Worker */ 484*77c1e3ccSAndroid Build Coastguard Worker int allow_sub_blk_me_in_tf; 485*77c1e3ccSAndroid Build Coastguard Worker } HIGH_LEVEL_SPEED_FEATURES; 486*77c1e3ccSAndroid Build Coastguard Worker 487*77c1e3ccSAndroid Build Coastguard Worker /*! 488*77c1e3ccSAndroid Build Coastguard Worker * Speed features for the first pass. 489*77c1e3ccSAndroid Build Coastguard Worker */ 490*77c1e3ccSAndroid Build Coastguard Worker typedef struct FIRST_PASS_SPEED_FEATURES { 491*77c1e3ccSAndroid Build Coastguard Worker /*! 492*77c1e3ccSAndroid Build Coastguard Worker * \brief Reduces the mv search window. 493*77c1e3ccSAndroid Build Coastguard Worker * By default, the initial search window is around 494*77c1e3ccSAndroid Build Coastguard Worker * MIN(MIN(dims), MAX_FULL_PEL_VAL) = MIN(MIN(dims), 1023). 495*77c1e3ccSAndroid Build Coastguard Worker * Each step reduction decrease the window size by about a factor of 2. 496*77c1e3ccSAndroid Build Coastguard Worker */ 497*77c1e3ccSAndroid Build Coastguard Worker int reduce_mv_step_param; 498*77c1e3ccSAndroid Build Coastguard Worker 499*77c1e3ccSAndroid Build Coastguard Worker /*! 500*77c1e3ccSAndroid Build Coastguard Worker * \brief Skips the motion search when the zero mv has small sse. 501*77c1e3ccSAndroid Build Coastguard Worker */ 502*77c1e3ccSAndroid Build Coastguard Worker int skip_motion_search_threshold; 503*77c1e3ccSAndroid Build Coastguard Worker 504*77c1e3ccSAndroid Build Coastguard Worker /*! 505*77c1e3ccSAndroid Build Coastguard Worker * \brief Skips reconstruction by using source buffers for prediction 506*77c1e3ccSAndroid Build Coastguard Worker */ 507*77c1e3ccSAndroid Build Coastguard Worker int disable_recon; 508*77c1e3ccSAndroid Build Coastguard Worker 509*77c1e3ccSAndroid Build Coastguard Worker /*! 510*77c1e3ccSAndroid Build Coastguard Worker * \brief Skips the motion search centered on 0,0 mv. 511*77c1e3ccSAndroid Build Coastguard Worker */ 512*77c1e3ccSAndroid Build Coastguard Worker int skip_zeromv_motion_search; 513*77c1e3ccSAndroid Build Coastguard Worker } FIRST_PASS_SPEED_FEATURES; 514*77c1e3ccSAndroid Build Coastguard Worker 515*77c1e3ccSAndroid Build Coastguard Worker /*!\cond */ 516*77c1e3ccSAndroid Build Coastguard Worker typedef struct TPL_SPEED_FEATURES { 517*77c1e3ccSAndroid Build Coastguard Worker // GOP length adaptive decision. 518*77c1e3ccSAndroid Build Coastguard Worker // If set to 0, tpl model decides whether a shorter gf interval is better. 519*77c1e3ccSAndroid Build Coastguard Worker // If set to 1, tpl stats of ARFs from base layer, (base+1) layer and 520*77c1e3ccSAndroid Build Coastguard Worker // (base+2) layer decide whether a shorter gf interval is better. 521*77c1e3ccSAndroid Build Coastguard Worker // If set to 2, tpl stats of ARFs from base layer, (base+1) layer and GF boost 522*77c1e3ccSAndroid Build Coastguard Worker // decide whether a shorter gf interval is better. 523*77c1e3ccSAndroid Build Coastguard Worker // If set to 3, gop length adaptive decision is disabled. 524*77c1e3ccSAndroid Build Coastguard Worker int gop_length_decision_method; 525*77c1e3ccSAndroid Build Coastguard Worker // Prune the intra modes search by tpl. 526*77c1e3ccSAndroid Build Coastguard Worker // If set to 0, we will search all intra modes from DC_PRED to PAETH_PRED. 527*77c1e3ccSAndroid Build Coastguard Worker // If set to 1, we only search DC_PRED, V_PRED, and H_PRED. 528*77c1e3ccSAndroid Build Coastguard Worker int prune_intra_modes; 529*77c1e3ccSAndroid Build Coastguard Worker // This parameter controls which step in the n-step process we start at. 530*77c1e3ccSAndroid Build Coastguard Worker int reduce_first_step_size; 531*77c1e3ccSAndroid Build Coastguard Worker // Skip motion estimation based on the precision of center MVs and the 532*77c1e3ccSAndroid Build Coastguard Worker // difference between center MVs. 533*77c1e3ccSAndroid Build Coastguard Worker // If set to 0, motion estimation is skipped for duplicate center MVs 534*77c1e3ccSAndroid Build Coastguard Worker // (default). If set to 1, motion estimation is skipped for duplicate 535*77c1e3ccSAndroid Build Coastguard Worker // full-pixel center MVs. If set to 2, motion estimation is skipped if the 536*77c1e3ccSAndroid Build Coastguard Worker // difference between center MVs is less than the threshold. 537*77c1e3ccSAndroid Build Coastguard Worker int skip_alike_starting_mv; 538*77c1e3ccSAndroid Build Coastguard Worker 539*77c1e3ccSAndroid Build Coastguard Worker // When to stop subpel search. 540*77c1e3ccSAndroid Build Coastguard Worker SUBPEL_FORCE_STOP subpel_force_stop; 541*77c1e3ccSAndroid Build Coastguard Worker 542*77c1e3ccSAndroid Build Coastguard Worker // Which search method to use. 543*77c1e3ccSAndroid Build Coastguard Worker SEARCH_METHODS search_method; 544*77c1e3ccSAndroid Build Coastguard Worker 545*77c1e3ccSAndroid Build Coastguard Worker // Prune starting mvs in TPL based on sad scores. 546*77c1e3ccSAndroid Build Coastguard Worker int prune_starting_mv; 547*77c1e3ccSAndroid Build Coastguard Worker 548*77c1e3ccSAndroid Build Coastguard Worker // Prune reference frames in TPL. 549*77c1e3ccSAndroid Build Coastguard Worker int prune_ref_frames_in_tpl; 550*77c1e3ccSAndroid Build Coastguard Worker 551*77c1e3ccSAndroid Build Coastguard Worker // Support compound predictions. 552*77c1e3ccSAndroid Build Coastguard Worker int allow_compound_pred; 553*77c1e3ccSAndroid Build Coastguard Worker 554*77c1e3ccSAndroid Build Coastguard Worker // Calculate rate and distortion based on Y plane only. 555*77c1e3ccSAndroid Build Coastguard Worker int use_y_only_rate_distortion; 556*77c1e3ccSAndroid Build Coastguard Worker 557*77c1e3ccSAndroid Build Coastguard Worker // Use SAD instead of SATD during intra/inter mode search. 558*77c1e3ccSAndroid Build Coastguard Worker // If set to 0, use SATD always. 559*77c1e3ccSAndroid Build Coastguard Worker // If set to 1, use SAD during intra/inter mode search for frames in the 560*77c1e3ccSAndroid Build Coastguard Worker // higher temporal layers of the hierarchical prediction structure. 561*77c1e3ccSAndroid Build Coastguard Worker // If set to 2, use SAD during intra/inter mode search for all frames. 562*77c1e3ccSAndroid Build Coastguard Worker // This sf is disabled for the first GF group of the key-frame interval, 563*77c1e3ccSAndroid Build Coastguard Worker // i.e., SATD is used during intra/inter mode search of the first GF group. 564*77c1e3ccSAndroid Build Coastguard Worker int use_sad_for_mode_decision; 565*77c1e3ccSAndroid Build Coastguard Worker 566*77c1e3ccSAndroid Build Coastguard Worker // Skip tpl processing for frames of type LF_UPDATE. 567*77c1e3ccSAndroid Build Coastguard Worker // This sf is disabled for the first GF group of the key-frame interval. 568*77c1e3ccSAndroid Build Coastguard Worker int reduce_num_frames; 569*77c1e3ccSAndroid Build Coastguard Worker } TPL_SPEED_FEATURES; 570*77c1e3ccSAndroid Build Coastguard Worker 571*77c1e3ccSAndroid Build Coastguard Worker typedef struct GLOBAL_MOTION_SPEED_FEATURES { 572*77c1e3ccSAndroid Build Coastguard Worker GM_SEARCH_TYPE gm_search_type; 573*77c1e3ccSAndroid Build Coastguard Worker 574*77c1e3ccSAndroid Build Coastguard Worker // During global motion estimation, prune remaining reference frames in a 575*77c1e3ccSAndroid Build Coastguard Worker // given direction(past/future), if the evaluated ref_frame in that direction 576*77c1e3ccSAndroid Build Coastguard Worker // yields gm_type as INVALID/TRANSLATION/IDENTITY 577*77c1e3ccSAndroid Build Coastguard Worker int prune_ref_frame_for_gm_search; 578*77c1e3ccSAndroid Build Coastguard Worker 579*77c1e3ccSAndroid Build Coastguard Worker // When the current GM type is set to ZEROMV, prune ZEROMV if its performance 580*77c1e3ccSAndroid Build Coastguard Worker // is worse than NEWMV under SSE metric. 581*77c1e3ccSAndroid Build Coastguard Worker // 0 : no pruning 582*77c1e3ccSAndroid Build Coastguard Worker // 1 : conservative pruning 583*77c1e3ccSAndroid Build Coastguard Worker // 2 : aggressive pruning 584*77c1e3ccSAndroid Build Coastguard Worker int prune_zero_mv_with_sse; 585*77c1e3ccSAndroid Build Coastguard Worker 586*77c1e3ccSAndroid Build Coastguard Worker // Disable global motion estimation based on stats of previous frames in the 587*77c1e3ccSAndroid Build Coastguard Worker // GF group 588*77c1e3ccSAndroid Build Coastguard Worker int disable_gm_search_based_on_stats; 589*77c1e3ccSAndroid Build Coastguard Worker 590*77c1e3ccSAndroid Build Coastguard Worker // Downsampling pyramid level to use for global motion estimation 591*77c1e3ccSAndroid Build Coastguard Worker int downsample_level; 592*77c1e3ccSAndroid Build Coastguard Worker 593*77c1e3ccSAndroid Build Coastguard Worker // Number of refinement steps to apply after initial model generation 594*77c1e3ccSAndroid Build Coastguard Worker int num_refinement_steps; 595*77c1e3ccSAndroid Build Coastguard Worker } GLOBAL_MOTION_SPEED_FEATURES; 596*77c1e3ccSAndroid Build Coastguard Worker 597*77c1e3ccSAndroid Build Coastguard Worker typedef struct PARTITION_SPEED_FEATURES { 598*77c1e3ccSAndroid Build Coastguard Worker PARTITION_SEARCH_TYPE partition_search_type; 599*77c1e3ccSAndroid Build Coastguard Worker 600*77c1e3ccSAndroid Build Coastguard Worker // Used if partition_search_type = FIXED_PARTITION 601*77c1e3ccSAndroid Build Coastguard Worker BLOCK_SIZE fixed_partition_size; 602*77c1e3ccSAndroid Build Coastguard Worker 603*77c1e3ccSAndroid Build Coastguard Worker // Prune extended partition types search based on the current best partition 604*77c1e3ccSAndroid Build Coastguard Worker // and the combined rdcost of the subblocks estimated from previous 605*77c1e3ccSAndroid Build Coastguard Worker // partitions. Can take values 0 - 2, 0 referring to no pruning, and 1 - 2 606*77c1e3ccSAndroid Build Coastguard Worker // increasing aggressiveness of pruning in order. 607*77c1e3ccSAndroid Build Coastguard Worker int prune_ext_partition_types_search_level; 608*77c1e3ccSAndroid Build Coastguard Worker 609*77c1e3ccSAndroid Build Coastguard Worker // Prune part4 based on block size 610*77c1e3ccSAndroid Build Coastguard Worker int prune_part4_search; 611*77c1e3ccSAndroid Build Coastguard Worker 612*77c1e3ccSAndroid Build Coastguard Worker // Use a ML model to prune rectangular, ab and 4-way horz 613*77c1e3ccSAndroid Build Coastguard Worker // and vert partitions 614*77c1e3ccSAndroid Build Coastguard Worker int ml_prune_partition; 615*77c1e3ccSAndroid Build Coastguard Worker 616*77c1e3ccSAndroid Build Coastguard Worker // Use a ML model to adaptively terminate partition search after trying 617*77c1e3ccSAndroid Build Coastguard Worker // PARTITION_SPLIT. Can take values 0 - 2, 0 meaning not being enabled, and 618*77c1e3ccSAndroid Build Coastguard Worker // 1 - 2 increasing aggressiveness in order. 619*77c1e3ccSAndroid Build Coastguard Worker int ml_early_term_after_part_split_level; 620*77c1e3ccSAndroid Build Coastguard Worker 621*77c1e3ccSAndroid Build Coastguard Worker // Skip rectangular partition test when partition type none gives better 622*77c1e3ccSAndroid Build Coastguard Worker // rd than partition type split. Can take values 0 - 2, 0 referring to no 623*77c1e3ccSAndroid Build Coastguard Worker // skipping, and 1 - 2 increasing aggressiveness of skipping in order. 624*77c1e3ccSAndroid Build Coastguard Worker int less_rectangular_check_level; 625*77c1e3ccSAndroid Build Coastguard Worker 626*77c1e3ccSAndroid Build Coastguard Worker // Use square partition only beyond this block size. 627*77c1e3ccSAndroid Build Coastguard Worker BLOCK_SIZE use_square_partition_only_threshold; 628*77c1e3ccSAndroid Build Coastguard Worker 629*77c1e3ccSAndroid Build Coastguard Worker // Sets max square partition levels for this superblock based on 630*77c1e3ccSAndroid Build Coastguard Worker // motion vector and prediction error distribution produced from 16x16 631*77c1e3ccSAndroid Build Coastguard Worker // simple motion search 632*77c1e3ccSAndroid Build Coastguard Worker MAX_PART_PRED_MODE auto_max_partition_based_on_simple_motion; 633*77c1e3ccSAndroid Build Coastguard Worker 634*77c1e3ccSAndroid Build Coastguard Worker // Min and max square partition size we enable (block_size) as per auto 635*77c1e3ccSAndroid Build Coastguard Worker // min max, but also used by adjust partitioning, and pick_partitioning. 636*77c1e3ccSAndroid Build Coastguard Worker BLOCK_SIZE default_min_partition_size; 637*77c1e3ccSAndroid Build Coastguard Worker BLOCK_SIZE default_max_partition_size; 638*77c1e3ccSAndroid Build Coastguard Worker 639*77c1e3ccSAndroid Build Coastguard Worker // Sets level of adjustment of variance-based partitioning during 640*77c1e3ccSAndroid Build Coastguard Worker // rd_use_partition 0 - no partition adjustment, 1 - try to merge partitions 641*77c1e3ccSAndroid Build Coastguard Worker // for small blocks and high QP, 2 - try to merge partitions, 3 - try to merge 642*77c1e3ccSAndroid Build Coastguard Worker // and split leaf partitions and 0 - 3 decreasing aggressiveness in order. 643*77c1e3ccSAndroid Build Coastguard Worker int adjust_var_based_rd_partitioning; 644*77c1e3ccSAndroid Build Coastguard Worker 645*77c1e3ccSAndroid Build Coastguard Worker // Partition search early breakout thresholds. 646*77c1e3ccSAndroid Build Coastguard Worker int64_t partition_search_breakout_dist_thr; 647*77c1e3ccSAndroid Build Coastguard Worker int partition_search_breakout_rate_thr; 648*77c1e3ccSAndroid Build Coastguard Worker 649*77c1e3ccSAndroid Build Coastguard Worker // Thresholds for ML based partition search breakout. 650*77c1e3ccSAndroid Build Coastguard Worker int ml_partition_search_breakout_thresh[PARTITION_BLOCK_SIZES]; 651*77c1e3ccSAndroid Build Coastguard Worker 652*77c1e3ccSAndroid Build Coastguard Worker // Aggressiveness levels for pruning split and rectangular partitions based on 653*77c1e3ccSAndroid Build Coastguard Worker // simple_motion_search. SIMPLE_AGG_LVL0 to SIMPLE_AGG_LVL3 correspond to 654*77c1e3ccSAndroid Build Coastguard Worker // simple motion search based pruning. QIDX_BASED_AGG_LVL1 corresponds to 655*77c1e3ccSAndroid Build Coastguard Worker // qindex based and simple motion search based pruning. 656*77c1e3ccSAndroid Build Coastguard Worker int simple_motion_search_prune_agg; 657*77c1e3ccSAndroid Build Coastguard Worker 658*77c1e3ccSAndroid Build Coastguard Worker // Perform simple_motion_search on each possible subblock and use it to prune 659*77c1e3ccSAndroid Build Coastguard Worker // PARTITION_HORZ and PARTITION_VERT. 660*77c1e3ccSAndroid Build Coastguard Worker int simple_motion_search_prune_rect; 661*77c1e3ccSAndroid Build Coastguard Worker 662*77c1e3ccSAndroid Build Coastguard Worker // Perform simple motion search before none_partition to decide if we 663*77c1e3ccSAndroid Build Coastguard Worker // want to remove all partitions other than PARTITION_SPLIT. If set to 0, this 664*77c1e3ccSAndroid Build Coastguard Worker // model is disabled. If set to 1, the model attempts to perform 665*77c1e3ccSAndroid Build Coastguard Worker // PARTITION_SPLIT only. If set to 2, the model also attempts to prune 666*77c1e3ccSAndroid Build Coastguard Worker // PARTITION_SPLIT. 667*77c1e3ccSAndroid Build Coastguard Worker int simple_motion_search_split; 668*77c1e3ccSAndroid Build Coastguard Worker 669*77c1e3ccSAndroid Build Coastguard Worker // Use features from simple_motion_search to terminate prediction block 670*77c1e3ccSAndroid Build Coastguard Worker // partition after PARTITION_NONE 671*77c1e3ccSAndroid Build Coastguard Worker int simple_motion_search_early_term_none; 672*77c1e3ccSAndroid Build Coastguard Worker 673*77c1e3ccSAndroid Build Coastguard Worker // Controls whether to reduce the number of motion search steps. If this is 0, 674*77c1e3ccSAndroid Build Coastguard Worker // then simple_motion_search has the same number of steps as 675*77c1e3ccSAndroid Build Coastguard Worker // single_motion_search (assuming no other speed features). Otherwise, reduce 676*77c1e3ccSAndroid Build Coastguard Worker // the number of steps by the value contained in this variable. 677*77c1e3ccSAndroid Build Coastguard Worker int simple_motion_search_reduce_search_steps; 678*77c1e3ccSAndroid Build Coastguard Worker 679*77c1e3ccSAndroid Build Coastguard Worker // This variable controls the maximum block size where intra blocks can be 680*77c1e3ccSAndroid Build Coastguard Worker // used in inter frames. 681*77c1e3ccSAndroid Build Coastguard Worker // TODO(aconverse): Fold this into one of the other many mode skips 682*77c1e3ccSAndroid Build Coastguard Worker BLOCK_SIZE max_intra_bsize; 683*77c1e3ccSAndroid Build Coastguard Worker 684*77c1e3ccSAndroid Build Coastguard Worker // Use CNN with luma pixels on source frame on each of the 64x64 subblock to 685*77c1e3ccSAndroid Build Coastguard Worker // perform partition pruning in intra frames. 686*77c1e3ccSAndroid Build Coastguard Worker // 0: No Pruning 687*77c1e3ccSAndroid Build Coastguard Worker // 1: Prune split and rectangular partitions only 688*77c1e3ccSAndroid Build Coastguard Worker // 2: Prune none, split and rectangular partitions 689*77c1e3ccSAndroid Build Coastguard Worker int intra_cnn_based_part_prune_level; 690*77c1e3ccSAndroid Build Coastguard Worker 691*77c1e3ccSAndroid Build Coastguard Worker // Disable extended partition search if the current bsize is greater than the 692*77c1e3ccSAndroid Build Coastguard Worker // threshold. Must be a square block size BLOCK_8X8 or higher. 693*77c1e3ccSAndroid Build Coastguard Worker BLOCK_SIZE ext_partition_eval_thresh; 694*77c1e3ccSAndroid Build Coastguard Worker 695*77c1e3ccSAndroid Build Coastguard Worker // Use best partition decision so far to tune 'ext_partition_eval_thresh' 696*77c1e3ccSAndroid Build Coastguard Worker int ext_part_eval_based_on_cur_best; 697*77c1e3ccSAndroid Build Coastguard Worker 698*77c1e3ccSAndroid Build Coastguard Worker // Disable rectangular partitions for larger block sizes. 699*77c1e3ccSAndroid Build Coastguard Worker int rect_partition_eval_thresh; 700*77c1e3ccSAndroid Build Coastguard Worker 701*77c1e3ccSAndroid Build Coastguard Worker // Prune extended partition search based on whether the split/rect partitions 702*77c1e3ccSAndroid Build Coastguard Worker // provided an improvement in the previous search. 703*77c1e3ccSAndroid Build Coastguard Worker // 0 : no pruning 704*77c1e3ccSAndroid Build Coastguard Worker // 1 : prune 1:4 partition search using winner info from split partitions 705*77c1e3ccSAndroid Build Coastguard Worker // 2 : prune 1:4 and AB partition search using split and HORZ/VERT info 706*77c1e3ccSAndroid Build Coastguard Worker int prune_ext_part_using_split_info; 707*77c1e3ccSAndroid Build Coastguard Worker 708*77c1e3ccSAndroid Build Coastguard Worker // Prunt rectangular, AB and 4-way partition based on q index and block size 709*77c1e3ccSAndroid Build Coastguard Worker // 0 : no pruning 710*77c1e3ccSAndroid Build Coastguard Worker // 1 : prune sub_8x8 at very low quantizers 711*77c1e3ccSAndroid Build Coastguard Worker // 2 : prune all block size based on qindex 712*77c1e3ccSAndroid Build Coastguard Worker int prune_rectangular_split_based_on_qidx; 713*77c1e3ccSAndroid Build Coastguard Worker 714*77c1e3ccSAndroid Build Coastguard Worker // Prune rectangular partitions based on 4x4 sub-block variance 715*77c1e3ccSAndroid Build Coastguard Worker // false : no pruning 716*77c1e3ccSAndroid Build Coastguard Worker // true : prune rectangular partitions based on 4x4 sub-block variance 717*77c1e3ccSAndroid Build Coastguard Worker // deviation 718*77c1e3ccSAndroid Build Coastguard Worker // 719*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this speed feature reduces instruction count by 6.4% 720*77c1e3ccSAndroid Build Coastguard Worker // for speed=6 with coding performance change less than 0.24%. For AVIF image 721*77c1e3ccSAndroid Build Coastguard Worker // encode, this speed feature reduces encode time by 8.14% for speed 6 on a 722*77c1e3ccSAndroid Build Coastguard Worker // typical image dataset with coding performance change less than 0.16%. This 723*77c1e3ccSAndroid Build Coastguard Worker // speed feature is not applicable to speed >= 7. 724*77c1e3ccSAndroid Build Coastguard Worker bool prune_rect_part_using_4x4_var_deviation; 725*77c1e3ccSAndroid Build Coastguard Worker 726*77c1e3ccSAndroid Build Coastguard Worker // Prune rectangular partitions based on prediction mode chosen by NONE 727*77c1e3ccSAndroid Build Coastguard Worker // partition. 728*77c1e3ccSAndroid Build Coastguard Worker // false : no pruning 729*77c1e3ccSAndroid Build Coastguard Worker // true : prunes rectangular partition as described below 730*77c1e3ccSAndroid Build Coastguard Worker // If prediction mode chosen by NONE partition is 731*77c1e3ccSAndroid Build Coastguard Worker // DC_PRED or SMOOTH_PRED: Prunes both horizontal and vertical partitions if 732*77c1e3ccSAndroid Build Coastguard Worker // at least one of the left and top neighbor blocks is larger than the 733*77c1e3ccSAndroid Build Coastguard Worker // current block. 734*77c1e3ccSAndroid Build Coastguard Worker // Directional Mode: Prunes either of the horizontal and vertical partition 735*77c1e3ccSAndroid Build Coastguard Worker // based on center angle of the prediction mode chosen by NONE partition. For 736*77c1e3ccSAndroid Build Coastguard Worker // example, vertical partition is pruned if center angle of the prediction 737*77c1e3ccSAndroid Build Coastguard Worker // mode chosen by NONE partition is close to 180 degrees (i.e. horizontal 738*77c1e3ccSAndroid Build Coastguard Worker // direction) and vice versa. 739*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this speed feature reduces instruction count by 5.1% 740*77c1e3ccSAndroid Build Coastguard Worker // for speed=6 with coding performance change less than 0.22%. For AVIF image 741*77c1e3ccSAndroid Build Coastguard Worker // encode, this speed feature reduces encode time by 4.44% for speed 6 on a 742*77c1e3ccSAndroid Build Coastguard Worker // typical image dataset with coding performance change less than 0.15%. 743*77c1e3ccSAndroid Build Coastguard Worker // For speed >= 7, variance-based logic is used to determine the partition 744*77c1e3ccSAndroid Build Coastguard Worker // structure instead of recursive partition search. Therefore, this speed 745*77c1e3ccSAndroid Build Coastguard Worker // feature is not applicable in such cases. 746*77c1e3ccSAndroid Build Coastguard Worker bool prune_rect_part_using_none_pred_mode; 747*77c1e3ccSAndroid Build Coastguard Worker 748*77c1e3ccSAndroid Build Coastguard Worker // Terminate partition search for child partition, 749*77c1e3ccSAndroid Build Coastguard Worker // when NONE and SPLIT partition rd_costs are INT64_MAX. 750*77c1e3ccSAndroid Build Coastguard Worker int early_term_after_none_split; 751*77c1e3ccSAndroid Build Coastguard Worker 752*77c1e3ccSAndroid Build Coastguard Worker // Level used to adjust threshold for av1_ml_predict_breakout(). At lower 753*77c1e3ccSAndroid Build Coastguard Worker // levels, more conservative threshold is used, and value of 0 indicates 754*77c1e3ccSAndroid Build Coastguard Worker // av1_ml_predict_breakout() is disabled. Value of 3 corresponds to default 755*77c1e3ccSAndroid Build Coastguard Worker // case with no adjustment to lbd thresholds. 756*77c1e3ccSAndroid Build Coastguard Worker int ml_predict_breakout_level; 757*77c1e3ccSAndroid Build Coastguard Worker 758*77c1e3ccSAndroid Build Coastguard Worker // Prune sub_8x8 (BLOCK_4X4, BLOCK_4X8 and BLOCK_8X4) partitions. 759*77c1e3ccSAndroid Build Coastguard Worker // 0 : no pruning 760*77c1e3ccSAndroid Build Coastguard Worker // 1 : pruning based on neighbour block information 761*77c1e3ccSAndroid Build Coastguard Worker // 2 : prune always 762*77c1e3ccSAndroid Build Coastguard Worker int prune_sub_8x8_partition_level; 763*77c1e3ccSAndroid Build Coastguard Worker 764*77c1e3ccSAndroid Build Coastguard Worker // Prune rectangular split based on simple motion search split/no_split score. 765*77c1e3ccSAndroid Build Coastguard Worker // 0: disable pruning, 1: enable pruning 766*77c1e3ccSAndroid Build Coastguard Worker int simple_motion_search_rect_split; 767*77c1e3ccSAndroid Build Coastguard Worker 768*77c1e3ccSAndroid Build Coastguard Worker // The current encoder adopts a DFS search for block partitions. 769*77c1e3ccSAndroid Build Coastguard Worker // Therefore the mode selection and associated rdcost is ready for smaller 770*77c1e3ccSAndroid Build Coastguard Worker // blocks before the mode selection for some partition types. 771*77c1e3ccSAndroid Build Coastguard Worker // AB partition could use previous rd information and skip mode search. 772*77c1e3ccSAndroid Build Coastguard Worker // An example is: 773*77c1e3ccSAndroid Build Coastguard Worker // 774*77c1e3ccSAndroid Build Coastguard Worker // current block 775*77c1e3ccSAndroid Build Coastguard Worker // +---+---+ 776*77c1e3ccSAndroid Build Coastguard Worker // | | 777*77c1e3ccSAndroid Build Coastguard Worker // + + 778*77c1e3ccSAndroid Build Coastguard Worker // | | 779*77c1e3ccSAndroid Build Coastguard Worker // +-------+ 780*77c1e3ccSAndroid Build Coastguard Worker // 781*77c1e3ccSAndroid Build Coastguard Worker // SPLIT partition has been searched first before trying HORZ_A 782*77c1e3ccSAndroid Build Coastguard Worker // +---+---+ 783*77c1e3ccSAndroid Build Coastguard Worker // | R | R | 784*77c1e3ccSAndroid Build Coastguard Worker // +---+---+ 785*77c1e3ccSAndroid Build Coastguard Worker // | R | R | 786*77c1e3ccSAndroid Build Coastguard Worker // +---+---+ 787*77c1e3ccSAndroid Build Coastguard Worker // 788*77c1e3ccSAndroid Build Coastguard Worker // HORZ_A 789*77c1e3ccSAndroid Build Coastguard Worker // +---+---+ 790*77c1e3ccSAndroid Build Coastguard Worker // | | | 791*77c1e3ccSAndroid Build Coastguard Worker // +---+---+ 792*77c1e3ccSAndroid Build Coastguard Worker // | | 793*77c1e3ccSAndroid Build Coastguard Worker // +-------+ 794*77c1e3ccSAndroid Build Coastguard Worker // 795*77c1e3ccSAndroid Build Coastguard Worker // With this speed feature, the top two sub blocks can directly use rdcost 796*77c1e3ccSAndroid Build Coastguard Worker // searched in split partition, and the mode info is also copied from 797*77c1e3ccSAndroid Build Coastguard Worker // saved info. Similarly, the bottom rectangular block can also use 798*77c1e3ccSAndroid Build Coastguard Worker // the available information from previous rectangular search. 799*77c1e3ccSAndroid Build Coastguard Worker int reuse_prev_rd_results_for_part_ab; 800*77c1e3ccSAndroid Build Coastguard Worker 801*77c1e3ccSAndroid Build Coastguard Worker // Reuse the best prediction modes found in PARTITION_SPLIT and PARTITION_RECT 802*77c1e3ccSAndroid Build Coastguard Worker // when encoding PARTITION_AB. 803*77c1e3ccSAndroid Build Coastguard Worker int reuse_best_prediction_for_part_ab; 804*77c1e3ccSAndroid Build Coastguard Worker 805*77c1e3ccSAndroid Build Coastguard Worker // The current partition search records the best rdcost so far and uses it 806*77c1e3ccSAndroid Build Coastguard Worker // in mode search and transform search to early skip when some criteria is 807*77c1e3ccSAndroid Build Coastguard Worker // met. For example, when the current rdcost is larger than the best rdcost, 808*77c1e3ccSAndroid Build Coastguard Worker // or the model rdcost is larger than the best rdcost times some thresholds. 809*77c1e3ccSAndroid Build Coastguard Worker // By default, this feature is turned on to speed up the encoder partition 810*77c1e3ccSAndroid Build Coastguard Worker // search. 811*77c1e3ccSAndroid Build Coastguard Worker // If disabling it, at speed 0, 30 frames, we could get 812*77c1e3ccSAndroid Build Coastguard Worker // about -0.25% quality gain (psnr, ssim, vmaf), with about 13% slowdown. 813*77c1e3ccSAndroid Build Coastguard Worker int use_best_rd_for_pruning; 814*77c1e3ccSAndroid Build Coastguard Worker 815*77c1e3ccSAndroid Build Coastguard Worker // Skip evaluation of non-square partitions based on the corresponding NONE 816*77c1e3ccSAndroid Build Coastguard Worker // partition. 817*77c1e3ccSAndroid Build Coastguard Worker // 0: no pruning 818*77c1e3ccSAndroid Build Coastguard Worker // 1: prune extended partitions if NONE is skippable 819*77c1e3ccSAndroid Build Coastguard Worker // 2: on top of 1, prune rectangular partitions if NONE is inter, not a newmv 820*77c1e3ccSAndroid Build Coastguard Worker // mode and skippable 821*77c1e3ccSAndroid Build Coastguard Worker int skip_non_sq_part_based_on_none; 822*77c1e3ccSAndroid Build Coastguard Worker 823*77c1e3ccSAndroid Build Coastguard Worker // Disables 8x8 and below partitions for low quantizers. 824*77c1e3ccSAndroid Build Coastguard Worker int disable_8x8_part_based_on_qidx; 825*77c1e3ccSAndroid Build Coastguard Worker } PARTITION_SPEED_FEATURES; 826*77c1e3ccSAndroid Build Coastguard Worker 827*77c1e3ccSAndroid Build Coastguard Worker typedef struct MV_SPEED_FEATURES { 828*77c1e3ccSAndroid Build Coastguard Worker // Motion search method (Diamond, NSTEP, Hex, Big Diamond, Square, etc). 829*77c1e3ccSAndroid Build Coastguard Worker SEARCH_METHODS search_method; 830*77c1e3ccSAndroid Build Coastguard Worker 831*77c1e3ccSAndroid Build Coastguard Worker // Enable the use of faster, less accurate mv search method 832*77c1e3ccSAndroid Build Coastguard Worker // 0: disable, 1: if bsize >= BLOCK_32X32, 2: based on bsize, SAD and qp 833*77c1e3ccSAndroid Build Coastguard Worker // TODO([email protected]): Take the clip's resolution and mv activity into 834*77c1e3ccSAndroid Build Coastguard Worker // account. 835*77c1e3ccSAndroid Build Coastguard Worker int use_bsize_dependent_search_method; 836*77c1e3ccSAndroid Build Coastguard Worker 837*77c1e3ccSAndroid Build Coastguard Worker // If this is set to 1, we limit the motion search range to 2 times the 838*77c1e3ccSAndroid Build Coastguard Worker // largest motion vector found in the last frame. 839*77c1e3ccSAndroid Build Coastguard Worker int auto_mv_step_size; 840*77c1e3ccSAndroid Build Coastguard Worker 841*77c1e3ccSAndroid Build Coastguard Worker // Subpel_search_method can only be subpel_tree which does a subpixel 842*77c1e3ccSAndroid Build Coastguard Worker // logarithmic search that keeps stepping at 1/2 pixel units until 843*77c1e3ccSAndroid Build Coastguard Worker // you stop getting a gain, and then goes on to 1/4 and repeats 844*77c1e3ccSAndroid Build Coastguard Worker // the same process. Along the way it skips many diagonals. 845*77c1e3ccSAndroid Build Coastguard Worker SUBPEL_SEARCH_METHOD subpel_search_method; 846*77c1e3ccSAndroid Build Coastguard Worker 847*77c1e3ccSAndroid Build Coastguard Worker // Maximum number of steps in logarithmic subpel search before giving up. 848*77c1e3ccSAndroid Build Coastguard Worker int subpel_iters_per_step; 849*77c1e3ccSAndroid Build Coastguard Worker 850*77c1e3ccSAndroid Build Coastguard Worker // When to stop subpel search. 851*77c1e3ccSAndroid Build Coastguard Worker SUBPEL_FORCE_STOP subpel_force_stop; 852*77c1e3ccSAndroid Build Coastguard Worker 853*77c1e3ccSAndroid Build Coastguard Worker // When to stop subpel search in simple motion search. 854*77c1e3ccSAndroid Build Coastguard Worker SUBPEL_FORCE_STOP simple_motion_subpel_force_stop; 855*77c1e3ccSAndroid Build Coastguard Worker 856*77c1e3ccSAndroid Build Coastguard Worker // If true, sub-pixel search uses the exact convolve function used for final 857*77c1e3ccSAndroid Build Coastguard Worker // encoding and decoding; otherwise, it uses bilinear interpolation. 858*77c1e3ccSAndroid Build Coastguard Worker SUBPEL_SEARCH_TYPE use_accurate_subpel_search; 859*77c1e3ccSAndroid Build Coastguard Worker 860*77c1e3ccSAndroid Build Coastguard Worker // Threshold for allowing exhaustive motion search. 861*77c1e3ccSAndroid Build Coastguard Worker int exhaustive_searches_thresh; 862*77c1e3ccSAndroid Build Coastguard Worker 863*77c1e3ccSAndroid Build Coastguard Worker // Pattern to be used for any exhaustive mesh searches (except intraBC ME). 864*77c1e3ccSAndroid Build Coastguard Worker MESH_PATTERN mesh_patterns[MAX_MESH_STEP]; 865*77c1e3ccSAndroid Build Coastguard Worker 866*77c1e3ccSAndroid Build Coastguard Worker // Pattern to be used for exhaustive mesh searches of intraBC ME. 867*77c1e3ccSAndroid Build Coastguard Worker MESH_PATTERN intrabc_mesh_patterns[MAX_MESH_STEP]; 868*77c1e3ccSAndroid Build Coastguard Worker 869*77c1e3ccSAndroid Build Coastguard Worker // Reduce single motion search range based on MV result of prior ref_mv_idx. 870*77c1e3ccSAndroid Build Coastguard Worker int reduce_search_range; 871*77c1e3ccSAndroid Build Coastguard Worker 872*77c1e3ccSAndroid Build Coastguard Worker // Prune mesh search. 873*77c1e3ccSAndroid Build Coastguard Worker PRUNE_MESH_SEARCH_LEVEL prune_mesh_search; 874*77c1e3ccSAndroid Build Coastguard Worker 875*77c1e3ccSAndroid Build Coastguard Worker // Use the rd cost around the best FULLPEL_MV to speed up subpel search 876*77c1e3ccSAndroid Build Coastguard Worker int use_fullpel_costlist; 877*77c1e3ccSAndroid Build Coastguard Worker 878*77c1e3ccSAndroid Build Coastguard Worker // Set the full pixel search level of obmc 879*77c1e3ccSAndroid Build Coastguard Worker // 0: obmc_full_pixel_diamond 880*77c1e3ccSAndroid Build Coastguard Worker // 1: obmc_refining_search_sad (faster) 881*77c1e3ccSAndroid Build Coastguard Worker int obmc_full_pixel_search_level; 882*77c1e3ccSAndroid Build Coastguard Worker 883*77c1e3ccSAndroid Build Coastguard Worker // Accurate full pixel motion search based on TPL stats. 884*77c1e3ccSAndroid Build Coastguard Worker int full_pixel_search_level; 885*77c1e3ccSAndroid Build Coastguard Worker 886*77c1e3ccSAndroid Build Coastguard Worker // Allow intrabc motion search 887*77c1e3ccSAndroid Build Coastguard Worker int use_intrabc; 888*77c1e3ccSAndroid Build Coastguard Worker 889*77c1e3ccSAndroid Build Coastguard Worker // Whether to downsample the rows in sad calculation during motion search. 890*77c1e3ccSAndroid Build Coastguard Worker // This is only active when there are at least 16 rows. When this sf is 891*77c1e3ccSAndroid Build Coastguard Worker // active, if there is a large discrepancy in the SAD values for the final 892*77c1e3ccSAndroid Build Coastguard Worker // motion vector between skipping vs not skipping, motion search is redone 893*77c1e3ccSAndroid Build Coastguard Worker // with skip row features off. 894*77c1e3ccSAndroid Build Coastguard Worker // 0: Disabled (do not downsample rows) 895*77c1e3ccSAndroid Build Coastguard Worker // 1: Skip SAD calculation of odd rows if the SAD deviation of the even and 896*77c1e3ccSAndroid Build Coastguard Worker // odd rows for the starting MV is small. Redo motion search with sf off 897*77c1e3ccSAndroid Build Coastguard Worker // when SAD deviation is high for the final motion vector. 898*77c1e3ccSAndroid Build Coastguard Worker // 2: Skip SAD calculation of odd rows. SAD deviation is not tested for the 899*77c1e3ccSAndroid Build Coastguard Worker // start MV and tested only for the final MV. 900*77c1e3ccSAndroid Build Coastguard Worker int use_downsampled_sad; 901*77c1e3ccSAndroid Build Coastguard Worker 902*77c1e3ccSAndroid Build Coastguard Worker // Enable/disable extensive joint motion search. 903*77c1e3ccSAndroid Build Coastguard Worker int disable_extensive_joint_motion_search; 904*77c1e3ccSAndroid Build Coastguard Worker 905*77c1e3ccSAndroid Build Coastguard Worker // Enable second best mv check in joint mv search. 906*77c1e3ccSAndroid Build Coastguard Worker // 0: allow second MV (use rd cost as the metric) 907*77c1e3ccSAndroid Build Coastguard Worker // 1: use var as the metric 908*77c1e3ccSAndroid Build Coastguard Worker // 2: disable second MV 909*77c1e3ccSAndroid Build Coastguard Worker int disable_second_mv; 910*77c1e3ccSAndroid Build Coastguard Worker 911*77c1e3ccSAndroid Build Coastguard Worker // Skips full pixel search based on start mv of prior ref_mv_idx. 912*77c1e3ccSAndroid Build Coastguard Worker // 0: Disabled 913*77c1e3ccSAndroid Build Coastguard Worker // 1: Skips the full pixel search upto 4 neighbor full-pel MV positions. 914*77c1e3ccSAndroid Build Coastguard Worker // 2: Skips the full pixel search upto 8 neighbor full-pel MV positions. 915*77c1e3ccSAndroid Build Coastguard Worker int skip_fullpel_search_using_startmv; 916*77c1e3ccSAndroid Build Coastguard Worker 917*77c1e3ccSAndroid Build Coastguard Worker // Method to use for refining WARPED_CAUSAL motion vectors 918*77c1e3ccSAndroid Build Coastguard Worker // TODO(rachelbarker): Can this be unified with OBMC in some way? 919*77c1e3ccSAndroid Build Coastguard Worker WARP_SEARCH_METHOD warp_search_method; 920*77c1e3ccSAndroid Build Coastguard Worker 921*77c1e3ccSAndroid Build Coastguard Worker // Maximum number of iterations in WARPED_CAUSAL refinement search 922*77c1e3ccSAndroid Build Coastguard Worker int warp_search_iters; 923*77c1e3ccSAndroid Build Coastguard Worker } MV_SPEED_FEATURES; 924*77c1e3ccSAndroid Build Coastguard Worker 925*77c1e3ccSAndroid Build Coastguard Worker typedef struct INTER_MODE_SPEED_FEATURES { 926*77c1e3ccSAndroid Build Coastguard Worker // 2-pass inter mode model estimation where the preliminary pass skips 927*77c1e3ccSAndroid Build Coastguard Worker // transform search and uses a model to estimate rd, while the final pass 928*77c1e3ccSAndroid Build Coastguard Worker // computes the full transform search. Two types of models are supported: 929*77c1e3ccSAndroid Build Coastguard Worker // 0: not used 930*77c1e3ccSAndroid Build Coastguard Worker // 1: used with online dynamic rd model 931*77c1e3ccSAndroid Build Coastguard Worker // 2: used with static rd model 932*77c1e3ccSAndroid Build Coastguard Worker int inter_mode_rd_model_estimation; 933*77c1e3ccSAndroid Build Coastguard Worker 934*77c1e3ccSAndroid Build Coastguard Worker // Bypass transform search based on skip rd at following stages 935*77c1e3ccSAndroid Build Coastguard Worker // i. Compound type mode search 936*77c1e3ccSAndroid Build Coastguard Worker // ii. Motion mode search (mode evaluation and winner motion mode stage) 937*77c1e3ccSAndroid Build Coastguard Worker // iii. Transform search for best inter candidates 938*77c1e3ccSAndroid Build Coastguard Worker int txfm_rd_gate_level[TX_SEARCH_CASES]; 939*77c1e3ccSAndroid Build Coastguard Worker 940*77c1e3ccSAndroid Build Coastguard Worker // Limit the inter mode tested in the RD loop 941*77c1e3ccSAndroid Build Coastguard Worker int reduce_inter_modes; 942*77c1e3ccSAndroid Build Coastguard Worker 943*77c1e3ccSAndroid Build Coastguard Worker // This variable is used to cap the maximum number of times we skip testing a 944*77c1e3ccSAndroid Build Coastguard Worker // mode to be evaluated. A high value means we will be faster. 945*77c1e3ccSAndroid Build Coastguard Worker int adaptive_rd_thresh; 946*77c1e3ccSAndroid Build Coastguard Worker 947*77c1e3ccSAndroid Build Coastguard Worker // Aggressively prune inter modes when best mode is skippable. 948*77c1e3ccSAndroid Build Coastguard Worker int prune_inter_modes_if_skippable; 949*77c1e3ccSAndroid Build Coastguard Worker 950*77c1e3ccSAndroid Build Coastguard Worker // Drop less likely to be picked reference frames in the RD search. 951*77c1e3ccSAndroid Build Coastguard Worker // Has seven levels for now: 0, 1, 2, 3, 4, 5 and 6 where higher levels prune 952*77c1e3ccSAndroid Build Coastguard Worker // more aggressively than lower ones. (0 means no pruning). 953*77c1e3ccSAndroid Build Coastguard Worker int selective_ref_frame; 954*77c1e3ccSAndroid Build Coastguard Worker 955*77c1e3ccSAndroid Build Coastguard Worker // Prune reference frames for rectangular partitions. 956*77c1e3ccSAndroid Build Coastguard Worker // 0 implies no pruning 957*77c1e3ccSAndroid Build Coastguard Worker // 1 implies prune for extended partition 958*77c1e3ccSAndroid Build Coastguard Worker // 2 implies prune horiz, vert and extended partition 959*77c1e3ccSAndroid Build Coastguard Worker int prune_ref_frame_for_rect_partitions; 960*77c1e3ccSAndroid Build Coastguard Worker 961*77c1e3ccSAndroid Build Coastguard Worker // Prune inter modes w.r.t past reference frames 962*77c1e3ccSAndroid Build Coastguard Worker // 0 no pruning 963*77c1e3ccSAndroid Build Coastguard Worker // 1 prune inter modes w.r.t ALTREF2 and ALTREF reference frames 964*77c1e3ccSAndroid Build Coastguard Worker // 2 prune inter modes w.r.t BWDREF, ALTREF2 and ALTREF reference frames 965*77c1e3ccSAndroid Build Coastguard Worker int alt_ref_search_fp; 966*77c1e3ccSAndroid Build Coastguard Worker 967*77c1e3ccSAndroid Build Coastguard Worker // Prune reference frames for single prediction modes based on temporal 968*77c1e3ccSAndroid Build Coastguard Worker // distance and pred MV SAD. Feasible values are 0, 1, 2. The feature is 969*77c1e3ccSAndroid Build Coastguard Worker // disabled for 0. An increasing value indicates more aggressive pruning 970*77c1e3ccSAndroid Build Coastguard Worker // threshold. 971*77c1e3ccSAndroid Build Coastguard Worker int prune_single_ref; 972*77c1e3ccSAndroid Build Coastguard Worker 973*77c1e3ccSAndroid Build Coastguard Worker // Prune compound reference frames 974*77c1e3ccSAndroid Build Coastguard Worker // 0 no pruning 975*77c1e3ccSAndroid Build Coastguard Worker // 1 prune compound references which do not satisfy the two conditions: 976*77c1e3ccSAndroid Build Coastguard Worker // a) The references are at a nearest distance from the current frame in 977*77c1e3ccSAndroid Build Coastguard Worker // both past and future direction. 978*77c1e3ccSAndroid Build Coastguard Worker // b) The references have minimum pred_mv_sad in both past and future 979*77c1e3ccSAndroid Build Coastguard Worker // direction. 980*77c1e3ccSAndroid Build Coastguard Worker // 2 prune compound references except the one with nearest distance from the 981*77c1e3ccSAndroid Build Coastguard Worker // current frame in both past and future direction. 982*77c1e3ccSAndroid Build Coastguard Worker int prune_comp_ref_frames; 983*77c1e3ccSAndroid Build Coastguard Worker 984*77c1e3ccSAndroid Build Coastguard Worker // Skip the current ref_mv in NEW_MV mode based on mv, rate cost, etc. 985*77c1e3ccSAndroid Build Coastguard Worker // This speed feature equaling 0 means no skipping. 986*77c1e3ccSAndroid Build Coastguard Worker // If the speed feature equals 1 or 2, skip the current ref_mv in NEW_MV mode 987*77c1e3ccSAndroid Build Coastguard Worker // if we have already encountered ref_mv in the drl such that: 988*77c1e3ccSAndroid Build Coastguard Worker // 1. The other drl has the same mv during the SIMPLE_TRANSLATION search 989*77c1e3ccSAndroid Build Coastguard Worker // process as the current mv. 990*77c1e3ccSAndroid Build Coastguard Worker // 2. The rate needed to encode the current mv is larger than that for the 991*77c1e3ccSAndroid Build Coastguard Worker // other ref_mv. 992*77c1e3ccSAndroid Build Coastguard Worker // The speed feature equaling 1 means using subpel mv in the comparison. 993*77c1e3ccSAndroid Build Coastguard Worker // The speed feature equaling 2 means using fullpel mv in the comparison. 994*77c1e3ccSAndroid Build Coastguard Worker // If the speed feature >= 3, skip the current ref_mv in NEW_MV mode based on 995*77c1e3ccSAndroid Build Coastguard Worker // known full_mv bestsme and drl cost. 996*77c1e3ccSAndroid Build Coastguard Worker int skip_newmv_in_drl; 997*77c1e3ccSAndroid Build Coastguard Worker 998*77c1e3ccSAndroid Build Coastguard Worker // This speed feature checks duplicate ref MVs among NEARESTMV, NEARMV, 999*77c1e3ccSAndroid Build Coastguard Worker // GLOBALMV and skips NEARMV or GLOBALMV (in order) if a duplicate is found 1000*77c1e3ccSAndroid Build Coastguard Worker // TODO(any): Instead of skipping repeated ref mv, use the recalculated 1001*77c1e3ccSAndroid Build Coastguard Worker // rd-cost based on mode rate and skip the mode evaluation 1002*77c1e3ccSAndroid Build Coastguard Worker int skip_repeated_ref_mv; 1003*77c1e3ccSAndroid Build Coastguard Worker 1004*77c1e3ccSAndroid Build Coastguard Worker // Flag used to control the ref_best_rd based gating for chroma 1005*77c1e3ccSAndroid Build Coastguard Worker int perform_best_rd_based_gating_for_chroma; 1006*77c1e3ccSAndroid Build Coastguard Worker 1007*77c1e3ccSAndroid Build Coastguard Worker // Reuse the inter_intra_mode search result from NEARESTMV mode to other 1008*77c1e3ccSAndroid Build Coastguard Worker // single ref modes 1009*77c1e3ccSAndroid Build Coastguard Worker int reuse_inter_intra_mode; 1010*77c1e3ccSAndroid Build Coastguard Worker 1011*77c1e3ccSAndroid Build Coastguard Worker // prune wedge and compound segment approximate rd evaluation based on 1012*77c1e3ccSAndroid Build Coastguard Worker // compound average modeled rd 1013*77c1e3ccSAndroid Build Coastguard Worker int prune_comp_type_by_model_rd; 1014*77c1e3ccSAndroid Build Coastguard Worker 1015*77c1e3ccSAndroid Build Coastguard Worker // prune wedge and compound segment approximate rd evaluation based on 1016*77c1e3ccSAndroid Build Coastguard Worker // compound average rd/ref_best_rd 1017*77c1e3ccSAndroid Build Coastguard Worker int prune_comp_type_by_comp_avg; 1018*77c1e3ccSAndroid Build Coastguard Worker 1019*77c1e3ccSAndroid Build Coastguard Worker // Skip some ref frames in compound motion search by single motion search 1020*77c1e3ccSAndroid Build Coastguard Worker // result. Has three levels for now: 0 referring to no skipping, and 1 - 3 1021*77c1e3ccSAndroid Build Coastguard Worker // increasing aggressiveness of skipping in order. 1022*77c1e3ccSAndroid Build Coastguard Worker // Note: The search order might affect the result. It assumes that the single 1023*77c1e3ccSAndroid Build Coastguard Worker // reference modes are searched before compound modes. It is better to search 1024*77c1e3ccSAndroid Build Coastguard Worker // same single inter mode as a group. 1025*77c1e3ccSAndroid Build Coastguard Worker int prune_comp_search_by_single_result; 1026*77c1e3ccSAndroid Build Coastguard Worker 1027*77c1e3ccSAndroid Build Coastguard Worker // Instead of performing a full MV search, do a simple translation first 1028*77c1e3ccSAndroid Build Coastguard Worker // and only perform a full MV search on the motion vectors that performed 1029*77c1e3ccSAndroid Build Coastguard Worker // well. 1030*77c1e3ccSAndroid Build Coastguard Worker int prune_mode_search_simple_translation; 1031*77c1e3ccSAndroid Build Coastguard Worker 1032*77c1e3ccSAndroid Build Coastguard Worker // Only search compound modes with at least one "good" reference frame. 1033*77c1e3ccSAndroid Build Coastguard Worker // A reference frame is good if, after looking at its performance among 1034*77c1e3ccSAndroid Build Coastguard Worker // the single reference modes, it is one of the two best performers. 1035*77c1e3ccSAndroid Build Coastguard Worker int prune_compound_using_single_ref; 1036*77c1e3ccSAndroid Build Coastguard Worker 1037*77c1e3ccSAndroid Build Coastguard Worker // Skip extended compound mode (NEAREST_NEWMV, NEW_NEARESTMV, NEAR_NEWMV, 1038*77c1e3ccSAndroid Build Coastguard Worker // NEW_NEARMV) using ref frames of above and left neighbor 1039*77c1e3ccSAndroid Build Coastguard Worker // blocks. 1040*77c1e3ccSAndroid Build Coastguard Worker // 0 : no pruning 1041*77c1e3ccSAndroid Build Coastguard Worker // 1 : prune ext compound modes using neighbor blocks (less aggressiveness) 1042*77c1e3ccSAndroid Build Coastguard Worker // 2 : prune ext compound modes using neighbor blocks (high aggressiveness) 1043*77c1e3ccSAndroid Build Coastguard Worker // 3 : prune ext compound modes unconditionally (highest aggressiveness) 1044*77c1e3ccSAndroid Build Coastguard Worker int prune_ext_comp_using_neighbors; 1045*77c1e3ccSAndroid Build Coastguard Worker 1046*77c1e3ccSAndroid Build Coastguard Worker // Skip NEW_NEARMV and NEAR_NEWMV extended compound modes 1047*77c1e3ccSAndroid Build Coastguard Worker int skip_ext_comp_nearmv_mode; 1048*77c1e3ccSAndroid Build Coastguard Worker 1049*77c1e3ccSAndroid Build Coastguard Worker // Skip extended compound mode when ref frame corresponding to NEWMV does not 1050*77c1e3ccSAndroid Build Coastguard Worker // have NEWMV as single mode winner. 1051*77c1e3ccSAndroid Build Coastguard Worker // 0 : no pruning 1052*77c1e3ccSAndroid Build Coastguard Worker // 1 : prune extended compound mode (less aggressiveness) 1053*77c1e3ccSAndroid Build Coastguard Worker // 2 : prune extended compound mode (high aggressiveness) 1054*77c1e3ccSAndroid Build Coastguard Worker int prune_comp_using_best_single_mode_ref; 1055*77c1e3ccSAndroid Build Coastguard Worker 1056*77c1e3ccSAndroid Build Coastguard Worker // Skip NEARESTMV and NEARMV using weight computed in ref mv list population 1057*77c1e3ccSAndroid Build Coastguard Worker // 1058*77c1e3ccSAndroid Build Coastguard Worker // Pruning is enabled only when both the top and left neighbor blocks are 1059*77c1e3ccSAndroid Build Coastguard Worker // available and when the current block already has a valid inter prediction. 1060*77c1e3ccSAndroid Build Coastguard Worker int prune_nearest_near_mv_using_refmv_weight; 1061*77c1e3ccSAndroid Build Coastguard Worker 1062*77c1e3ccSAndroid Build Coastguard Worker // Based on previous ref_mv_idx search result, prune the following search. 1063*77c1e3ccSAndroid Build Coastguard Worker int prune_ref_mv_idx_search; 1064*77c1e3ccSAndroid Build Coastguard Worker 1065*77c1e3ccSAndroid Build Coastguard Worker // Disable one sided compound modes. 1066*77c1e3ccSAndroid Build Coastguard Worker int disable_onesided_comp; 1067*77c1e3ccSAndroid Build Coastguard Worker 1068*77c1e3ccSAndroid Build Coastguard Worker // Prune obmc search using previous frame stats. 1069*77c1e3ccSAndroid Build Coastguard Worker // INT_MAX : disable obmc search 1070*77c1e3ccSAndroid Build Coastguard Worker int prune_obmc_prob_thresh; 1071*77c1e3ccSAndroid Build Coastguard Worker 1072*77c1e3ccSAndroid Build Coastguard Worker // Prune warped motion search using previous frame stats. 1073*77c1e3ccSAndroid Build Coastguard Worker int prune_warped_prob_thresh; 1074*77c1e3ccSAndroid Build Coastguard Worker 1075*77c1e3ccSAndroid Build Coastguard Worker // Variance threshold to enable/disable Interintra wedge search 1076*77c1e3ccSAndroid Build Coastguard Worker unsigned int disable_interintra_wedge_var_thresh; 1077*77c1e3ccSAndroid Build Coastguard Worker 1078*77c1e3ccSAndroid Build Coastguard Worker // Variance threshold to enable/disable Interinter wedge search 1079*77c1e3ccSAndroid Build Coastguard Worker unsigned int disable_interinter_wedge_var_thresh; 1080*77c1e3ccSAndroid Build Coastguard Worker 1081*77c1e3ccSAndroid Build Coastguard Worker // De-couple wedge and mode search during interintra RDO. 1082*77c1e3ccSAndroid Build Coastguard Worker int fast_interintra_wedge_search; 1083*77c1e3ccSAndroid Build Coastguard Worker 1084*77c1e3ccSAndroid Build Coastguard Worker // Whether fast wedge sign estimate is used 1085*77c1e3ccSAndroid Build Coastguard Worker int fast_wedge_sign_estimate; 1086*77c1e3ccSAndroid Build Coastguard Worker 1087*77c1e3ccSAndroid Build Coastguard Worker // Enable/disable ME for interinter wedge search. 1088*77c1e3ccSAndroid Build Coastguard Worker int disable_interinter_wedge_newmv_search; 1089*77c1e3ccSAndroid Build Coastguard Worker 1090*77c1e3ccSAndroid Build Coastguard Worker // Decide when and how to use joint_comp. 1091*77c1e3ccSAndroid Build Coastguard Worker DIST_WTD_COMP_FLAG use_dist_wtd_comp_flag; 1092*77c1e3ccSAndroid Build Coastguard Worker 1093*77c1e3ccSAndroid Build Coastguard Worker // Clip the frequency of updating the mv cost. 1094*77c1e3ccSAndroid Build Coastguard Worker INTERNAL_COST_UPDATE_TYPE mv_cost_upd_level; 1095*77c1e3ccSAndroid Build Coastguard Worker 1096*77c1e3ccSAndroid Build Coastguard Worker // Clip the frequency of updating the coeff cost. 1097*77c1e3ccSAndroid Build Coastguard Worker INTERNAL_COST_UPDATE_TYPE coeff_cost_upd_level; 1098*77c1e3ccSAndroid Build Coastguard Worker 1099*77c1e3ccSAndroid Build Coastguard Worker // Clip the frequency of updating the mode cost. 1100*77c1e3ccSAndroid Build Coastguard Worker INTERNAL_COST_UPDATE_TYPE mode_cost_upd_level; 1101*77c1e3ccSAndroid Build Coastguard Worker 1102*77c1e3ccSAndroid Build Coastguard Worker // Prune inter modes based on tpl stats 1103*77c1e3ccSAndroid Build Coastguard Worker // 0 : no pruning 1104*77c1e3ccSAndroid Build Coastguard Worker // 1 - 3 indicate increasing aggressiveness in order. 1105*77c1e3ccSAndroid Build Coastguard Worker int prune_inter_modes_based_on_tpl; 1106*77c1e3ccSAndroid Build Coastguard Worker 1107*77c1e3ccSAndroid Build Coastguard Worker // Skip NEARMV and NEAR_NEARMV modes using ref frames of above and left 1108*77c1e3ccSAndroid Build Coastguard Worker // neighbor blocks and qindex. 1109*77c1e3ccSAndroid Build Coastguard Worker PRUNE_NEARMV_LEVEL prune_nearmv_using_neighbors; 1110*77c1e3ccSAndroid Build Coastguard Worker 1111*77c1e3ccSAndroid Build Coastguard Worker // Model based breakout after interpolation filter search 1112*77c1e3ccSAndroid Build Coastguard Worker // 0: no breakout 1113*77c1e3ccSAndroid Build Coastguard Worker // 1: use model based rd breakout 1114*77c1e3ccSAndroid Build Coastguard Worker int model_based_post_interp_filter_breakout; 1115*77c1e3ccSAndroid Build Coastguard Worker 1116*77c1e3ccSAndroid Build Coastguard Worker // Reuse compound type rd decision when exact match is found 1117*77c1e3ccSAndroid Build Coastguard Worker // 0: No reuse 1118*77c1e3ccSAndroid Build Coastguard Worker // 1: Reuse the compound type decision 1119*77c1e3ccSAndroid Build Coastguard Worker int reuse_compound_type_decision; 1120*77c1e3ccSAndroid Build Coastguard Worker 1121*77c1e3ccSAndroid Build Coastguard Worker // Enable/disable masked compound. 1122*77c1e3ccSAndroid Build Coastguard Worker int disable_masked_comp; 1123*77c1e3ccSAndroid Build Coastguard Worker 1124*77c1e3ccSAndroid Build Coastguard Worker // Enable/disable MV refinement for compound modes corresponds to compound 1125*77c1e3ccSAndroid Build Coastguard Worker // types COMPOUND_AVERAGE, COMPOUND_DISTWTD (currently, this compound type 1126*77c1e3ccSAndroid Build Coastguard Worker // is disabled for speeds >= 2 using the sf 'use_dist_wtd_comp_flag') and 1127*77c1e3ccSAndroid Build Coastguard Worker // COMPOUND_DIFFWTD based on the availability. Levels 0 to 3 indicate 1128*77c1e3ccSAndroid Build Coastguard Worker // increasing order of aggressiveness to disable MV refinement. 1129*77c1e3ccSAndroid Build Coastguard Worker // 0: MV Refinement is enabled and for NEW_NEWMV mode used two iterations of 1130*77c1e3ccSAndroid Build Coastguard Worker // refinement in av1_joint_motion_search(). 1131*77c1e3ccSAndroid Build Coastguard Worker // 1: MV Refinement is disabled for COMPOUND_DIFFWTD and enabled for 1132*77c1e3ccSAndroid Build Coastguard Worker // COMPOUND_AVERAGE & COMPOUND_DISTWTD. 1133*77c1e3ccSAndroid Build Coastguard Worker // 2: MV Refinement is enabled for COMPOUND_AVERAGE & COMPOUND_DISTWTD for 1134*77c1e3ccSAndroid Build Coastguard Worker // NEW_NEWMV mode with one iteration of refinement in 1135*77c1e3ccSAndroid Build Coastguard Worker // av1_joint_motion_search() and MV Refinement is disabled for other compound 1136*77c1e3ccSAndroid Build Coastguard Worker // type modes. 1137*77c1e3ccSAndroid Build Coastguard Worker // 3: MV Refinement is disabled. 1138*77c1e3ccSAndroid Build Coastguard Worker int enable_fast_compound_mode_search; 1139*77c1e3ccSAndroid Build Coastguard Worker 1140*77c1e3ccSAndroid Build Coastguard Worker // Reuse masked compound type search results 1141*77c1e3ccSAndroid Build Coastguard Worker int reuse_mask_search_results; 1142*77c1e3ccSAndroid Build Coastguard Worker 1143*77c1e3ccSAndroid Build Coastguard Worker // Enable/disable fast search for wedge masks 1144*77c1e3ccSAndroid Build Coastguard Worker int enable_fast_wedge_mask_search; 1145*77c1e3ccSAndroid Build Coastguard Worker 1146*77c1e3ccSAndroid Build Coastguard Worker // Early breakout from transform search of inter modes 1147*77c1e3ccSAndroid Build Coastguard Worker int inter_mode_txfm_breakout; 1148*77c1e3ccSAndroid Build Coastguard Worker 1149*77c1e3ccSAndroid Build Coastguard Worker // Limit number of inter modes for txfm search if a newmv mode gets 1150*77c1e3ccSAndroid Build Coastguard Worker // evaluated among the top modes. 1151*77c1e3ccSAndroid Build Coastguard Worker // 0: no pruning 1152*77c1e3ccSAndroid Build Coastguard Worker // 1 to 3 indicate increasing order of aggressiveness 1153*77c1e3ccSAndroid Build Coastguard Worker int limit_inter_mode_cands; 1154*77c1e3ccSAndroid Build Coastguard Worker 1155*77c1e3ccSAndroid Build Coastguard Worker // Cap the no. of txfm searches for a given prediction mode. 1156*77c1e3ccSAndroid Build Coastguard Worker // 0: no cap, 1: cap beyond first 4 searches, 2: cap beyond first 3 searches. 1157*77c1e3ccSAndroid Build Coastguard Worker int limit_txfm_eval_per_mode; 1158*77c1e3ccSAndroid Build Coastguard Worker 1159*77c1e3ccSAndroid Build Coastguard Worker // Prune warped motion search based on block size. 1160*77c1e3ccSAndroid Build Coastguard Worker int extra_prune_warped; 1161*77c1e3ccSAndroid Build Coastguard Worker 1162*77c1e3ccSAndroid Build Coastguard Worker // Do not search compound modes for ARF. 1163*77c1e3ccSAndroid Build Coastguard Worker // The intuition is that ARF is predicted by frames far away from it, 1164*77c1e3ccSAndroid Build Coastguard Worker // whose temporal correlations with the ARF are likely low. 1165*77c1e3ccSAndroid Build Coastguard Worker // It is therefore likely that compound modes do not work as well for ARF 1166*77c1e3ccSAndroid Build Coastguard Worker // as other inter frames. 1167*77c1e3ccSAndroid Build Coastguard Worker // Speed/quality impact: 1168*77c1e3ccSAndroid Build Coastguard Worker // Speed 1: 12% faster, 0.1% psnr loss. 1169*77c1e3ccSAndroid Build Coastguard Worker // Speed 2: 2% faster, 0.05% psnr loss. 1170*77c1e3ccSAndroid Build Coastguard Worker // No change for speed 3 and up, because |disable_onesided_comp| is true. 1171*77c1e3ccSAndroid Build Coastguard Worker int skip_arf_compound; 1172*77c1e3ccSAndroid Build Coastguard Worker } INTER_MODE_SPEED_FEATURES; 1173*77c1e3ccSAndroid Build Coastguard Worker 1174*77c1e3ccSAndroid Build Coastguard Worker typedef struct INTERP_FILTER_SPEED_FEATURES { 1175*77c1e3ccSAndroid Build Coastguard Worker // Do limited interpolation filter search for dual filters, since best choice 1176*77c1e3ccSAndroid Build Coastguard Worker // usually includes EIGHTTAP_REGULAR. 1177*77c1e3ccSAndroid Build Coastguard Worker int use_fast_interpolation_filter_search; 1178*77c1e3ccSAndroid Build Coastguard Worker 1179*77c1e3ccSAndroid Build Coastguard Worker // Disable dual filter 1180*77c1e3ccSAndroid Build Coastguard Worker int disable_dual_filter; 1181*77c1e3ccSAndroid Build Coastguard Worker 1182*77c1e3ccSAndroid Build Coastguard Worker // Save results of av1_interpolation_filter_search for a block 1183*77c1e3ccSAndroid Build Coastguard Worker // Check mv and ref_frames before search, if they are very close with previous 1184*77c1e3ccSAndroid Build Coastguard Worker // saved results, filter search can be skipped. 1185*77c1e3ccSAndroid Build Coastguard Worker int use_interp_filter; 1186*77c1e3ccSAndroid Build Coastguard Worker 1187*77c1e3ccSAndroid Build Coastguard Worker // skip sharp_filter evaluation based on regular and smooth filter rd for 1188*77c1e3ccSAndroid Build Coastguard Worker // dual_filter=0 case 1189*77c1e3ccSAndroid Build Coastguard Worker int skip_sharp_interp_filter_search; 1190*77c1e3ccSAndroid Build Coastguard Worker 1191*77c1e3ccSAndroid Build Coastguard Worker // skip interpolation filter search for a block in chessboard pattern 1192*77c1e3ccSAndroid Build Coastguard Worker int cb_pred_filter_search; 1193*77c1e3ccSAndroid Build Coastguard Worker 1194*77c1e3ccSAndroid Build Coastguard Worker // adaptive interp_filter search to allow skip of certain filter types. 1195*77c1e3ccSAndroid Build Coastguard Worker int adaptive_interp_filter_search; 1196*77c1e3ccSAndroid Build Coastguard Worker 1197*77c1e3ccSAndroid Build Coastguard Worker // Forces interpolation filter to EIGHTTAP_REGULAR and skips interpolation 1198*77c1e3ccSAndroid Build Coastguard Worker // filter search. 1199*77c1e3ccSAndroid Build Coastguard Worker int skip_interp_filter_search; 1200*77c1e3ccSAndroid Build Coastguard Worker } INTERP_FILTER_SPEED_FEATURES; 1201*77c1e3ccSAndroid Build Coastguard Worker 1202*77c1e3ccSAndroid Build Coastguard Worker typedef struct INTRA_MODE_SPEED_FEATURES { 1203*77c1e3ccSAndroid Build Coastguard Worker // These bit masks allow you to enable or disable intra modes for each 1204*77c1e3ccSAndroid Build Coastguard Worker // transform size separately. 1205*77c1e3ccSAndroid Build Coastguard Worker int intra_y_mode_mask[TX_SIZES]; 1206*77c1e3ccSAndroid Build Coastguard Worker int intra_uv_mode_mask[TX_SIZES]; 1207*77c1e3ccSAndroid Build Coastguard Worker 1208*77c1e3ccSAndroid Build Coastguard Worker // flag to allow skipping intra mode for inter frame prediction 1209*77c1e3ccSAndroid Build Coastguard Worker int skip_intra_in_interframe; 1210*77c1e3ccSAndroid Build Coastguard Worker 1211*77c1e3ccSAndroid Build Coastguard Worker // Prune intra mode candidates based on source block histogram of gradient. 1212*77c1e3ccSAndroid Build Coastguard Worker // Applies to luma plane only. 1213*77c1e3ccSAndroid Build Coastguard Worker // Feasible values are 0..4. The feature is disabled for 0. An increasing 1214*77c1e3ccSAndroid Build Coastguard Worker // value indicates more aggressive pruning threshold. 1215*77c1e3ccSAndroid Build Coastguard Worker int intra_pruning_with_hog; 1216*77c1e3ccSAndroid Build Coastguard Worker 1217*77c1e3ccSAndroid Build Coastguard Worker // Prune intra mode candidates based on source block histogram of gradient. 1218*77c1e3ccSAndroid Build Coastguard Worker // Applies to chroma plane only. 1219*77c1e3ccSAndroid Build Coastguard Worker // Feasible values are 0..4. The feature is disabled for 0. An increasing 1220*77c1e3ccSAndroid Build Coastguard Worker // value indicates more aggressive pruning threshold. 1221*77c1e3ccSAndroid Build Coastguard Worker int chroma_intra_pruning_with_hog; 1222*77c1e3ccSAndroid Build Coastguard Worker 1223*77c1e3ccSAndroid Build Coastguard Worker // Enable/disable smooth intra modes. 1224*77c1e3ccSAndroid Build Coastguard Worker int disable_smooth_intra; 1225*77c1e3ccSAndroid Build Coastguard Worker 1226*77c1e3ccSAndroid Build Coastguard Worker // Prune UV_SMOOTH_PRED mode for chroma based on chroma source variance. 1227*77c1e3ccSAndroid Build Coastguard Worker // false : No pruning 1228*77c1e3ccSAndroid Build Coastguard Worker // true : Prune UV_SMOOTH_PRED mode based on chroma source variance 1229*77c1e3ccSAndroid Build Coastguard Worker // 1230*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this speed feature reduces instruction count 1231*77c1e3ccSAndroid Build Coastguard Worker // by 1.90%, 2.21% and 1.97% for speed 6, 7 and 8 with coding performance 1232*77c1e3ccSAndroid Build Coastguard Worker // change less than 0.04%. For AVIF image encode, this speed feature reduces 1233*77c1e3ccSAndroid Build Coastguard Worker // encode time by 1.56%, 2.14% and 0.90% for speed 6, 7 and 8 on a typical 1234*77c1e3ccSAndroid Build Coastguard Worker // image dataset with coding performance change less than 0.05%. 1235*77c1e3ccSAndroid Build Coastguard Worker bool prune_smooth_intra_mode_for_chroma; 1236*77c1e3ccSAndroid Build Coastguard Worker 1237*77c1e3ccSAndroid Build Coastguard Worker // Prune filter intra modes in intra frames. 1238*77c1e3ccSAndroid Build Coastguard Worker // 0 : No pruning 1239*77c1e3ccSAndroid Build Coastguard Worker // 1 : Evaluate applicable filter intra modes based on best intra mode so far 1240*77c1e3ccSAndroid Build Coastguard Worker // 2 : Do not evaluate filter intra modes 1241*77c1e3ccSAndroid Build Coastguard Worker int prune_filter_intra_level; 1242*77c1e3ccSAndroid Build Coastguard Worker 1243*77c1e3ccSAndroid Build Coastguard Worker // prune palette search 1244*77c1e3ccSAndroid Build Coastguard Worker // 0: No pruning 1245*77c1e3ccSAndroid Build Coastguard Worker // 1: Perform coarse search to prune the palette colors. For winner colors, 1246*77c1e3ccSAndroid Build Coastguard Worker // neighbors are also evaluated using a finer search. 1247*77c1e3ccSAndroid Build Coastguard Worker // 2: Perform 2 way palette search from max colors to min colors (and min 1248*77c1e3ccSAndroid Build Coastguard Worker // colors to remaining colors) and terminate the search if current number of 1249*77c1e3ccSAndroid Build Coastguard Worker // palette colors is not the winner. 1250*77c1e3ccSAndroid Build Coastguard Worker int prune_palette_search_level; 1251*77c1e3ccSAndroid Build Coastguard Worker 1252*77c1e3ccSAndroid Build Coastguard Worker // Terminate early in luma palette_size search. Speed feature values indicate 1253*77c1e3ccSAndroid Build Coastguard Worker // increasing level of pruning. 1254*77c1e3ccSAndroid Build Coastguard Worker // 0: No early termination 1255*77c1e3ccSAndroid Build Coastguard Worker // 1: Terminate early for higher luma palette_size, if header rd cost of lower 1256*77c1e3ccSAndroid Build Coastguard Worker // palette_size is more than 2 * best_rd. This level of pruning is more 1257*77c1e3ccSAndroid Build Coastguard Worker // conservative when compared to sf level 2 as the cases which will get pruned 1258*77c1e3ccSAndroid Build Coastguard Worker // with sf level 1 is a subset of the cases which will get pruned with sf 1259*77c1e3ccSAndroid Build Coastguard Worker // level 2. 1260*77c1e3ccSAndroid Build Coastguard Worker // 2: Terminate early for higher luma palette_size, if header rd cost of lower 1261*77c1e3ccSAndroid Build Coastguard Worker // palette_size is more than best_rd. 1262*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this sf reduces instruction count by 2.49%, 1.07%, 1263*77c1e3ccSAndroid Build Coastguard Worker // 2.76%, 2.30%, 1.84%, 2.69%, 2.04%, 2.05% and 1.44% for speed 0, 1, 2, 3, 4, 1264*77c1e3ccSAndroid Build Coastguard Worker // 5, 6, 7 and 8 on screen content set with coding performance change less 1265*77c1e3ccSAndroid Build Coastguard Worker // than 0.01% for speed <= 2 and less than 0.03% for speed >= 3. For AVIF 1266*77c1e3ccSAndroid Build Coastguard Worker // image encode, this sf reduces instruction count by 1.94%, 1.13%, 1.29%, 1267*77c1e3ccSAndroid Build Coastguard Worker // 0.93%, 0.89%, 1.03%, 1.07%, 1.20% and 0.18% for speed 0, 1, 2, 3, 4, 5, 6, 1268*77c1e3ccSAndroid Build Coastguard Worker // 7 and 8 on a typical image dataset with coding performance change less than 1269*77c1e3ccSAndroid Build Coastguard Worker // 0.01%. 1270*77c1e3ccSAndroid Build Coastguard Worker int prune_luma_palette_size_search_level; 1271*77c1e3ccSAndroid Build Coastguard Worker 1272*77c1e3ccSAndroid Build Coastguard Worker // Prune chroma intra modes based on luma intra mode winner. 1273*77c1e3ccSAndroid Build Coastguard Worker // 0: No pruning 1274*77c1e3ccSAndroid Build Coastguard Worker // 1: Prune chroma intra modes other than UV_DC_PRED, UV_SMOOTH_PRED, 1275*77c1e3ccSAndroid Build Coastguard Worker // UV_CFL_PRED and the mode that corresponds to luma intra mode winner. 1276*77c1e3ccSAndroid Build Coastguard Worker int prune_chroma_modes_using_luma_winner; 1277*77c1e3ccSAndroid Build Coastguard Worker 1278*77c1e3ccSAndroid Build Coastguard Worker // Clip the frequency of updating the mv cost for intrabc. 1279*77c1e3ccSAndroid Build Coastguard Worker INTERNAL_COST_UPDATE_TYPE dv_cost_upd_level; 1280*77c1e3ccSAndroid Build Coastguard Worker 1281*77c1e3ccSAndroid Build Coastguard Worker // We use DCT_DCT transform followed by computing SATD (Sum of Absolute 1282*77c1e3ccSAndroid Build Coastguard Worker // Transformed Differences) as an estimation of RD score to quickly find the 1283*77c1e3ccSAndroid Build Coastguard Worker // best possible Chroma from Luma (CFL) parameter. Then we do a full RD search 1284*77c1e3ccSAndroid Build Coastguard Worker // near the best possible parameter. The search range is set here. 1285*77c1e3ccSAndroid Build Coastguard Worker // The range of cfl_searh_range should be [1, 33], and the following are the 1286*77c1e3ccSAndroid Build Coastguard Worker // recommended values. 1287*77c1e3ccSAndroid Build Coastguard Worker // 1: Fastest mode. 1288*77c1e3ccSAndroid Build Coastguard Worker // 3: Default mode that provides good speedup without losing compression 1289*77c1e3ccSAndroid Build Coastguard Worker // performance at speed 0. 1290*77c1e3ccSAndroid Build Coastguard Worker // 33: Exhaustive rd search (33 == CFL_MAGS_SIZE). This mode should only 1291*77c1e3ccSAndroid Build Coastguard Worker // be used for debugging purpose. 1292*77c1e3ccSAndroid Build Coastguard Worker int cfl_search_range; 1293*77c1e3ccSAndroid Build Coastguard Worker 1294*77c1e3ccSAndroid Build Coastguard Worker // TOP_INTRA_MODEL_COUNT is 4 that is the number of top model rd to store in 1295*77c1e3ccSAndroid Build Coastguard Worker // intra mode decision. Here, add a speed feature to reduce this number for 1296*77c1e3ccSAndroid Build Coastguard Worker // higher speeds. 1297*77c1e3ccSAndroid Build Coastguard Worker int top_intra_model_count_allowed; 1298*77c1e3ccSAndroid Build Coastguard Worker 1299*77c1e3ccSAndroid Build Coastguard Worker // Adapt top_intra_model_count_allowed locally to prune luma intra modes using 1300*77c1e3ccSAndroid Build Coastguard Worker // neighbor block and quantizer information. 1301*77c1e3ccSAndroid Build Coastguard Worker int adapt_top_model_rd_count_using_neighbors; 1302*77c1e3ccSAndroid Build Coastguard Worker 1303*77c1e3ccSAndroid Build Coastguard Worker // Prune the evaluation of odd delta angles of directional luma intra modes by 1304*77c1e3ccSAndroid Build Coastguard Worker // using the rdcosts of neighbouring delta angles. 1305*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this speed feature reduces instruction count 1306*77c1e3ccSAndroid Build Coastguard Worker // by 4.461%, 3.699% and 3.536% for speed 6, 7 and 8 on a typical video 1307*77c1e3ccSAndroid Build Coastguard Worker // dataset with coding performance change less than 0.26%. For AVIF image 1308*77c1e3ccSAndroid Build Coastguard Worker // encode, this speed feature reduces encode time by 2.849%, 2.471%, 1309*77c1e3ccSAndroid Build Coastguard Worker // and 2.051% for speed 6, 7 and 8 on a typical image dataset with coding 1310*77c1e3ccSAndroid Build Coastguard Worker // performance change less than 0.27%. 1311*77c1e3ccSAndroid Build Coastguard Worker int prune_luma_odd_delta_angles_in_intra; 1312*77c1e3ccSAndroid Build Coastguard Worker 1313*77c1e3ccSAndroid Build Coastguard Worker // Terminate early in chroma palette_size search. 1314*77c1e3ccSAndroid Build Coastguard Worker // 0: No early termination 1315*77c1e3ccSAndroid Build Coastguard Worker // 1: Terminate early for higher palette_size, if header rd cost of lower 1316*77c1e3ccSAndroid Build Coastguard Worker // palette_size is more than best_rd. 1317*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this sf reduces instruction count by 0.45%, 1318*77c1e3ccSAndroid Build Coastguard Worker // 0.62%, 1.73%, 2.50%, 2.89%, 3.09% and 3.86% for speed 0 to 6 on screen 1319*77c1e3ccSAndroid Build Coastguard Worker // content set with coding performance change less than 0.01%. 1320*77c1e3ccSAndroid Build Coastguard Worker // For AVIF image encode, this sf reduces instruction count by 0.45%, 0.81%, 1321*77c1e3ccSAndroid Build Coastguard Worker // 0.85%, 1.05%, 1.45%, 1.66% and 1.95% for speed 0 to 6 on a typical image 1322*77c1e3ccSAndroid Build Coastguard Worker // dataset with no quality drop. 1323*77c1e3ccSAndroid Build Coastguard Worker int early_term_chroma_palette_size_search; 1324*77c1e3ccSAndroid Build Coastguard Worker 1325*77c1e3ccSAndroid Build Coastguard Worker // Skips the evaluation of filter intra modes in inter frames if rd evaluation 1326*77c1e3ccSAndroid Build Coastguard Worker // of luma intra dc mode results in invalid rd stats. 1327*77c1e3ccSAndroid Build Coastguard Worker int skip_filter_intra_in_inter_frames; 1328*77c1e3ccSAndroid Build Coastguard Worker } INTRA_MODE_SPEED_FEATURES; 1329*77c1e3ccSAndroid Build Coastguard Worker 1330*77c1e3ccSAndroid Build Coastguard Worker typedef struct TX_SPEED_FEATURES { 1331*77c1e3ccSAndroid Build Coastguard Worker // Init search depth for square and rectangular transform partitions. 1332*77c1e3ccSAndroid Build Coastguard Worker // Values: 1333*77c1e3ccSAndroid Build Coastguard Worker // 0 - search full tree, 1: search 1 level, 2: search the highest level only 1334*77c1e3ccSAndroid Build Coastguard Worker int inter_tx_size_search_init_depth_sqr; 1335*77c1e3ccSAndroid Build Coastguard Worker int inter_tx_size_search_init_depth_rect; 1336*77c1e3ccSAndroid Build Coastguard Worker int intra_tx_size_search_init_depth_sqr; 1337*77c1e3ccSAndroid Build Coastguard Worker int intra_tx_size_search_init_depth_rect; 1338*77c1e3ccSAndroid Build Coastguard Worker 1339*77c1e3ccSAndroid Build Coastguard Worker // If any dimension of a coding block size above 64, always search the 1340*77c1e3ccSAndroid Build Coastguard Worker // largest transform only, since the largest transform block size is 64x64. 1341*77c1e3ccSAndroid Build Coastguard Worker int tx_size_search_lgr_block; 1342*77c1e3ccSAndroid Build Coastguard Worker 1343*77c1e3ccSAndroid Build Coastguard Worker TX_TYPE_SEARCH tx_type_search; 1344*77c1e3ccSAndroid Build Coastguard Worker 1345*77c1e3ccSAndroid Build Coastguard Worker // Skip split transform block partition when the collocated bigger block 1346*77c1e3ccSAndroid Build Coastguard Worker // is selected as all zero coefficients. 1347*77c1e3ccSAndroid Build Coastguard Worker int txb_split_cap; 1348*77c1e3ccSAndroid Build Coastguard Worker 1349*77c1e3ccSAndroid Build Coastguard Worker // Shortcut the transform block partition and type search when the target 1350*77c1e3ccSAndroid Build Coastguard Worker // rdcost is relatively lower. 1351*77c1e3ccSAndroid Build Coastguard Worker // Values are 0 (not used) , or 1 - 2 with progressively increasing 1352*77c1e3ccSAndroid Build Coastguard Worker // aggressiveness 1353*77c1e3ccSAndroid Build Coastguard Worker int adaptive_txb_search_level; 1354*77c1e3ccSAndroid Build Coastguard Worker 1355*77c1e3ccSAndroid Build Coastguard Worker // Prune level for tx_size_type search for inter based on rd model 1356*77c1e3ccSAndroid Build Coastguard Worker // 0: no pruning 1357*77c1e3ccSAndroid Build Coastguard Worker // 1-2: progressively increasing aggressiveness of pruning 1358*77c1e3ccSAndroid Build Coastguard Worker int model_based_prune_tx_search_level; 1359*77c1e3ccSAndroid Build Coastguard Worker 1360*77c1e3ccSAndroid Build Coastguard Worker // Refine TX type after fast TX search. 1361*77c1e3ccSAndroid Build Coastguard Worker int refine_fast_tx_search_results; 1362*77c1e3ccSAndroid Build Coastguard Worker 1363*77c1e3ccSAndroid Build Coastguard Worker // Prune transform split/no_split eval based on residual properties. A value 1364*77c1e3ccSAndroid Build Coastguard Worker // of 0 indicates no pruning, and the aggressiveness of pruning progressively 1365*77c1e3ccSAndroid Build Coastguard Worker // increases from levels 1 to 3. 1366*77c1e3ccSAndroid Build Coastguard Worker int prune_tx_size_level; 1367*77c1e3ccSAndroid Build Coastguard Worker 1368*77c1e3ccSAndroid Build Coastguard Worker // Prune the evaluation of transform depths as decided by the NN model. 1369*77c1e3ccSAndroid Build Coastguard Worker // false: No pruning. 1370*77c1e3ccSAndroid Build Coastguard Worker // true : Avoid the evaluation of specific transform depths using NN model. 1371*77c1e3ccSAndroid Build Coastguard Worker // 1372*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this speed feature reduces instruction count 1373*77c1e3ccSAndroid Build Coastguard Worker // by 4.76%, 8.92% and 11.28% for speed 6, 7 and 8 with coding performance 1374*77c1e3ccSAndroid Build Coastguard Worker // change less than 0.32%. For AVIF image encode, this speed feature reduces 1375*77c1e3ccSAndroid Build Coastguard Worker // encode time by 4.65%, 9.16% and 10.45% for speed 6, 7 and 8 on a typical 1376*77c1e3ccSAndroid Build Coastguard Worker // image dataset with coding performance change less than 0.19%. 1377*77c1e3ccSAndroid Build Coastguard Worker bool prune_intra_tx_depths_using_nn; 1378*77c1e3ccSAndroid Build Coastguard Worker 1379*77c1e3ccSAndroid Build Coastguard Worker // Enable/disable early breakout during transform search of intra modes, by 1380*77c1e3ccSAndroid Build Coastguard Worker // using the minimum rd cost possible. By using this approach, the rd 1381*77c1e3ccSAndroid Build Coastguard Worker // evaluation of applicable transform blocks (in the current block) can be 1382*77c1e3ccSAndroid Build Coastguard Worker // avoided as 1383*77c1e3ccSAndroid Build Coastguard Worker // 1) best_rd evolves during the search in choose_tx_size_type_from_rd() 1384*77c1e3ccSAndroid Build Coastguard Worker // 2) appropriate ref_best_rd is passed in intra_block_yrd() 1385*77c1e3ccSAndroid Build Coastguard Worker // 1386*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this speed feature reduces instruction count 1387*77c1e3ccSAndroid Build Coastguard Worker // by 1.11%, 1.08%, 1.02% and 0.93% for speed 3, 6, 7 and 8 with coding 1388*77c1e3ccSAndroid Build Coastguard Worker // performance change less than 0.02%. For AVIF image encode, this speed 1389*77c1e3ccSAndroid Build Coastguard Worker // feature reduces encode time by 0.93%, 1.46%, 1.07%, 0.84%, 0.99% and 0.73% 1390*77c1e3ccSAndroid Build Coastguard Worker // for speed 3, 4, 5, 6, 7 and 8 on a typical image dataset with coding 1391*77c1e3ccSAndroid Build Coastguard Worker // performance change less than 0.004%. 1392*77c1e3ccSAndroid Build Coastguard Worker bool use_rd_based_breakout_for_intra_tx_search; 1393*77c1e3ccSAndroid Build Coastguard Worker } TX_SPEED_FEATURES; 1394*77c1e3ccSAndroid Build Coastguard Worker 1395*77c1e3ccSAndroid Build Coastguard Worker typedef struct RD_CALC_SPEED_FEATURES { 1396*77c1e3ccSAndroid Build Coastguard Worker // Fast approximation of av1_model_rd_from_var_lapndz 1397*77c1e3ccSAndroid Build Coastguard Worker int simple_model_rd_from_var; 1398*77c1e3ccSAndroid Build Coastguard Worker 1399*77c1e3ccSAndroid Build Coastguard Worker // Perform faster distortion computation during the R-D evaluation by trying 1400*77c1e3ccSAndroid Build Coastguard Worker // to approximate the prediction error with transform coefficients (faster but 1401*77c1e3ccSAndroid Build Coastguard Worker // less accurate) rather than computing distortion in the pixel domain (slower 1402*77c1e3ccSAndroid Build Coastguard Worker // but more accurate). The following methods are used for distortion 1403*77c1e3ccSAndroid Build Coastguard Worker // computation: 1404*77c1e3ccSAndroid Build Coastguard Worker // Method 0: Always compute distortion in the pixel domain 1405*77c1e3ccSAndroid Build Coastguard Worker // Method 1: Based on block error, try using transform domain distortion for 1406*77c1e3ccSAndroid Build Coastguard Worker // tx_type search and compute distortion in pixel domain for final RD_STATS 1407*77c1e3ccSAndroid Build Coastguard Worker // Method 2: Based on block error, try to compute distortion in transform 1408*77c1e3ccSAndroid Build Coastguard Worker // domain 1409*77c1e3ccSAndroid Build Coastguard Worker // Methods 1 and 2 may fallback to computing distortion in the pixel domain in 1410*77c1e3ccSAndroid Build Coastguard Worker // case the block error is less than the threshold, which is controlled by the 1411*77c1e3ccSAndroid Build Coastguard Worker // speed feature tx_domain_dist_thres_level. 1412*77c1e3ccSAndroid Build Coastguard Worker // 1413*77c1e3ccSAndroid Build Coastguard Worker // The speed feature tx_domain_dist_level decides which of the above methods 1414*77c1e3ccSAndroid Build Coastguard Worker // needs to be used across different mode evaluation stages as described 1415*77c1e3ccSAndroid Build Coastguard Worker // below: 1416*77c1e3ccSAndroid Build Coastguard Worker // Eval type: Default Mode Winner 1417*77c1e3ccSAndroid Build Coastguard Worker // Level 0 : Method 0 Method 2 Method 0 1418*77c1e3ccSAndroid Build Coastguard Worker // Level 1 : Method 1 Method 2 Method 0 1419*77c1e3ccSAndroid Build Coastguard Worker // Level 2 : Method 2 Method 2 Method 0 1420*77c1e3ccSAndroid Build Coastguard Worker // Level 3 : Method 2 Method 2 Method 2 1421*77c1e3ccSAndroid Build Coastguard Worker int tx_domain_dist_level; 1422*77c1e3ccSAndroid Build Coastguard Worker 1423*77c1e3ccSAndroid Build Coastguard Worker // Transform domain distortion threshold level 1424*77c1e3ccSAndroid Build Coastguard Worker int tx_domain_dist_thres_level; 1425*77c1e3ccSAndroid Build Coastguard Worker 1426*77c1e3ccSAndroid Build Coastguard Worker // Trellis (dynamic programming) optimization of quantized values 1427*77c1e3ccSAndroid Build Coastguard Worker TRELLIS_OPT_TYPE optimize_coefficients; 1428*77c1e3ccSAndroid Build Coastguard Worker 1429*77c1e3ccSAndroid Build Coastguard Worker // Use hash table to store macroblock RD search results 1430*77c1e3ccSAndroid Build Coastguard Worker // to avoid repeated search on the same residue signal. 1431*77c1e3ccSAndroid Build Coastguard Worker int use_mb_rd_hash; 1432*77c1e3ccSAndroid Build Coastguard Worker 1433*77c1e3ccSAndroid Build Coastguard Worker // Flag used to control the extent of coeff R-D optimization 1434*77c1e3ccSAndroid Build Coastguard Worker int perform_coeff_opt; 1435*77c1e3ccSAndroid Build Coastguard Worker } RD_CALC_SPEED_FEATURES; 1436*77c1e3ccSAndroid Build Coastguard Worker 1437*77c1e3ccSAndroid Build Coastguard Worker typedef struct WINNER_MODE_SPEED_FEATURES { 1438*77c1e3ccSAndroid Build Coastguard Worker // Flag used to control the winner mode processing for better R-D optimization 1439*77c1e3ccSAndroid Build Coastguard Worker // of quantized coeffs 1440*77c1e3ccSAndroid Build Coastguard Worker int enable_winner_mode_for_coeff_opt; 1441*77c1e3ccSAndroid Build Coastguard Worker 1442*77c1e3ccSAndroid Build Coastguard Worker // Flag used to control the winner mode processing for transform size 1443*77c1e3ccSAndroid Build Coastguard Worker // search method 1444*77c1e3ccSAndroid Build Coastguard Worker int enable_winner_mode_for_tx_size_srch; 1445*77c1e3ccSAndroid Build Coastguard Worker 1446*77c1e3ccSAndroid Build Coastguard Worker // Control transform size search level 1447*77c1e3ccSAndroid Build Coastguard Worker // Eval type: Default Mode Winner 1448*77c1e3ccSAndroid Build Coastguard Worker // Level 0 : FULL RD LARGEST ALL FULL RD 1449*77c1e3ccSAndroid Build Coastguard Worker // Level 1 : FAST RD LARGEST ALL FULL RD 1450*77c1e3ccSAndroid Build Coastguard Worker // Level 2 : LARGEST ALL LARGEST ALL FULL RD 1451*77c1e3ccSAndroid Build Coastguard Worker // Level 3 : LARGEST ALL LARGEST ALL LARGEST ALL 1452*77c1e3ccSAndroid Build Coastguard Worker int tx_size_search_level; 1453*77c1e3ccSAndroid Build Coastguard Worker 1454*77c1e3ccSAndroid Build Coastguard Worker // Flag used to control the winner mode processing for use transform 1455*77c1e3ccSAndroid Build Coastguard Worker // domain distortion 1456*77c1e3ccSAndroid Build Coastguard Worker int enable_winner_mode_for_use_tx_domain_dist; 1457*77c1e3ccSAndroid Build Coastguard Worker 1458*77c1e3ccSAndroid Build Coastguard Worker // Flag used to enable processing of multiple winner modes 1459*77c1e3ccSAndroid Build Coastguard Worker MULTI_WINNER_MODE_TYPE multi_winner_mode_type; 1460*77c1e3ccSAndroid Build Coastguard Worker 1461*77c1e3ccSAndroid Build Coastguard Worker // Motion mode for winner candidates: 1462*77c1e3ccSAndroid Build Coastguard Worker // 0: speed feature OFF 1463*77c1e3ccSAndroid Build Coastguard Worker // 1 / 2 : Use configured number of winner candidates 1464*77c1e3ccSAndroid Build Coastguard Worker int motion_mode_for_winner_cand; 1465*77c1e3ccSAndroid Build Coastguard Worker 1466*77c1e3ccSAndroid Build Coastguard Worker // Controls the prediction of transform skip block or DC only block. 1467*77c1e3ccSAndroid Build Coastguard Worker // 1468*77c1e3ccSAndroid Build Coastguard Worker // Different speed feature values (0 to 3) decide the aggressiveness of 1469*77c1e3ccSAndroid Build Coastguard Worker // prediction (refer to predict_dc_levels[][] in speed_features.c) to be used 1470*77c1e3ccSAndroid Build Coastguard Worker // during different mode evaluation stages. 1471*77c1e3ccSAndroid Build Coastguard Worker int dc_blk_pred_level; 1472*77c1e3ccSAndroid Build Coastguard Worker 1473*77c1e3ccSAndroid Build Coastguard Worker // If on, disables interpolation filter search in handle_inter_mode loop, and 1474*77c1e3ccSAndroid Build Coastguard Worker // performs it during winner mode processing by \ref 1475*77c1e3ccSAndroid Build Coastguard Worker // tx_search_best_inter_candidates. 1476*77c1e3ccSAndroid Build Coastguard Worker int winner_mode_ifs; 1477*77c1e3ccSAndroid Build Coastguard Worker 1478*77c1e3ccSAndroid Build Coastguard Worker // Controls the disabling of winner mode processing. Speed feature levels 1479*77c1e3ccSAndroid Build Coastguard Worker // are ordered in increasing aggressiveness of pruning. The method considered 1480*77c1e3ccSAndroid Build Coastguard Worker // for disabling, depends on the sf level value and it is described as below. 1481*77c1e3ccSAndroid Build Coastguard Worker // 0: Do not disable 1482*77c1e3ccSAndroid Build Coastguard Worker // 1: Disable for blocks with low source variance. 1483*77c1e3ccSAndroid Build Coastguard Worker // 2: Disable for blocks which turn out to be transform skip (skipped based on 1484*77c1e3ccSAndroid Build Coastguard Worker // eob) during MODE_EVAL stage except NEWMV mode. 1485*77c1e3ccSAndroid Build Coastguard Worker // 3: Disable for blocks which turn out to be transform skip during MODE_EVAL 1486*77c1e3ccSAndroid Build Coastguard Worker // stage except NEWMV mode. For high quantizers, prune conservatively based on 1487*77c1e3ccSAndroid Build Coastguard Worker // transform skip (skipped based on eob) except for NEWMV mode. 1488*77c1e3ccSAndroid Build Coastguard Worker // 4: Disable for blocks which turn out to be transform skip during MODE_EVAL 1489*77c1e3ccSAndroid Build Coastguard Worker // stage. 1490*77c1e3ccSAndroid Build Coastguard Worker int prune_winner_mode_eval_level; 1491*77c1e3ccSAndroid Build Coastguard Worker } WINNER_MODE_SPEED_FEATURES; 1492*77c1e3ccSAndroid Build Coastguard Worker 1493*77c1e3ccSAndroid Build Coastguard Worker typedef struct LOOP_FILTER_SPEED_FEATURES { 1494*77c1e3ccSAndroid Build Coastguard Worker // This feature controls how the loop filter level is determined. 1495*77c1e3ccSAndroid Build Coastguard Worker LPF_PICK_METHOD lpf_pick; 1496*77c1e3ccSAndroid Build Coastguard Worker 1497*77c1e3ccSAndroid Build Coastguard Worker // Skip some final iterations in the determination of the best loop filter 1498*77c1e3ccSAndroid Build Coastguard Worker // level. 1499*77c1e3ccSAndroid Build Coastguard Worker int use_coarse_filter_level_search; 1500*77c1e3ccSAndroid Build Coastguard Worker 1501*77c1e3ccSAndroid Build Coastguard Worker // Control how the CDEF strength is determined. 1502*77c1e3ccSAndroid Build Coastguard Worker CDEF_PICK_METHOD cdef_pick_method; 1503*77c1e3ccSAndroid Build Coastguard Worker 1504*77c1e3ccSAndroid Build Coastguard Worker // Decoder side speed feature to add penalty for use of dual-sgr filters. 1505*77c1e3ccSAndroid Build Coastguard Worker // Takes values 0 - 10, 0 indicating no penalty and each additional level 1506*77c1e3ccSAndroid Build Coastguard Worker // adding a penalty of 1% 1507*77c1e3ccSAndroid Build Coastguard Worker int dual_sgr_penalty_level; 1508*77c1e3ccSAndroid Build Coastguard Worker 1509*77c1e3ccSAndroid Build Coastguard Worker // prune sgr ep using binary search like mechanism 1510*77c1e3ccSAndroid Build Coastguard Worker int enable_sgr_ep_pruning; 1511*77c1e3ccSAndroid Build Coastguard Worker 1512*77c1e3ccSAndroid Build Coastguard Worker // Disable loop restoration for Chroma plane 1513*77c1e3ccSAndroid Build Coastguard Worker int disable_loop_restoration_chroma; 1514*77c1e3ccSAndroid Build Coastguard Worker 1515*77c1e3ccSAndroid Build Coastguard Worker // Disable loop restoration for luma plane 1516*77c1e3ccSAndroid Build Coastguard Worker int disable_loop_restoration_luma; 1517*77c1e3ccSAndroid Build Coastguard Worker 1518*77c1e3ccSAndroid Build Coastguard Worker // Range of loop restoration unit sizes to search 1519*77c1e3ccSAndroid Build Coastguard Worker // The minimum size is clamped against the superblock size in 1520*77c1e3ccSAndroid Build Coastguard Worker // av1_pick_filter_restoration, so that the code which sets this value does 1521*77c1e3ccSAndroid Build Coastguard Worker // not need to know the superblock size ahead of time. 1522*77c1e3ccSAndroid Build Coastguard Worker int min_lr_unit_size; 1523*77c1e3ccSAndroid Build Coastguard Worker int max_lr_unit_size; 1524*77c1e3ccSAndroid Build Coastguard Worker 1525*77c1e3ccSAndroid Build Coastguard Worker // Prune RESTORE_WIENER evaluation based on source variance 1526*77c1e3ccSAndroid Build Coastguard Worker // 0 : no pruning 1527*77c1e3ccSAndroid Build Coastguard Worker // 1 : conservative pruning 1528*77c1e3ccSAndroid Build Coastguard Worker // 2 : aggressive pruning 1529*77c1e3ccSAndroid Build Coastguard Worker int prune_wiener_based_on_src_var; 1530*77c1e3ccSAndroid Build Coastguard Worker 1531*77c1e3ccSAndroid Build Coastguard Worker // Prune self-guided loop restoration based on wiener search results 1532*77c1e3ccSAndroid Build Coastguard Worker // 0 : no pruning 1533*77c1e3ccSAndroid Build Coastguard Worker // 1 : pruning based on rdcost ratio of RESTORE_WIENER and RESTORE_NONE 1534*77c1e3ccSAndroid Build Coastguard Worker // 2 : pruning based on winner restoration type among RESTORE_WIENER and 1535*77c1e3ccSAndroid Build Coastguard Worker // RESTORE_NONE 1536*77c1e3ccSAndroid Build Coastguard Worker int prune_sgr_based_on_wiener; 1537*77c1e3ccSAndroid Build Coastguard Worker 1538*77c1e3ccSAndroid Build Coastguard Worker // Reduce the wiener filter win size for luma 1539*77c1e3ccSAndroid Build Coastguard Worker int reduce_wiener_window_size; 1540*77c1e3ccSAndroid Build Coastguard Worker 1541*77c1e3ccSAndroid Build Coastguard Worker // Flag to disable Wiener Loop restoration filter. 1542*77c1e3ccSAndroid Build Coastguard Worker bool disable_wiener_filter; 1543*77c1e3ccSAndroid Build Coastguard Worker 1544*77c1e3ccSAndroid Build Coastguard Worker // Flag to disable Self-guided Loop restoration filter. 1545*77c1e3ccSAndroid Build Coastguard Worker bool disable_sgr_filter; 1546*77c1e3ccSAndroid Build Coastguard Worker 1547*77c1e3ccSAndroid Build Coastguard Worker // Disable the refinement search around the wiener filter coefficients. 1548*77c1e3ccSAndroid Build Coastguard Worker bool disable_wiener_coeff_refine_search; 1549*77c1e3ccSAndroid Build Coastguard Worker 1550*77c1e3ccSAndroid Build Coastguard Worker // Whether to downsample the rows in computation of wiener stats. 1551*77c1e3ccSAndroid Build Coastguard Worker int use_downsampled_wiener_stats; 1552*77c1e3ccSAndroid Build Coastguard Worker } LOOP_FILTER_SPEED_FEATURES; 1553*77c1e3ccSAndroid Build Coastguard Worker 1554*77c1e3ccSAndroid Build Coastguard Worker typedef struct REAL_TIME_SPEED_FEATURES { 1555*77c1e3ccSAndroid Build Coastguard Worker // check intra prediction for non-RD mode. 1556*77c1e3ccSAndroid Build Coastguard Worker int check_intra_pred_nonrd; 1557*77c1e3ccSAndroid Build Coastguard Worker 1558*77c1e3ccSAndroid Build Coastguard Worker // Skip checking intra prediction. 1559*77c1e3ccSAndroid Build Coastguard Worker // 0 - don't skip 1560*77c1e3ccSAndroid Build Coastguard Worker // 1 - skip if TX is skipped and best mode is not NEWMV 1561*77c1e3ccSAndroid Build Coastguard Worker // 2 - skip if TX is skipped 1562*77c1e3ccSAndroid Build Coastguard Worker // Skipping aggressiveness increases from level 1 to 2. 1563*77c1e3ccSAndroid Build Coastguard Worker int skip_intra_pred; 1564*77c1e3ccSAndroid Build Coastguard Worker 1565*77c1e3ccSAndroid Build Coastguard Worker // Estimate motion before calculating variance in variance-based partition 1566*77c1e3ccSAndroid Build Coastguard Worker // 0 - Only use zero MV 1567*77c1e3ccSAndroid Build Coastguard Worker // 1 - perform coarse ME 1568*77c1e3ccSAndroid Build Coastguard Worker // 2 - perform coarse ME, and also use neighbours' MVs 1569*77c1e3ccSAndroid Build Coastguard Worker // 3 - use neighbours' MVs without performing coarse ME 1570*77c1e3ccSAndroid Build Coastguard Worker int estimate_motion_for_var_based_partition; 1571*77c1e3ccSAndroid Build Coastguard Worker 1572*77c1e3ccSAndroid Build Coastguard Worker // For nonrd_use_partition: mode of extra check of leaf partition 1573*77c1e3ccSAndroid Build Coastguard Worker // 0 - don't check merge 1574*77c1e3ccSAndroid Build Coastguard Worker // 1 - always check merge 1575*77c1e3ccSAndroid Build Coastguard Worker // 2 - check merge and prune checking final split 1576*77c1e3ccSAndroid Build Coastguard Worker // 3 - check merge and prune checking final split based on bsize and qindex 1577*77c1e3ccSAndroid Build Coastguard Worker int nonrd_check_partition_merge_mode; 1578*77c1e3ccSAndroid Build Coastguard Worker 1579*77c1e3ccSAndroid Build Coastguard Worker // For nonrd_use_partition: check of leaf partition extra split 1580*77c1e3ccSAndroid Build Coastguard Worker int nonrd_check_partition_split; 1581*77c1e3ccSAndroid Build Coastguard Worker 1582*77c1e3ccSAndroid Build Coastguard Worker // Implements various heuristics to skip searching modes 1583*77c1e3ccSAndroid Build Coastguard Worker // The heuristics selected are based on flags 1584*77c1e3ccSAndroid Build Coastguard Worker // defined in the MODE_SEARCH_SKIP_HEURISTICS enum 1585*77c1e3ccSAndroid Build Coastguard Worker unsigned int mode_search_skip_flags; 1586*77c1e3ccSAndroid Build Coastguard Worker 1587*77c1e3ccSAndroid Build Coastguard Worker // For nonrd: Reduces ref frame search. 1588*77c1e3ccSAndroid Build Coastguard Worker // 0 - low level of search prune in non last frames 1589*77c1e3ccSAndroid Build Coastguard Worker // 1 - pruned search in non last frames 1590*77c1e3ccSAndroid Build Coastguard Worker // 2 - more pruned search in non last frames 1591*77c1e3ccSAndroid Build Coastguard Worker int nonrd_prune_ref_frame_search; 1592*77c1e3ccSAndroid Build Coastguard Worker 1593*77c1e3ccSAndroid Build Coastguard Worker // This flag controls the use of non-RD mode decision. 1594*77c1e3ccSAndroid Build Coastguard Worker int use_nonrd_pick_mode; 1595*77c1e3ccSAndroid Build Coastguard Worker 1596*77c1e3ccSAndroid Build Coastguard Worker // Use ALTREF frame in non-RD mode decision. 1597*77c1e3ccSAndroid Build Coastguard Worker int use_nonrd_altref_frame; 1598*77c1e3ccSAndroid Build Coastguard Worker 1599*77c1e3ccSAndroid Build Coastguard Worker // Use compound reference for non-RD mode. 1600*77c1e3ccSAndroid Build Coastguard Worker int use_comp_ref_nonrd; 1601*77c1e3ccSAndroid Build Coastguard Worker 1602*77c1e3ccSAndroid Build Coastguard Worker // Reference frames for compound prediction for nonrd pickmode: 1603*77c1e3ccSAndroid Build Coastguard Worker // LAST_GOLDEN (0), LAST_LAST2 (1), or LAST_ALTREF (2). 1604*77c1e3ccSAndroid Build Coastguard Worker int ref_frame_comp_nonrd[3]; 1605*77c1e3ccSAndroid Build Coastguard Worker 1606*77c1e3ccSAndroid Build Coastguard Worker // use reduced ref set for real-time mode 1607*77c1e3ccSAndroid Build Coastguard Worker int use_real_time_ref_set; 1608*77c1e3ccSAndroid Build Coastguard Worker 1609*77c1e3ccSAndroid Build Coastguard Worker // Skip a number of expensive mode evaluations for blocks with very low 1610*77c1e3ccSAndroid Build Coastguard Worker // temporal variance. 1611*77c1e3ccSAndroid Build Coastguard Worker int short_circuit_low_temp_var; 1612*77c1e3ccSAndroid Build Coastguard Worker 1613*77c1e3ccSAndroid Build Coastguard Worker // Reuse inter prediction in fast non-rd mode. 1614*77c1e3ccSAndroid Build Coastguard Worker int reuse_inter_pred_nonrd; 1615*77c1e3ccSAndroid Build Coastguard Worker 1616*77c1e3ccSAndroid Build Coastguard Worker // Number of best inter modes to search transform. INT_MAX - search all. 1617*77c1e3ccSAndroid Build Coastguard Worker int num_inter_modes_for_tx_search; 1618*77c1e3ccSAndroid Build Coastguard Worker 1619*77c1e3ccSAndroid Build Coastguard Worker // Use interpolation filter search in non-RD mode decision. 1620*77c1e3ccSAndroid Build Coastguard Worker int use_nonrd_filter_search; 1621*77c1e3ccSAndroid Build Coastguard Worker 1622*77c1e3ccSAndroid Build Coastguard Worker // Use simplified RD model for interpolation search and Intra 1623*77c1e3ccSAndroid Build Coastguard Worker int use_simple_rd_model; 1624*77c1e3ccSAndroid Build Coastguard Worker 1625*77c1e3ccSAndroid Build Coastguard Worker // For nonrd mode: use hybrid intra mode search for intra only frames based on 1626*77c1e3ccSAndroid Build Coastguard Worker // block properties. 1627*77c1e3ccSAndroid Build Coastguard Worker // 0 : use nonrd pick intra for all blocks 1628*77c1e3ccSAndroid Build Coastguard Worker // 1 : use rd for bsize < 16x16, nonrd otherwise 1629*77c1e3ccSAndroid Build Coastguard Worker // 2 : use rd for bsize < 16x16 and src var >= 101, nonrd otherwise 1630*77c1e3ccSAndroid Build Coastguard Worker int hybrid_intra_pickmode; 1631*77c1e3ccSAndroid Build Coastguard Worker 1632*77c1e3ccSAndroid Build Coastguard Worker // Filter blocks by certain criteria such as SAD, source variance, such that 1633*77c1e3ccSAndroid Build Coastguard Worker // fewer blocks will go through the palette search. 1634*77c1e3ccSAndroid Build Coastguard Worker // For nonrd encoding path, enable this feature reduces encoding time when 1635*77c1e3ccSAndroid Build Coastguard Worker // palette mode is used. Disabling it leads to better compression efficiency. 1636*77c1e3ccSAndroid Build Coastguard Worker // 0: off 1637*77c1e3ccSAndroid Build Coastguard Worker // 1: less aggressive pruning mode 1638*77c1e3ccSAndroid Build Coastguard Worker // 2: more aggressive pruning mode 1639*77c1e3ccSAndroid Build Coastguard Worker int prune_palette_search_nonrd; 1640*77c1e3ccSAndroid Build Coastguard Worker 1641*77c1e3ccSAndroid Build Coastguard Worker // Compute variance/sse on source difference, prior to encoding superblock. 1642*77c1e3ccSAndroid Build Coastguard Worker int source_metrics_sb_nonrd; 1643*77c1e3ccSAndroid Build Coastguard Worker 1644*77c1e3ccSAndroid Build Coastguard Worker // Flag to indicate process for handling overshoot on slide/scene change, 1645*77c1e3ccSAndroid Build Coastguard Worker // for real-time CBR mode. 1646*77c1e3ccSAndroid Build Coastguard Worker OVERSHOOT_DETECTION_CBR overshoot_detection_cbr; 1647*77c1e3ccSAndroid Build Coastguard Worker 1648*77c1e3ccSAndroid Build Coastguard Worker // Check for scene/content change detection on every frame before encoding. 1649*77c1e3ccSAndroid Build Coastguard Worker int check_scene_detection; 1650*77c1e3ccSAndroid Build Coastguard Worker 1651*77c1e3ccSAndroid Build Coastguard Worker // For keyframes in rtc: adjust the rc_bits_per_mb, to reduce overshoot. 1652*77c1e3ccSAndroid Build Coastguard Worker int rc_adjust_keyframe; 1653*77c1e3ccSAndroid Build Coastguard Worker 1654*77c1e3ccSAndroid Build Coastguard Worker // On scene change: compute spatial variance. 1655*77c1e3ccSAndroid Build Coastguard Worker int rc_compute_spatial_var_sc; 1656*77c1e3ccSAndroid Build Coastguard Worker 1657*77c1e3ccSAndroid Build Coastguard Worker // For nonrd mode: Prefer larger partition blks in variance based partitioning 1658*77c1e3ccSAndroid Build Coastguard Worker // 0: disabled, 1-3: increasing aggressiveness 1659*77c1e3ccSAndroid Build Coastguard Worker int prefer_large_partition_blocks; 1660*77c1e3ccSAndroid Build Coastguard Worker 1661*77c1e3ccSAndroid Build Coastguard Worker // uses results of temporal noise estimate 1662*77c1e3ccSAndroid Build Coastguard Worker int use_temporal_noise_estimate; 1663*77c1e3ccSAndroid Build Coastguard Worker 1664*77c1e3ccSAndroid Build Coastguard Worker // Parameter indicating initial search window to be used in full-pixel search 1665*77c1e3ccSAndroid Build Coastguard Worker // for nonrd_pickmode. Range [0, MAX_MVSEARCH_STEPS - 1]. Lower value 1666*77c1e3ccSAndroid Build Coastguard Worker // indicates larger window. If set to 0, step_param is set based on internal 1667*77c1e3ccSAndroid Build Coastguard Worker // logic in set_mv_search_params(). 1668*77c1e3ccSAndroid Build Coastguard Worker int fullpel_search_step_param; 1669*77c1e3ccSAndroid Build Coastguard Worker 1670*77c1e3ccSAndroid Build Coastguard Worker // Bit mask to enable or disable intra modes for each prediction block size 1671*77c1e3ccSAndroid Build Coastguard Worker // separately, for nonrd_pickmode. Currently, the sf is not respected when 1672*77c1e3ccSAndroid Build Coastguard Worker // 'force_intra_check' is true in 'av1_estimate_intra_mode()' function. Also, 1673*77c1e3ccSAndroid Build Coastguard Worker // H and V pred modes allowed through this sf can be further pruned when 1674*77c1e3ccSAndroid Build Coastguard Worker //'prune_hv_pred_modes_using_src_sad' sf is true. 1675*77c1e3ccSAndroid Build Coastguard Worker int intra_y_mode_bsize_mask_nrd[BLOCK_SIZES]; 1676*77c1e3ccSAndroid Build Coastguard Worker 1677*77c1e3ccSAndroid Build Coastguard Worker // Prune H and V intra predition modes evalution in inter frame. 1678*77c1e3ccSAndroid Build Coastguard Worker // The sf does not have any impact. 1679*77c1e3ccSAndroid Build Coastguard Worker // i. when frame_source_sad is 1.1 times greater than avg_source_sad 1680*77c1e3ccSAndroid Build Coastguard Worker // ii. when cyclic_refresh_segment_id_boosted is enabled 1681*77c1e3ccSAndroid Build Coastguard Worker // iii. when SB level source sad is greater than kMedSad 1682*77c1e3ccSAndroid Build Coastguard Worker // iv. when color sensitivity is non zero for both the chroma channels 1683*77c1e3ccSAndroid Build Coastguard Worker bool prune_hv_pred_modes_using_src_sad; 1684*77c1e3ccSAndroid Build Coastguard Worker 1685*77c1e3ccSAndroid Build Coastguard Worker // Skips mode checks more aggressively in nonRD mode 1686*77c1e3ccSAndroid Build Coastguard Worker int nonrd_aggressive_skip; 1687*77c1e3ccSAndroid Build Coastguard Worker 1688*77c1e3ccSAndroid Build Coastguard Worker // Skip cdef on 64x64 blocks/ 1689*77c1e3ccSAndroid Build Coastguard Worker // 0: disabled 1690*77c1e3ccSAndroid Build Coastguard Worker // 1: skip when NEWMV or INTRA is not picked or color sensitivity is off. 1691*77c1e3ccSAndroid Build Coastguard Worker // When color sensitivity is on for a superblock, all 64x64 blocks within 1692*77c1e3ccSAndroid Build Coastguard Worker // will not skip. 1693*77c1e3ccSAndroid Build Coastguard Worker // 2: more aggressive mode where skip is done for all frames where 1694*77c1e3ccSAndroid Build Coastguard Worker // rc->high_source_sad = 0 (non slide-changes), and color sensitivity off. 1695*77c1e3ccSAndroid Build Coastguard Worker int skip_cdef_sb; 1696*77c1e3ccSAndroid Build Coastguard Worker 1697*77c1e3ccSAndroid Build Coastguard Worker // Force selective cdf update. 1698*77c1e3ccSAndroid Build Coastguard Worker int selective_cdf_update; 1699*77c1e3ccSAndroid Build Coastguard Worker 1700*77c1e3ccSAndroid Build Coastguard Worker // Force only single reference (LAST) for prediction. 1701*77c1e3ccSAndroid Build Coastguard Worker int force_only_last_ref; 1702*77c1e3ccSAndroid Build Coastguard Worker 1703*77c1e3ccSAndroid Build Coastguard Worker // Forces larger partition blocks in variance based partitioning for intra 1704*77c1e3ccSAndroid Build Coastguard Worker // frames 1705*77c1e3ccSAndroid Build Coastguard Worker int force_large_partition_blocks_intra; 1706*77c1e3ccSAndroid Build Coastguard Worker 1707*77c1e3ccSAndroid Build Coastguard Worker // Use fixed partition for superblocks based on source_sad. 1708*77c1e3ccSAndroid Build Coastguard Worker // 0: disabled 1709*77c1e3ccSAndroid Build Coastguard Worker // 1: enabled 1710*77c1e3ccSAndroid Build Coastguard Worker int use_fast_fixed_part; 1711*77c1e3ccSAndroid Build Coastguard Worker 1712*77c1e3ccSAndroid Build Coastguard Worker // Increase source_sad thresholds in nonrd pickmode. 1713*77c1e3ccSAndroid Build Coastguard Worker int increase_source_sad_thresh; 1714*77c1e3ccSAndroid Build Coastguard Worker 1715*77c1e3ccSAndroid Build Coastguard Worker // Skip evaluation of no split in tx size selection for merge partition 1716*77c1e3ccSAndroid Build Coastguard Worker int skip_tx_no_split_var_based_partition; 1717*77c1e3ccSAndroid Build Coastguard Worker 1718*77c1e3ccSAndroid Build Coastguard Worker // Intermediate termination of newMV mode evaluation based on so far best mode 1719*77c1e3ccSAndroid Build Coastguard Worker // sse 1720*77c1e3ccSAndroid Build Coastguard Worker int skip_newmv_mode_based_on_sse; 1721*77c1e3ccSAndroid Build Coastguard Worker 1722*77c1e3ccSAndroid Build Coastguard Worker // Define gf length multiplier. 1723*77c1e3ccSAndroid Build Coastguard Worker // Level 0: use large multiplier, level 1: use medium multiplier. 1724*77c1e3ccSAndroid Build Coastguard Worker int gf_length_lvl; 1725*77c1e3ccSAndroid Build Coastguard Worker 1726*77c1e3ccSAndroid Build Coastguard Worker // Prune inter modes with golden frame as reference for NEARMV and NEWMV modes 1727*77c1e3ccSAndroid Build Coastguard Worker int prune_inter_modes_with_golden_ref; 1728*77c1e3ccSAndroid Build Coastguard Worker 1729*77c1e3ccSAndroid Build Coastguard Worker // Prune inter modes w.r.t golden or alt-ref frame based on sad 1730*77c1e3ccSAndroid Build Coastguard Worker int prune_inter_modes_wrt_gf_arf_based_on_sad; 1731*77c1e3ccSAndroid Build Coastguard Worker 1732*77c1e3ccSAndroid Build Coastguard Worker // Prune inter mode search in rd path based on current block's temporal 1733*77c1e3ccSAndroid Build Coastguard Worker // variance wrt LAST reference. 1734*77c1e3ccSAndroid Build Coastguard Worker int prune_inter_modes_using_temp_var; 1735*77c1e3ccSAndroid Build Coastguard Worker 1736*77c1e3ccSAndroid Build Coastguard Worker // Reduce MV precision to halfpel for higher int MV value & frame-level motion 1737*77c1e3ccSAndroid Build Coastguard Worker // 0: disabled 1738*77c1e3ccSAndroid Build Coastguard Worker // 1-2: Reduce precision to halfpel, fullpel based on conservative 1739*77c1e3ccSAndroid Build Coastguard Worker // thresholds, aggressiveness increases with increase in level 1740*77c1e3ccSAndroid Build Coastguard Worker // 3: Reduce precision to halfpel using more aggressive thresholds 1741*77c1e3ccSAndroid Build Coastguard Worker int reduce_mv_pel_precision_highmotion; 1742*77c1e3ccSAndroid Build Coastguard Worker 1743*77c1e3ccSAndroid Build Coastguard Worker // Reduce MV precision for low complexity blocks 1744*77c1e3ccSAndroid Build Coastguard Worker // 0: disabled 1745*77c1e3ccSAndroid Build Coastguard Worker // 1: Reduce the mv resolution for zero mv if the variance is low 1746*77c1e3ccSAndroid Build Coastguard Worker // 2: Switch to halfpel, fullpel based on low block spatial-temporal 1747*77c1e3ccSAndroid Build Coastguard Worker // complexity. 1748*77c1e3ccSAndroid Build Coastguard Worker int reduce_mv_pel_precision_lowcomplex; 1749*77c1e3ccSAndroid Build Coastguard Worker 1750*77c1e3ccSAndroid Build Coastguard Worker // Prune intra mode evaluation in inter frames based on mv range. 1751*77c1e3ccSAndroid Build Coastguard Worker BLOCK_SIZE prune_intra_mode_based_on_mv_range; 1752*77c1e3ccSAndroid Build Coastguard Worker // The number of times to left shift the splitting thresholds in variance 1753*77c1e3ccSAndroid Build Coastguard Worker // based partitioning. The minimum values should be 7 to avoid left shifting 1754*77c1e3ccSAndroid Build Coastguard Worker // by a negative number. 1755*77c1e3ccSAndroid Build Coastguard Worker int var_part_split_threshold_shift; 1756*77c1e3ccSAndroid Build Coastguard Worker 1757*77c1e3ccSAndroid Build Coastguard Worker // Qindex based variance partition threshold index, which determines 1758*77c1e3ccSAndroid Build Coastguard Worker // the aggressiveness of partition pruning 1759*77c1e3ccSAndroid Build Coastguard Worker // 0: disabled for speeds 9,10 1760*77c1e3ccSAndroid Build Coastguard Worker // 1,2: (rd-path) lowers qindex thresholds conditionally (for low SAD sb) 1761*77c1e3ccSAndroid Build Coastguard Worker // 3,4: (non-rd path) uses pre-tuned qindex thresholds 1762*77c1e3ccSAndroid Build Coastguard Worker int var_part_based_on_qidx; 1763*77c1e3ccSAndroid Build Coastguard Worker 1764*77c1e3ccSAndroid Build Coastguard Worker // Enable GF refresh based on Q value. 1765*77c1e3ccSAndroid Build Coastguard Worker int gf_refresh_based_on_qp; 1766*77c1e3ccSAndroid Build Coastguard Worker 1767*77c1e3ccSAndroid Build Coastguard Worker // Temporal filtering 1768*77c1e3ccSAndroid Build Coastguard Worker // The value can be 1 or 2, which indicates the threshold to use. 1769*77c1e3ccSAndroid Build Coastguard Worker // Must be off for lossless mode. 1770*77c1e3ccSAndroid Build Coastguard Worker int use_rtc_tf; 1771*77c1e3ccSAndroid Build Coastguard Worker 1772*77c1e3ccSAndroid Build Coastguard Worker // Use of the identity transform in nonrd_pickmode, 1773*77c1e3ccSAndroid Build Coastguard Worker int use_idtx_nonrd; 1774*77c1e3ccSAndroid Build Coastguard Worker 1775*77c1e3ccSAndroid Build Coastguard Worker // Prune the use of the identity transform in nonrd_pickmode: 1776*77c1e3ccSAndroid Build Coastguard Worker // only for smaller blocks and higher spatial variance, and when skip_txfm 1777*77c1e3ccSAndroid Build Coastguard Worker // is not already set. 1778*77c1e3ccSAndroid Build Coastguard Worker int prune_idtx_nonrd; 1779*77c1e3ccSAndroid Build Coastguard Worker 1780*77c1e3ccSAndroid Build Coastguard Worker // Force to only use dct for palette search in nonrd pickmode. 1781*77c1e3ccSAndroid Build Coastguard Worker int dct_only_palette_nonrd; 1782*77c1e3ccSAndroid Build Coastguard Worker 1783*77c1e3ccSAndroid Build Coastguard Worker // Skip loopfilter, for static content after slide change 1784*77c1e3ccSAndroid Build Coastguard Worker // or key frame, once quality has ramped up. 1785*77c1e3ccSAndroid Build Coastguard Worker // 0: disabled 1786*77c1e3ccSAndroid Build Coastguard Worker // 1: skip only after quality is ramped up. 1787*77c1e3ccSAndroid Build Coastguard Worker // 2: aggrssive mode, where skip is done for all frames that 1788*77c1e3ccSAndroid Build Coastguard Worker // where rc->high_source_sad = 0 (no slide-changes). 1789*77c1e3ccSAndroid Build Coastguard Worker int skip_lf_screen; 1790*77c1e3ccSAndroid Build Coastguard Worker 1791*77c1e3ccSAndroid Build Coastguard Worker // Threshold on the active/inactive region percent to disable 1792*77c1e3ccSAndroid Build Coastguard Worker // the loopfilter and cdef. Setting to 100 disables this feature. 1793*77c1e3ccSAndroid Build Coastguard Worker int thresh_active_maps_skip_lf_cdef; 1794*77c1e3ccSAndroid Build Coastguard Worker 1795*77c1e3ccSAndroid Build Coastguard Worker // For nonrd: early exit out of variance partition that sets the 1796*77c1e3ccSAndroid Build Coastguard Worker // block size to superblock size, and sets mode to zeromv-last skip. 1797*77c1e3ccSAndroid Build Coastguard Worker // 0: disabled 1798*77c1e3ccSAndroid Build Coastguard Worker // 1: zeromv-skip is enabled at SB level only 1799*77c1e3ccSAndroid Build Coastguard Worker // 2: zeromv-skip is enabled at SB level and coding block level 1800*77c1e3ccSAndroid Build Coastguard Worker int part_early_exit_zeromv; 1801*77c1e3ccSAndroid Build Coastguard Worker 1802*77c1e3ccSAndroid Build Coastguard Worker // Early terminate inter mode search based on sse in non-rd path. 1803*77c1e3ccSAndroid Build Coastguard Worker INTER_SEARCH_EARLY_TERM_IDX sse_early_term_inter_search; 1804*77c1e3ccSAndroid Build Coastguard Worker 1805*77c1e3ccSAndroid Build Coastguard Worker // SAD based adaptive altref selection 1806*77c1e3ccSAndroid Build Coastguard Worker int sad_based_adp_altref_lag; 1807*77c1e3ccSAndroid Build Coastguard Worker 1808*77c1e3ccSAndroid Build Coastguard Worker // Enable/disable partition direct merging. 1809*77c1e3ccSAndroid Build Coastguard Worker int partition_direct_merging; 1810*77c1e3ccSAndroid Build Coastguard Worker 1811*77c1e3ccSAndroid Build Coastguard Worker // Level of aggressiveness for obtaining tx size based on qstep 1812*77c1e3ccSAndroid Build Coastguard Worker int tx_size_level_based_on_qstep; 1813*77c1e3ccSAndroid Build Coastguard Worker 1814*77c1e3ccSAndroid Build Coastguard Worker // Avoid the partitioning of a 16x16 block in variance based partitioning 1815*77c1e3ccSAndroid Build Coastguard Worker // (VBP) by making use of minimum and maximum sub-block variances. 1816*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this speed feature reduces instruction count by 5.39% 1817*77c1e3ccSAndroid Build Coastguard Worker // for speed 9 on a typical video dataset with coding performance gain 1818*77c1e3ccSAndroid Build Coastguard Worker // of 1.44%. 1819*77c1e3ccSAndroid Build Coastguard Worker // For AVIF image encode, this speed feature reduces encode time 1820*77c1e3ccSAndroid Build Coastguard Worker // by 8.44% for speed 9 on a typical image dataset with coding performance 1821*77c1e3ccSAndroid Build Coastguard Worker // gain of 0.78%. 1822*77c1e3ccSAndroid Build Coastguard Worker bool vbp_prune_16x16_split_using_min_max_sub_blk_var; 1823*77c1e3ccSAndroid Build Coastguard Worker 1824*77c1e3ccSAndroid Build Coastguard Worker // A qindex threshold that determines whether to use qindex based CDEF filter 1825*77c1e3ccSAndroid Build Coastguard Worker // strength estimation for screen content types. The strength estimation model 1826*77c1e3ccSAndroid Build Coastguard Worker // used for screen contents prefers to allow cdef filtering for more frames. 1827*77c1e3ccSAndroid Build Coastguard Worker // This sf is used to limit the frames which go through cdef filtering and 1828*77c1e3ccSAndroid Build Coastguard Worker // following explains the setting of the same. 1829*77c1e3ccSAndroid Build Coastguard Worker // MAXQ (255): This disables the usage of this sf. Here, frame does not use a 1830*77c1e3ccSAndroid Build Coastguard Worker // screen content model thus reduces the number of frames that go through cdef 1831*77c1e3ccSAndroid Build Coastguard Worker // filtering. 1832*77c1e3ccSAndroid Build Coastguard Worker // MINQ (0): Frames always use screen content model thus increasing the number 1833*77c1e3ccSAndroid Build Coastguard Worker // of frames that go through cdef filtering. 1834*77c1e3ccSAndroid Build Coastguard Worker // This speed feature has a substantial gain on coding metrics, with moderate 1835*77c1e3ccSAndroid Build Coastguard Worker // increase encoding time. Select threshold based on speed vs quality 1836*77c1e3ccSAndroid Build Coastguard Worker // trade-off. 1837*77c1e3ccSAndroid Build Coastguard Worker int screen_content_cdef_filter_qindex_thresh; 1838*77c1e3ccSAndroid Build Coastguard Worker 1839*77c1e3ccSAndroid Build Coastguard Worker // Prune compound mode if its variance is higher than the variance of single 1840*77c1e3ccSAndroid Build Coastguard Worker // modes. 1841*77c1e3ccSAndroid Build Coastguard Worker bool prune_compoundmode_with_singlecompound_var; 1842*77c1e3ccSAndroid Build Coastguard Worker 1843*77c1e3ccSAndroid Build Coastguard Worker // Allow mode cost update at frame level every couple frames. This 1844*77c1e3ccSAndroid Build Coastguard Worker // overrides the command line setting --mode-cost-upd-freq=3 (never update 1845*77c1e3ccSAndroid Build Coastguard Worker // except on key frame and first delta). 1846*77c1e3ccSAndroid Build Coastguard Worker bool frame_level_mode_cost_update; 1847*77c1e3ccSAndroid Build Coastguard Worker 1848*77c1e3ccSAndroid Build Coastguard Worker // Prune H_PRED during intra mode evaluation in the nonrd path based on best 1849*77c1e3ccSAndroid Build Coastguard Worker // mode so far. 1850*77c1e3ccSAndroid Build Coastguard Worker // 1851*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this speed feature reduces instruction count by 1.10% 1852*77c1e3ccSAndroid Build Coastguard Worker // for speed 9 with coding performance change less than 0.04%. 1853*77c1e3ccSAndroid Build Coastguard Worker // For AVIF image encode, this speed feature reduces encode time by 1.03% for 1854*77c1e3ccSAndroid Build Coastguard Worker // speed 9 on a typical image dataset with coding performance change less than 1855*77c1e3ccSAndroid Build Coastguard Worker // 0.08%. 1856*77c1e3ccSAndroid Build Coastguard Worker bool prune_h_pred_using_best_mode_so_far; 1857*77c1e3ccSAndroid Build Coastguard Worker 1858*77c1e3ccSAndroid Build Coastguard Worker // Enable pruning of intra mode evaluations in nonrd path based on source 1859*77c1e3ccSAndroid Build Coastguard Worker // variance and best mode so far. The pruning logic is enabled only if the 1860*77c1e3ccSAndroid Build Coastguard Worker // mode is not a winner mode of both the neighboring blocks (left/top). 1861*77c1e3ccSAndroid Build Coastguard Worker // 1862*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this speed feature reduces instruction count by 3.96% 1863*77c1e3ccSAndroid Build Coastguard Worker // for speed 9 with coding performance change less than 0.38%. 1864*77c1e3ccSAndroid Build Coastguard Worker // For AVIF image encode, this speed feature reduces encode time by 3.46% for 1865*77c1e3ccSAndroid Build Coastguard Worker // speed 9 on a typical image dataset with coding performance change less than 1866*77c1e3ccSAndroid Build Coastguard Worker // -0.06%. 1867*77c1e3ccSAndroid Build Coastguard Worker bool enable_intra_mode_pruning_using_neighbors; 1868*77c1e3ccSAndroid Build Coastguard Worker 1869*77c1e3ccSAndroid Build Coastguard Worker // Prune intra mode evaluations in nonrd path based on best sad so far. 1870*77c1e3ccSAndroid Build Coastguard Worker // 1871*77c1e3ccSAndroid Build Coastguard Worker // For allintra encode, this speed feature reduces instruction count by 3.05% 1872*77c1e3ccSAndroid Build Coastguard Worker // for speed 9 with coding performance change less than 0.24%. 1873*77c1e3ccSAndroid Build Coastguard Worker // For AVIF image encode, this speed feature reduces encode time by 1.87% for 1874*77c1e3ccSAndroid Build Coastguard Worker // speed 9 on a typical image dataset with coding performance change less than 1875*77c1e3ccSAndroid Build Coastguard Worker // 0.16%. 1876*77c1e3ccSAndroid Build Coastguard Worker bool prune_intra_mode_using_best_sad_so_far; 1877*77c1e3ccSAndroid Build Coastguard Worker 1878*77c1e3ccSAndroid Build Coastguard Worker // If compound is enabled, and the current block size is \geq BLOCK_16X16, 1879*77c1e3ccSAndroid Build Coastguard Worker // limit the compound modes to GLOBAL_GLOBALMV. This does not apply to the 1880*77c1e3ccSAndroid Build Coastguard Worker // base layer of svc. 1881*77c1e3ccSAndroid Build Coastguard Worker bool check_only_zero_zeromv_on_large_blocks; 1882*77c1e3ccSAndroid Build Coastguard Worker 1883*77c1e3ccSAndroid Build Coastguard Worker // Allow for disabling cdf update for non reference frames in svc mode. 1884*77c1e3ccSAndroid Build Coastguard Worker bool disable_cdf_update_non_reference_frame; 1885*77c1e3ccSAndroid Build Coastguard Worker 1886*77c1e3ccSAndroid Build Coastguard Worker // Prune compound modes if the single modes variances do not perform well. 1887*77c1e3ccSAndroid Build Coastguard Worker bool prune_compoundmode_with_singlemode_var; 1888*77c1e3ccSAndroid Build Coastguard Worker 1889*77c1e3ccSAndroid Build Coastguard Worker // Skip searching all compound mode if the variance of single_mode residue is 1890*77c1e3ccSAndroid Build Coastguard Worker // sufficiently low. 1891*77c1e3ccSAndroid Build Coastguard Worker bool skip_compound_based_on_var; 1892*77c1e3ccSAndroid Build Coastguard Worker 1893*77c1e3ccSAndroid Build Coastguard Worker // Sets force_zeromv_skip based on the source sad available. Aggressiveness 1894*77c1e3ccSAndroid Build Coastguard Worker // increases with increase in the level set for speed feature. 1895*77c1e3ccSAndroid Build Coastguard Worker // 0: No setting 1896*77c1e3ccSAndroid Build Coastguard Worker // 1: If source sad is kZeroSad 1897*77c1e3ccSAndroid Build Coastguard Worker // 2: If source sad <= kVeryLowSad 1898*77c1e3ccSAndroid Build Coastguard Worker int set_zeromv_skip_based_on_source_sad; 1899*77c1e3ccSAndroid Build Coastguard Worker 1900*77c1e3ccSAndroid Build Coastguard Worker // Downgrades the block-level subpel motion search to 1901*77c1e3ccSAndroid Build Coastguard Worker // av1_find_best_sub_pixel_tree_pruned_more for higher QP and when fullpel 1902*77c1e3ccSAndroid Build Coastguard Worker // search performed well, zeromv has low sad or low source_var 1903*77c1e3ccSAndroid Build Coastguard Worker bool use_adaptive_subpel_search; 1904*77c1e3ccSAndroid Build Coastguard Worker 1905*77c1e3ccSAndroid Build Coastguard Worker // A flag used in RTC case to control frame_refs_short_signaling. Note that 1906*77c1e3ccSAndroid Build Coastguard Worker // the final decision is made in check_frame_refs_short_signaling(). The flag 1907*77c1e3ccSAndroid Build Coastguard Worker // can only be turned on when res < 360p and speed >= 9, in which case only 1908*77c1e3ccSAndroid Build Coastguard Worker // LAST and GOLDEN ref frames are used now. 1909*77c1e3ccSAndroid Build Coastguard Worker bool enable_ref_short_signaling; 1910*77c1e3ccSAndroid Build Coastguard Worker 1911*77c1e3ccSAndroid Build Coastguard Worker // A flag that controls if we check or bypass GLOBALMV in rtc single ref frame 1912*77c1e3ccSAndroid Build Coastguard Worker // case. 1913*77c1e3ccSAndroid Build Coastguard Worker bool check_globalmv_on_single_ref; 1914*77c1e3ccSAndroid Build Coastguard Worker 1915*77c1e3ccSAndroid Build Coastguard Worker // Allows for increasing the color_threshold for palette prediction. 1916*77c1e3ccSAndroid Build Coastguard Worker // This generally leads to better coding efficiency but with some speed loss. 1917*77c1e3ccSAndroid Build Coastguard Worker // Only used for screen content and for nonrd_pickmode. 1918*77c1e3ccSAndroid Build Coastguard Worker bool increase_color_thresh_palette; 1919*77c1e3ccSAndroid Build Coastguard Worker 1920*77c1e3ccSAndroid Build Coastguard Worker // Flag to indicate selecting of higher threshold for scenee change detection. 1921*77c1e3ccSAndroid Build Coastguard Worker int higher_thresh_scene_detection; 1922*77c1e3ccSAndroid Build Coastguard Worker 1923*77c1e3ccSAndroid Build Coastguard Worker // FLag to indicate skip testing of NEWMV for flat blocks. 1924*77c1e3ccSAndroid Build Coastguard Worker int skip_newmv_flat_blocks_screen; 1925*77c1e3ccSAndroid Build Coastguard Worker 1926*77c1e3ccSAndroid Build Coastguard Worker // Flag to force skip encoding for non_reference_frame on slide/scene changes. 1927*77c1e3ccSAndroid Build Coastguard Worker int skip_encoding_non_reference_slide_change; 1928*77c1e3ccSAndroid Build Coastguard Worker 1929*77c1e3ccSAndroid Build Coastguard Worker // Flag to indicate more aggressive QP downward adjustment for screen static 1930*77c1e3ccSAndroid Build Coastguard Worker // content, to make convergence to min_qp faster. 1931*77c1e3ccSAndroid Build Coastguard Worker int rc_faster_convergence_static; 1932*77c1e3ccSAndroid Build Coastguard Worker } REAL_TIME_SPEED_FEATURES; 1933*77c1e3ccSAndroid Build Coastguard Worker 1934*77c1e3ccSAndroid Build Coastguard Worker /*!\endcond */ 1935*77c1e3ccSAndroid Build Coastguard Worker 1936*77c1e3ccSAndroid Build Coastguard Worker /*! 1937*77c1e3ccSAndroid Build Coastguard Worker * \brief Top level speed vs quality trade off data struture. 1938*77c1e3ccSAndroid Build Coastguard Worker */ 1939*77c1e3ccSAndroid Build Coastguard Worker typedef struct SPEED_FEATURES { 1940*77c1e3ccSAndroid Build Coastguard Worker /*! 1941*77c1e3ccSAndroid Build Coastguard Worker * Sequence/frame level speed features: 1942*77c1e3ccSAndroid Build Coastguard Worker */ 1943*77c1e3ccSAndroid Build Coastguard Worker HIGH_LEVEL_SPEED_FEATURES hl_sf; 1944*77c1e3ccSAndroid Build Coastguard Worker 1945*77c1e3ccSAndroid Build Coastguard Worker /*! 1946*77c1e3ccSAndroid Build Coastguard Worker * Speed features for the first pass. 1947*77c1e3ccSAndroid Build Coastguard Worker */ 1948*77c1e3ccSAndroid Build Coastguard Worker FIRST_PASS_SPEED_FEATURES fp_sf; 1949*77c1e3ccSAndroid Build Coastguard Worker 1950*77c1e3ccSAndroid Build Coastguard Worker /*! 1951*77c1e3ccSAndroid Build Coastguard Worker * Speed features related to how tpl's searches are done. 1952*77c1e3ccSAndroid Build Coastguard Worker */ 1953*77c1e3ccSAndroid Build Coastguard Worker TPL_SPEED_FEATURES tpl_sf; 1954*77c1e3ccSAndroid Build Coastguard Worker 1955*77c1e3ccSAndroid Build Coastguard Worker /*! 1956*77c1e3ccSAndroid Build Coastguard Worker * Global motion speed features: 1957*77c1e3ccSAndroid Build Coastguard Worker */ 1958*77c1e3ccSAndroid Build Coastguard Worker GLOBAL_MOTION_SPEED_FEATURES gm_sf; 1959*77c1e3ccSAndroid Build Coastguard Worker 1960*77c1e3ccSAndroid Build Coastguard Worker /*! 1961*77c1e3ccSAndroid Build Coastguard Worker * Partition search speed features: 1962*77c1e3ccSAndroid Build Coastguard Worker */ 1963*77c1e3ccSAndroid Build Coastguard Worker PARTITION_SPEED_FEATURES part_sf; 1964*77c1e3ccSAndroid Build Coastguard Worker 1965*77c1e3ccSAndroid Build Coastguard Worker /*! 1966*77c1e3ccSAndroid Build Coastguard Worker * Motion search speed features: 1967*77c1e3ccSAndroid Build Coastguard Worker */ 1968*77c1e3ccSAndroid Build Coastguard Worker MV_SPEED_FEATURES mv_sf; 1969*77c1e3ccSAndroid Build Coastguard Worker 1970*77c1e3ccSAndroid Build Coastguard Worker /*! 1971*77c1e3ccSAndroid Build Coastguard Worker * Inter mode search speed features: 1972*77c1e3ccSAndroid Build Coastguard Worker */ 1973*77c1e3ccSAndroid Build Coastguard Worker INTER_MODE_SPEED_FEATURES inter_sf; 1974*77c1e3ccSAndroid Build Coastguard Worker 1975*77c1e3ccSAndroid Build Coastguard Worker /*! 1976*77c1e3ccSAndroid Build Coastguard Worker * Interpolation filter search speed features: 1977*77c1e3ccSAndroid Build Coastguard Worker */ 1978*77c1e3ccSAndroid Build Coastguard Worker INTERP_FILTER_SPEED_FEATURES interp_sf; 1979*77c1e3ccSAndroid Build Coastguard Worker 1980*77c1e3ccSAndroid Build Coastguard Worker /*! 1981*77c1e3ccSAndroid Build Coastguard Worker * Intra mode search speed features: 1982*77c1e3ccSAndroid Build Coastguard Worker */ 1983*77c1e3ccSAndroid Build Coastguard Worker INTRA_MODE_SPEED_FEATURES intra_sf; 1984*77c1e3ccSAndroid Build Coastguard Worker 1985*77c1e3ccSAndroid Build Coastguard Worker /*! 1986*77c1e3ccSAndroid Build Coastguard Worker * Transform size/type search speed features: 1987*77c1e3ccSAndroid Build Coastguard Worker */ 1988*77c1e3ccSAndroid Build Coastguard Worker TX_SPEED_FEATURES tx_sf; 1989*77c1e3ccSAndroid Build Coastguard Worker 1990*77c1e3ccSAndroid Build Coastguard Worker /*! 1991*77c1e3ccSAndroid Build Coastguard Worker * RD calculation speed features: 1992*77c1e3ccSAndroid Build Coastguard Worker */ 1993*77c1e3ccSAndroid Build Coastguard Worker RD_CALC_SPEED_FEATURES rd_sf; 1994*77c1e3ccSAndroid Build Coastguard Worker 1995*77c1e3ccSAndroid Build Coastguard Worker /*! 1996*77c1e3ccSAndroid Build Coastguard Worker * Two-pass mode evaluation features: 1997*77c1e3ccSAndroid Build Coastguard Worker */ 1998*77c1e3ccSAndroid Build Coastguard Worker WINNER_MODE_SPEED_FEATURES winner_mode_sf; 1999*77c1e3ccSAndroid Build Coastguard Worker 2000*77c1e3ccSAndroid Build Coastguard Worker /*! 2001*77c1e3ccSAndroid Build Coastguard Worker * In-loop filter speed features: 2002*77c1e3ccSAndroid Build Coastguard Worker */ 2003*77c1e3ccSAndroid Build Coastguard Worker LOOP_FILTER_SPEED_FEATURES lpf_sf; 2004*77c1e3ccSAndroid Build Coastguard Worker 2005*77c1e3ccSAndroid Build Coastguard Worker /*! 2006*77c1e3ccSAndroid Build Coastguard Worker * Real-time mode speed features: 2007*77c1e3ccSAndroid Build Coastguard Worker */ 2008*77c1e3ccSAndroid Build Coastguard Worker REAL_TIME_SPEED_FEATURES rt_sf; 2009*77c1e3ccSAndroid Build Coastguard Worker } SPEED_FEATURES; 2010*77c1e3ccSAndroid Build Coastguard Worker /*!\cond */ 2011*77c1e3ccSAndroid Build Coastguard Worker 2012*77c1e3ccSAndroid Build Coastguard Worker struct AV1_COMP; 2013*77c1e3ccSAndroid Build Coastguard Worker 2014*77c1e3ccSAndroid Build Coastguard Worker /*!\endcond */ 2015*77c1e3ccSAndroid Build Coastguard Worker /*!\brief Frame size independent speed vs quality trade off flags 2016*77c1e3ccSAndroid Build Coastguard Worker * 2017*77c1e3ccSAndroid Build Coastguard Worker *\ingroup speed_features 2018*77c1e3ccSAndroid Build Coastguard Worker * 2019*77c1e3ccSAndroid Build Coastguard Worker * \param[in] cpi Top - level encoder instance structure 2020*77c1e3ccSAndroid Build Coastguard Worker * \param[in] speed Speed setting passed in from the command line 2021*77c1e3ccSAndroid Build Coastguard Worker * 2022*77c1e3ccSAndroid Build Coastguard Worker * \remark No return value but configures the various speed trade off flags 2023*77c1e3ccSAndroid Build Coastguard Worker * based on the passed in speed setting. (Higher speed gives lower 2024*77c1e3ccSAndroid Build Coastguard Worker * quality) 2025*77c1e3ccSAndroid Build Coastguard Worker */ 2026*77c1e3ccSAndroid Build Coastguard Worker void av1_set_speed_features_framesize_independent(struct AV1_COMP *cpi, 2027*77c1e3ccSAndroid Build Coastguard Worker int speed); 2028*77c1e3ccSAndroid Build Coastguard Worker 2029*77c1e3ccSAndroid Build Coastguard Worker /*!\brief Frame size dependent speed vs quality trade off flags 2030*77c1e3ccSAndroid Build Coastguard Worker * 2031*77c1e3ccSAndroid Build Coastguard Worker *\ingroup speed_features 2032*77c1e3ccSAndroid Build Coastguard Worker * 2033*77c1e3ccSAndroid Build Coastguard Worker * \param[in] cpi Top - level encoder instance structure 2034*77c1e3ccSAndroid Build Coastguard Worker * \param[in] speed Speed setting passed in from the command line 2035*77c1e3ccSAndroid Build Coastguard Worker * 2036*77c1e3ccSAndroid Build Coastguard Worker * \remark No return value but configures the various speed trade off flags 2037*77c1e3ccSAndroid Build Coastguard Worker * based on the passed in speed setting and frame size. (Higher speed 2038*77c1e3ccSAndroid Build Coastguard Worker * corresponds to lower quality) 2039*77c1e3ccSAndroid Build Coastguard Worker */ 2040*77c1e3ccSAndroid Build Coastguard Worker void av1_set_speed_features_framesize_dependent(struct AV1_COMP *cpi, 2041*77c1e3ccSAndroid Build Coastguard Worker int speed); 2042*77c1e3ccSAndroid Build Coastguard Worker /*!\brief Q index dependent speed vs quality trade off flags 2043*77c1e3ccSAndroid Build Coastguard Worker * 2044*77c1e3ccSAndroid Build Coastguard Worker *\ingroup speed_features 2045*77c1e3ccSAndroid Build Coastguard Worker * 2046*77c1e3ccSAndroid Build Coastguard Worker * \param[in] cpi Top - level encoder instance structure 2047*77c1e3ccSAndroid Build Coastguard Worker * \param[in] speed Speed setting passed in from the command line 2048*77c1e3ccSAndroid Build Coastguard Worker * 2049*77c1e3ccSAndroid Build Coastguard Worker * \remark No return value but configures the various speed trade off flags 2050*77c1e3ccSAndroid Build Coastguard Worker * based on the passed in speed setting and current frame's Q index. 2051*77c1e3ccSAndroid Build Coastguard Worker * (Higher speed corresponds to lower quality) 2052*77c1e3ccSAndroid Build Coastguard Worker */ 2053*77c1e3ccSAndroid Build Coastguard Worker void av1_set_speed_features_qindex_dependent(struct AV1_COMP *cpi, int speed); 2054*77c1e3ccSAndroid Build Coastguard Worker 2055*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus 2056*77c1e3ccSAndroid Build Coastguard Worker } // extern "C" 2057*77c1e3ccSAndroid Build Coastguard Worker #endif 2058*77c1e3ccSAndroid Build Coastguard Worker 2059*77c1e3ccSAndroid Build Coastguard Worker #endif // AOM_AV1_ENCODER_SPEED_FEATURES_H_ 2060