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

Method encode

arch/macintosh/encoder.cc:223–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221
222public:
223 std::unique_ptr<Fluxmap> encode(const LogicalTrackLayout& ltl,
224 const std::vector<std::shared_ptr<const Sector>>& sectors,
225 const Image& image) override
226 {
227 double clockRateUs = clockRateUsForTrack(ltl.logicalCylinder);
228 int bitsPerRevolution = 200000.0 / clockRateUs;
229 std::vector<bool> bits(bitsPerRevolution);
230 unsigned cursor = 0;
231
232 fillBitmapTo(bits,
233 cursor,
234 _config.post_index_gap_us() / clockRateUs,
235 {true, false});
236 lastBit = false;
237
238 for (const auto& sector : sectors)
239 write_sector(bits, cursor, sector);
240
241 if (cursor >= bits.size())
242 error("track data overrun by {} bits", cursor - bits.size());
243 fillBitmapTo(bits, cursor, bits.size(), {true, false});
244
245 std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
246 fluxmap->appendBits(
247 bits, calculatePhysicalClockPeriod(clockRateUs * 1e3, 200e6));
248 return fluxmap;
249 }
250
251private:
252 const MacintoshEncoderProto& _config;

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected