summaryrefslogtreecommitdiffstats
path: root/third_party/aom/av1/common/filter.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom/av1/common/filter.h')
-rw-r--r--third_party/aom/av1/common/filter.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/third_party/aom/av1/common/filter.h b/third_party/aom/av1/common/filter.h
index d791af173..343e87560 100644
--- a/third_party/aom/av1/common/filter.h
+++ b/third_party/aom/av1/common/filter.h
@@ -12,6 +12,8 @@
#ifndef AV1_COMMON_FILTER_H_
#define AV1_COMMON_FILTER_H_
+#include <assert.h>
+
#include "./aom_config.h"
#include "aom/aom_integer.h"
#include "aom_dsp/aom_filter.h"
@@ -30,10 +32,10 @@ extern "C" {
typedef enum {
EIGHTTAP_REGULAR,
EIGHTTAP_SMOOTH,
- MULTITAP_SHARP,
#if USE_EXTRA_FILTER
EIGHTTAP_SMOOTH2,
#endif // USE_EXTRA_FILTER
+ MULTITAP_SHARP,
BILINEAR,
#if USE_EXTRA_FILTER
EIGHTTAP_SHARP,
@@ -51,6 +53,49 @@ typedef enum {
#endif
} InterpFilter;
+// With CONFIG_DUAL_FILTER, pack two InterpFilter's into a uint32_t: since
+// there are at most 10 filters, we can use 16 bits for each and have more than
+// enough space. This reduces argument passing and unifies the operation of
+// setting a (pair of) filters.
+//
+// Without CONFIG_DUAL_FILTER,
+#if CONFIG_DUAL_FILTER
+typedef uint32_t InterpFilters;
+static INLINE InterpFilter av1_extract_interp_filter(InterpFilters filters,
+ int x_filter) {
+ return (InterpFilter)((filters >> (x_filter ? 16 : 0)) & 0xffff);
+}
+
+static INLINE InterpFilters av1_make_interp_filters(InterpFilter y_filter,
+ InterpFilter x_filter) {
+ uint16_t y16 = y_filter & 0xffff;
+ uint16_t x16 = x_filter & 0xffff;
+ return y16 | ((uint32_t)x16 << 16);
+}
+
+static INLINE InterpFilters av1_broadcast_interp_filter(InterpFilter filter) {
+ return av1_make_interp_filters(filter, filter);
+}
+#else
+typedef InterpFilter InterpFilters;
+static INLINE InterpFilter av1_extract_interp_filter(InterpFilters filters,
+ int x_filter) {
+#ifdef NDEBUG
+ (void)x_filter;
+#endif
+ assert(!x_filter);
+ return filters;
+}
+
+static INLINE InterpFilters av1_broadcast_interp_filter(InterpFilter filter) {
+ return filter;
+}
+#endif
+
+static INLINE InterpFilter av1_unswitchable_filter(InterpFilter filter) {
+ return filter == SWITCHABLE ? EIGHTTAP_REGULAR : filter;
+}
+
#if USE_EXTRA_FILTER
#define LOG_SWITCHABLE_FILTERS \
3 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */