MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / encode

Method encode

arch/tartu/encoder.cc:20–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18 }
19
20 std::unique_ptr<Fluxmap> encode(const LogicalTrackLayout& ltl,
21 const std::vector<std::shared_ptr<const Sector>>& sectors,
22 const Image& image) override
23 {
24 _clockRateUs = _config.clock_period_us();
25 int bitsPerRevolution =
26 (_config.target_rotational_period_ms() * 1000.0) / _clockRateUs;
27
28 const auto& sector = *sectors.begin();
29 _bits.resize(bitsPerRevolution);
30 _cursor = 0;
31
32 writeFillerRawBitsUs(_config.gap1_us());
33 bool first = true;
34 for (const auto& sectorData : sectors)
35 {
36 if (!first)
37 writeFillerRawBitsUs(_config.gap4_us());
38 first = false;
39 writeSector(sectorData);
40 }
41
42 if (_cursor > _bits.size())
43 error("track data overrun");
44 writeFillerRawBitsUs(_config.target_rotational_period_ms() * 1000.0);
45
46 std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
47 fluxmap->appendBits(_bits,
48 calculatePhysicalClockPeriod(_clockRateUs * 1e3,
49 _config.target_rotational_period_ms() * 1e6));
50 return fluxmap;
51 }
52
53private:
54 void writeBytes(const Bytes& bytes)

Callers

nothing calls this directly

Calls 4

errorFunction · 0.85
beginMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected