-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sum-pooling-bench
- Loading branch information
Showing
20 changed files
with
229 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior. | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
- OS: [e.g. Ubuntu] | ||
- Version [e.g. 20.04] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#------------------------------------------------------------------------------- | ||
# Audio Processing Benchmark Target | ||
#------------------------------------------------------------------------------- | ||
|
||
add_subdirectory(${KFR_DIR} ./kfr) | ||
|
||
include_directories(${KFR_DIR}/include) | ||
|
||
add_executable(audio-processing-benchmark | ||
KFRFir.cpp | ||
Main.cpp | ||
) | ||
|
||
target_link_directories(audio-processing-benchmark PRIVATE ${KFR_DIR}/build/) | ||
target_link_libraries(audio-processing-benchmark | ||
PRIVATE | ||
kfr_io | ||
kfr_dft | ||
GoogleBenchmark | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
//===- KFRFir.cpp ---------------------------------------------------------===// | ||
// | ||
// 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. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file implements the benchmark for KFR Fir function. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include <benchmark/benchmark.h> | ||
#include <kfr/base.hpp> | ||
#include <kfr/dft.hpp> | ||
#include <kfr/dsp.hpp> | ||
#include <kfr/io.hpp> | ||
|
||
using namespace kfr; | ||
|
||
univector<fbase, 1023> taps127; | ||
univector<float, 2000000> aud; | ||
univector<float> result; | ||
|
||
// Initialize univector. | ||
void initializeKFRFir() { | ||
expression_pointer<fbase> kaiser = | ||
to_pointer(window_kaiser(taps127.size(), 3.0)); | ||
fir_lowpass(taps127, 0.2, kaiser, true); | ||
audio_reader_wav<float> reader(open_file_for_reading( | ||
"../../benchmarks/AudioProcessing/Audios/NASA_Mars.wav")); | ||
reader.read(aud.data(), aud.size()); | ||
} | ||
|
||
// Benchmarking function. | ||
static void KFR_FIR(benchmark::State &state) { | ||
for (auto _ : state) { | ||
for (int i = 0; i < state.range(0); ++i) { | ||
result = kfr::fir(aud, taps127); | ||
} | ||
} | ||
} | ||
|
||
// Register benchmarking function. | ||
BENCHMARK(KFR_FIR)->Arg(1); | ||
|
||
// Generate result wav file. | ||
void generateResultKFRFir() { | ||
univector<float> generateResult = kfr::fir(aud, taps127); | ||
|
||
audio_writer_wav<float> writer(open_file_for_writing("./ResultKFRFir.wav"), | ||
audio_format{1 /* channel */, | ||
audio_sample_type::i24, | ||
100000 /* sample rate */}); | ||
writer.write(generateResult.data(), generateResult.size()); | ||
println("Sample Rate = ", writer.format().samplerate); | ||
println("Channels = ", writer.format().channels); | ||
println("Length = ", writer.format().length); | ||
println("Duration (s) = ", | ||
writer.format().length / writer.format().samplerate); | ||
println("Bit depth = ", audio_sample_bit_depth(writer.format().type)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//===- Main.cpp -----------------------------------------------------------===// | ||
// | ||
// 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. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This is the main file of the audio processing benchmark. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include <benchmark/benchmark.h> | ||
|
||
void initializeKFRFir(); | ||
|
||
void generateResultKFRFir(); | ||
|
||
int main(int argc, char **argv) { | ||
initializeKFRFir(); | ||
::benchmark::Initialize(&argc, argv); | ||
::benchmark::RunSpecifiedBenchmarks(); | ||
generateResultKFRFir(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters