Commit aec522e9de for aom
commit aec522e9dea84992d8096f0bce6a95cc070378f9
Author: Jingning Han <jingning@google.com>
Date: Wed Nov 26 09:23:51 2025 -0800
Move experimental code under compiler flag
Change-Id: Ib6c3acf2d9f842555cc92668bb669a9ee6b7a944
diff --git a/av1/encoder/partition_search.c b/av1/encoder/partition_search.c
index 19540ae590..681c4f0cbb 100644
--- a/av1/encoder/partition_search.c
+++ b/av1/encoder/partition_search.c
@@ -41,7 +41,9 @@
#include "av1/encoder/tune_vmaf.h"
#endif
-#define COLLECT_MOTION_SEARCH_FEATURE_SB 0
+#ifndef COLLECT_MOTION_SEARCH_FEATURE_SB
+#define COLLECT_MOTION_SEARCH_FEATURE_SB CONFIG_PARTITION_SEARCH_ORDER
+#endif
#if CONFIG_PARTITION_SEARCH_ORDER
void av1_reset_part_sf(PARTITION_SPEED_FEATURES *part_sf) {
@@ -96,6 +98,7 @@ void av1_reset_sf_for_ext_part(AV1_COMP *const cpi) {
#endif // CONFIG_PARTITION_SEARCH_ORDER
#if !CONFIG_REALTIME_ONLY
+#if COLLECT_MOTION_SEARCH_FEATURE_SB
// If input |features| is NULL, write tpl stats to file for each super block.
// Otherwise, store tpl stats to |features|.
// The tpl stats is computed in the unit of tpl_bsize_1d (16x16).
@@ -204,6 +207,7 @@ static void collect_tpl_stats_sb(const AV1_COMP *const cpi,
}
}
}
+#endif // COLLECT_MOTION_SEARCH_FEATURE_SB
#endif // !CONFIG_REALTIME_ONLY
static void update_txfm_count(MACROBLOCK *x, MACROBLOCKD *xd,
@@ -4560,6 +4564,7 @@ static void split_partition_search(
av1_restore_context(x, x_ctx, mi_row, mi_col, bsize, av1_num_planes(cm));
}
+#if COLLECT_MOTION_SEARCH_FEATURE_SB
// The max number of nodes in the partition tree.
// The number of leaf nodes is (128x128) / (4x4) = 1024.
// The number of All possible parent nodes is 1 + 2 + ... + 512 = 1023.
@@ -4623,6 +4628,7 @@ static void write_partition_tree(AV1_COMP *const cpi,
fclose(pfile);
}
+#endif // COLLECT_MOTION_SEARCH_FEATURE_SB
#if CONFIG_PARTITION_SEARCH_ORDER
static void verify_write_partition_tree(const AV1_COMP *const cpi,
@@ -5584,12 +5590,13 @@ bool av1_rd_pick_partition(AV1_COMP *const cpi, ThreadData *td,
// external ML model.
// TODO(chengchen): reduce motion search. This function is similar to
// av1_get_max_min_partition_features().
- if (COLLECT_MOTION_SEARCH_FEATURE_SB && !frame_is_intra_only(cm) &&
- bsize == cm->seq_params->sb_size) {
+#if COLLECT_MOTION_SEARCH_FEATURE_SB
+ if (!frame_is_intra_only(cm) && bsize == cm->seq_params->sb_size) {
av1_collect_motion_search_features_sb(cpi, td, tile_data, mi_row, mi_col,
bsize, /*features=*/NULL);
collect_tpl_stats_sb(cpi, bsize, mi_row, mi_col, /*features=*/NULL);
}
+#endif // !COLLECT_MOTION_SEARCH_FEATURE_SB
// Update rd cost of the bound using the current multiplier.
av1_rd_cost_update(x->rdmult, &best_rdc);
@@ -5851,12 +5858,11 @@ BEGIN_PARTITION_SEARCH:
const int emit_output = multi_pass_mode != SB_DRY_PASS;
const RUN_TYPE run_type = emit_output ? OUTPUT_ENABLED : DRY_RUN_NORMAL;
+#if COLLECT_MOTION_SEARCH_FEATURE_SB
// Write partition tree to file. Not used by default.
- if (COLLECT_MOTION_SEARCH_FEATURE_SB) {
- write_partition_tree(cpi, pc_tree, bsize, mi_row, mi_col);
- ++cpi->sb_counter;
- }
-
+ write_partition_tree(cpi, pc_tree, bsize, mi_row, mi_col);
+ ++cpi->sb_counter;
+#endif // COLLECT_MOTION_SEARCH_FEATURE_SB
set_cb_offsets(x->cb_offset, 0, 0);
encode_sb(cpi, td, tile_data, tp, mi_row, mi_col, run_type, bsize,
pc_tree, NULL);