Change MV_REFERENCE_FRAME type back to int8_t. It can take values outside the range of any single enum, so we define its type to be int8_t as before. This fixes some build issues. BUG=aomedia:2236 BUG=aomedia:2230 Change-Id: If9c50d6917b20770b556287732ed128613e4cb6f
diff --git a/av1/common/enums.h b/av1/common/enums.h index be6d7a6..e06d7cf 100644 --- a/av1/common/enums.h +++ b/av1/common/enums.h
@@ -539,8 +539,8 @@ #define TXFM_PARTITION_CONTEXTS ((TX_SIZES - TX_8X8) * 6 - 3) typedef uint8_t TXFM_CONTEXT; -// An enum for various types of reference frame types (and some derived values). -typedef enum ATTRIBUTE_PACKED { +// An enum for single reference types (and some derived values). +enum ATTRIBUTE_PACKED { NONE_FRAME = -1, INTRA_FRAME, LAST_FRAME, @@ -567,7 +567,7 @@ BWD_REFS = ALTREF_FRAME - BWDREF_FRAME + 1, SINGLE_REFS = FWD_REFS + BWD_REFS, -} MV_REFERENCE_FRAME; +}; #define REF_FRAMES_LOG2 3 @@ -604,6 +604,10 @@ // possible to have a reference pair not listed for explicit signaling. #define MODE_CTX_REF_FRAMES (REF_FRAMES + TOTAL_COMP_REFS) +// Note: It includes single and compound references. So, it can take values from +// NONE_FRAME to (MODE_CTX_REF_FRAMES - 1). Hence, it is not defined as an enum. +typedef int8_t MV_REFERENCE_FRAME; + typedef enum ATTRIBUTE_PACKED { RESTORE_NONE, RESTORE_WIENER,
diff --git a/av1/common/mvref_common.h b/av1/common/mvref_common.h index bb37357..1ef50e7 100644 --- a/av1/common/mvref_common.h +++ b/av1/common/mvref_common.h
@@ -169,13 +169,13 @@ // clang-format on static INLINE void av1_set_ref_frame(MV_REFERENCE_FRAME *rf, - int8_t ref_frame_type) { + MV_REFERENCE_FRAME ref_frame_type) { if (ref_frame_type >= REF_FRAMES) { rf[0] = ref_frame_map[ref_frame_type - REF_FRAMES][0]; rf[1] = ref_frame_map[ref_frame_type - REF_FRAMES][1]; } else { assert(ref_frame_type > NONE_FRAME); - rf[0] = (MV_REFERENCE_FRAME)ref_frame_type; + rf[0] = ref_frame_type; rf[1] = NONE_FRAME; } }
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h index ea7d03a..8b35cae 100644 --- a/av1/encoder/encoder.h +++ b/av1/encoder/encoder.h
@@ -961,14 +961,13 @@ static INLINE int enc_is_ref_frame_buf(AV1_COMP *cpi, RefCntBuffer *frame_buf) { AV1_COMMON *const cm = &cpi->common; - int ref_num; - for (ref_num = LAST_FRAME; ref_num <= ALTREF_FRAME; ++ref_num) { - const MV_REFERENCE_FRAME ref_frame = (MV_REFERENCE_FRAME)ref_num; + MV_REFERENCE_FRAME ref_frame; + for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) { const int buf_idx = get_ref_frame_buf_idx(cpi, ref_frame); if (buf_idx == INVALID_IDX) continue; if (frame_buf == &cm->buffer_pool->frame_bufs[buf_idx]) break; } - return (ref_num <= ALTREF_FRAME); + return (ref_frame <= ALTREF_FRAME); } // Token buffer is only used for palette tokens.