Reputation: 1836
I want to write some code that allows someone to upload an image to an e-Paper ID Badge using NFC. I found some code written in Dart / Flutter that goes through and optimizes the input image and then packetizes it. Part of that process includes doing some image compression. The code uses some standard libraries, but the image compression makes use of two methods: fCompressImg and fCompressImgHead. We're guessing they may be proprietary? But for this purpose, it's probably a fast, lossless algorithm, like RLE.
The latter call looks like this:
fCompressImgHead.call( _headPoi, 0x02, 0x01, 0x01, _len, 16, 0x00 );
In this call:
_headPoi: A pointer to allocated memory for a CompressHeadStruct (where the header data will be stored).
0x02: Likely a flag or identifier indicating the compression type.
0x01 (first occurrence): Possibly the major version of the compression scheme.
0x01 (second occurrence): Possibly the minor version of the compression scheme.
_len: The length of the source image data (number of bytes to be compressed).
16: Probably the expected size of the header or a fixed value required by the compression routine.
0x00: Likely a reserved parameter or flag, possibly for future options or additional configuration.
This probably is used to initialize the use of the compressor.
The call to fCompressImg in the code passes five parameters:
_srcPoi: A pointer to the source image data that needs to be compressed.
_cSrcLen: An integer indicating the length (in bytes) of the source data segment that is to be compressed.
_dstPoi: A pointer to the destination buffer where the compressed data will be written.
_dstLenPoi: A pointer to a 32-bit unsigned integer that will receive the length of the compressed data output.
_wrkmemPoi: A pointer to a block of working memory (a scratch area) that the compression function uses during processing.
These parameters allow the compression routine to know where to read the raw data, how much data to process, where to store the result, and provide it with temporary space for its internal operations.
I have not done any programming work with these particular types of devices or NFC technology yet, but this encoder shrinks the packet size tremendously before transferring it, and there must be a decoder on the device that expands it.
I'm trying to figure out what the algorithm might be, and was thinking someone here might be familiar with doing this kind of thing and could shed some light on what we might be looking at here. For all I know, this could be using an algo from a FAX machine. They need to be simple, fast, and effective.
Given the Header parameters, does anything come to mind that makes sense?
The badge is from KAICONN and supports Black, White, Red and Yellow. The image size is 240 x 420 px.
Upvotes: -1
Views: 29