| /* |
| * Copyright 2019 The libgav1 Authors |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #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. |
| // IWYU pragma: begin_exports |
| |
| // ARM: |
| #include "src/dsp/arm/convolve_neon.h" |
| |
| // x86: |
| // Note includes should be sorted in logical order avx2/avx/sse4, etc. |
| // The order of includes is important as each tests for a superior version |
| // before setting the base. |
| // clang-format off |
| #include "src/dsp/x86/convolve_avx2.h" |
| #include "src/dsp/x86/convolve_sse4.h" |
| // clang-format on |
| |
| // IWYU pragma: end_exports |
| |
| namespace libgav1 { |
| namespace dsp { |
| |
| // Initializes Dsp::convolve and Dsp::convolve_scale. This function is not |
| // 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 |
| |
| #endif // LIBGAV1_SRC_DSP_CONVOLVE_H_ |