I am new to use Delta encoding to compress Hex data, I used the C implementation in wiki, so if my data is like 0xFFFFFFF,0xFFFFFFF,0xFFFFFFF,0xFFFFFFF,0xFFFFFFF the encoding result will be as follows : 0xFFFFFFF,0x0000000,0x0000000,0x0000000,0x0000000 , unlike rest of lossless algorithms which compression ratio = origial size / compressed size , i found that size of data will be fixed like before the compression, so how could i calculate compression ratio in delta encoding ? and how could i compress redundant delta ? The code is :
{
unsigned char last = 0;
for (int i = 0; i < length; i++)
{
unsigned char current = buffer[i];
buffer[i] = current - last;
last = current;
}
}
void delta_decode(unsigned char *buffer, int length)
{
unsigned char last = 0;
for (int i = 0; i < length; i++)
{
unsigned char delta = buffer[i];
buffer[i] = delta + last;
last = buffer[i];
}
} ```