Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .github/workflows/book-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Install Doxygen + Graphviz
run: sudo apt-get update && sudo apt-get install -y doxygen graphviz
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Configure (Release)
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DSRT_WERROR=ON
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
werror: OFF
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Configure
env:
Expand Down Expand Up @@ -68,6 +70,8 @@ jobs:
flags: -fsanitize=thread
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Configure
env:
Expand Down Expand Up @@ -109,6 +113,8 @@ jobs:
HEXAGON_TOOLCHAIN_SHA256: "55b41922318f6331590ab7baa7f5dbdd99c109327a9c44a52c5e9878fab148c1"
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Cache toolchain
id: cache
Expand Down Expand Up @@ -193,6 +199,8 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Install toolchain and QEMU
run: >
Expand Down Expand Up @@ -222,6 +230,8 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Install toolchain and QEMU
run: >
Expand Down Expand Up @@ -294,6 +304,8 @@ jobs:
HEXAGON_TOOLCHAIN_SHA256: "55b41922318f6331590ab7baa7f5dbdd99c109327a9c44a52c5e9878fab148c1"
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Install toolchains and QEMU
run: >
Expand Down Expand Up @@ -440,6 +452,8 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Configure
run: >
Expand All @@ -464,6 +478,8 @@ jobs:
timeout-minutes: 20
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Install dependencies
run: >
Expand Down Expand Up @@ -493,6 +509,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive
# Run the TapHouse pre-commit hook — the same pinned clang-format
# developers get from `pre-commit install` (.pre-commit-config.yaml), so
# local and CI share one version AND one file scope (all C/C++ minus
Expand All @@ -515,6 +533,8 @@ jobs:
MDBOOK_SHA256: "9ef07fd288ba58ff3b99d1c94e6d414d431c9a61fdb20348e5beb74b823d546b"
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Install mdBook (pinned)
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/compare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
HEXAGON_TOOLCHAIN_SHA256: "55b41922318f6331590ab7baa7f5dbdd99c109327a9c44a52c5e9878fab148c1"
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive

- name: Install toolchains and QEMU
run: >
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install tools
run: sudo apt-get update && sudo apt-get install -y clang-tidy-18 libgtest-dev cmake python3
- name: Configure (compile database)
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "submodules/dsptap"]
path = submodules/dsptap
url = https://github.com/tap/dsptap
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
cmake_minimum_required(VERSION 3.24)
project(SampleRateTap VERSION 0.1.0 LANGUAGES CXX)

# Shared Tap-family substrate (tap::dsp): kaiser design math, sample-format
# traits, FIR dot kernels, row-sum quantization, measurement instruments.
# Pinned as a submodule per the DspTap release flow (changes land there first,
# consumers bump the pin).
add_subdirectory(submodules/dsptap)

