rtc: Fix to get_ref_frame_flags for nonrd mode

For nonrd mode where ALT_REF is used (speed 7),
we can remove the GOLDEN reference if its the same
as LAST or ALT_REF.

This gives a small speedup as we avoid checking
golden ref in nonrd_pickmode on some frames (where
golden coincides with alt_ref).

Neutral change in bdrate.
Speedup ~5% observed on street180p clip at 80k

Change-Id: I6f0e23363eff57d3c3c2069734fbda5f7f287550
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index dba5773..9aec7bd 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -232,10 +232,10 @@
     const RefCntBuffer *const this_ref = ref_frames[i];
     // If this_ref has appeared before, mark the corresponding ref frame as
     // invalid. For nonrd mode, only disable GOLDEN_FRAME if it's the same
-    // as LAST_FRAME.
+    // as LAST_FRAME or ALTREF_FRAME (if ALTREF is being used in nonrd).
     int index = (cpi->sf.use_nonrd_pick_mode &&
                  ref_frame_priority_order[i] == GOLDEN_FRAME)
-                    ? 1
+                    ? (1 + cpi->sf.use_nonrd_altref_frame)
                     : i;
     for (int j = 0; j < index; ++j) {
       if (this_ref == ref_frames[j]) {