A question about the TS map preview(PreviewPack | Maxim | 15:37 29-03-2020 | | |
Hello, I have been writing my utility to directly replace a map preview.
On the modenc wiki it states that it is a base64 encoded string of LZO compressed 24-bit BGR image data.
But when I looked into the source of XCC mixer I found this function:
-------
-------
-------
struct t_pack_section_header
{
unsigned __int16 size_in;
unsigned __int16 size_out;
};
...
int encode5s(const unsigned char* s, unsigned char* d, int cb_s)
{
lzo_init();
lzo_uint cb_d;
if (LZO_E_OK != lzo1x_1_compress(s, cb_s, d, &cb_d, wrkmem))
cb_d = 0;
return cb_d;
}
...
int encode5(const byte* s, byte* d, int cb_s, int format)
{
const byte* r = s;
const byte* r_end = s + cb_s;
byte* w = d;
while (r < r_end)
{
int cb_section = min(r_end - r, 8192);
t_pack_section_header& header = *reinterpret_cast<t_pack_section_header*>(w);
w += sizeof(t_pack_section_header);
w += header.size_in = format == 80 ? encode80(r, w, cb_section) : encode5s(r, w, cb_section);
r += header.size_out = cb_section;
}
return w - d;
}
-------
-------
-------
I copied the function to my own codebase.
What it seems to do is pack it in sections(8192 bytes max) of LZO compressed data, with a header of uncompressed and compressed sizes before each chunk.
But my preview comes out like this, while I do provide BGR 24-bit image data, with no padding:
https://i.imgur.com/jpVHuyv.png
Am I missing something? I already checked the rest of the process (base64 encoding, the image data itself)
Thanks in advance for your time
Maxim