add_library(SampleRateTap INTERFACE)
add_library(SampleRateTap::SampleRateTap ALIAS SampleRateTap)
target_include_directories(SampleRateTap INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(SampleRateTap INTERFACE cxx_std_20)
target_link_libraries(SampleRateTap INTERFACE tap::dsp)

if(PROJECT_IS_TOP_LEVEL)
option(SRT_BUILD_TESTS "Build SampleRateTap tests" ON)
Expand Down
10 changes: 5 additions & 5 deletions book/src/epilogue/letter.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ design target by 1/sinc(f/fs) so the composite comes out flat *and*
zeroed:

```cpp
{{#include ../../../include/srt/detail/kaiser.h:pw_comp_design}}
{{#include ../../../submodules/dsptap/include/tap/dsp/kaiser.h:pw_comp_design}}
```

Two implementation details earned their scars. The cosine-series trick is
Expand All @@ -98,7 +98,7 @@ rect is applied as a running sum *after* windowing, which makes the zeros
exact in the discrete composite:

```cpp
{{#include ../../../include/srt/detail/kaiser.h:pw_comp_rect}}
{{#include ../../../submodules/dsptap/include/tap/dsp/kaiser.h:pw_comp_rect}}
```

One bug in between is worth its paragraph, because the test suite caught
Expand Down Expand Up @@ -158,14 +158,14 @@ log-spaced 60 Hz–16 kHz, amplitudes pink (equal energy per octave — the
long-run average of real program), phases chosen for bounded crest:

```cpp
{{#include ../../../tests/support/multitone_analysis.h:pw_comb}}
{{#include ../../../submodules/dsptap/include/tap/dsp/analysis/multitone_analysis.h:pw_comb}}
```

The measurement fits every tone jointly and calls everything left over —
aliases, servo FM, noise — the residual:

```cpp
{{#include ../../../tests/support/multitone_analysis.h:pw_metric}}
{{#include ../../../submodules/dsptap/include/tap/dsp/analysis/multitone_analysis.h:pw_metric}}
```

The instrument fought back twice, and both fights are preserved in its
Expand Down Expand Up @@ -249,7 +249,7 @@ over with a widened tolerance earlier in this very chapter's story. The
tricky thing is row-sum-preserving quantization:

```cpp
{{#include ../../../include/srt/polyphase_filter.h:pw_row_sum}}
{{#include ../../../submodules/dsptap/include/tap/dsp/quantize.h:pw_row_sum}}
```

After it, the measured result is the one his claim demanded: a DC input
Expand Down
4 changes: 2 additions & 2 deletions book/src/part1/fractional-resampler.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The fix is to split the kernel at its natural seam: blend once per frame
into a scratch row, then run a plain dot product per channel.

```cpp
{{#include ../../../include/srt/polyphase_filter.h:rs_dot_row}}
{{#include ../../../submodules/dsptap/include/tap/dsp/fir_kernels.h:rs_dot_row}}
```

Two things about this function beyond its arithmetic. First, the comment
Expand Down Expand Up @@ -326,7 +326,7 @@ history to deliver all channels of tap t contiguously — the frame-major
layout — and a register-blocked kernel:

```cpp
{{#include ../../../include/srt/polyphase_filter.h:rs_dot_rows_frame_major}}
{{#include ../../../submodules/dsptap/include/tap/dsp/fir_kernels.h:rs_dot_rows_frame_major}}
```

The measured C6 results, condensed (the full campaign, including the
Expand Down
12 changes: 6 additions & 6 deletions book/src/part1/kaiser.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interpolates exactly. The `sinc` in this file is that function, with the
one hazard a numeric programmer would expect handled explicitly:

```cpp
{{#include ../../../include/srt/detail/kaiser.h:kai_sinc}}
{{#include ../../../submodules/dsptap/include/tap/dsp/kaiser.h:kai_sinc}}
```

(The 0/0 at x = 0 is a *removable* singularity — the limit is 1 — but IEEE
Expand Down Expand Up @@ -114,7 +114,7 @@ I₀(x) = Σₖ [ (x/2)ᵏ / k! ]²
which converges for every finite x:

```cpp
{{#include ../../../include/srt/detail/kaiser.h:kai_besseli0}}
{{#include ../../../submodules/dsptap/include/tap/dsp/kaiser.h:kai_besseli0}}
```

Three details carry all the engineering.
Expand Down Expand Up @@ -155,7 +155,7 @@ constant *relative* accuracy, which is what the window formula's ratio
## `kaiser_beta`: an empirical fit, taken as published

```cpp
{{#include ../../../include/srt/detail/kaiser.h:kai_beta}}
{{#include ../../../submodules/dsptap/include/tap/dsp/kaiser.h:kai_beta}}
```

This is Kaiser's published fit, digit for digit — `0.1102`, `0.5842`,
Expand All @@ -182,7 +182,7 @@ harris) says taps scale linearly with attenuation and inversely with
transition width:

```cpp
{{#include ../../../include/srt/detail/kaiser.h:kai_estimate}}
{{#include ../../../submodules/dsptap/include/tap/dsp/kaiser.h:kai_estimate}}
```

Note what the signature normalizes to: transition width *as a fraction of
Expand Down Expand Up @@ -222,7 +222,7 @@ UB, however silly the input.
## `design_prototype`: where all of it lands

```cpp
{{#include ../../../include/srt/detail/kaiser.h:kai_prototype}}
{{#include ../../../submodules/dsptap/include/tap/dsp/kaiser.h:kai_prototype}}
```

One pass, one output array, but four decisions are packed into these lines.
Expand Down Expand Up @@ -292,7 +292,7 @@ was rejected, and since the reasoning is a design artifact it is kept where
refactors will trip over it:

```cpp
{{#include ../../../include/srt/detail/kaiser.h:kai_design_note}}
{{#include ../../../submodules/dsptap/include/tap/dsp/kaiser.h:kai_design_note}}
```

Present the alternative fairly, because it *almost* works:
Expand Down
10 changes: 5 additions & 5 deletions book/src/part1/sample-traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ precisely at the row where the response matters most.
So the coefficients trade one precision bit for one headroom bit:

```cpp
{{#include ../../../include/srt/sample_traits.h:st_q15_coeff}}
{{#include ../../../submodules/dsptap/include/tap/dsp/sample_traits.h:st_q15_coeff}}
```

with the conversion doing round-half-away-from-zero and saturating at the
integer limits (the *design* is checked separately; saturation here is a
belt against future filter specs, not an expected event):

```cpp
{{#include ../../../include/srt/sample_traits.h:st_roundsat}}
{{#include ../../../submodules/dsptap/include/tap/dsp/sample_traits.h:st_roundsat}}
```

What did the traded bit cost? Quantizing coefficients to Q14 puts the
Expand All @@ -190,7 +190,7 @@ and that is their virtue: `Q15::make_coeff(1.0) == 16384` is the sentence
Here is the Q15 multiply-accumulate:

```cpp
{{#include ../../../include/srt/sample_traits.h:st_q15_mac}}
{{#include ../../../submodules/dsptap/include/tap/dsp/sample_traits.h:st_q15_mac}}
```

Two things are chosen here. The product is computed in `int32_t` — a
Expand Down Expand Up @@ -218,7 +218,7 @@ blended-row rewrite could both be verified *bit-exact* rather than
All of the rounding budget is spent in one place:

```cpp
{{#include ../../../include/srt/sample_traits.h:st_q15_finalize}}
{{#include ../../../submodules/dsptap/include/tap/dsp/sample_traits.h:st_q15_finalize}}
```

The accumulator holds a Q29 value (Q0.15 sample × Q1.14 coefficient); the
Expand Down Expand Up @@ -256,7 +256,7 @@ accumulator worth having on the targets this path exists for.
So each product gives up 16 bits *before* joining the sum:

```cpp
{{#include ../../../include/srt/sample_traits.h:st_q31_mac}}
{{#include ../../../submodules/dsptap/include/tap/dsp/sample_traits.h:st_q31_mac}}
```

Now redo the bound: Q45 products have worst-case magnitude 2⁴⁵, and
Expand Down
2 changes: 1 addition & 1 deletion book/src/part3/c3-c5.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ The subtle part of C4 is not the intrinsic; it is the **gate**. Here is
the actual block from `include/srt/polyphase_filter.h`, pulled in live:

```cpp
{{#include ../../../include/srt/polyphase_filter.h:opt_smlald_gate}}
{{#include ../../../submodules/dsptap/include/tap/dsp/fir_kernels.h:opt_smlald_gate}}
```

Read the condition: DSP extension present *and MVE absent*. The naive gate
Expand Down
4 changes: 2 additions & 2 deletions book/src/part3/c6.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ demonstrably keeps in registers. The library's tile is a template on K,
taken live from `include/srt/polyphase_filter.h`:

```cpp
{{#include ../../../include/srt/polyphase_filter.h:opt_dot_tile}}
{{#include ../../../submodules/dsptap/include/tap/dsp/fir_kernels.h:opt_dot_tile}}
```

The doc comment carries the 2.8× number in the header itself — the trap
Expand Down Expand Up @@ -181,7 +181,7 @@ cascade of tiles — 8, then 4, then 2, then 1 — each a specialization of
the same template:

```cpp
{{#include ../../../include/srt/polyphase_filter.h:opt_dot_rows}}
{{#include ../../../submodules/dsptap/include/tap/dsp/fir_kernels.h:opt_dot_rows}}
```

Twelve channels is 8+4. Sixteen is 8+8. The deployment shapes exercise
Expand Down
Loading
Loading