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

Method encode

arch/amiga/encoder.cc:113–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111
112public:
113 std::unique_ptr<Fluxmap> encode(const LogicalTrackLayout& ltl,
114 const std::vector<std::shared_ptr<const Sector>>& sectors,
115 const Image& image) override
116 {
117 /* Number of bits for one nominal revolution of a real 200ms Amiga disk.
118 */
119 int bitsPerRevolution = 200e3 / _config.clock_rate_us();
120 std::vector<bool> bits(bitsPerRevolution);
121 unsigned cursor = 0;
122
123 fillBitmapTo(bits,
124 cursor,
125 _config.post_index_gap_ms() * 1000 / _config.clock_rate_us(),
126 {true, false});
127 lastBit = false;
128
129 for (const auto& sector : sectors)
130 write_sector(bits, cursor, sector);
131
132 if (cursor >= bits.size())
133 error("track data overrun");
134 fillBitmapTo(bits, cursor, bits.size(), {true, false});
135
136 auto fluxmap = std::make_unique<Fluxmap>();
137 fluxmap->appendBits(bits,
138 calculatePhysicalClockPeriod(_config.clock_rate_us() * 1e3, 200e6));
139 return fluxmap;
140 }
141
142private:
143 const AmigaEncoderProto& _config;

Callers

nothing calls this directly

Calls 4

fillBitmapToFunction · 0.85
errorFunction · 0.85
write_sectorFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected