aboutsummaryrefslogtreecommitdiffstats
path: root/doc/swresample.txt
blob: 2d192a394ef2beb70cb49096bbdf1b8cb97028c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    The official guide to swresample for confused developers.
   =========================================================

Current (simplified) Architecture:
---------------------------------
                        Input
                          v
       __________________/|\___________
      /                   |            \
     /    input sample format convert   v
    /                     | ___________/
    |                     |/
    |                     v
    |         ___________/|\___________              _____________
    |        /            |            \            |             |
    |   Rematrix          |          resample <---->|   Buffers   |
    |        \___________ | ___________/            |_____________|
    v                    \|/
Special Converter         v
    v         ___________/|\___________              _____________
    |        /            |            \            |             |
    |   Rematrix          |          resample <---->|   Buffers   |
    |        \___________ | ___________/            |_____________|
    |                    \|/
    |                     v
    |                     |\___________
    \                     |            \
     \   output sample format convert   v
      \_________________  | ___________/
                         \|/
                          v
                        Output

Planar/Packed conversion is done when needed during sample format conversion.
Every step can be skipped without memcpy when it is not needed.
Either Resampling and Rematrixing can be performed first depending on which
way it is faster.
The Buffers are needed for resampling due to resamplng being a process that
requires future and past data, it thus also introduces inevitably a delay when
used.
Internally 32bit float and 16bit int is supported currently, other formats can
easily be added.
Externally all sample formats in packed and planar configuration are supported
It's also trivial to add special converters for common cases.
If only sample format and/or packed/planar conversion is needed, it
is performed from input to output directly in a single pass with no intermediates.