/*
   HARK Library
   Copyright (C) 2021 Honda Research Institute Japan Inc.
 */

#if !defined(_HARKLIB_NODE_M_SL_SEXTRACTION_H_INCLUDED_)
#define _HARKLIB_NODE_M_SL_SEXTRACTION_H_INCLUDED_ 1

#include "hark-lib/hark-lib.h"
#include "hark-lib/node.h"

#include <vector>

namespace hark
{
namespace node
{
    class MSLSExtraction: public NodeDef
    {
    public:
        MSLSExtraction();
        virtual void reset();
        virtual bool operator () (size_t count, InputDataBundle &input, OutputDataBundle &output);

    private:
        void initialize(InputDataBundle &input);

        void Lifter(std::vector<float> &fbank);
        void LifterOld(std::vector<float> &fbank);
        void SubtractMean(std::vector<float> &fbank) const;
        void dct(const float *x, float *y, int n) const;
        void idct(const float *x, float *y, int n) const;
        void EmphasizeSpectralPeak(std::vector<float> &vec) const;

    private:
        enum {
            LEGACY_MODE, CEPSTRAL_MODE, SPECTRAL_MODE
        } normalization_mode;

        int fbank_count;

        int duration;
        bool use_power;
        int dim_static;

        std::vector<float>lifter;
        std::vector<float>cepstrum;

    };
}
}

#endif /* #if !defined(_HARKLIB_NODE_M_SL_SEXTRACTION_H_INCLUDED_) */

/* end of file */
