I am not sure what you mean here? Every field in the string (char array) represent something, for more information on post #10Are there any strings that have different meanings from other strings?
I am not sure what you mean here? Every field in the string (char array) represent something, for more information on post #10Are there any strings that have different meanings from other strings?
there is no magic, it is all about using patterns and reducing complexity of data using lookup table.Hi team
Just wondering if a way to compress short string, something like these:
I am running out of bandwidth... some data are missing... and I don't have control over buffer size / speed of the communication channel.
I have tried this: https://github.com/antirez/smaz, and my string actually enlarge by 7%
And what if he does this? He still has to convert it to a string of hexadecimal characters before sending it to the communications module for transmission. I suspect the data is just too short to get meaningful compression to overcome the overhead.yea... that link is wasting 50% of data stream
the
there is no magic, it is all about using patterns and reducing complexity of data using lookup table.
btw. did you check readme for this?
did you see the note about compression rates?
it is bad for numbers and your example "064904EC94F2A1CEFFFFAE0E01CE" is mostly numbers.
the best compression rate is for lowercase letters.
smaz.c shows the codebooks used but changing them to optimize would be a bit of effort.
so.... did you consider shifting all nibble values in your string from hexadecimal range '0'-'F' into range of lowercase letters such as 'a'-'p' before compression...? this should maximize what smaz can do for you and maybe instead of +7% change you can get closer to those -46% or so. if that works on other side just reverse process.
We still need more information in order to tell if you can to better.Oh I think I see what you mean now. If I understand you correctly, I can combine a few fields and reduce 2 - 3 bytes. Is that what you mean?
Here is the information:
So I can reduce the string by 3 bytes. Can I do better?
- I think I can combine: SUB, CMD, TYPE and SN into two bytes.
- No control over SN1 - 4.
- possible combine ID.L ID.H and V.L V.H into 3 bytes
- possible no control over STAT and RSSI
View attachment 221392
Far from it. Let's say that there are four distinct values of SUB and four distinct values of CMD and they can appear in any combination. That's 16 combinations which can then be encoded into a singe hexadecimal character instead of the four currently being used, thus saving the needed three bytes from the transmission stream right there.If SUB and CMD are fixed values as shown in your table, can you simply throw them away? If they must remain, then it seems they cannot be combined with anything.
The Table in Post #10 has SUB = 0x06 and CMD = 0x49 and not "XX". This could imply these two entries are fixed in value. If this is the case, they would not be combined with other entities as variables. So, if they are fixed, can they simply be removed since the values are known? If they are needed for identification of a subframe, etc., then they cannot be changed in any way.Far from it. Let's say that there are four distinct values of SUB and four distinct values of CMD and they can appear in any combination. That's 16 combinations which can then be encoded into a singe hexadecimal character instead of the four currently being used, thus saving the needed three bytes from the transmission stream right there.
I agree that, if they are truly fixed, they can be eliminated. However, the TS talks about them like they are not static (he talks about being able to combine those two with two others) and are merely an example. I have asked repeatedly for further information about those fields and for some reason the TS won't supply it.The Table in Post #10 has SUB = 0x06 and CMD = 0x49 and not "XX". This could imply these two entries are fixed in value. If this is the case, they would not be combined with other entities as variables. So, if they are fixed, can they simply be removed since the values are known? If they are needed for identification of a subframe, etc., then they cannot be changed in any way.
I guess my questions is "Are these fields fixed in value?".
This is the kind of question which might give room for the additional 10% needed.
My communicate channel only accept '0' - 'F' in char, EOF and SOF. I did try using the lower case, it actually increase more than 7%, don't remember the exact number now.so.... did you consider shifting all nibble values in your string from hexadecimal range '0'-'F' into range of lowercase letters such as 'a'-'p' before compression...? this should maximize what smaz can do for you and maybe instead of +7% change you can get closer to those -46% or so. if that works on other side just reverse process.
SN1 - 4 are 8 bit numbers ( 0 - 255), using smaz is something I first try but didn't work.When you say no control over SN1 - 4, what does that mean? Clearly you had the ability to manipulate them otherwise you couldn't have used smaz on them in the first place.
There are other packets that I will need to send on the same channel, and also other devices. I have no control over other devices. The SUB and CMD are for other devices to decode their packets. The fixed values there in the table are assign to me, so I have to use them. However, I can choose other free code that are not use yet.If SUB and CMD are fixed values as shown in your table, can you simply throw them away? If they must remain, then it seems they cannot be combined with anything.
There is only one channel, there are two byte of information that I don't need to send all the time, so I may take them off.do all parts of the message need to be transmitted at same intervals or some parts may only change at different rate?
and one channel can support 100byte/sec
but how many channels are available?
Just responded in my last reply.I guess my questions is "Are these fields fixed in value?".
Sorry WBahn, I got a few ideas from yesterday's (local time here) replies and busy trying a few different things here. The information you asked, some are easy to answer, like the SN1 - 4, some are not so. eg the SUB and CMD, those are assigned to me, but I do have some flexibility to change them, and to change them, I need to look into other part of the system. So I don't have an answer for those yet.I have asked repeatedly for further information about those fields and for some reason the TS won't supply it.
These are all ASCII coded hex, eg '0' - 'F'.Forget compression. There is not enough redundancy in such a short message.
Let's backup for a moment.
064904EC94F2A1CEFFFFAE0E01CE
What are you actually sending?
06 are two characters or one byte?
The first byte are sub group of the device, there are other devices on the same channel as well. I forgot that myself when I first try using smaz lib.What do you mean that they are assigned to you? Are others monitoring the channel and need to know which strings are meant for them and which are not? If so, then how will they know which are which if your messages are manipulated so as to compress them?
06 ASCII encoded would be two bytes:These are all ASCII coded hex, eg '0' - 'F'.
The communication channel only accept '0' - 'F' in char, SOF and EOF.06 ASCII encoded would be two bytes:
0x30
0x36
You can reduce the number of bytes by a factor of 2 by sending straight binary, e.g. 0x06.
‘0’ to ‘9’ in char is 0x30 to 0x39 in hex. Those are the actual values stored in a byte. ‘A’ through ‘F’ in char is 0x40 to 0x46. I didn’t bother looking up SOF and EOF, but hopefully you get the idea.The communication channel only accept '0' - 'F' in char, SOF and EOF.
Yes, I got the idea‘0’ to ‘9’ in char is 0x30 to 0x39 in hex. That is the actual value stored in a byte. ‘A’ through ‘F’ in char is 0x40 to 0x46. I didn’t bother looking up SOF and EOF, but hopefully you get the idea.
Ok! I guess you have got it. I was just clarifying so we all were on the same page. Hope you weren’t insulted.Yes, I got the idea
What I am saying is, to send 0x09, I need to send it in two bytes [0x30, 0x39]. If I send one byte [0x09], nothing will come out from the other end of the communication link. And I have to use this communication link.
by Jake Hertz
by Duane Benson
by Aaron Carman
by Jake Hertz