Exemple #1
0
void mtf_encode(uint8_t *buf, size_t len)
{
	uint8_t tbl[0x100];
	size_t i;

	for(i = 0; i < 0x100; i++)
		tbl[i] = i;

	for(i = 0; i < len; i++) {
		uint8_t s = buf[i];

		buf[i] = tbl[s];
		mtf(tbl, s);
	}
}
Exemple #2
0
void Codec_MTF::encode_MTF(DataBlock* inData) {
    initEncoder(inData);

    encodedDataSize = decodedDataSize;

    buffer.reserve(encodedDataSize);
    buffer.resize(decodedDataSize);

    init_mtf(256);

    for (unsigned int i = 0; i < decodedDataSize; ++i)
        buffer[i] = mtf(data[i]);

    inData->setData(buffer.data(), encodedDataSize);

    recordOutHeader(inData->getHeader(), JAA::CodecID::MTF_ID);
}