Ë
    ÿÍ:jJ  ã                   ó.   — d dl Z d dlmZmZ i Zd„ Zdd„Zy)é    N)ÚrfftÚirfftc                 óÔ   — 	 t         |    S # t        $ r Y nw xY wt        | t        «      r| dkD  sJ ‚| }	 |}dD ]  }||z  dk(  sŒ||z  }||z  dk(  rŒŒ |dk(  r|t         | <   |S |dz  }Œ6)a7  
    Returns the next largest number ``n >= size`` whose prime factors are all
    2, 3, or 5. These sizes are efficient for fast fourier transforms.
    Equivalent to :func:`scipy.fftpack.next_fast_len`.

    Note: This function was originally copied from the https://github.com/pyro-ppl/pyro
    repository, where the license was Apache 2.0. Any modifications to the original code can be
    found at https://github.com/asteroid-team/torch-audiomentations/commits

    :param int size: A positive number.
    :returns: A possibly larger number.
    :rtype int:
    r   )é   é   é   é   )Ú_NEXT_FAST_LENÚKeyErrorÚ
isinstanceÚint)ÚsizeÚ	next_sizeÚ	remainingÚns       ú|/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/torch_audiomentations/utils/convolution.pyÚnext_fast_lenr      s¢   € ðÜ˜dÑ#Ð#øÜò Ùðúô �dœCÔ  T¨A¢XÐ-Ð-Ø€IØ
Øˆ	Øò 	 ˆAØ˜a‘- 1Ó$Ø˜a‘�	ð ˜a‘- 1Ô$ð	 ð ˜Š>Ø#,ŒN˜4Ñ ØÐØ�Q‰ˆ	ð s   ‚ ‹	–c                 ó¤  — | j                  d«      }|j                  d«      }|dk(  r	||z   dz
  }nN|dk(  rt        ||«      t        ||«      z
  dz   }n,|dk(  rt        ||«      }nt        dj	                  |«      «      ‚||z   dz
  }t        |«      }t        | |¬«      }t        ||¬«      }	||	z  }
t        |
|¬«      }||z
  dz  }|d	|||z   …f   S )
a¡  
    Computes the 1-d convolution of signal by kernel using FFTs.
    The two arguments should have the same rightmost dim, but may otherwise be
    arbitrarily broadcastable.

    Note: This function was originally copied from the https://github.com/pyro-ppl/pyro
    repository, where the license was Apache 2.0. Any modifications to the original code can be
    found at https://github.com/asteroid-team/torch-audiomentations/commits

    :param torch.Tensor signal: A signal to convolve.
    :param torch.Tensor kernel: A convolution kernel.
    :param str mode: One of: 'full', 'valid', 'same'.
    :return: A tensor with broadcasted shape. Letting ``m = signal.size(-1)``
        and ``n = kernel.size(-1)``, the rightmost size of the result will be:
        ``m + n - 1`` if mode is 'full';
        ``max(m, n) - min(m, n) + 1`` if mode is 'valid'; or
        ``max(m, n)`` if mode is 'same'.
    :rtype torch.Tensor:
    éÿÿÿÿÚfullr	   ÚvalidÚsamezUnknown mode: {})r   r   .)r   ÚmaxÚminÚ
ValueErrorÚformatr   r   r   )ÚsignalÚkernelÚmodeÚmr   ÚtruncateÚpadded_sizeÚfast_ftt_sizeÚf_signalÚf_kernelÚf_resultÚresultÚ	start_idxs                r   Úconvolver)   (   sí   € ð( 	�‰�B‹€AØ�‰�B‹€AØˆv‚~Ø�q‘5˜1‘9‰Ø	�ŠÜ�q˜!“9œs 1 a›yÑ(¨1Ñ,‰Ø	�ŠÜ�q˜!“9‰äÐ+×2Ñ2°4Ó8Ó9Ð9ð �a‘%˜!‘)€Kä! +Ó.€MÜ�F˜mÔ,€HÜ�F˜mÔ,€HØ˜(Ñ"€HÜ�8˜}Ô-€Fà˜xÑ'¨AÑ-€IØ�#�y 9¨xÑ#7Ð7Ð7Ñ8Ð8ó    )r   )ÚtorchÚtorch_audiomentations.utils.fftr   r   r
   r   r)   © r*   r   ú<module>r.      s   ðÛ ç 7à€òô@)9r*   