#pragma once
#include <cstdint>
#include <vector>

namespace bmp2tile
{

// Ported from Einar Saukas's public-domain reference "zx7" compressor
// (compress.c / optimize.c / zx7.h, (c) 2012-2016, BSD-style licence) as
// vendored in maxim-zhao/bmp2tilecompressors -- specifically its "8-bit
// limited" variant (MAX_LEN capped at 255, matching the simplified Z80
// decoder devkitSMS's SMS_decompressZX7/SMS_loadZX7compressedTiles
// expect). This is a direct port of that source (optimal LZ77 parsing +
// Elias-gamma/byte-oriented bitstream emission), not a reimplementation
// from a description -- the delta/diff bookkeeping from the original
// (used for in-place decompression safety margins) is dropped since
// bmp2tile's own callers discard it too, and manual malloc/free is
// replaced with std::vector, but the actual bitstream this produces is
// unchanged from the reference.
std::vector<uint8_t> CompressZx7(const std::vector<uint8_t>& input);

}  // namespace bmp2tile
