code: def _overlap_add_filter(
      x,
      h,
      n_fft=None,
      phase="zero",
      picks=None,
      n_jobs=None,
      copy=True,
      pad="reflect_limited",
  ):
      """Filter the signal x using h with overlap-add FFTs.
  
      Parameters
      ----------
      x : array, shape (n_signals, n_times)
          Signals to filter.
      h : 1d array
          Filter impulse response (FIR filter coefficients). Must be odd length
          if ``phase='linear'``.
      n_fft : int
          Length of the FFT. If None, the best size is determined automatically.
      phase : str
          If ``'zero'``, the delay for the filter is compensated (and it must be
          an odd-length symmetric filter). If ``'linear'``, the response is
          uncompensated. If ``'zero-double'``, the filter is applied in the
          forward and reverse directions. If 'minimum', a minimum-phase
          filter will be used.
      picks : list | None
          See calling functions.
      n_jobs : int | str
          Number of jobs to run in parallel. Can be ``'cuda'`` if ``cupy``
          is installed properly.
      copy : bool
          If True, a copy of x, filtered, is returned. Otherwise, it operates
          on x in place.
      pad : str
          Padding type for ``_smart_pad``.
  
      Returns
      -------
      x : array, shape (n_signals, n_times)
          x filtered.
      """
      # set up array for filtering, reshape to 2D, operate on last axis
      x, orig_shape, picks = _prep_for_filtering(x, copy, picks)
      # Extend the signal by mirroring the edges to reduce transient filter
      # response
      _check_zero_phase_length(len(h), phase)
      if len(h) == 1:
          return x * h**2 if phase == "zero-double" else x * h
      n_edge = max(min(len(h), x.shape[1]) - 1, 0)
      logger.debug(
          "Smart-padding with:  %s samples on each edge" % n_edge
      )
      n_x = x.shape[1] + 2 * n_edge
  
      if phase == "zero-double":
          h = np.convolve(h, h[::-1])
  
      # Determine FFT length to use
      min_fft = 2 * len(h) - 1
      if n_fft is None:
          max_fft = n_x
          if max_fft >= min_fft:
              # cost function based on number of multiplications
              N = 2 ** np.arange(
                  np.ceil(np.log2(min_fft)),
                  np.ceil(np.log2(max_fft)) + 1,
                  dtype=int,
              )
              cost = (
                  np.ceil(n_x / (N - len(h) + 1).astype(np.float64))
                  * N
                  * (np.log2(N) + 1)
              )
  
              # add a heuristic term to prevent too-long FFT's which are slow
              # (not predicted by mult. cost alone, 4e-5 exp. determined)
              cost += 4e-5 * N * n_x
  
              n_fft = N[np.argmin(cost)]
          else:
              # Use only a single block
              n_fft = next_fast_len(min_fft)
      logger.debug("FFT block length:   %s" % n_fft)
      if n_fft < min_fft:
          raise ValueError(
              f"n_fft is too short, has to be at least 2 * len(h) - 1 ({min_fft}), got "
              f"{n_fft}"
          )
  
      # Figure out if we should use CUDA
      n_jobs, cuda_dict = _setup_cuda_fft_multiply_repeated(
          n_jobs, h, n_fft
      )
  
      # Process each row separately
      picks = _picks_to_idx(len(x), picks)
      parallel, p_fun, _ = parallel_func(_1d_overlap_filter, n_jobs)
      if n_jobs == 1:
          for p in picks:
              x[p] = _1d_overlap_filter(
                  x[p], len(h), n_edge, phase, cuda_dict, pad, n_fft
              )
      else:
          data_new = parallel(
              p_fun(x[p], len(h), n_edge, phase, cuda_dict, pad, n_fft)
              for p in picks
          )
          for pp, p in enumerate(picks):
              x[p] = data_new[pp]
  
      x.shape = orig_shape
      return x
  
imports: from collections import Counter
  from copy import deepcopy
  from functools import partial
  from math import gcd
  import numpy
  from scipy import fft, signal
  from scipy.stats import f
  from ._fiff.pick import _picks_to_idx
  from ._ola import _COLA
  from .cuda import _fft_multiply_repeated, _fft_resample, _setup_cuda_fft_multiply_repeated, _setup_cuda_fft_resample, _smart_pad
  from .parallel import parallel_func
  from .utils import _check_option, _check_preload, _ensure_int, _pl, _validate_type, logger, sum_squared, verbose, warn
label_desc: Use image node_id 3 for calling a global function with example usage: _overlap_add_filter(x, h, n_fft, phase, picks, n_jobs, copy, pad) and returns: x, unknown