5 #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
19 REQUIRE(dcc.
initDecoder(std::make_unique<FileStream>(
"BaalSpirit.dcc")));
21 const DCC::Header& header = dcc.
getHeader();
23 CHECK(header.signature == 116);
24 CHECK(header.version == 6);
25 CHECK(header.directions == 1);
26 CHECK(header.framesPerDir == 200);
27 CHECK(header.tag == 1);
28 CHECK(header.finalDc6Size == 547757);
34 CHECK(dir0.header.outsizeCoded == 546933);
35 CHECK(dir0.header.hasRawPixelEncoding ==
false);
36 CHECK(dir0.header.compressEqualCells ==
true);
37 CHECK(dir0.header.variable0Bits == 0);
38 CHECK(dir0.header.widthBits == 5);
39 CHECK(dir0.header.heightBits == 5);
40 CHECK(dir0.header.xOffsetBits == 5);
41 CHECK(dir0.header.yOffsetBits == 5);
42 CHECK(dir0.header.optionalBytesBits == 0);
43 CHECK(dir0.header.codedBytesBits == 9);
45 CHECK(dir0.extents.xLower == -51);
46 CHECK(dir0.extents.yLower == -178);
47 CHECK(dir0.extents.xUpper == (143+1));
48 CHECK(dir0.extents.yUpper == (45+1));
49 CHECK(dir0.extents.width() == 195);
50 CHECK(dir0.extents.height() == 224);
60 REQUIRE(dcc.
initDecoder(std::make_unique<FileStream>(
"CRHDBRVDTHTH.dcc")));
62 const DCC::Header& header = dcc.
getHeader();
64 CHECK(header.signature == 116);
65 CHECK(header.version == 6);
66 CHECK(header.directions == 8);
67 CHECK(header.framesPerDir == 24);
68 CHECK(header.tag == 1);
69 CHECK(header.finalDc6Size == 59600);
75 CHECK(dir0.header.outsizeCoded == 7225);
76 CHECK(dir0.header.hasRawPixelEncoding ==
true);
77 CHECK(dir0.header.compressEqualCells ==
true);
78 CHECK(dir0.header.variable0Bits == 0);
79 CHECK(dir0.header.widthBits == 4);
80 CHECK(dir0.header.heightBits == 4);
81 CHECK(dir0.header.xOffsetBits == 4);
82 CHECK(dir0.header.yOffsetBits == 5);
83 CHECK(dir0.header.optionalBytesBits == 0);
84 CHECK(dir0.header.codedBytesBits == 6);
86 CHECK(dir0.extents.xLower == -12);
87 CHECK(dir0.extents.yLower == -75);
88 CHECK(dir0.extents.xUpper == (46+1));
89 CHECK(dir0.extents.yUpper == (-15+1));
90 CHECK(dir0.extents.width() == 59);
91 CHECK(dir0.extents.height() == 61);
102 REQUIRE(dcc.
initDecoder(std::make_unique<FileStream>(
"BloodSmall01.dcc")));
104 const DCC::Header& header = dcc.
getHeader();
106 CHECK(header.signature == 116);
107 CHECK(header.version == 6);
108 CHECK(header.directions == 8);
109 CHECK(header.framesPerDir == 9);
110 CHECK(header.tag == 1);
111 CHECK(header.finalDc6Size == 14200);
117 CHECK(dir0.header.outsizeCoded == 1776);
118 CHECK(dir0.header.hasRawPixelEncoding ==
false);
119 CHECK(dir0.header.compressEqualCells ==
false);
120 CHECK(dir0.header.variable0Bits == 0);
121 CHECK(dir0.header.widthBits == 4);
122 CHECK(dir0.header.heightBits == 4);
123 CHECK(dir0.header.xOffsetBits == 4);
124 CHECK(dir0.header.yOffsetBits == 5);
125 CHECK(dir0.header.optionalBytesBits == 0);
126 CHECK(dir0.header.codedBytesBits == 6);
128 CHECK(dir0.extents.xLower == -18);
129 CHECK(dir0.extents.yLower == -44);
130 CHECK(dir0.extents.xUpper == (13+1));
131 CHECK(dir0.extents.yUpper == (9+1));
132 CHECK(dir0.extents.width() == 32);
133 CHECK(dir0.extents.height() == 54);
143 REQUIRE(dcc.
initDecoder(std::make_unique<FileStream>(
"HZTRLITA1HTH.dcc")));
145 const DCC::Header& header = dcc.
getHeader();
147 CHECK(header.signature == 116);
148 CHECK(header.version == 6);
149 CHECK(header.directions == 8);
150 CHECK(header.framesPerDir == 12);
151 CHECK(header.tag == 1);
152 CHECK(header.finalDc6Size == 92732);
158 CHECK(dir.header.outsizeCoded == 10923);
159 CHECK(dir.header.hasRawPixelEncoding ==
false);
160 CHECK(dir.header.compressEqualCells ==
true);
161 CHECK(dir.header.variable0Bits == 0);
162 CHECK(dir.header.widthBits == 4);
163 CHECK(dir.header.heightBits == 4);
164 CHECK(dir.header.xOffsetBits == 4);
165 CHECK(dir.header.yOffsetBits == 1);
166 CHECK(dir.header.optionalBytesBits == 0);
167 CHECK(dir.header.codedBytesBits == 6);
169 CHECK(dir.extents.xLower == -22);
170 CHECK(dir.extents.yLower == -62);
171 CHECK(dir.extents.xUpper == (33+1));
172 CHECK(dir.extents.yUpper == (-1+1));
173 CHECK(dir.extents.width() == 56);
174 CHECK(dir.extents.height() == 62);
178 CHECK(dir.header.outsizeCoded == 9774);
179 CHECK(dir.header.hasRawPixelEncoding ==
false);
180 CHECK(dir.header.compressEqualCells ==
true);
181 CHECK(dir.header.variable0Bits == 0);
182 CHECK(dir.header.widthBits == 4);
183 CHECK(dir.header.heightBits == 4);
184 CHECK(dir.header.xOffsetBits == 1);
185 CHECK(dir.header.yOffsetBits == 1);
186 CHECK(dir.header.optionalBytesBits == 0);
187 CHECK(dir.header.codedBytesBits == 6);
189 CHECK(dir.extents.xLower == -1);
190 CHECK(dir.extents.yLower == -62);
191 CHECK(dir.extents.xUpper == (22+1));
192 CHECK(dir.extents.yUpper == (-1+1));
193 CHECK(dir.extents.width() == 24);
194 CHECK(dir.extents.height() == 62);
bool readDirection(Direction &outDir, uint32_t dirIndex, IImageProvider< uint8_t > &imgProvider)
Decodes a direction of the file into memory.
Decoder for the DCC image format.
const Header & getHeader() const
Returns the header of the file read by extractHeaderAndOffsets.
A simple image provider that allocates a new buffer for each call to getNewImage() ...
TEST_CASE("DCC decoding BaalSpirit.dcc")
Try to decode BaalSpirit.dcc.
Wrapper around POSIX file io, same as ifstream but without iostream formatting.
Implementation of a DCC file decoder.
bool initDecoder(StreamPtr &&streamPtr)
Start decoding the stream and preparing data.