surroundize

Tool/PipeWire filter to convert stereo audio to surround
git clone https://git.neptards.moe/u3shit/surroundize.git
Log | Files | Refs | README | LICENSE

ffdshow_decoder.hpp (1665B)


      1 #ifndef GUARD_LEERILY_DIMORAIC_MATHOM_PIMPS_OUT_4424
      2 #define GUARD_LEERILY_DIMORAIC_MATHOM_PIMPS_OUT_4424
      3 #pragma once
      4 
      5 #include "../channel.hpp"
      6 #include "../options.hpp"
      7 
      8 #include <memory>
      9 #include <span>
     10 #include <vector>
     11 
     12 class FfdshowDecoder
     13 {
     14 public:
     15   void Init(float rate);
     16   [[nodiscard]] std::span<const float> Decode(std::span<const float> in);
     17 
     18   [[nodiscard]] static constexpr unsigned GetBlockSize() noexcept { return 0; }
     19   [[nodiscard]] std::vector<Option> GetOptions();
     20 
     21   [[nodiscard]] static std::vector<Channel::E> GetChannels();
     22   [[nodiscard]] static constexpr uint32_t GetDelay() noexcept { return 0; }
     23 
     24   bool enable_lfe = true;
     25   float center_gain = 1;
     26 
     27 private:
     28   static float passive_lock(float x);
     29   void matrix_decode(const float *in, int k, int il,
     30                      int ir, bool decode_rear,
     31                      int dlbuflen,
     32                      float l_fwr, float r_fwr,
     33                      float lpr_fwr, float lmr_fwr,
     34                      float *adapt_l_gain, float *adapt_r_gain,
     35                      float *adapt_lpr_gain, float *adapt_lmr_gain,
     36                      float *lf, float *rf, float *lr,
     37                      float *rr, float *cf) const;
     38 
     39   float rate = -1;
     40   unsigned int dlbuflen;
     41   int cyc_pos;
     42   float l_fwr, r_fwr, lpr_fwr, lmr_fwr;
     43   std::vector<float> fwrbuf_l, fwrbuf_r;
     44   float adapt_l_gain, adapt_r_gain, adapt_lpr_gain, adapt_lmr_gain;
     45   std::vector<float> lf, rf, lr, rr, cf, cr;
     46   float LFE_buf[256];
     47   unsigned int lfe_pos;
     48   std::unique_ptr<float[]> filter_coefs_lfe;
     49   unsigned int len125;
     50   std::unique_ptr<float[]> calc_coefficients_125Hz_lowpass();
     51 
     52   std::vector<float> out_buf;
     53 };
     54 
     55 #endif