Run-Length Encoding (RLE) is one of the oldest algorithms for data-compression available. It compresses by looking at the data for repetitions of the same character in a row and storing the amount and the respective character as target-data. Unfortunately, it only compresses within strict and special cases. Outside of these cases, it increases the data-size, even doubles the size in worst cases compared to the original, unprocessed data
In order to implement this algorithm, the following steps should be considered:
- Matrix width (integer)
- Matrix height (integer)
- Number of different characters (integer)
- The used letters (char array)
- Modify filepaths of input_data.txt , encoded_data.txt , decoded_data.txt
- Create a random matrix (Matrix width * Matrix height values), that will be used as input data
- Save the input data in a text file (input_data.txt)
- Function looks at the data for repetitions of the same character in a row and stores the number of repetitions and the respective character
- Write the encoded data in a text file (encoded_data.txt)
- Function that extracts the characters from the encoded file (encoded_data.txt) and save them in a char array.
- Transform an array of consecutive char digits (‘1’,’2’,’3’) in an integer number (123)
- Write the decoded data in a text file (decoded_data.txt)
- Check the execution time of encoding and decoding for unoptimized and optimized code
- Check the size of input data, encoded data and decoded data
Use the Makefile in order to run both, optimized and unoptimized versions of the Run-Length Encoding algorithm.
make
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.