aboutsummaryrefslogtreecommitdiffstats
path: root/src/atrac/atrac_scale.h
blob: dd437a2d68d3c030a337e1bfeaa1ee2de523abb1 (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
#pragma once
#include <vector>
#include <map>
#include <cstdint>

#include "atrac1.h"
namespace NAtracDEnc {

struct TScaledBlock {
	TScaledBlock(uint8_t sfi) : ScaleFactorIndex(sfi) {}
    const uint8_t ScaleFactorIndex = 0;
    std::vector<double> Values;
};

template <class TBaseData>
class TScaler : public TBaseData {
    std::map<double, uint8_t>ScaleIndex;
public:
    TScaler() {
        for (int i = 0; i < 64; i++) {
            ScaleIndex[TBaseData::ScaleTable[i]] = i;
        }
    }
    std::vector<TScaledBlock> Scale(const std::vector<double>& specs, const TBlockSize& blockSize);
};

}