1. 20 Mar, 2023 1 commit
    • moto's avatar
      Support CUDA frame in FilterGraph (#3183) · c5b96558
      moto authored
      Summary:
      This commit adds CUDA frame support to FilterGraph
      
      It initializes and attaches CUDA frames context to FilterGraph,
      so that CUDA frames can be processed in FilterGraph.
      
      As a result, it enables
      1. CUDA filter support such as `scale_cuda`
      2. Properly retrieve the pixel format coming out of FilterGraph when
         CUDA HW acceleration is enabled. (currently it is reported as "cuda")
      
      Resolves https://github.com/pytorch/audio/issues/3159
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3183
      
      Reviewed By: hwangjeff
      
      Differential Revision: D44183722
      
      Pulled By: mthrok
      
      fbshipit-source-id: 522d21039c361ddfaa87fa89cf49c19d210ac62f
      c5b96558
  2. 17 Mar, 2023 1 commit
  3. 16 Mar, 2023 1 commit
    • moto's avatar
      Refactor Tensor conversion in StreamReader (#3170) · 014d7140
      moto authored
      Summary:
      Currently, when the Buffer converts AVFrame* to torch::Tensor,
      it checks the format at each time a frame is passed, and
      perform the conversion.
      
      This commit changes it so that the conversion operation is
      pre-instantiated at the time outside stream is configured.
      
      It introduces Converter implementations for various formats,
      and use template to embed them in Buffer class.
      This way, branching like if/switch are eliminated from
      decoding path.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3170
      
      Reviewed By: xiaohui-zhang
      
      Differential Revision: D44048293
      
      Pulled By: mthrok
      
      fbshipit-source-id: 30d8b240a5695d7513f499ce17853f2f0ffcab9f
      014d7140
  4. 15 Mar, 2023 1 commit
  5. 08 Mar, 2023 2 commits
    • moto's avatar
      Include format information after filter (#3155) · 146195d8
      moto authored
      Summary:
      This commit adds fields to OutputStream, which shows the result
      of fitlers, such as width and height after filtering.
      
      Before
      
      ```
      OutputStream(
          source_index=0,
          filter_description='fps=3,scale=width=320:height=320,format=pix_fmts=gray')
      ```
      
      After
      
      ```
      OutputVideoStream(
          source_index=0,
          filter_description='fps=3,scale=width=320:height=320,format=pix_fmts=gray',
          media_type='video',
          format='gray',
          width=320,
          height=320,
          frame_rate=3.0)
      ```
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3155
      
      Reviewed By: nateanl
      
      Differential Revision: D43882399
      
      Pulled By: mthrok
      
      fbshipit-source-id: 620676b1a06f293fdd56de8203a11120f228fa2d
      146195d8
    • moto's avatar
      Support overwriting PTS in StreamWriter (#3135) · 8d2f6f8d
      moto authored
      Summary: Pull Request resolved: https://github.com/pytorch/audio/pull/3135
      
      Reviewed By: xiaohui-zhang
      
      Differential Revision: D43724273
      
      Pulled By: mthrok
      
      fbshipit-source-id: 9b52823618948945a26e57d5b3deccbf5f9268c1
      8d2f6f8d
  6. 07 Mar, 2023 3 commits
  7. 02 Mar, 2023 1 commit
  8. 01 Mar, 2023 1 commit
    • Zhaoheng Ni's avatar
      Fix windows tests (#3119) · 6a4a8200
      Zhaoheng Ni authored
      Summary:
      `sox` is not available on Windows machines. Add skip decorators to the sox related tests to skip running tests on Windows.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3119
      
      Reviewed By: mthrok
      
      Differential Revision: D43682754
      
      Pulled By: nateanl
      
      fbshipit-source-id: f69987dac8232a3569be83f096b32389bd8bda81
      6a4a8200
  9. 27 Feb, 2023 1 commit
  10. 25 Feb, 2023 1 commit
  11. 23 Feb, 2023 1 commit
  12. 22 Feb, 2023 1 commit
  13. 17 Feb, 2023 1 commit
  14. 16 Feb, 2023 1 commit
    • hwangjeff's avatar
      Introduce I/O backend dispatcher (#3015) · b799fcd6
      hwangjeff authored
      Summary:
      Adds I/O backend dispatcher that routes I/O requests to FFmpeg, SoX, or Soundfile backend, per library availability. It allows users to specify a backend mapped to a media library, i.e. one of `["ffmpeg", "sox", "soundfile"]`, to use via keyword argument, with FFmpeg being the default. Environment variable `TORCHAUDIO_USE_BACKEND_DISPATCHER` gates enablement of the dispatcher; specifically, if `TORCHAUDIO_USE_BACKEND_DISPATCHER` is explicitly set to `1`, importing TorchAudio makes it accessible via `torchaudio.info`, `torchaudio.load`, and `torchaudio.save`.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3015
      
      Reviewed By: mthrok
      
      Differential Revision: D43258649
      
      Pulled By: hwangjeff
      
      fbshipit-source-id: 8f12e4e56b9fa3f0814dd3fed3e1783ab23a53a1
      b799fcd6
  15. 15 Feb, 2023 2 commits
  16. 14 Feb, 2023 1 commit
  17. 07 Feb, 2023 1 commit
    • juan.azcarreta.ortiz's avatar
      Add playback function (#3026) · 2ead941e
      juan.azcarreta.ortiz authored
      Summary:
      Allows user to play audio through the
      device speaker.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3026
      
      Test Plan:
      Created a new test that mocks a call to the write audio chunk method from StreamWriter. To run the test:
      
      `pytest test/torchaudio_unittest/io/_playback_test.py`
      
      Reviewed By: mthrok
      
      Differential Revision: D43082062
      
      Pulled By: jazcarretao
      
      fbshipit-source-id: 01a85b32ce925687a633d1208d15d54556e89dd8
      2ead941e
  18. 04 Feb, 2023 1 commit
  19. 03 Feb, 2023 1 commit
    • moto's avatar
      Add Linux GPU unit tests on GHA (#3029) · 6bdd3830
      moto authored
      Summary:
      Add GitHub Action-based GPU test jobs.
      - It seems that there is 2 hour upper cap so only running CUDA/GPU tests.
      - Since Kaldi related features are not available, they are disabled.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3029
      
      Reviewed By: hwangjeff
      
      Differential Revision: D42983800
      
      Pulled By: mthrok
      
      fbshipit-source-id: 47fefe39c635d1c73ad6799ddacefd2666fe5403
      6bdd3830
  20. 01 Feb, 2023 2 commits
  21. 27 Jan, 2023 1 commit
  22. 26 Jan, 2023 1 commit
  23. 24 Jan, 2023 1 commit
  24. 22 Jan, 2023 1 commit
    • moto's avatar
      Make StreamReader return PTS (#2975) · 0dd59e0d
      moto authored
      Summary:
      This commit makes `StreamReader` report PTS (presentation time stamp) of the returned chunk as well.
      
      Example
      
      ```python
      from torchaudio.io import StreamReader
      
      s = StreamReader(...)
      s.add_video_stream(...)
      for (video_chunk, ) in s.stream():
          # video_chunk is Torch tensor type but has extra attribute of PTS
          print(video_chunk.pts)  # reports the PTS of the first frame of the video chunk.
      ```
      
      For the backward compatibility, we introduce a `_ChunkTensor`, that is a composition
      of Tensor and metadata, but works like a normal tensor in PyTorch operations.
      
      The implementation of `_ChunkTensor` is based on [TrivialTensorViaComposition](https://github.com/albanD/subclass_zoo/blob/0eeb1d68fb59879029c610bc407f2997ae43ba0a/trivial_tensors.py#L83).
      
      It was also suggested to attach metadata directly to Tensor object,
      but the possibility to have the collision on torchaudio's metadata and new attributes introduced in
      PyTorch cannot be ignored, so we use Tensor subclass implementation.
      
      If any unexpected issue arise from metadata attribute name collision, client code can
      fetch the bare Tensor and continue.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/2975
      
      Reviewed By: hwangjeff
      
      Differential Revision: D42526945
      
      Pulled By: mthrok
      
      fbshipit-source-id: b4e9422e914ff328421b975120460f3001268f35
      0dd59e0d
  25. 19 Jan, 2023 1 commit
  26. 16 Jan, 2023 1 commit
  27. 14 Jan, 2023 1 commit
  28. 13 Jan, 2023 1 commit
  29. 12 Jan, 2023 2 commits
    • mthrok's avatar
      Refactor extension modules initialization (#2968) · 5dfe0b22
      mthrok authored
      Summary:
      * Refactor _extension module so that
        * the implementation of initialization logic and its execution are separated.
          * logic goes to `_extension.utils`
          * the execution is at `_extension.__init__`
          * global variables are defined and modified in `__init__`.
      * Replace `is_sox_available()` with `_extension._SOX_INITIALIZED`
      * Replace `is_kaldi_available()` with `_extension._IS_KALDI_AVAILABLE`
      * Move `requies_sox()` and `requires_kaldi()` to break the circular dependency among `_extension` and `_internal.module_utils`.
      * Merge the sox-related initialization logic in `_extension.utils` module.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/2968
      
      Reviewed By: hwangjeff
      
      Differential Revision: D42387251
      
      Pulled By: mthrok
      
      fbshipit-source-id: 0c3245dfab53f9bc1b8a83ec2622eb88ec96673f
      5dfe0b22
    • moto's avatar
      Add `buffer_chunk_size=-1` option (#2969) · 22788a8f
      moto authored
      Summary:
      This commit adds `buffer_chunk_size=-1`, which does not drop buffered frames.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/2969
      
      Reviewed By: xiaohui-zhang
      
      Differential Revision: D42403467
      
      Pulled By: mthrok
      
      fbshipit-source-id: a0847e6878874ce7e4b0ec3f56e5fbb8ebdb5992
      22788a8f
  30. 10 Jan, 2023 1 commit
    • moto's avatar
      Update the handling of videos without PTS values (#2970) · 1717edaa
      moto authored
      Summary:
      filter graph does not fallback to `best_effort_timestamp`, thus applying filters (like changing fps) on videos without PTS values failed.
      
      This commit changes the behavior by overwriting the PTS values with best_effort_timestamp.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/2970
      
      Reviewed By: YosuaMichael
      
      Differential Revision: D42425771
      
      Pulled By: mthrok
      
      fbshipit-source-id: 7b7a033ea2ad89bb49d6e1663d35d377dab2aae9
      1717edaa
  31. 06 Jan, 2023 2 commits
  32. 05 Jan, 2023 2 commits