Skip to content

A C++ implementation of a function that performs Run-Length Encoding and Decoding on a 2-Dimensional char array, plus a HLS implementaion.

Notifications You must be signed in to change notification settings

RazvaNGLS/Run_Length_Encoding_Decoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Run_Length_Encoding_Decoding

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:

Declare the INPUT DATA:

  • 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

Generate random INPUT DATA to be ENCODED:

  • 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)

ENCODE function:

  • 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)

DECODE function

  • 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)

PERFORMANCE ANALYSIS

  • Check the execution time of encoding and decoding for unoptimized and optimized code
  • Check the size of input data, encoded data and decoded data

Usage

Use the Makefile in order to run both, optimized and unoptimized versions of the Run-Length Encoding algorithm.

make

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

A C++ implementation of a function that performs Run-Length Encoding and Decoding on a 2-Dimensional char array, plus a HLS implementaion.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published