aboutsummaryrefslogtreecommitdiffstats
path: root/src/atracdenc.h
blob: 5abdac9579143bb0c308e57a5bebbe6bc2fabb64 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include "pcmengin.h"
#include "aea.h"
#include "atrac_encode_settings.h"
#include "atrac/atrac1.h"
#include "atrac/atrac1_qmf.h"
#include "atrac/atrac1_scale.h"
#include "mdct/mdct.h"

namespace NAtracDEnc {

enum EMode {
    E_ENCODE = 1,
    E_DECODE = 2
};

class TAtrac1MDCT : public virtual TAtrac1Data {
    NMDCT::TMDCT<512> Mdct512;
    NMDCT::TMDCT<256> Mdct256;
    NMDCT::TMDCT<64> Mdct64;
    NMDCT::TMIDCT<512> Midct512;
    NMDCT::TMIDCT<256> Midct256;
public:
    void IMdct(double specs[512], const TBlockSize& mode, double* low, double* mid, double* hi);
    void Mdct(double specs[512], double* low, double* mid, double* hi, const TBlockSize& blockSize);
    TAtrac1MDCT()
        : Mdct512(2)
        , Mdct256(1)
    {}
};

class TAtrac1Processor : public TAtrac1MDCT, public virtual TAtrac1Data {
    const bool MixChannel;
    TAeaPtr Aea;

    double PcmBufLow[2][256 + 16];
    double PcmBufMid[2][256 + 16];
    double PcmBufHi[2][512 + 16];

    Atrac1SynthesisFilterBank<double> SynthesisFilterBank[2];
    Atrac1SplitFilterBank<double> SplitFilterBank[2];
 
    NAtrac1::TScaler Scaler;

public:
    TAtrac1Processor(TAeaPtr&& aea, bool mono = false);
    TPCMEngine<double>::TProcessLambda GetDecodeLambda();

    TPCMEngine<double>::TProcessLambda GetEncodeLambda(const TAtrac1EncodeSettings& settings);
};
}