Skip to content

Commit e4037a1

Browse files
authored
Merge pull request #81 from ed-xmos/feature/doc_review
Documentation update following review
2 parents 5509bd5 + 29e186d commit e4037a1

12 files changed

Lines changed: 336 additions & 276 deletions

File tree

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: Build documentation
4444
run: |
4545
pwd
46-
docker run --user "$(id -u):$(id -g)" --rm -v ${{ github.workspace }}:/build -e EXCLUDE_PATTERNS="/build/doc/exclude-patterns.inc" -e OUTPUT_DIR="/build/doc/_build" -e PDF=1 -e SKIP_LINK=1 ${XCORE_DOC_BUILDER}
46+
docker run --user "$(id -u):$(id -g)" --rm -v ${{ github.workspace }}:/build -e EXCLUDE_PATTERNS="/build/doc/exclude-patterns.inc" -e OUTPUT_DIR="/build/doc/_build" -e PDF=1 -e SKIP_LINK=1 -e DOXYGEN_INCLUDE=/build/doc/Doxyfile.inc -e DOXYGEN_INPUT=ignore ${XCORE_DOC_BUILDER}
4747
tree
4848
DOC_VERSION=$(grep version settings.json | grep -o "[0-9]*\.[0-9]*\.[0-9]")
4949
mv doc/_build/pdf/programming_guide.pdf doc/_build/pdf/programming_guide_v${DOC_VERSION}.pdf

README.rst

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Overview
66

77
The XMOS Sample Rate Conversion (SRC) library provides both synchronous and asynchronous audio sample rate conversion functions for use on xCORE multicore micro-controllers.
88

9-
In systems where the rate change is exactly equal to the ratio of nominal rates, synchronous sample rate conversion (SSRC) provides efficient and high performance rate conversion. Where the input and output rates are not locked by a common clock or clocked by an exact rational frequency ratio, the Asynchronous Sample Rate Converter (ASRC) provides a way of streaming high quality audio between the two different clock domains, at the cost of higher processing resource usage. ASRC can ease interfacing in cases where the are multiple digital audio inputs or allow cost saving by removing the need for physical clock recovery using a PLL.
9+
In systems where the rate change is exactly equal to the ratio of nominal rates, synchronous sample rate conversion (SSRC) provides efficient and high performance rate conversion. Where the input and output rates are not locked by a common clock or clocked by an exact rational frequency ratio, the Asynchronous Sample Rate Converter (ASRC) provides a way of streaming high quality audio between the two different clock domains, at the cost of higher processing resource usage. ASRC can ease interfacing in cases where there are multiple digital audio inputs or allow cost saving by removing the need for physical clock recovery using a PLL.
1010

1111
Features
1212
........
@@ -16,7 +16,7 @@ Multi-rate Hi-Fi functionality:
1616
* Conversion between 44.1, 48, 88.2, 96, 176.4 and 192 KHz input and output sample rates.
1717
* 32 bit PCM input and output data in Q1.31 signed format.
1818
* Optional output dithering to 24 bit using Triangular Probability Density Function (TPDF).
19-
* Optimized for xCORE-200 instruction set with dual-issue.
19+
* Optimized for xCORE-200 instruction set with dual-issue and compatible with XCORE-AI.
2020
* Block based processing - Minimum 4 samples input per call, must be power of 2.
2121
* Up to 10000 ppm sample rate ratio deviation from nominal rate (ASRC only).
2222
* Very high quality - SNR greater than 135 dB (ASRC) or 140 dB (SSRC), with THD of less than 0.0001% (reference 1KHz).
@@ -27,7 +27,14 @@ Multi-rate Hi-Fi functionality:
2727
Fixed factor functionality:
2828

