aboutsummaryrefslogtreecommitdiffstats
path: root/src/atrac/atrac1.cpp
blob: b361ad56b97a32c4dd684b2b1112ea60985ef803 (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
/*
 * This file is part of AtracDEnc.
 *
 * AtracDEnc is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * AtracDEnc is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with AtracDEnc; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#include "atrac1.h"
#include "bitstream/bitstream.h"

namespace NAtracDEnc {
namespace NAtrac1 {

constexpr uint32_t TAtrac1Data::BlocksPerBand[NumQMF + 1];
constexpr uint32_t TAtrac1Data::SpecsPerBlock[MaxBfus];
constexpr uint32_t TAtrac1Data::SpecsStartLong[MaxBfus];
constexpr uint32_t TAtrac1Data::SpecsStartShort[MaxBfus];
constexpr uint32_t TAtrac1Data::BfuAmountTab[8];
float TAtrac1Data::ScaleTable[64] = {0};
float TAtrac1Data::SineWindow[32] = {0};

const static TAtrac1Data Atrac1Data;

std::array<int, 3> TAtrac1Data::TBlockSizeMod::Parse(NBitStream::TBitStream* stream) {
    std::array<int, 3> tmp;
    tmp[0] = 2 - stream->Read(2);
    tmp[1] = 2 - stream->Read(2);
    tmp[2] = 3 - stream->Read(2);
    stream->Read(2); //skip unused 2 bits
    return tmp;
}

} //namespace NAtrac1
} //namespace NAtracDEnc