1
|
|
/*
|
2
|
|
RawSpeed - RAW file decoder.
|
3
|
|
|
4
|
|
Copyright (C) 2018 Roman Lebedev
|
5
|
|
|
6
|
|
This library is free software; you can redistribute it and/or
|
7
|
|
modify it under the terms of the GNU Lesser General Public
|
8
|
|
License as published by the Free Software Foundation; either
|
9
|
|
version 2 of the License, or (at your option) any later version.
|
10
|
|
|
11
|
|
This library is distributed in the hope that it will be useful,
|
12
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
|
Lesser General Public License for more details.
|
15
|
|
|
16
|
|
You should have received a copy of the GNU Lesser General Public
|
17
|
|
License along with this library; if not, write to the Free Software
|
18
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
19
|
|
*/
|
20
|
|
|
21
|
|
#include "io/BitPumpMSB32.h" // for BitPumpMSB32
|
22
|
|
#include "io/BitPumpTest.h" // for Pattern, (anonymous), GenOnesBE, BitPum...
|
23
|
|
#include <array> // for array
|
24
|
|
#include <cstdint> // for uint32_t, uint8_t
|
25
|
|
#include <gtest/gtest.h> // for Types, INSTANTIATE_TYPED_TEST_CASE_P
|
26
|
|
|
27
|
|
using rawspeed::BitPumpMSB32;
|
28
|
|
|
29
|
|
namespace rawspeed_test {
|
30
|
|
|
31
|
|
struct InvOnesTag;
|
32
|
|
struct OnesTag;
|
33
|
|
|
34
|
|
template <>
|
35
|
|
const std::array<uint8_t, 4> Pattern<BitPumpMSB32, OnesTag>::Data = {
|
36
|
|
{/* [Byte3 Byte2 Byte1 Byte0] */
|
37
|
|
/* Byte: [Bit0 .. Bit7] */
|
38
|
|
0b00011111, 0b00001000, 0b01000010, 0b10100100}};
|
39
|
1
|
template <> uint32_t Pattern<BitPumpMSB32, OnesTag>::data(int index) {
|
40
|
1
|
const auto set = GenOnesBE(1, 0);
|
41
|
1
|
return set[index];
|
42
|
|
}
|
43
|
|
|
44
|
|
template <>
|
45
|
|
const std::array<uint8_t, 4> Pattern<BitPumpMSB32, InvOnesTag>::Data = {
|
46
|
|
{0b00001111, 0b00000100, 0b00100001, 0b11010010}};
|
47
|
1
|
template <> uint32_t Pattern<BitPumpMSB32, InvOnesTag>::data(int index) {
|
48
|
1
|
const auto set = GenOnesBE(0, -1);
|
49
|
1
|
return set[index];
|
50
|
|
}
|
51
|
|
|
52
|
|
INSTANTIATE_TYPED_TEST_CASE_P(MSB32, BitPumpTest, Patterns<BitPumpMSB32>);
|
53
|
|
|
54
|
|
} // namespace rawspeed_test
|