2929
* Synchronous fixed factor of 3 downsample and oversample functions supporting either HiFi quality or reduced resource requirements for voice applications.
30-
* Synchronous fixed factor of 3 and 3/2 downsample and oversample functions for voice applications optimised for the XS3 Vector Processing Unit.
30+
* Synchronous fixed factor of 3 and 3/2 downsample and oversample functions for voice applications optimized for the XS3 Vector Processing Unit.
31+
32+
Building
33+
........
34+
35+
The library can be built under `cmake` or `xcommon` via `xmake` offering backwards compatibility for legacy applications.
36+
It is recommended to use `cmake` where the library name `lib_src` is included in the cmake files. See `Related application notes`_ for example usage.
37+
The library has no dependencies when building under `cmake` although does require `lib_logging` and `lib_xassert` when using `xcommon`.
3138

3239
Components
3340
..........
@@ -38,23 +45,23 @@ Components
3845
* Synchronous factor of 3 downsample function (ds3)
3946
* Synchronous factor of 3 oversample function (os3)
4047

41-
* Synchronous factor of 3 downsample function optimised for use with voice (src_ds3_voice)
48+
* Synchronous factor of 3 downsample function optimized for use with voice (src_ds3_voice)
4249
* Synchronous factor of 3 oversample function optimised for use with voice (src_us3_voice)
4350

44-
* Synchronous factor of 3 downsample function optimised for use with voice optimised for XS3 (src_ff3_96t_ds)
45-
* Synchronous factor of 3 oversample function optimised for use with voice optimised for XS3 (src_ff3_96t_us)
51+
* Synchronous factor of 3 downsample function for use with voice optimized for XS3 (ff3_96t_ds)
52+
* Synchronous factor of 3 oversample function for use with voice optimized for XS3 (ff3_96t_us)
4653

47-
* Synchronous factor of 3/2 downsample function optimised for use with voice optimised for XS3 (src_rat_2_3_96t_ds)
48-
* Synchronous factor of 3/2 oversample function optimised for use with voice optimised for XS3 (src_rat_3_2_96t_us)
54+
* Synchronous factor of 3/2 downsample function for use with voice optimized for XS3 (rat_2_3_96t_ds)
55+
* Synchronous factor of 3/2 oversample function for use with voice optimized for XS3 (rat_3_2_96t_us)
4956

5057
There are three different component options that support fixed factor of 3 up/downsampling. To help choose which one to use follow these steps:
5158

52-
#. If you require HiFi quality (130 dB SNR) up/downsampling, use src_ds3_voice or src_us3_voice.
53-
#. If you require voice quality (65 dB SNR) and are using xCORE-200, use src_ds3_voice or src_us3_voice.
54-
#. If you require voice quality (75 dB SNR) and are using xCORE-AI, use src_ff3_96t_ds or src_ff3_96t_us.
59+
#. If HiFi quality (130 dB SNR) up/downsampling is required, use ds3 or os3.
60+
#. If voice quality (65 dB SNR) is required running on xCORE-200, use ds3_voice or us3_voice.
61+
#. If voice quality (75 dB SNR) is required running xcore-ai, use ff3_96t_ds or ff3_96t_us.
5562

5663

57-
Related application notes
64+
Related Application Notes
5865
.........................
5966

6067
An adaptive USB Audio ASRC example can be found in https://github.com/xmos/sln_voice/tree/develop/examples.

doc/exclude-patterns.inc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ build/*
77
*.md
88
**/*.md
99

10-
# Do not build the app docs
11-
# app_xvf3800/*
12-
# tools/*
13-
14-
# Don't include libraries in user docs
15-
# lib_sw_pll/*
10+
# We need to ensure these are not processed twice which breaks figure numbering. They are included via index.rst.
11+
**/multi_rate_hifi_src.rst
12+
**/fixed_ratio_src.rst
13+
**/resource_usage_asrc.rst
14+
**/resource_usage_ssrc.rst

doc/rst/overview.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/rst/programming_guide/fixed_ratio_src.rst

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
Fixed factor of 3 functions
2-
===========================
1+
Fixed factor of 3 HiFi functions
2+
================================
33

