Modify Lookahead queue API
Modified Lookahead queue context and API, to
facilitate multiple consumers to independently
pop entries pushed into the queue.
Change-Id: I20f5a1894c30bcf169f5d0b621bc4d5daa413015
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index 808bb9b..b2238f5 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -416,7 +416,7 @@
*code_arf = 0;
struct lookahead_entry *source =
- av1_lookahead_peek(cpi->lookahead, arf_src_index);
+ av1_lookahead_peek(cpi->lookahead, arf_src_index, ENCODE_STAGE);
if (source != NULL) {
cm->showable_frame = 1;
@@ -454,7 +454,8 @@
static int is_forced_keyframe_pending(struct lookahead_ctx *lookahead,
const int up_to_index) {
for (int i = 0; i <= up_to_index; i++) {
- const struct lookahead_entry *e = av1_lookahead_peek(lookahead, i);
+ const struct lookahead_entry *e =
+ av1_lookahead_peek(lookahead, i, ENCODE_STAGE);
if (e == NULL) {
// We have reached the end of the lookahead buffer and not early-returned
// so there isn't a forced key-frame pending.
@@ -495,10 +496,10 @@
if (!source) {
// Get last frame source.
if (cm->current_frame.frame_number > 0) {
- *last_source = av1_lookahead_peek(cpi->lookahead, -1);
+ *last_source = av1_lookahead_peek(cpi->lookahead, -1, ENCODE_STAGE);
}
// Read in the source frame.
- source = av1_lookahead_pop(cpi->lookahead, *flush);
+ source = av1_lookahead_pop(cpi->lookahead, *flush, ENCODE_STAGE);
if (source == NULL) return NULL;
frame_params->show_frame = 1;
@@ -516,7 +517,7 @@
if (cpi->common.current_frame.frame_number == 0) return 0;
const struct lookahead_entry *lookahead_src =
- av1_lookahead_peek(cpi->lookahead, 0);
+ av1_lookahead_peek(cpi->lookahead, 0, ENCODE_STAGE);
if (lookahead_src == NULL) return 1;
const int is_error_resilient =
@@ -1150,7 +1151,7 @@
struct lookahead_entry *source = NULL;
struct lookahead_entry *last_source = NULL;
if (frame_params.show_existing_frame) {
- source = av1_lookahead_pop(cpi->lookahead, flush);
+ source = av1_lookahead_pop(cpi->lookahead, flush, ENCODE_STAGE);
frame_params.show_frame = 1;
} else {
int show_existing_alt_ref = 0;