-
-
Notifications
You must be signed in to change notification settings - Fork 19k
musly: add patches for FFmpeg 7, C++17, and external deps; kissfft: build with CMake; libresample: 0.1.3 -> 0.1.4-unstable-2024-08-23 #332035
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
699c320
libsndfile: enable on all platforms
emilazy 2543d15
libsamplerate: mark broken on MinGW
emilazy d7988eb
libresample: move to `pkgs/by-name`
emilazy 1e0e30a
libresample: format with `nixfmt-rfc-style`
emilazy 7ca429f
libresample: add myself to maintainers
emilazy 095ef5e
libresample: 0.1.3 -> 0.1.4-unstable-2024-08-23
emilazy 1d22e2e
kissfft: move to `pkgs/by-name`
emilazy 990e965
kissfft: format with `nixfmt-rfc-style`
emilazy 1f81efc
kissfft: build with CMake
emilazy b7ac426
qm-dsp: fix kissfft include path
emilazy 9561c35
musly: move to `pkgs/by-name`
emilazy cbb58be
musly: format with `nixfmt-rfc-style`
emilazy c3c5af2
musly: unstable-2017-04-26 -> 0.1-unstable-2019-09-05
emilazy 7245ee2
musly: add patches for FFmpeg 7, C++17, and external deps
emilazy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,23 @@ | ||
| From a73134e594d85abc32e27a34a78ce75c5f006f92 Mon Sep 17 00:00:00 2001 | ||
| From: Emily <hello@emily.moe> | ||
| Date: Sat, 3 Aug 2024 17:49:57 +0100 | ||
| Subject: [PATCH] Fix FFTW dependency check | ||
|
|
||
| `KISFFT_FLOAT` is not defined anywhere. | ||
| --- | ||
| test/CMakeLists.txt | 2 +- | ||
| 1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
|
||
| diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt | ||
| index 0a0e403..d7d8350 100644 | ||
| --- a/test/CMakeLists.txt | ||
| +++ b/test/CMakeLists.txt | ||
| @@ -24,7 +24,7 @@ add_kissfft_test_executable(bm_kiss benchkiss.c pstats.c) | ||
| # set_tests_properties(${NAME} PROPERTIES TIMEOUT 3600) | ||
|
|
||
| include(FindPkgConfig) | ||
| -if(KISSFFT_FLOAT) | ||
| +if(KISSFFT_DATATYPE MATCHES "^float$") | ||
| set(fftw3_pkg fftw3f) | ||
| else() | ||
| set(fftw3_pkg fftw3) |
This file contains hidden or 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,86 @@ | ||
| { | ||
| lib, | ||
| stdenv, | ||
| fetchFromGitHub, | ||
| cmake, | ||
| ninja, | ||
| pkg-config, | ||
| fftw, | ||
| fftwFloat, | ||
| python3, | ||
| datatype ? "double", | ||
| libpng, | ||
| enableStatic ? stdenv.hostPlatform.isStatic, | ||
| enableOpenmp ? false, | ||
| llvmPackages, | ||
| }: | ||
|
|
||
| stdenv.mkDerivation (finalAttrs: { | ||
| pname = "kissfft-${datatype}${lib.optionalString enableOpenmp "-openmp"}"; | ||
| version = "131.1.0"; | ||
|
|
||
| outputs = [ | ||
| "bin" | ||
| "dev" | ||
| "out" | ||
| ]; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "mborgerding"; | ||
| repo = "kissfft"; | ||
| rev = finalAttrs.version; | ||
| hash = "sha256-ukikTVnmKomKXTo6zc+PhpZzEkzXN2imFwZOYlfR3Pk="; | ||
| }; | ||
|
|
||
| patches = [ | ||
| # Fix FFTW dependency check | ||
| # https://github.com/mborgerding/kissfft/pull/95 | ||
| ./fix-fftw-dependency-check.patch | ||
| ]; | ||
|
|
||
| nativeBuildInputs = [ | ||
| cmake | ||
| ninja | ||
| pkg-config | ||
| ]; | ||
|
|
||
| buildInputs = | ||
| lib.optionals (datatype != "simd") [ libpng ] | ||
| # TODO: This may mismatch the LLVM version in the stdenv, see #79818. | ||
| ++ lib.optional (enableOpenmp && stdenv.cc.isClang) llvmPackages.openmp; | ||
|
|
||
| nativeCheckInputs = [ (python3.withPackages (ps: [ ps.numpy ])) ]; | ||
|
|
||
| checkInputs = [ (if datatype == "float" then fftwFloat else fftw) ]; | ||
|
|
||
| cmakeFlags = [ | ||
| (lib.cmakeFeature "KISSFFT_DATATYPE" datatype) | ||
| (lib.cmakeBool "KISSFFT_STATIC" enableStatic) | ||
| # `test/testkiss.py` expects this… | ||
| (lib.cmakeFeature "KISSFFT_OPENMP" (if enableOpenmp then "ON" else "OFF")) | ||
| ]; | ||
|
|
||
| # Required for `test/testcpp.c`. | ||
| env = { | ||
| NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-D__MATH_LONG_DOUBLE_CONSTANTS=1"; | ||
| }; | ||
|
|
||
| doCheck = true; | ||
|
|
||
| # https://bugs.llvm.org/show_bug.cgi?id=45034 | ||
| postPatch = | ||
| lib.optionalString | ||
| (stdenv.hostPlatform.isLinux && stdenv.cc.isClang && lib.versionOlder stdenv.cc.version "10") | ||
| '' | ||
| substituteInPlace CMakeLists.txt \ | ||
| --replace "-ffast-math" "" | ||
| ''; | ||
|
|
||
| meta = { | ||
| description = "Mixed-radix Fast Fourier Transform based up on the KISS principle"; | ||
| homepage = "https://github.com/mborgerding/kissfft"; | ||
| license = lib.licenses.bsd3; | ||
| maintainers = [ ]; | ||
| platforms = lib.platforms.all; | ||
| }; | ||
| }) |
This file contains hidden or 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,108 @@ | ||
| From fb8e3c74d582038a358936d827f53c4c0c43d4e6 Mon Sep 17 00:00:00 2001 | ||
| From: Matt Harvey <mattharvey@google.com> | ||
| Date: Mon, 27 Nov 2023 16:28:53 -0800 | ||
| Subject: [PATCH] Fix testresample.c output span; add exit code | ||
|
|
||
| Prior to this chance, the "Resample with different factors" test only | ||
| passed for 60 of the 63 factors, with the 3 failing ones being the | ||
| largest. | ||
|
|
||
| 1. Since only 63 distinct factors were being considered, 100 random | ||
| samples was overkill. | ||
| 2. To support noticing failure in continuous build systems, it's nice if | ||
| the test exit()s with nonzero when there are failures. | ||
| 3. The root cause was a formula error when determining which indices in | ||
| the resampled output ought be compared. Details are explained in a | ||
| comment. | ||
| --- | ||
| tests/testresample.c | 32 ++++++++++++++++++++++++-------- | ||
| 1 file changed, 24 insertions(+), 8 deletions(-) | ||
|
|
||
| diff --git a/tests/testresample.c b/tests/testresample.c | ||
| index aa83a46..640df5a 100644 | ||
| --- a/tests/testresample.c | ||
| +++ b/tests/testresample.c | ||
| @@ -19,6 +19,8 @@ | ||
|
|
||
| #define MIN(A, B) (A) < (B)? (A) : (B) | ||
|
|
||
| +int global_error; | ||
| + | ||
| void runtest(int srclen, double freq, double factor, | ||
| int srcblocksize, int dstblocksize) | ||
| { | ||
| @@ -65,10 +67,12 @@ void runtest(int srclen, double freq, double factor, | ||
|
|
||
| if (o < 0) { | ||
| printf("Error: resample_process returned an error: %d\n", o); | ||
| + global_error = 1; | ||
| } | ||
|
|
||
| if (out <= 0) { | ||
| printf("Error: resample_process returned %d samples\n", out); | ||
| + global_error = 1; | ||
| free(src); | ||
| free(dst); | ||
| return; | ||
| @@ -79,15 +83,16 @@ void runtest(int srclen, double freq, double factor, | ||
| printf(" Expected ~%d, got %d samples out\n", | ||
| expectedlen, out); | ||
| } | ||
| - | ||
| + | ||
| sum = 0.0; | ||
| sumsq = 0.0; | ||
| errcount = 0.0; | ||
|
|
||
| - /* Don't compute statistics on all output values; the last few | ||
| - are guaranteed to be off because it's based on far less | ||
| - interpolation. */ | ||
| - statlen = out - fwidth; | ||
| + /* Don't compute statistics on all output values; the last small fraction | ||
| + are guaranteed to be off since they are interpolated based on far fewer | ||
| + values. When upsampling, the length of the range where this concern | ||
| + applies is in direct proportion to the upsampling factor. */ | ||
| + statlen = out - ((int)round(fwidth * factor)); | ||
|
|
||
| for(i=0; i<statlen; i++) { | ||
| double diff = sin((i/freq)/factor) - dst[i]; | ||
| @@ -117,6 +122,7 @@ void runtest(int srclen, double freq, double factor, | ||
| printf(" i=%d: expected %.3f, got %.3f\n", | ||
| i, sin((i/freq)/factor), dst[i]); | ||
| printf(" At least %d samples had significant error.\n", errcount); | ||
| + global_error = 1; | ||
| } | ||
| err = sum / statlen; | ||
| rmserr = sqrt(sumsq / statlen); | ||
| @@ -130,6 +136,8 @@ int main(int argc, char **argv) | ||
| int i, srclen, dstlen, ifreq; | ||
| double factor; | ||
|
|
||
| + global_error = 0; | ||
| + | ||
| printf("\n*** Vary source block size*** \n\n"); | ||
| srclen = 10000; | ||
| ifreq = 100; | ||
| @@ -172,11 +180,19 @@ int main(int argc, char **argv) | ||
| printf("\n*** Resample with different factors ***\n\n"); | ||
| srclen = 10000; | ||
| ifreq = 100; | ||
| - for(i=0; i<100; i++) { | ||
| - factor = ((rand() % 64) + 1) / 4.0; | ||
| + for (i = 1; i < 64; i++) { | ||
| + factor = i / 4.0; | ||
| + dstlen = (int)(srclen * factor + 10); | ||
| + runtest(srclen, (double)ifreq, factor, srclen, dstlen); | ||
| + } | ||
| + | ||
| + printf("\n*** Resample with large factors ***\n\n"); | ||
| + srclen = 200; | ||
| + ifreq = 100; | ||
| + for (factor = 25.0; factor < 1000.0; factor *= 1.7) { | ||
| dstlen = (int)(srclen * factor + 10); | ||
| runtest(srclen, (double)ifreq, factor, srclen, dstlen); | ||
| } | ||
|
|
||
| - return 0; | ||
| + return global_error; | ||
| } |
This file contains hidden or 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,68 @@ | ||
| { | ||
| lib, | ||
| stdenv, | ||
| fetchFromGitHub, | ||
| cmake, | ||
| meson, | ||
| ninja, | ||
| pkg-config, | ||
| libsndfile, | ||
| libsamplerate, | ||
| }: | ||
|
|
||
| stdenv.mkDerivation (finalAttrs: { | ||
| pname = "libresample"; | ||
| version = "0.1.4-unstable-2024-08-23"; | ||
|
|
||
| outputs = [ | ||
| "bin" | ||
| "dev" | ||
| "out" | ||
| ]; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "minorninth"; | ||
| repo = "libresample"; | ||
| rev = "7cb7f9c3f72d4e6774d964dc324af827192df7c3"; | ||
| hash = "sha256-8gyGZVblqeHYXKFM79AcfX455+l3Tsoq3xQse5nrKAo="; | ||
| }; | ||
|
|
||
| patches = [ | ||
| # Fix testresample.c output span; add exit code | ||
| # https://github.com/minorninth/libresample/pull/7 | ||
| ./fix-test.patch | ||
| ]; | ||
|
|
||
| nativeBuildInputs = [ | ||
| meson | ||
| ninja | ||
| pkg-config | ||
| ]; | ||
|
|
||
| buildInputs = | ||
| [ | ||
| # For `resample-sndfile` | ||
| libsndfile | ||
| ] | ||
| ++ lib.optionals (!libsamplerate.meta.broken) [ | ||
| # For `compareresample` | ||
| libsamplerate | ||
| ]; | ||
|
|
||
| mesonFlags = [ (lib.mesonEnable "compareresample" (!libsamplerate.meta.broken)) ]; | ||
|
|
||
| doCheck = true; | ||
|
|
||
| meta = { | ||
| description = "Real-time library for sampling rate conversion library"; | ||
| homepage = "https://github.com/minorninth/libresample"; | ||
| license = lib.licenses.bsd2; # OR LGPL-2.1-or-later | ||
| sourceProvenance = [ lib.sourceTypes.fromSource ]; | ||
| platforms = lib.platforms.all; | ||
| maintainers = [ | ||
| lib.maintainers.sander | ||
| lib.maintainers.emily | ||
| ]; | ||
| mainProgram = "resample-sndfile"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong commit
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it’s the correct commit. The tools were not being built before. |
||
| }; | ||
| }) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbis is the default and should explicitly not be added to reduce noise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my previous response (and the one I linked last time with more thoughts from others). It adds value, does no harm, and the argument that it is redundant also applies to other possible settings of
sourceProvenance. Nobody objects to the equivalentlicense = lib.licenses.free;. (Anyway, just like licence information and main programs, we should be moving in the direction of requiring explicitsourceProvenancefor all packages, not away from it.)