4-
The SRC library also includes synchronous sample rate conversion functions to downsample (decimate) and oversample (upsample or interpolate) by a fixed factor of three.
4+
Overview
5+
--------
6+
7+
The SRC library includes synchronous sample rate conversion functions to downsample (decimate) and oversample (upsample or interpolate) by a fixed factor of 3.
58

69
These components offer a high quality conversion with an SNR of 130 dB.
710

8-
In each case, the processing is carried out each time a single output sample is required. In the case of the decimator, three input samples passed to filter with a resulting one sample output on calling the processing function. The interpolator produces an output sample each time the processing function is called but will require a single sample to be pushed into the filter every third cycle. All samples use Q31 format (left justified signed 32b integer).
11+
In each case, the processing is carried out each time a single output sample is required. In the case of the decimator, three input samples are passed to the filter with a resulting one sample output on calling the processing function. The interpolator produces an output sample each time the processing function is called but will require a single sample to be pushed into the filter every third cycle. All samples use Q1.31 format (left justified signed 32b integer).
912

1013
Both sample rate converters are based on a 144 tap FIR filter with two sets of coefficients available, depending on application requirements:
1114

12-
* firos3_b_144.dat / firds3_b_144.dat - These filters have 20dB of attenuation at the nyquist frequency and a higher cutoff frequency
13-
* firos3_144.dat / firds3_144.dat - These filters have 60dB of attenuation at the nyquist frequency but trade this off with a lower cutoff frequency
15+
* firos3_b_144.dat / firds3_b_144.dat - These filters have 20 dB of attenuation at the Nyquist frequency and a higher cutoff frequency
16+
* firos3_144.dat / firds3_144.dat - These filters have 60 dB of attenuation at the Nyquist frequency but trade this off with a lower cutoff frequency
1417

15-
The default setting is to use the 60dB of attenuation at the nyquist frequency coefficients.
18+
The default setting is to use the coefficients that provide 60 dB of attenuation at the Nyquist frequency.
1619

1720
The filter coefficients may be selected by adjusting the line::
1821

@@ -24,18 +27,18 @@ and::
2427

2528
in the files ``src_ff3_os3.h`` (API for oversampling) and ``src_ff3_ds3.h`` (API for downsampling) respectively.
2629

27-
The OS3 processing takes up to 153 core cycles to compute a sample which translates to 1.53us at 100MHz or 2.448us at 62.5MHz core speed. This permits up to 8 channels of 16 kHz -> 48 kHz sample rate conversion in a single 62.5MHz core.
30+
The OS3 processing takes up to 153 core cycles to compute a sample which translates to 1.53 :math:`{\mu}s` at 100 MHz or 2.448 :math:`{\mu}s` at 62.5 MHz core speed. This permits up to 8 channels of 16 kHz -> 48 kHz sample rate conversion in a single 62.5MHz core.
2831

29-
The DS3 processing takes up to 389 core cycles to compute a sample which translates to 3.89us at 100MHz or 6.224us at 62.5MHz core speed. This permits up to 9 channels of 48 kHz -> 16 kHz sample rate conversion in a single 62.5MHz core.
32+
The DS3 processing takes up to 389 core cycles to compute a sample which translates to 3.89 :math:`{\mu}s` at 100 MHz or 6.224 :math:`{\mu}s` at 62.5 MHz core speed. This permits up to 9 channels of 48 kHz -> 16 kHz sample rate conversion in a single 62.5MHz core.
3033

31-
Both downsample and oversample functions return ``ERROR`` or ``NOERROR`` status codes as defined in return codes enums listed below. The only way these functions can error is if the passed `delay_base` structure member has been uninitialised and is NULL.
34+
Both downsample and oversample functions return ``ERROR`` or ``NO_ERROR`` status codes as defined in the return code enums listed below. The only way these functions can error is if the passed `delay_base` structure member is uninitialized (NULL).
3235

