Merge FPMT updates of frame_probs to default
FPMT related updates to handle frame_probs are merged to the default
path.
Change-Id: I3a24ed592fa11bbf46198b996790f44cbd12b444
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index d35d91b..cfee892 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1648,7 +1648,6 @@
assert(oxcf->txfm_cfg.enable_tx64 || tx_search_type != USE_LARGESTALL);
features->tx_mode = select_tx_mode(cm, tx_search_type);
-#if CONFIG_FRAME_PARALLEL_ENCODE
// Retain the frame level probability update conditions for parallel frames.
// These conditions will be consumed during postencode stage to update the
// probability.
@@ -1666,7 +1665,6 @@
cpi->sf.interp_sf.adaptive_interp_filter_search == 2 &&
features->interp_filter == SWITCHABLE);
}
-#endif
if (cpi->sf.tx_sf.tx_type_search.prune_tx_type_using_stats ||
((cpi->sf.tx_sf.tx_type_search.fast_inter_tx_type_prob_thresh !=
@@ -1687,8 +1685,7 @@
const int new_prob =
sum ? MAX_TX_TYPE_PROB * cpi->td.rd_counts.tx_type_used[i][j] / sum
: (j ? 0 : MAX_TX_TYPE_PROB);
-#if CONFIG_FRAME_PARALLEL_ENCODE
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
if (cpi->ppi->fpmt_unit_test_cfg == PARALLEL_SIMULATION_ENCODE) {
if (cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] ==
0) {
@@ -1710,7 +1707,7 @@
}
update_txtype_frameprobs = 0;
}
-#endif // CONFIG_FPMT_TEST
+#endif // CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
// Track the frame probabilities of parallel encode frames to update
// during postencode stage.
if (cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0) {
@@ -1718,7 +1715,6 @@
cpi->frame_new_probs[cpi->num_frame_recode]
.tx_type_probs[update_type][i][j] = new_prob;
}
-#endif // CONFIG_FRAME_PARALLEL_ENCODE
if (update_txtype_frameprobs) {
int prob =
(frame_probs->tx_type_probs[update_type][i][j] + new_prob) >> 1;
@@ -1748,8 +1744,7 @@
const int new_prob =
sum ? 128 * cpi->td.rd_counts.obmc_used[i][1] / sum : 0;
-#if CONFIG_FRAME_PARALLEL_ENCODE
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
if (cpi->ppi->fpmt_unit_test_cfg == PARALLEL_SIMULATION_ENCODE) {
if (cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] == 0) {
temp_frame_probs_simulation->obmc_probs[update_type][i] =
@@ -1765,7 +1760,7 @@
}
update_obmc_frameprobs = 0;
}
-#endif // CONFIG_FPMT_TEST
+#endif // CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
// Track the frame probabilities of parallel encode frames to update
// during postencode stage.
if (cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0) {
@@ -1773,7 +1768,6 @@
cpi->frame_new_probs[cpi->num_frame_recode].obmc_probs[update_type][i] =
new_prob;
}
-#endif // CONFIG_FRAME_PARALLEL_ENCODE
if (update_obmc_frameprobs) {
frame_probs->obmc_probs[update_type][i] =
(frame_probs->obmc_probs[update_type][i] + new_prob) >> 1;
@@ -1789,8 +1783,7 @@
int sum = 0;
for (i = 0; i < 2; i++) sum += cpi->td.rd_counts.warped_used[i];
const int new_prob = sum ? 128 * cpi->td.rd_counts.warped_used[1] / sum : 0;
-#if CONFIG_FRAME_PARALLEL_ENCODE
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
if (cpi->ppi->fpmt_unit_test_cfg == PARALLEL_SIMULATION_ENCODE) {
if (cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] == 0) {
temp_frame_probs_simulation->warped_probs[update_type] =
@@ -1806,7 +1799,7 @@
}
update_warp_frameprobs = 0;
}
-#endif // CONFIG_FPMT_TEST
+#endif // CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
// Track the frame probabilities of parallel encode frames to update
// during postencode stage.
if (cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0) {
@@ -1814,7 +1807,6 @@
cpi->frame_new_probs[cpi->num_frame_recode].warped_probs[update_type] =
new_prob;
}
-#endif // CONFIG_FRAME_PARALLEL_ENCODE
if (update_warp_frameprobs) {
frame_probs->warped_probs[update_type] =
(frame_probs->warped_probs[update_type] + new_prob) >> 1;
@@ -1841,8 +1833,7 @@
const int new_prob =
sum ? 1536 * cpi->td.counts->switchable_interp[i][j] / sum
: (j ? 0 : 1536);
-#if CONFIG_FRAME_PARALLEL_ENCODE
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
if (cpi->ppi->fpmt_unit_test_cfg == PARALLEL_SIMULATION_ENCODE) {
if (cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] ==
0) {
@@ -1864,7 +1855,7 @@
}
update_interpfilter_frameprobs = 0;
}
-#endif // CONFIG_FPMT_TEST
+#endif // CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
// Track the frame probabilities of parallel encode frames to update
// during postencode stage.
if (cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0) {
@@ -1872,7 +1863,6 @@
cpi->frame_new_probs[cpi->num_frame_recode]
.switchable_interp_probs[update_type][i][j] = new_prob;
}
-#endif // CONFIG_FRAME_PARALLEL_ENCODE
if (update_interpfilter_frameprobs) {
int prob = (frame_probs->switchable_interp_probs[update_type][i][j] +
new_prob) >>
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index a4856cc..cc5292c 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -2599,9 +2599,8 @@
int original_q = 0;
#endif
-#if CONFIG_FRAME_PARALLEL_ENCODE
cpi->num_frame_recode = 0;
-#endif
+
// Loop variables
int loop = 0;
int loop_count = 0;
@@ -2864,12 +2863,10 @@
if (loop) {
++loop_count;
-#if CONFIG_FRAME_PARALLEL_ENCODE
cpi->num_frame_recode =
(cpi->num_frame_recode < (NUM_RECODES_PER_FRAME - 1))
? (cpi->num_frame_recode + 1)
: (NUM_RECODES_PER_FRAME - 1);
-#endif
#if CONFIG_INTERNAL_STATS
++cpi->frame_recode_hits;
#endif
@@ -2938,14 +2935,12 @@
#if CONFIG_COLLECT_COMPONENT_TIMING
start_timing(cpi, encode_with_or_without_recode_time);
#endif
-#if CONFIG_FRAME_PARALLEL_ENCODE
for (int i = 0; i < NUM_RECODES_PER_FRAME; i++) {
cpi->do_update_frame_probs_txtype[i] = 0;
cpi->do_update_frame_probs_obmc[i] = 0;
cpi->do_update_frame_probs_warp[i] = 0;
cpi->do_update_frame_probs_interpfilter[i] = 0;
}
-#endif
cpi->do_update_vbr_bits_off_target_fast = 0;
int err;
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index cf1891d..6606b1a 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -1505,15 +1505,16 @@
/**@}*/
} AV1EncRowMultiThreadInfo;
+/*!
+ * \brief Max number of recodes used to track the frame probabilities.
+ */
+#define NUM_RECODES_PER_FRAME 10
+
#if CONFIG_FRAME_PARALLEL_ENCODE
/*!
* \brief Max number of frames that can be encoded in a parallel encode set.
*/
#define MAX_PARALLEL_FRAMES 4
-/*!
- * \brief Max number of recodes used to track the frame probabilities.
- */
-#define NUM_RECODES_PER_FRAME 10
/*!
* \brief Buffers to be backed up during parallel encode set to be restored
@@ -2985,7 +2986,6 @@
*/
VarBasedPartitionInfo vbp_info;
-#if CONFIG_FRAME_PARALLEL_ENCODE
/*!
* Number of recodes in the frame.
*/
@@ -3016,6 +3016,7 @@
*/
int do_update_frame_probs_interpfilter[NUM_RECODES_PER_FRAME];
+#if CONFIG_FRAME_PARALLEL_ENCODE
#if CONFIG_FPMT_TEST
/*!
* Temporary variable for simulation.
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c
index b495091..16df508 100644
--- a/av1/encoder/pass2_strategy.c
+++ b/av1/encoder/pass2_strategy.c
@@ -4195,10 +4195,9 @@
#endif
}
-#if CONFIG_FRAME_PARALLEL_ENCODE
// Update the frame probabilities obtained from parallel encode frames
FrameProbInfo *const frame_probs = &cpi->ppi->frame_probs;
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
/* The variable temp_active_best_quality is introduced only for quality
* simulation purpose, it retains the value previous to the parallel
* encode frames. The variable is updated based on the update flag.
@@ -4239,7 +4238,7 @@
for (j = TX_TYPES - 1; j >= 0; j--) {
const int new_prob =
cpi->frame_new_probs[loop].tx_type_probs[update_type][i][j];
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
int prob =
(temp_frame_probs_simulation->tx_type_probs[update_type][i][j] +
new_prob) >>
@@ -4267,7 +4266,7 @@
for (i = 0; i < BLOCK_SIZES_ALL; i++) {
const int new_prob =
cpi->frame_new_probs[loop].obmc_probs[update_type][i];
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
temp_frame_probs_simulation->obmc_probs[update_type][i] =
(temp_frame_probs_simulation->obmc_probs[update_type][i] +
new_prob) >>
@@ -4285,7 +4284,7 @@
const FRAME_UPDATE_TYPE update_type =
get_frame_update_type(&cpi->ppi->gf_group, cpi->gf_frame_index);
const int new_prob = cpi->frame_new_probs[loop].warped_probs[update_type];
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
temp_frame_probs_simulation->warped_probs[update_type] =
(temp_frame_probs_simulation->warped_probs[update_type] + new_prob) >>
1;
@@ -4307,7 +4306,7 @@
for (j = SWITCHABLE_FILTERS - 1; j >= 0; j--) {
const int new_prob = cpi->frame_new_probs[loop]
.switchable_interp_probs[update_type][i][j];
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
int prob = (temp_frame_probs_simulation
->switchable_interp_probs[update_type][i][j] +
new_prob) >>
@@ -4330,7 +4329,7 @@
}
}
-#if CONFIG_FPMT_TEST
+#if CONFIG_FRAME_PARALLEL_ENCODE && CONFIG_FPMT_TEST
// Copying temp_frame_probs_simulation to temp_frame_probs based on
// the flag
if (cpi->do_frame_data_update &&
@@ -4360,6 +4359,7 @@
}
}
#endif
+#if CONFIG_FRAME_PARALLEL_ENCODE
// Update framerate obtained from parallel encode frames
if (cpi->common.show_frame &&
cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0)