# Compression of GNSS Data with the Aim of Speeding up Communication to Autonomous Vehicles
## 6 Experiments
Since the H.264-like algorithm employs differences between iterations, it is important for us to have the same number of rows in each iteration to calculate a difference from another line or a difference from the average. Monitoring and testing made it possible to see that the changes are made infrequently, so it was decided to split the file. That is, as soon as an iteration is received in which the number of lines in the GPGSV protocol differs from the previous number of lines, the file is closed, and a new file initialized with a number of lines in the latest GPGSV, and so on. In the process of building a binary file, another problem was detected. When a computer writes a file, the size of the file will be rounded to a multiple of 8 bits because computers work with bytes. This caused a problem in the decoding stage as the decoding came out wrong due to the added bits at the end of the file. As a result, it was decided to add another byte at the end of the binary file, in which it is indicated how many zeros that were added as padding must be removed from the previous byte. An issue that should be handled occurs when there are lines from different iterations with different fields. Figure 11 in Appendix A shows such a case, where there is a value between the commas, and the algorithm needs to make a difference from a row from an upper block where there is no value between the commas (NULL) or vice versa. For such cases we used a special pattern, seen in Figure 2.  
Figure 1: Example of using H.264 concept. Figure 2: Handling different fields. When a difference from the average must be calculated (as the B-frame in H.264), for example:  
\[\text{Block 2}-\frac{\text{Block 4}+\text{Block 1}}{2}\]  
It would be helpful if the rows had matching fields or no values in the same fields (which are also matching), but sometimes, as shown above, in certain lines between commas contain a value compared to the average where there is no value between commas (or vice versa). An example of this is:  
AVG EXAMPLE \(\rightarrow(4+1)/2\)  
1,2,3 = 1  
1,2,3,4 = 4  
1,2,3, EOL,4 = avg  
Or vice versa  
AVG EXAMPLE \(\rightarrow(4+1)/2\)  
1,2,3,4 = 1  
1,2,3 = 4  
1,2,3 = avg  
It is possible to stop counting after \(\frac{3+3}{2}\) and saving all the information after index 3 (4 + null) because iteration 1 (iterative) exists all the time and can be easily restored/decoded. Similarly, when we calculate the average (AVG), for example, \(\frac{\text{Block 4}+\text{Block 1}}{2}\), there may be no values between commas in block 4 in a certain protocol compared to block 1 (or vice versa). An example for such a case:  
AVG \(\rightarrow(4+1)/2\) (4 on the left, 1 on the right)  
3,6,9, = 1  
1,2,3,4 = 4  
2,4,6,#4 (complete to the left side of 4)  
Or vice versa:  
AVG \(\rightarrow(4+1)/2\) (4 on the left, 1 on the right)  
3,6,9,5, = 1  
1,2,3,, = 4  
2,4,6, -#5 (minus means the number after # put on the right side of 1)  
When a row in which we want to make a difference or a difference from the average, it is shorter (or longer) than a row from another block, respectively. That is, a certain row has more fields (or fewer) than a corresponding row. An example of such a case:  
AVG \(\rightarrow(4+1)/2\)  
3,6,9 = 1  
1,2,3,4,5,6,7 = 4  
2,4,6, EOL,4,5,6,7 (once we see EOL we put all the info after EOL to left side of 4)  
Another example is vice versa but a little bit different:  
AVG \(\rightarrow(4+1)/2\) (4 on the left, 1 on the right)  
3,6,9,1,2,4 = 1  
1,2,3,4 = 4  
2,4,6  
We stopped calculating after \((9+3)/2\) and we do not need to save all the information after index 4 (2 + null) because we have iteration 1 (it appears iteratively) all the time and it can be simply recovered/decoded. After performing the actions mentioned above, we get a difference file, saving only around 28% in space. At this point, we achieve a file with many repeating zeroes, which allows us to use Huffman coding more efficiently and thus attain a better compression ratio later. An example of the different file is shown in Figure A6 in Appendix A.