33-
The down sampling functions return the following error codes ::
36+
The downsampling functions return the following error codes ::
3437

3538
FIRDS3_NO_ERROR
3639
FIRDS3_ERROR
3740

38-
The up sampling functions return the following error codes ::
41+
The upsampling functions return the following error codes ::
3942

4043
FIROS3_NO_ERROR
4144
FIROS3_ERROR
@@ -70,15 +73,17 @@ OS3 API
7073
.. doxygenfunction:: src_os3_proc
7174

7275

73-
Fixed factor of 3 functions optimised for use with voice
76+
Fixed factor of 3 functions optimized for use with voice
7477
========================================================
7578

76-
A pair of SRC components supporting up and down coversion by a factor of 3 are provided that are suitable for voice applications. They provide voice quality SNR (around 60 dB),
77-
use a 72 tap Remez FIR filter and are optimised for the XS2 instruction set.
79+
Overview
80+
--------
81+
82+
A pair of SRC components supporting upconversion and downconversion by a factor of 3 are provided that are suitable for voice applications. They provide voice quality SNR (around 60 dB) and use a 72 tap Remez FIR filter and are optimized for the XS2 instruction set.
7883

7984

8085
.. warning::
81-
These SRC components have been deprecated. For new designs using xCORE-AI, please use the XS3 optimised components which provide both much better performance and use approximately half of the MIPS.
86+
These SRC components have been deprecated. For new designs using XCORE-AI, please use the XS3 optimized components which provide both much better performance and use approximately half of the MIPS. See `ff3_voice_vpu_hdr`_
8287

8388
..
8489
.. doxygenvariable:: src_ff3v_fir_coefs_debug
@@ -101,28 +106,32 @@ Voice US3 API
101106
.. doxygenfunction:: src_us3_voice_get_next_sample
102107

103108

104-
Fixed factor of 3 and 3/2 functions optimised for XS3 (xCORE-AI) and for use in voice applications
105-
==================================================================================================
109+
Fixed factor of 3 and 3/2 voice functions optimized for XS3
110+
===========================================================
111+
112+
Overview
113+
--------
106114

107-
A set of SRC components are provided which are optimised for the Vector Processing Unit (VPU) and are suitable for voice applications.
115+
A set of SRC components are provided which are optimized for the Vector Processing Unit (VPU) and are suitable for voice applications.
108116
The fixed factor of 3 SRC components are designed for conversion between 48 kHz to 16 kHz and the fixed factor of 3/2 are designed for conversion between 48 kHz and 32 kHz.
109117

110-
They have been designed for voice applications and, in particular, conformance to the MS Teams specification.
118+
They have been designed for voice applications and, in particular, conformance to the MS Teams v5 specification.
111119

112120

113121
.. note::
114-
These filters will only run on xCORE-AI due to the inner dot product calculation employing the XS3 VPU.
115-
122+
These filters will only run on XCORE-AI due to the inner dot product calculation employing the XS3 VPU.
116123

124+
.. _ff3_voice_vpu_hdr:
117125
Fixed factor of 3 VPU
118126
---------------------
119127

120128
The filters use less than half of the cycles of the previous fixed factor of 3 functions but at the same time offer a much improved
121129
filter response thanks to an increased filter length of 96 taps (compared with 72 taps) and use of a Kaiser window with a beta of 4.0.
130+
The filter specification is shown in :numref:`src_ff3_vpu_filter`.
122131

123-
132+
.. _src_ff3_vpu_filter:
124133
.. list-table:: Fixed Factor of 3 Voice VPU SRC characteristics
125-
:header-rows: 1
134+
:header-rows: 1
126135

