Pass ref_frame_list through duck_encode interface
BUG=b/241257063
Change-Id: I2b6678ae680052eaf3670c8b3d564b083406bb99
diff --git a/av1/ducky_encode.cc b/av1/ducky_encode.cc
index 6cbc91a..16ff97d 100644
--- a/av1/ducky_encode.cc
+++ b/av1/ducky_encode.cc
@@ -15,6 +15,7 @@
#include <numeric>
#include <vector>
+#include "av1/common/enums.h"
#include "config/aom_config.h"
#include "aom/aom_encoder.h"
@@ -292,7 +293,7 @@
gf_group->max_layer_depth = 0;
int i = 0;
- for (auto &frame : gop_struct.gop_frame_list) {
+ for (const auto &frame : gop_struct.gop_frame_list) {
gf_group->update_type[i] = (int)frame.update_type;
if (frame.update_type == GopFrameType::kRegularArf) gf_group->arf_index = i;
@@ -310,6 +311,14 @@
AOMMAX(frame.layer_depth, gf_group->max_layer_depth);
gf_group->refbuf_state[i] =
frame.is_key_frame ? REFBUF_RESET : REFBUF_UPDATE;
+
+ memset(gf_group->ref_frame_list[i], -1, REF_FRAMES);
+ for (int ref_idx = 0;
+ ref_idx < static_cast<int>(frame.ref_frame_list.size()); ++ref_idx) {
+ int ref_frame = static_cast<int>(frame.ref_frame_list[ref_idx].name);
+ gf_group->ref_frame_list[i][ref_frame] =
+ static_cast<int8_t>(frame.ref_frame_list[ref_idx].index);
+ }
++i;
}
ppi->cpi->gf_frame_index = 0;
diff --git a/av1/encoder/firstpass.h b/av1/encoder/firstpass.h
index a872ea6..c81b612 100644
--- a/av1/encoder/firstpass.h
+++ b/av1/encoder/firstpass.h
@@ -362,6 +362,16 @@
REFBUF_STATE refbuf_state[MAX_STATIC_GF_GROUP_LENGTH];
int arf_index; // the index in the gf group of ARF, if no arf, then -1
int size; // The total length of a GOP
+
+ // The offset into lookahead_ctx for choosing
+ // source of frame parallel encodes.
+ int src_offset[MAX_STATIC_GF_GROUP_LENGTH];
+ // Stores the display order hint of each frame in the current GF_GROUP.
+ int display_idx[MAX_STATIC_GF_GROUP_LENGTH];
+
+ // Reference frame list
+ int8_t ref_frame_list[MAX_STATIC_GF_GROUP_LENGTH][REF_FRAMES];
+
// Indicates the level of parallelism in frame parallel encodes.
// 0 : frame is independently encoded (not part of parallel encodes).
// 1 : frame is the first in encode order in a given parallel encode set.
@@ -372,11 +382,6 @@
// 1 : frame is a non-reference frame.
int is_frame_non_ref[MAX_STATIC_GF_GROUP_LENGTH];
- // The offset into lookahead_ctx for choosing
- // source of frame parallel encodes.
- int src_offset[MAX_STATIC_GF_GROUP_LENGTH];
- // Stores the display order hint of each frame in the current GF_GROUP.
- int display_idx[MAX_STATIC_GF_GROUP_LENGTH];
// Stores the display order hint of the frames not to be
// refreshed by the current frame.
int skip_frame_refresh[MAX_STATIC_GF_GROUP_LENGTH][REF_FRAMES];