swresample.txt 2.1 KB

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