127136
* - Filter
128137
- CPU cycles
@@ -136,25 +145,26 @@ filter response thanks to an increased filter length of 96 taps (compared with 7
136145
- 0.475
137146
- 0.525
138147
- 0.01 dB
139-
- 70 dB
148+
- 70 dB min
140149
- 96
141150
* - src_ff3_96t_us
142151
- 85
143152
- 0.475
144153
- 0.525
145154
- 0.01 dB
146-
- 70 dB
155+
- 70 dB min
147156
- 96
148157

149-
The fixed factor of three components produce three samples for each call passing one sample in the case of upsampling and produce a single sample for each call passing three samples in the case of downsampling.
150-
All input and output samples are signed 32 bit integers.
151-
158+
The fixed factor of 3 components produce three samples for each call passing one sample in the case of upsampling and produce a single sample for each call passing three samples in the case of downsampling.
159+
All input and output samples are signed 32 bit integers. The filter characteristics are shown in :numref:`src_ff3_vpu` and :numref:`src_ff3_vpu_pb`.
152160

161+
.. _src_ff3_vpu:
153162
.. figure:: images/src_ff3_vpu.png
154163
:width: 80%
155164

156165
Fixed Factor of 3 Voice VPU SRC filter response
157166

167+
.. _src_ff3_vpu_pb:
158168
.. figure:: images/src_ff3_vpu_pb.png
159169
:width: 80%
160170

@@ -177,11 +187,11 @@ Voice US3 API
177187
Fixed factor of 3/2 VPU
178188
-----------------------
179189

180-
The fixed factor of 3/2 VPU sample rate converts use a rational factor polyphase architecture to achieve the non-integer rate ratio. Downsampling takes two phases while upsampling takes three. The filters have been designed with a Kaiser window with a beta of 3.2.
181-
190+
The fixed factor of 3/2 VPU sample rate converts use a rational factor polyphase architecture to achieve the non-integer rate ratio. Downsampling takes two phases while upsampling takes three. The filters have been designed with a Kaiser window with a beta of 3.2. The filter specification is shown in :numref:`src_ff3_2_vpu_filter`.
182191

192+
.. _src_ff3_2_vpu_filter:
183193
.. list-table:: Fixed Factor of 3/2 Voice VPU SRC characteristics
184-
:header-rows: 1
194+
:header-rows: 1
185195

186196
* - Filter
187197
- CPU cycles
@@ -205,29 +215,31 @@ The fixed factor of 3/2 VPU sample rate converts use a rational factor polyphase
205215
- 70 dB
206216
- 96
207217

208-
The fixed factor of 3/2 components produce three samples for each call passing two samples in the case of upsampling and produce a two samples for each call passing three samples in the case of downsampling.
209-
All input and output samples are signed 32 bit integers.
218+
The fixed factor of 3/2 components produce three samples for each call passing two samples in the case of upsampling and produce two samples for each call passing three samples in the case of downsampling.
219+
All input and output samples are signed 32 bit integers. The filter characteristics are shown in :numref:`src_ff3_2_vpu` and :numref:`src_ff3_2_vpu_pb`.
210220

211221

222+
.. _src_ff3_2_vpu:
212223
.. figure:: images/src_rat_vpu.png
213224
:width: 80%
214225

215226
Fixed Factor of 3/2 Voice VPU SRC filter response
216227

228+
.. _src_ff3_2_vpu_pb:
217229
.. figure:: images/src_rat_vpu_pb.png
218230
:width: 80%
219231

220232
Fixed Factor of 3/2 Voice VPU SRC passband ripple
221233

222234

223235
Voice DS3/2 API
224-
-------------
236+
---------------
225237

226238
.. doxygengroup:: src_rat_2_3_96t_ds
227239
:content-only:
228240

229241
Voice US3/2 API
230-
-------------
242+
---------------
231243

232244
.. doxygengroup:: src_rat_3_2_96t_us
233245
:content-only:

doc/rst/programming_guide/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Programmer Guide
2-
################
1+
Programming Guide
2+
#################
33

44
.. include:: ../../../README.rst
55

0 commit comments

Comments
 (0)