InterpFilter type: Create an enum.
We use a single enum instead of multiple #defines.
- Ensures better type checking
- Enum values are generated implicitly, and hard-coded #defines are not
required.
- We use ATTRIBUTE_PACKED to indicate that the enum should still use the
smallest integral type.
Change-Id: I7532428da31744d3441b363bd932a7f233ee7ab5
diff --git a/av1/common/filter.h b/av1/common/filter.h
index 6c50d0a..fa2a348 100644
--- a/av1/common/filter.h
+++ b/av1/common/filter.h
@@ -21,49 +21,45 @@
extern "C" {
#endif
-#define EIGHTTAP_REGULAR 0
-#define EIGHTTAP_SMOOTH 1
-#define MULTITAP_SHARP 2
+#define USE_TEMPORALFILTER_12TAP 1
+
+typedef enum ATTRIBUTE_PACKED {
+ EIGHTTAP_REGULAR,
+ EIGHTTAP_SMOOTH,
+ MULTITAP_SHARP,
+#if CONFIG_DUAL_FILTER
+ EIGHTTAP_SMOOTH2,
+#endif // CONFIG_DUAL_FILTER
+ BILINEAR,
+#if CONFIG_DUAL_FILTER
+ EIGHTTAP_SHARP,
+ FILTER_REGULAR_UV,
+ FILTER_SMOOTH_UV,
+ FILTER_SHARP_UV,
+ FILTER_SMOOTH2_UV,
+#endif // CONFIG_DUAL_FILTER
+ INTERP_FILTERS_ALL,
+ SWITCHABLE_FILTERS = BILINEAR,
+ SWITCHABLE = SWITCHABLE_FILTERS + 1, /* the last switchable one */
+ EXTRA_FILTERS = INTERP_FILTERS_ALL - SWITCHABLE_FILTERS,
+#if USE_TEMPORALFILTER_12TAP
+ TEMPORALFILTER_12TAP = SWITCHABLE_FILTERS + EXTRA_FILTERS,
+#endif
+} InterpFilter;
#if CONFIG_DUAL_FILTER
-#define EIGHTTAP_SMOOTH2 3
-
#define MAX_SUBPEL_TAPS 12
-
-#define SWITCHABLE_FILTERS 4 /* Number of switchable filters */
#define LOG_SWITCHABLE_FILTERS \
3 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
-
-#define EIGHTTAP_SHARP (SWITCHABLE_FILTERS + 1)
-#define FILTER_REGULAR_UV (SWITCHABLE_FILTERS + 2)
-#define FILTER_SMOOTH_UV (SWITCHABLE_FILTERS + 3)
-#define FILTER_SHARP_UV (SWITCHABLE_FILTERS + 4)
-#define FILTER_SMOOTH2_UV (SWITCHABLE_FILTERS + 5)
-#define EXTRA_FILTERS 6
#define SWITCHABLE_FILTER_CONTEXTS ((SWITCHABLE_FILTERS + 1) * 4)
#define INTER_FILTER_COMP_OFFSET (SWITCHABLE_FILTERS + 1)
#define INTER_FILTER_DIR_OFFSET ((SWITCHABLE_FILTERS + 1) * 2)
-
#else // CONFIG_DUAL_FILTER
-
-#define SWITCHABLE_FILTERS 3 /* Number of switchable filters */
#define LOG_SWITCHABLE_FILTERS \
2 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
#define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
-#define EXTRA_FILTERS 1
-
#endif // CONFIG_DUAL_FILTER
-#define USE_TEMPORALFILTER_12TAP 1
-#if USE_TEMPORALFILTER_12TAP
-#define TEMPORALFILTER_12TAP (SWITCHABLE_FILTERS + EXTRA_FILTERS)
-#endif
-
-#define BILINEAR (SWITCHABLE_FILTERS)
-#define SWITCHABLE (SWITCHABLE_FILTERS + 1) /* the last one */
-
-typedef uint8_t InterpFilter;
-
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
typedef enum {