aboutsummaryrefslogtreecommitdiff
path: root/src/dsp/convolve.h
diff options
context:
space:
mode:
authorBoyuan Yang <byang@debian.org>2022-07-14 15:56:59 -0400
committerBoyuan Yang <byang@debian.org>2022-07-14 15:56:59 -0400
commit1a2e17bd28a068714658551c8c355171ce15dfa0 (patch)
treedb9e739007016850ee355365874a20b07034ef2c /src/dsp/convolve.h
parenta08da9600832caf817125edee2c3206fe24cd5cb (diff)
parentd4dbf19f6b0181ee78034bfe4caf189d1c016998 (diff)
downloadlibgav1-1a2e17bd28a068714658551c8c355171ce15dfa0.tar.gz
libgav1-1a2e17bd28a068714658551c8c355171ce15dfa0.tar.bz2
libgav1-1a2e17bd28a068714658551c8c355171ce15dfa0.zip
Update upstream source from tag 'upstream/0.18.0'
Update to upstream version '0.18.0' with Debian dir a69c1f7f3e7109393a3f9f5f1a2e7a5c3d3eda9f
Diffstat (limited to 'src/dsp/convolve.h')
-rw-r--r--src/dsp/convolve.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/dsp/convolve.h b/src/dsp/convolve.h
index 5bc0bad..8780bfc 100644
--- a/src/dsp/convolve.h
+++ b/src/dsp/convolve.h
@@ -17,6 +17,8 @@
#ifndef LIBGAV1_SRC_DSP_CONVOLVE_H_
#define LIBGAV1_SRC_DSP_CONVOLVE_H_
+#include <cassert>
+
// Pull in LIBGAV1_DspXXX defines representing the implementation status
// of each function. The resulting value of each can be used by each module to
// determine whether an implementation is needed at compile time.
@@ -43,6 +45,35 @@ namespace dsp {
// thread-safe.
void ConvolveInit_C();
+inline int GetNumTapsInFilter(const int filter_index) {
+ if (filter_index < 2) {
+ // Despite the names these only use 6 taps.
+ // kInterpolationFilterEightTap
+ // kInterpolationFilterEightTapSmooth
+ return 6;
+ }
+
+ if (filter_index == 2) {
+ // kInterpolationFilterEightTapSharp
+ return 8;
+ }
+
+ if (filter_index == 3) {
+ // kInterpolationFilterBilinear
+ return 2;
+ }
+
+ assert(filter_index > 3);
+ // For small sizes (width/height <= 4) the large filters are replaced with 4
+ // tap options.
+ // If the original filters were |kInterpolationFilterEightTap| or
+ // |kInterpolationFilterEightTapSharp| then it becomes
+ // |kInterpolationFilterSwitchable|.
+ // If it was |kInterpolationFilterEightTapSmooth| then it becomes an unnamed 4
+ // tap filter.
+ return 4;
+}
+
} // namespace dsp
} // namespace libgav1