Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hacked together a replacement of the ellitic filters with the tabuli #73

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b02365a
Hacked together a replacement of the ellitic filters with the tabuli
zond May 21, 2024
5518df7
less memory traffic, 2.5x speedup for tabuli
jyrkialakuijala Jun 14, 2024
4ff27be
Merge pull request #104 from jyrkialakuijala/tabuli
jyrkialakuijala Jun 14, 2024
a700eeb
less memory access by streaming the log10s for dbs
jyrkialakuijala Jun 14, 2024
1cebe3c
Merge pull request #106 from jyrkialakuijala/tabuli
jyrkialakuijala Jun 14, 2024
a6af47d
tiny fix
jyrkialakuijala Jun 14, 2024
a3d6cb6
Merge pull request #107 from jyrkialakuijala/tabuli
jyrkialakuijala Jun 14, 2024
9794994
more rotators (128->150) improves MSE by a few %
jyrkialakuijala Jun 14, 2024
4411d99
Merge pull request #108 from jyrkialakuijala/tabuli
jyrkialakuijala Jun 14, 2024
86b05dd
more optimization of heuristics, ~1 % improvement
jyrkialakuijala Jun 17, 2024
7d3e6b0
Merge pull request #109 from jyrkialakuijala/tabuli
jyrkialakuijala Jun 17, 2024
50178f3
~8 % improvement
jyrkialakuijala Jun 19, 2024
37c51d7
Merge pull request #114 from jyrkialakuijala/tabuli
jyrkialakuijala Jun 19, 2024
90d422a
simple loudness in fourier_bank
jyrkialakuijala Jun 19, 2024
91bb0f4
Merge pull request #115 from jyrkialakuijala/tabuli
jyrkialakuijala Jun 19, 2024
6542578
temporal masking
jyrkialakuijala Jun 21, 2024
766ee9f
Merge pull request #116 from jyrkialakuijala/tabuli
jyrkialakuijala Jun 21, 2024
ca6b7dc
switching loudness and masking
jyrkialakuijala Jun 24, 2024
f471890
Merge pull request #117 from jyrkialakuijala/tabuli
jyrkialakuijala Jun 24, 2024
780adbe
~0.5 % improvement
jyrkialakuijala Jul 3, 2024
b9fbd50
Merge pull request #119 from jyrkialakuijala/tabuli
jyrkialakuijala Jul 3, 2024
d67c2cc
7-8 % improvement
jyrkialakuijala Jul 8, 2024
a3dbc16
Merge pull request #120 from jyrkialakuijala/tabuli
jyrkialakuijala Jul 8, 2024
a933744
quality fix
jyrkialakuijala Jul 9, 2024
59cc535
Merge pull request #121 from jyrkialakuijala/tabuli
jyrkialakuijala Jul 9, 2024
6000340
~5% worse, but faster and simpler
jyrkialakuijala Jul 11, 2024
b112037
Merge pull request #122 from jyrkialakuijala/tabuli
jyrkialakuijala Jul 11, 2024
577f2fb
further simplifications
jyrkialakuijala Aug 9, 2024
fdcef96
Merge pull request #123 from jyrkialakuijala/tabuli
jyrkialakuijala Aug 9, 2024
bf7b003
minor improvement
jyrkialakuijala Aug 9, 2024
09e3309
Merge pull request #124 from jyrkialakuijala/tabuli
jyrkialakuijala Aug 9, 2024
604f19c
simplifications and more elegance
jyrkialakuijala Aug 20, 2024
d6493c5
Merge pull request #125 from jyrkialakuijala/tabuli
jyrkialakuijala Aug 20, 2024
915309f
several quality improvements
jyrkialakuijala Sep 19, 2024
cde4ede
Merge pull request #127 from jyrkialakuijala/tabuli
jyrkialakuijala Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ add_library(zimtohrli_base STATIC
cpp/zimt/elliptic.h
cpp/zimt/filterbank.cc
cpp/zimt/filterbank.h
cpp/zimt/fourier_bank.h
cpp/zimt/fourier_bank.cc
cpp/zimt/loudness.cc
cpp/zimt/loudness.h
cpp/zimt/masking.cc
Expand Down
2 changes: 1 addition & 1 deletion configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ elif [ "${1}" == "asan" ]; then
(cd asan_build && cmake -G Ninja -DCMAKE_C_FLAGS='-fsanitize=address -fPIC' -DCMAKE_CXX_FLAGS='-fsanitize=address -fPIC' -DCMAKE_LINKER_FLAGS_DEBUG='-fsanitize=address' -DCMAKE_BUILD_TYPE=RelWithDebInfo ..)
else
mkdir -p build
(cd build && cmake -G Ninja -DCMAKE_C_FLAGS='-fPIC' -DCMAKE_CXX_FLAGS='-fPIC' -DCMAKE_BUILD_TYPE=Release ..)
(cd build && cmake -G Ninja -DCMAKE_C_FLAGS='-fPIC -march=native -O3' -DCMAKE_CXX_FLAGS='-fPIC -march=native -O3' -DCMAKE_BUILD_TYPE=Release ..)
fi
2 changes: 1 addition & 1 deletion cpp/zimt/cam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CamFilterbank Cam::CreateFilterbank(float sample_rate) const {

int sections = -1;
for (float left_cam = low_threshold_cam;
left_cam + cam_delta < high_threshold_cam; left_cam += cam_delta) {
left_cam + 0.5 * cam_delta < high_threshold_cam; left_cam += cam_delta) {
float left_hz = HzFromCam(left_cam);
float right_hz = HzFromCam(left_cam + cam_delta);
const std::vector<BACoeffs> filter_coeffs = DigitalSOSBandPass(
Expand Down
2 changes: 1 addition & 1 deletion cpp/zimt/cam.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct Cam {
float high_threshold_hz = 20000;
// Frequency resolution at low threshold. Default is 5 since it has
// provided the best correlation scores with tested datasets.
float minimum_bandwidth_hz = 5;
float minimum_bandwidth_hz = 1;
// Order (sharpness and slowness) of channel filters.
int filter_order = 1;
// Attenuation in dB in each filter where the filterbank filters meet.
Expand Down
8 changes: 2 additions & 6 deletions cpp/zimt/compare.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ int Main(int argc, char* argv[]) {
const size_t num_downscaled_samples_a = static_cast<size_t>(
std::ceil(static_cast<float>(file_a->Frames().shape()[1]) *
z.perceptual_sample_rate / z.cam_filterbank->sample_rate));
hwy::AlignedNDArray<float, 2> channels_a(
{file_a->Frames().shape()[1], z.cam_filterbank->filter.Size()});
hwy::AlignedNDArray<float, 2> energy_channels_db_a(
{num_downscaled_samples_a, z.cam_filterbank->filter.Size()});
hwy::AlignedNDArray<float, 2> partial_energy_channels_db_a(
Expand All @@ -311,7 +309,7 @@ int Main(int argc, char* argv[]) {
++channel_index) {
hwy::AlignedNDArray<float, 2> spectrogram(
{num_downscaled_samples_a, z.cam_filterbank->filter.Size()});
z.Spectrogram(file_a->Frames()[{channel_index}], channels_a,
z.Spectrogram(file_a->Frames()[{channel_index}],
energy_channels_db_a, partial_energy_channels_db_a,
spectrogram);
file_a_spectrograms.push_back(std::move(spectrogram));
Expand All @@ -322,8 +320,6 @@ int Main(int argc, char* argv[]) {
const size_t num_downscaled_samples_b = static_cast<size_t>(
std::ceil(static_cast<float>(file_b.Frames().shape()[1]) *
z.perceptual_sample_rate / z.cam_filterbank->sample_rate));
hwy::AlignedNDArray<float, 2> channels_b(
{file_b.Frames().shape()[1], z.cam_filterbank->filter.Size()});
hwy::AlignedNDArray<float, 2> energy_channels_db_b(
{num_downscaled_samples_b, z.cam_filterbank->filter.Size()});
hwy::AlignedNDArray<float, 2> partial_energy_channels_db_b(
Expand All @@ -333,7 +329,7 @@ int Main(int argc, char* argv[]) {
float sum_of_squares = 0;
for (size_t channel_index = 0; channel_index < file_a->Info().channels;
++channel_index) {
z.Spectrogram(file_b.Frames()[{channel_index}], channels_b,
z.Spectrogram(file_b.Frames()[{channel_index}],
energy_channels_db_b, partial_energy_channels_db_b,
spectrogram_b);
const float distance =
Expand Down
Loading