xref: /aosp_15_r20/external/libaom/av1/encoder/partition_strategy.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1*77c1e3ccSAndroid Build Coastguard Worker /*
2*77c1e3ccSAndroid Build Coastguard Worker  * Copyright (c) 2019, 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_PARTITION_STRATEGY_H_
13*77c1e3ccSAndroid Build Coastguard Worker #define AOM_AV1_ENCODER_PARTITION_STRATEGY_H_
14*77c1e3ccSAndroid Build Coastguard Worker 
15*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/encodeframe.h"
16*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/encodeframe_utils.h"
17*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/encodemb.h"
18*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/encoder.h"
19*77c1e3ccSAndroid Build Coastguard Worker 
20*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
21*77c1e3ccSAndroid Build Coastguard Worker // Early terminates PARTITION_NONE using simple_motion_search features and the
22*77c1e3ccSAndroid Build Coastguard Worker // rate, distortion, and rdcost of PARTITION_NONE. This is only called when:
23*77c1e3ccSAndroid Build Coastguard Worker //  - The frame is a show frame
24*77c1e3ccSAndroid Build Coastguard Worker //  - The frame is not intra only
25*77c1e3ccSAndroid Build Coastguard Worker //  - The current bsize is > BLOCK_8X8
26*77c1e3ccSAndroid Build Coastguard Worker //  - blk_row + blk_height/2 < total_rows and blk_col + blk_width/2 < total_cols
27*77c1e3ccSAndroid Build Coastguard Worker void av1_simple_motion_search_early_term_none(AV1_COMP *const cpi,
28*77c1e3ccSAndroid Build Coastguard Worker                                               MACROBLOCK *x,
29*77c1e3ccSAndroid Build Coastguard Worker                                               SIMPLE_MOTION_DATA_TREE *sms_tree,
30*77c1e3ccSAndroid Build Coastguard Worker                                               const RD_STATS *none_rdc,
31*77c1e3ccSAndroid Build Coastguard Worker                                               PartitionSearchState *part_state);
32*77c1e3ccSAndroid Build Coastguard Worker 
33*77c1e3ccSAndroid Build Coastguard Worker // Get the features for selecting the max and min partition size. Currently this
34*77c1e3ccSAndroid Build Coastguard Worker // performs simple_motion_search on 16X16 subblocks of the current superblock,
35*77c1e3ccSAndroid Build Coastguard Worker // and then extract the statistics of sse and motion vectors as features.
36*77c1e3ccSAndroid Build Coastguard Worker void av1_get_max_min_partition_features(AV1_COMP *const cpi, MACROBLOCK *x,
37*77c1e3ccSAndroid Build Coastguard Worker                                         int mi_row, int mi_col,
38*77c1e3ccSAndroid Build Coastguard Worker                                         float *features);
39*77c1e3ccSAndroid Build Coastguard Worker 
40*77c1e3ccSAndroid Build Coastguard Worker // Predict the maximum BLOCK_SIZE to be used to encoder the current superblock.
41*77c1e3ccSAndroid Build Coastguard Worker BLOCK_SIZE av1_predict_max_partition(const AV1_COMP *const cpi,
42*77c1e3ccSAndroid Build Coastguard Worker                                      const MACROBLOCK *const x,
43*77c1e3ccSAndroid Build Coastguard Worker                                      const float *features);
44*77c1e3ccSAndroid Build Coastguard Worker 
45*77c1e3ccSAndroid Build Coastguard Worker // Attempts an early termination after PARTITION_SPLIT.
46*77c1e3ccSAndroid Build Coastguard Worker void av1_ml_early_term_after_split(AV1_COMP *const cpi, MACROBLOCK *const x,
47*77c1e3ccSAndroid Build Coastguard Worker                                    SIMPLE_MOTION_DATA_TREE *const sms_tree,
48*77c1e3ccSAndroid Build Coastguard Worker                                    int64_t best_rd, int64_t part_none_rd,
49*77c1e3ccSAndroid Build Coastguard Worker                                    int64_t part_split_rd,
50*77c1e3ccSAndroid Build Coastguard Worker                                    int64_t *split_block_rd,
51*77c1e3ccSAndroid Build Coastguard Worker                                    PartitionSearchState *part_state);
52*77c1e3ccSAndroid Build Coastguard Worker 
53*77c1e3ccSAndroid Build Coastguard Worker // Use the rdcost ratio and source var ratio to prune PARTITION_HORZ and
54*77c1e3ccSAndroid Build Coastguard Worker // PARTITION_VERT.
55*77c1e3ccSAndroid Build Coastguard Worker // TODO([email protected]): Currently this model does not use q value and has
56*77c1e3ccSAndroid Build Coastguard Worker // no information about rectangular partitions. Preliminary experiments suggest
57*77c1e3ccSAndroid Build Coastguard Worker // that we can get better performance by adding in q_index and rectangular
58*77c1e3ccSAndroid Build Coastguard Worker // sse/var from SMS. We should retrain and tune this model later.
59*77c1e3ccSAndroid Build Coastguard Worker void av1_ml_prune_rect_partition(AV1_COMP *const cpi, const MACROBLOCK *const x,
60*77c1e3ccSAndroid Build Coastguard Worker                                  int64_t best_rd, int64_t none_rd,
61*77c1e3ccSAndroid Build Coastguard Worker                                  const int64_t *split_rd,
62*77c1e3ccSAndroid Build Coastguard Worker                                  PartitionSearchState *part_state);
63*77c1e3ccSAndroid Build Coastguard Worker 
64*77c1e3ccSAndroid Build Coastguard Worker // Use a ML model to predict if horz4 and vert4 should be considered.
65*77c1e3ccSAndroid Build Coastguard Worker void av1_ml_prune_4_partition(AV1_COMP *const cpi, MACROBLOCK *const x,
66*77c1e3ccSAndroid Build Coastguard Worker                               int part_ctx, int64_t best_rd,
67*77c1e3ccSAndroid Build Coastguard Worker                               PartitionSearchState *part_state,
68*77c1e3ccSAndroid Build Coastguard Worker                               int *part4_allowed,
69*77c1e3ccSAndroid Build Coastguard Worker                               unsigned int pb_source_variance);
70*77c1e3ccSAndroid Build Coastguard Worker 
71*77c1e3ccSAndroid Build Coastguard Worker // ML-based partition search breakout after PARTITION_NONE.
72*77c1e3ccSAndroid Build Coastguard Worker void av1_ml_predict_breakout(AV1_COMP *const cpi, const MACROBLOCK *const x,
73*77c1e3ccSAndroid Build Coastguard Worker                              const RD_STATS *const rd_stats,
74*77c1e3ccSAndroid Build Coastguard Worker                              unsigned int pb_source_variance, int bit_depth,
75*77c1e3ccSAndroid Build Coastguard Worker                              PartitionSearchState *part_state);
76*77c1e3ccSAndroid Build Coastguard Worker 
77*77c1e3ccSAndroid Build Coastguard Worker // The first round of partition pruning determined before any partition
78*77c1e3ccSAndroid Build Coastguard Worker // has been tested. The decisions will be updated and passed back
79*77c1e3ccSAndroid Build Coastguard Worker // to the partition search function.
80*77c1e3ccSAndroid Build Coastguard Worker void av1_prune_partitions_before_search(AV1_COMP *const cpi,
81*77c1e3ccSAndroid Build Coastguard Worker                                         MACROBLOCK *const x,
82*77c1e3ccSAndroid Build Coastguard Worker                                         SIMPLE_MOTION_DATA_TREE *const sms_tree,
83*77c1e3ccSAndroid Build Coastguard Worker                                         PartitionSearchState *part_state);
84*77c1e3ccSAndroid Build Coastguard Worker 
85*77c1e3ccSAndroid Build Coastguard Worker // Prune out partitions that lead to coding block sizes outside the min and max
86*77c1e3ccSAndroid Build Coastguard Worker // bsizes set by the encoder. Max and min square partition levels are defined as
87*77c1e3ccSAndroid Build Coastguard Worker // the partition nodes that the recursive function rd_pick_partition() can
88*77c1e3ccSAndroid Build Coastguard Worker // reach. To implement this: only PARTITION_NONE is allowed if the current node
89*77c1e3ccSAndroid Build Coastguard Worker // equals max_partition_size, only PARTITION_SPLIT is allowed if the current
90*77c1e3ccSAndroid Build Coastguard Worker // node exceeds max_partition_size.
91*77c1e3ccSAndroid Build Coastguard Worker void av1_prune_partitions_by_max_min_bsize(SuperBlockEnc *sb_enc,
92*77c1e3ccSAndroid Build Coastguard Worker                                            PartitionSearchState *part_state);
93*77c1e3ccSAndroid Build Coastguard Worker 
94*77c1e3ccSAndroid Build Coastguard Worker // Prune out AB partitions based on rd decisions made from testing the
95*77c1e3ccSAndroid Build Coastguard Worker // basic partitions.
96*77c1e3ccSAndroid Build Coastguard Worker void av1_prune_ab_partitions(AV1_COMP *cpi, const MACROBLOCK *x,
97*77c1e3ccSAndroid Build Coastguard Worker                              const PC_TREE *pc_tree, int pb_source_variance,
98*77c1e3ccSAndroid Build Coastguard Worker                              int64_t best_rdcost,
99*77c1e3ccSAndroid Build Coastguard Worker                              const RD_RECT_PART_WIN_INFO *rect_part_win_info,
100*77c1e3ccSAndroid Build Coastguard Worker                              bool ext_partition_allowed,
101*77c1e3ccSAndroid Build Coastguard Worker                              PartitionSearchState *part_state,
102*77c1e3ccSAndroid Build Coastguard Worker                              int *ab_partitions_allowed);
103*77c1e3ccSAndroid Build Coastguard Worker 
104*77c1e3ccSAndroid Build Coastguard Worker void av1_collect_motion_search_features_sb(AV1_COMP *const cpi, ThreadData *td,
105*77c1e3ccSAndroid Build Coastguard Worker                                            TileDataEnc *tile_data,
106*77c1e3ccSAndroid Build Coastguard Worker                                            const int mi_row, const int mi_col,
107*77c1e3ccSAndroid Build Coastguard Worker                                            const BLOCK_SIZE bsize,
108*77c1e3ccSAndroid Build Coastguard Worker                                            aom_partition_features_t *features);
109*77c1e3ccSAndroid Build Coastguard Worker void av1_prepare_motion_search_features_block(
110*77c1e3ccSAndroid Build Coastguard Worker     AV1_COMP *const cpi, ThreadData *td, TileDataEnc *tile_data,
111*77c1e3ccSAndroid Build Coastguard Worker     const int mi_row, const int mi_col, const BLOCK_SIZE bsize,
112*77c1e3ccSAndroid Build Coastguard Worker     const int valid_partition_types, unsigned int *block_sse,
113*77c1e3ccSAndroid Build Coastguard Worker     unsigned int *block_var, unsigned int sub_block_sse[4],
114*77c1e3ccSAndroid Build Coastguard Worker     unsigned int sub_block_var[4], unsigned int horz_block_sse[2],
115*77c1e3ccSAndroid Build Coastguard Worker     unsigned int horz_block_var[2], unsigned int vert_block_sse[2],
116*77c1e3ccSAndroid Build Coastguard Worker     unsigned int vert_block_var[2]);
117*77c1e3ccSAndroid Build Coastguard Worker #endif  // !CONFIG_REALTIME_ONLY
118*77c1e3ccSAndroid Build Coastguard Worker 
119*77c1e3ccSAndroid Build Coastguard Worker // A simplified version of set_offsets meant to be used for
120*77c1e3ccSAndroid Build Coastguard Worker // simple_motion_search.
set_offsets_for_motion_search(const AV1_COMP * const cpi,MACROBLOCK * const x,int mi_row,int mi_col,BLOCK_SIZE bsize)121*77c1e3ccSAndroid Build Coastguard Worker static inline void set_offsets_for_motion_search(const AV1_COMP *const cpi,
122*77c1e3ccSAndroid Build Coastguard Worker                                                  MACROBLOCK *const x,
123*77c1e3ccSAndroid Build Coastguard Worker                                                  int mi_row, int mi_col,
124*77c1e3ccSAndroid Build Coastguard Worker                                                  BLOCK_SIZE bsize) {
125*77c1e3ccSAndroid Build Coastguard Worker   const AV1_COMMON *const cm = &cpi->common;
126*77c1e3ccSAndroid Build Coastguard Worker   const CommonModeInfoParams *const mi_params = &cm->mi_params;
127*77c1e3ccSAndroid Build Coastguard Worker   const int num_planes = av1_num_planes(cm);
128*77c1e3ccSAndroid Build Coastguard Worker   MACROBLOCKD *const xd = &x->e_mbd;
129*77c1e3ccSAndroid Build Coastguard Worker   const int mi_width = mi_size_wide[bsize];
130*77c1e3ccSAndroid Build Coastguard Worker   const int mi_height = mi_size_high[bsize];
131*77c1e3ccSAndroid Build Coastguard Worker 
132*77c1e3ccSAndroid Build Coastguard Worker   set_mode_info_offsets(&cpi->common.mi_params, &cpi->mbmi_ext_info, x, xd,
133*77c1e3ccSAndroid Build Coastguard Worker                         mi_row, mi_col);
134*77c1e3ccSAndroid Build Coastguard Worker 
135*77c1e3ccSAndroid Build Coastguard Worker   // Set up destination pointers.
136*77c1e3ccSAndroid Build Coastguard Worker   av1_setup_dst_planes(xd->plane, bsize, &cm->cur_frame->buf, mi_row, mi_col, 0,
137*77c1e3ccSAndroid Build Coastguard Worker                        num_planes);
138*77c1e3ccSAndroid Build Coastguard Worker 
139*77c1e3ccSAndroid Build Coastguard Worker   // Set up limit values for MV components.
140*77c1e3ccSAndroid Build Coastguard Worker   // Mv beyond the range do not produce new/different prediction block.
141*77c1e3ccSAndroid Build Coastguard Worker   av1_set_mv_limits(mi_params, &x->mv_limits, mi_row, mi_col, mi_height,
142*77c1e3ccSAndroid Build Coastguard Worker                     mi_width, cpi->oxcf.border_in_pixels);
143*77c1e3ccSAndroid Build Coastguard Worker 
144*77c1e3ccSAndroid Build Coastguard Worker   set_plane_n4(xd, mi_width, mi_height, num_planes);
145*77c1e3ccSAndroid Build Coastguard Worker 
146*77c1e3ccSAndroid Build Coastguard Worker   xd->mi_row = mi_row;
147*77c1e3ccSAndroid Build Coastguard Worker   xd->mi_col = mi_col;
148*77c1e3ccSAndroid Build Coastguard Worker 
149*77c1e3ccSAndroid Build Coastguard Worker   // Set up distance of MB to edge of frame in 1/8th pel units.
150*77c1e3ccSAndroid Build Coastguard Worker   assert(!(mi_col & (mi_width - 1)) && !(mi_row & (mi_height - 1)));
151*77c1e3ccSAndroid Build Coastguard Worker   xd->mb_to_top_edge = -GET_MV_SUBPEL(mi_row * MI_SIZE);
152*77c1e3ccSAndroid Build Coastguard Worker   xd->mb_to_bottom_edge =
153*77c1e3ccSAndroid Build Coastguard Worker       GET_MV_SUBPEL((mi_params->mi_rows - mi_height - mi_row) * MI_SIZE);
154*77c1e3ccSAndroid Build Coastguard Worker   xd->mb_to_left_edge = -GET_MV_SUBPEL(mi_col * MI_SIZE);
155*77c1e3ccSAndroid Build Coastguard Worker   xd->mb_to_right_edge =
156*77c1e3ccSAndroid Build Coastguard Worker       GET_MV_SUBPEL((mi_params->mi_cols - mi_width - mi_col) * MI_SIZE);
157*77c1e3ccSAndroid Build Coastguard Worker 
158*77c1e3ccSAndroid Build Coastguard Worker   // Set up source buffers.
159*77c1e3ccSAndroid Build Coastguard Worker   av1_setup_src_planes(x, cpi->source, mi_row, mi_col, num_planes, bsize);
160*77c1e3ccSAndroid Build Coastguard Worker }
161*77c1e3ccSAndroid Build Coastguard Worker 
162*77c1e3ccSAndroid Build Coastguard Worker void av1_init_simple_motion_search_mvs_for_sb(const AV1_COMP *cpi,
163*77c1e3ccSAndroid Build Coastguard Worker                                               const TileInfo *tile_info,
164*77c1e3ccSAndroid Build Coastguard Worker                                               MACROBLOCK *x,
165*77c1e3ccSAndroid Build Coastguard Worker                                               SIMPLE_MOTION_DATA_TREE *sms_root,
166*77c1e3ccSAndroid Build Coastguard Worker                                               int mi_row, int mi_col);
167*77c1e3ccSAndroid Build Coastguard Worker 
is_full_sb(const CommonModeInfoParams * const mi_params,int mi_row,int mi_col,BLOCK_SIZE sb_size)168*77c1e3ccSAndroid Build Coastguard Worker static inline int is_full_sb(const CommonModeInfoParams *const mi_params,
169*77c1e3ccSAndroid Build Coastguard Worker                              int mi_row, int mi_col, BLOCK_SIZE sb_size) {
170*77c1e3ccSAndroid Build Coastguard Worker   const int sb_mi_wide = mi_size_wide[sb_size];
171*77c1e3ccSAndroid Build Coastguard Worker   const int sb_mi_high = mi_size_high[sb_size];
172*77c1e3ccSAndroid Build Coastguard Worker 
173*77c1e3ccSAndroid Build Coastguard Worker   return (mi_row + sb_mi_high) <= mi_params->mi_rows &&
174*77c1e3ccSAndroid Build Coastguard Worker          (mi_col + sb_mi_wide) <= mi_params->mi_cols;
175*77c1e3ccSAndroid Build Coastguard Worker }
176*77c1e3ccSAndroid Build Coastguard Worker 
177*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
178*77c1e3ccSAndroid Build Coastguard Worker // Do not use this criteria for screen content videos.
179*77c1e3ccSAndroid Build Coastguard Worker // Since screen content videos could often find good predictors and the largest
180*77c1e3ccSAndroid Build Coastguard Worker // block size is likely to be used.
use_auto_max_partition(const AV1_COMP * const cpi,BLOCK_SIZE sb_size,int mi_row,int mi_col)181*77c1e3ccSAndroid Build Coastguard Worker static inline int use_auto_max_partition(const AV1_COMP *const cpi,
182*77c1e3ccSAndroid Build Coastguard Worker                                          BLOCK_SIZE sb_size, int mi_row,
183*77c1e3ccSAndroid Build Coastguard Worker                                          int mi_col) {
184*77c1e3ccSAndroid Build Coastguard Worker   assert(IMPLIES(cpi->ppi->gf_group.size > 0,
185*77c1e3ccSAndroid Build Coastguard Worker                  cpi->gf_frame_index < cpi->ppi->gf_group.size));
186*77c1e3ccSAndroid Build Coastguard Worker   const AV1_COMMON *const cm = &cpi->common;
187*77c1e3ccSAndroid Build Coastguard Worker   return !frame_is_intra_only(cm) && !cpi->use_screen_content_tools &&
188*77c1e3ccSAndroid Build Coastguard Worker          cpi->sf.part_sf.auto_max_partition_based_on_simple_motion !=
189*77c1e3ccSAndroid Build Coastguard Worker              NOT_IN_USE &&
190*77c1e3ccSAndroid Build Coastguard Worker          sb_size == BLOCK_128X128 &&
191*77c1e3ccSAndroid Build Coastguard Worker          is_full_sb(&cm->mi_params, mi_row, mi_col, sb_size) &&
192*77c1e3ccSAndroid Build Coastguard Worker          cpi->ppi->gf_group.update_type[cpi->gf_frame_index] !=
193*77c1e3ccSAndroid Build Coastguard Worker              OVERLAY_UPDATE &&
194*77c1e3ccSAndroid Build Coastguard Worker          cpi->ppi->gf_group.update_type[cpi->gf_frame_index] !=
195*77c1e3ccSAndroid Build Coastguard Worker              INTNL_OVERLAY_UPDATE;
196*77c1e3ccSAndroid Build Coastguard Worker }
197*77c1e3ccSAndroid Build Coastguard Worker 
dim_to_size(int dim)198*77c1e3ccSAndroid Build Coastguard Worker static BLOCK_SIZE dim_to_size(int dim) {
199*77c1e3ccSAndroid Build Coastguard Worker   switch (dim) {
200*77c1e3ccSAndroid Build Coastguard Worker     case 4: return BLOCK_4X4;
201*77c1e3ccSAndroid Build Coastguard Worker     case 8: return BLOCK_8X8;
202*77c1e3ccSAndroid Build Coastguard Worker     case 16: return BLOCK_16X16;
203*77c1e3ccSAndroid Build Coastguard Worker     case 32: return BLOCK_32X32;
204*77c1e3ccSAndroid Build Coastguard Worker     case 64: return BLOCK_64X64;
205*77c1e3ccSAndroid Build Coastguard Worker     case 128: return BLOCK_128X128;
206*77c1e3ccSAndroid Build Coastguard Worker     default: assert(0); return 0;
207*77c1e3ccSAndroid Build Coastguard Worker   }
208*77c1e3ccSAndroid Build Coastguard Worker }
209*77c1e3ccSAndroid Build Coastguard Worker 
set_max_min_partition_size(SuperBlockEnc * sb_enc,AV1_COMP * cpi,MACROBLOCK * x,const SPEED_FEATURES * sf,BLOCK_SIZE sb_size,int mi_row,int mi_col)210*77c1e3ccSAndroid Build Coastguard Worker static inline void set_max_min_partition_size(SuperBlockEnc *sb_enc,
211*77c1e3ccSAndroid Build Coastguard Worker                                               AV1_COMP *cpi, MACROBLOCK *x,
212*77c1e3ccSAndroid Build Coastguard Worker                                               const SPEED_FEATURES *sf,
213*77c1e3ccSAndroid Build Coastguard Worker                                               BLOCK_SIZE sb_size, int mi_row,
214*77c1e3ccSAndroid Build Coastguard Worker                                               int mi_col) {
215*77c1e3ccSAndroid Build Coastguard Worker   const AV1_COMMON *cm = &cpi->common;
216*77c1e3ccSAndroid Build Coastguard Worker 
217*77c1e3ccSAndroid Build Coastguard Worker   sb_enc->max_partition_size =
218*77c1e3ccSAndroid Build Coastguard Worker       AOMMIN(sf->part_sf.default_max_partition_size,
219*77c1e3ccSAndroid Build Coastguard Worker              dim_to_size(cpi->oxcf.part_cfg.max_partition_size));
220*77c1e3ccSAndroid Build Coastguard Worker   sb_enc->min_partition_size =
221*77c1e3ccSAndroid Build Coastguard Worker       AOMMAX(sf->part_sf.default_min_partition_size,
222*77c1e3ccSAndroid Build Coastguard Worker              dim_to_size(cpi->oxcf.part_cfg.min_partition_size));
223*77c1e3ccSAndroid Build Coastguard Worker   sb_enc->max_partition_size =
224*77c1e3ccSAndroid Build Coastguard Worker       AOMMIN(sb_enc->max_partition_size, cm->seq_params->sb_size);
225*77c1e3ccSAndroid Build Coastguard Worker   sb_enc->min_partition_size =
226*77c1e3ccSAndroid Build Coastguard Worker       AOMMIN(sb_enc->min_partition_size, cm->seq_params->sb_size);
227*77c1e3ccSAndroid Build Coastguard Worker 
228*77c1e3ccSAndroid Build Coastguard Worker   if (use_auto_max_partition(cpi, sb_size, mi_row, mi_col)) {
229*77c1e3ccSAndroid Build Coastguard Worker     float features[FEATURE_SIZE_MAX_MIN_PART_PRED] = { 0.0f };
230*77c1e3ccSAndroid Build Coastguard Worker 
231*77c1e3ccSAndroid Build Coastguard Worker     av1_get_max_min_partition_features(cpi, x, mi_row, mi_col, features);
232*77c1e3ccSAndroid Build Coastguard Worker     sb_enc->max_partition_size =
233*77c1e3ccSAndroid Build Coastguard Worker         AOMMAX(AOMMIN(av1_predict_max_partition(cpi, x, features),
234*77c1e3ccSAndroid Build Coastguard Worker                       sb_enc->max_partition_size),
235*77c1e3ccSAndroid Build Coastguard Worker                sb_enc->min_partition_size);
236*77c1e3ccSAndroid Build Coastguard Worker   }
237*77c1e3ccSAndroid Build Coastguard Worker }
238*77c1e3ccSAndroid Build Coastguard Worker #endif  // !CONFIG_REALTIME_ONLY
239*77c1e3ccSAndroid Build Coastguard Worker #endif  // AOM_AV1_ENCODER_PARTITION_STRATEGY_H_
240