| 1 | The official guide to swresample for confused developers. |
| 2 | ========================================================= |
| 3 | |
| 4 | Current (simplified) Architecture: |
| 5 | --------------------------------- |
| 6 | Input |
| 7 | v |
| 8 | __________________/|\___________ |
| 9 | / | \ |
| 10 | / input sample format convert v |
| 11 | / | ___________/ |
| 12 | | |/ |
| 13 | | v |
| 14 | | ___________/|\___________ _____________ |
| 15 | | / | \ | | |
| 16 | | Rematrix | resample <---->| Buffers | |
| 17 | | \___________ | ___________/ |_____________| |
| 18 | v \|/ |
| 19 | Special Converter v |
| 20 | v ___________/|\___________ _____________ |
| 21 | | / | \ | | |
| 22 | | Rematrix | resample <---->| Buffers | |
| 23 | | \___________ | ___________/ |_____________| |
| 24 | | \|/ |
| 25 | | v |
| 26 | | |\___________ |
| 27 | \ | \ |
| 28 | \ output sample format convert v |
| 29 | \_________________ | ___________/ |
| 30 | \|/ |
| 31 | v |
| 32 | Output |
| 33 | |
| 34 | Planar/Packed conversion is done when needed during sample format conversion. |
| 35 | Every step can be skipped without memcpy when it is not needed. |
| 36 | Either Resampling and Rematrixing can be performed first depending on which |
| 37 | way it is faster. |
| 38 | The Buffers are needed for resampling due to resamplng being a process that |
| 39 | requires future and past data, it thus also introduces inevitably a delay when |
| 40 | used. |
| 41 | Internally 32bit float and 16bit int is supported currently, other formats can |
| 42 | easily be added. |
| 43 | Externally all sample formats in packed and planar configuration are supported |
| 44 | It's also trivial to add special converters for common cases. |
| 45 | If only sample format and/or packed/planar conversion is needed, it |
| 46 | is performed from input to output directly in a single pass with no intermediates. |