Make get_frame_update_type only depend on gf_group struct
Change-Id: I3b9c26ef358f76c7d0473211c018aa4b41ef8099
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index 000e582..28803a9 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -1147,7 +1147,7 @@
int code_arf = 0;
struct lookahead_entry *source = NULL;
struct lookahead_entry *last_source = NULL;
- FRAME_UPDATE_TYPE frame_update_type = get_frame_update_type(cpi);
+ FRAME_UPDATE_TYPE frame_update_type = get_frame_update_type(gf_group);
if (frame_params.show_existing_frame) {
source = av1_lookahead_pop(cpi->lookahead, flush);
} else {
@@ -1208,16 +1208,16 @@
#if CONFIG_REALTIME_ONLY
av1_get_one_pass_rt_params(cpi, &frame_params, *frame_flags);
- frame_update_type = get_frame_update_type(cpi);
+ frame_update_type = get_frame_update_type(gf_group);
#else
if (oxcf->pass == 0 && oxcf->mode == REALTIME && oxcf->lag_in_frames == 0) {
av1_get_one_pass_rt_params(cpi, &frame_params, *frame_flags);
- frame_update_type = get_frame_update_type(cpi);
+ frame_update_type = get_frame_update_type(gf_group);
} else if (oxcf->pass != 1 &&
(!frame_params.show_existing_frame || is_overlay)) {
// GF_GROUP needs updating for arf overlays as well as non-show-existing
av1_get_second_pass_params(cpi, &frame_params, *frame_flags);
- frame_update_type = get_frame_update_type(cpi);
+ frame_update_type = get_frame_update_type(gf_group);
}
#endif
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 6f98e7f..c777790 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -4979,7 +4979,7 @@
}
if (cpi->sf.tx_type_search.prune_tx_type_using_stats) {
- const FRAME_UPDATE_TYPE update_type = get_frame_update_type(cpi);
+ const FRAME_UPDATE_TYPE update_type = get_frame_update_type(&cpi->gf_group);
for (i = 0; i < TX_SIZES_ALL; i++) {
int sum = 0;
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 07c81b0..857758d 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -1445,19 +1445,8 @@
}
// Get update type of the current frame.
-static INLINE FRAME_UPDATE_TYPE get_frame_update_type(const AV1_COMP *cpi) {
- const GF_GROUP *const gf_group = &cpi->gf_group;
- if (gf_group->size == 0) {
- // Special case 1: happens at the first frame of a video.
- return KF_UPDATE;
- }
- if (gf_group->index == gf_group->size) {
- // Special case 2: happens at the start of next GF group, or at the end of
- // the key-frame group. So, not marked in gf_group->update_type array, but
- // can be inferred implicitly.
- return cpi->rc.source_alt_ref_active ? OVERLAY_UPDATE : GF_UPDATE;
- }
- // General case.
+static INLINE FRAME_UPDATE_TYPE
+get_frame_update_type(const GF_GROUP *gf_group) {
return gf_group->update_type[gf_group->index];
}
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index deb585a..fbfc2d1 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -2075,7 +2075,8 @@
const int16_t *const scan = scan_order->scan;
// record tx type usage
- td->rd_counts.tx_type_used[get_frame_update_type(cpi)][tx_size][tx_type]++;
+ td->rd_counts
+ .tx_type_used[get_frame_update_type(&cpi->gf_group)][tx_size][tx_type]++;
#if CONFIG_ENTROPY_STATS
av1_update_eob_context(cdf_idx, eob, tx_size, tx_class, plane_type, ec_ctx,
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 5f3229f..1aa174f 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -3082,7 +3082,7 @@
assert(plane == 0);
allowed_tx_mask = ext_tx_used_flag;
int num_allowed = 0;
- const FRAME_UPDATE_TYPE update_type = get_frame_update_type(cpi);
+ const FRAME_UPDATE_TYPE update_type = get_frame_update_type(&cpi->gf_group);
const int *tx_type_probs = cpi->tx_type_probs[update_type][tx_size];
int i;