Group unit test related config in AV1EncoderConfig
This CL groups the configuration parameters related to unit tests
in AV1EncoderConfig into a new struct UnitTestCfg, and adds the
relevant documentation.
BUG=aomedia:2701
Change-Id: I8a4e62cb38ee47f4cb7405f5cb697abb68a38c11
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 94500d7..4b924d7 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -1077,8 +1077,12 @@
oxcf->save_as_annexb = cfg->save_as_annexb;
oxcf->frame_periodic_boost = extra_cfg->frame_periodic_boost;
- oxcf->motion_vector_unit_test = extra_cfg->motion_vector_unit_test;
- oxcf->sb_multipass_unit_test = extra_cfg->sb_multipass_unit_test;
+
+ // Set unit test related configuration.
+ oxcf->unit_test_cfg.motion_vector_unit_test =
+ extra_cfg->motion_vector_unit_test;
+ oxcf->unit_test_cfg.sb_multipass_unit_test =
+ extra_cfg->sb_multipass_unit_test;
oxcf->chroma_subsampling_x = extra_cfg->chroma_subsampling_x;
oxcf->chroma_subsampling_y = extra_cfg->chroma_subsampling_y;
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index d64b07a..88ea806 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -5247,7 +5247,8 @@
// The superblock can be searched only once, or twice consecutively for
// better quality. Note that the meaning of passes here is different from
// the general concept of 1-pass/2-pass encoders.
- const int num_passes = cpi->oxcf.sb_multipass_unit_test ? 2 : 1;
+ const int num_passes =
+ cpi->oxcf.unit_test_cfg.sb_multipass_unit_test ? 2 : 1;
if (num_passes == 1) {
PC_TREE *const pc_root = av1_alloc_pc_tree_node(sb_size);
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 0c0d4a4..f9b4a23 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -558,6 +558,13 @@
} ColorCfg;
typedef struct {
+ // Indicates if extreme motion vector unit test should be enabled or not.
+ unsigned int motion_vector_unit_test;
+ // Indicates if superblock multipass unit test should be enabled or not.
+ unsigned int sb_multipass_unit_test;
+} UnitTestCfg;
+
+typedef struct {
// List of QP offsets for: keyframe, ALTREF, and 3 levels of internal ARFs.
// If any of these values are negative, fixed offsets are disabled.
// Uses internal q range.
@@ -684,13 +691,14 @@
// Configuration related to reference frames.
RefFrameCfg ref_frm_cfg;
+ // Configuration related to unit tests.
+ UnitTestCfg unit_test_cfg;
+
uint8_t cdf_update_mode;
aom_superblock_size_t superblock_size;
uint8_t monochrome;
unsigned int full_still_picture_hdr;
int enable_dual_filter;
- unsigned int motion_vector_unit_test;
- unsigned int sb_multipass_unit_test;
int enable_order_hint;
int enable_ref_frame_mvs;
unsigned int allow_ref_frame_mvs;
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 32f42fe..3ae7f2f 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4069,7 +4069,8 @@
if ((cpi->prune_ref_frame_mask >> ref_type) & 1) return 1;
// This is only used in motion vector unit test.
- if (cpi->oxcf.motion_vector_unit_test && ref_frame[0] == INTRA_FRAME)
+ if (cpi->oxcf.unit_test_cfg.motion_vector_unit_test &&
+ ref_frame[0] == INTRA_FRAME)
return 1;
const AV1_COMMON *const cm = &cpi->common;
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index cf51ee6..462d535 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -1173,9 +1173,9 @@
}
// This is only used in motion vector unit test.
- if (cpi->oxcf.motion_vector_unit_test == 1)
+ if (cpi->oxcf.unit_test_cfg.motion_vector_unit_test == 1)
cpi->mv_search_params.find_fractional_mv_step = av1_return_max_sub_pixel_mv;
- else if (cpi->oxcf.motion_vector_unit_test == 2)
+ else if (cpi->oxcf.unit_test_cfg.motion_vector_unit_test == 2)
cpi->mv_search_params.find_fractional_mv_step = av1_return_min_sub_pixel_mv;
}
@@ -1264,9 +1264,9 @@
}
// This is only used in motion vector unit test.
- if (cpi->oxcf.motion_vector_unit_test == 1)
+ if (cpi->oxcf.unit_test_cfg.motion_vector_unit_test == 1)
mv_search_params->find_fractional_mv_step = av1_return_max_sub_pixel_mv;
- else if (cpi->oxcf.motion_vector_unit_test == 2)
+ else if (cpi->oxcf.unit_test_cfg.motion_vector_unit_test == 2)
mv_search_params->find_fractional_mv_step = av1_return_min_sub_pixel_mv;
// assert ensures that tx_domain_dist_level is accessed correctly