Skip to content

Commit 14dcd14

Browse files
committed
2 parents 1cd613a + 5b42119 commit 14dcd14

2 files changed

Lines changed: 55 additions & 156 deletions

File tree

CPP/makefile

Lines changed: 8 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -1,164 +1,17 @@
1-
main_function: main_11 main_12 main_13 main_14 main_21 main_22 main_23 main_24 main_31 main_32 main_33 main_34 main_41 main_42 main_43 main_44 main_51 main_52 main_53 main_54
1+
main_function: main_1 main_2
22
@echo "================================================================="
33
@echo "RLE Encode and Decode - Unoptimized - 2 characters - size 100x100: "
4-
@./main_11
4+
@./main_1
55
@echo "================================================================="
66

7-
@echo "RLE Encode and Decode - Optimized OpenMP - 2 characters - size 100x100: "
8-
@./main_12
7+
@echo "RLE Encode and Decode - Optimized + OpenMP - 2 characters - size 100x100: "
8+
@./main_2
99
@echo "================================================================="
1010

11-
@echo "RLE Encode and Decode - Unoptimized - 5 characters - size 100x100: "
12-
@./main_13
13-
@echo "================================================================="
14-
15-
@echo "RLE Encode and Decode - Optimized OpenMP - 5 characters - size 100x100: "
16-
@./main_14
17-
@echo "================================================================="
18-
19-
20-
21-
22-
@echo "================================================================="
23-
@echo "RLE Encode and Decode - Unoptimized - 2 characters - size 200x200: "
24-
@./main_21
25-
@echo "================================================================="
26-
27-
@echo "RLE Encode and Decode - Optimized OpenMP - 2 characters - size 200x200: "
28-
@./main_22
29-
@echo "================================================================="
30-
31-
@echo "RLE Encode and Decode - Unoptimized - 5 characters - size 200x200: "
32-
@./main_23
33-
@echo "================================================================="
34-
35-
@echo "RLE Encode and Decode - Optimized OpenMP - 5 characters - size 200x200: "
36-
@./main_24
37-
@echo "================================================================="
38-
39-
40-
41-
42-
@echo "================================================================="
43-
@echo "RLE Encode and Decode - Unoptimized - 2 characters - size 300x300: "
44-
@./main_31
45-
@echo "================================================================="
46-
47-
@echo "RLE Encode and Decode - Optimized OpenMP - 2 characters - size 300x300: "
48-
@./main_32
49-
@echo "================================================================="
50-
51-
@echo "RLE Encode and Decode - Unoptimized - 5 characters - size 300x300: "
52-
@./main_33
53-
@echo "================================================================="
54-
55-
@echo "RLE Encode and Decode - Optimized OpenMP - 5 characters - size 300x300: "
56-
@./main_34
57-
@echo "================================================================="
58-
59-
60-
61-
@echo "================================================================="
62-
@echo "RLE Encode and Decode - Unoptimized - 2 characters - size 500x500: "
63-
@./main_41
64-
@echo "================================================================="
65-
66-
@echo "RLE Encode and Decode - Optimized OpenMP - 2 characters - size 500x500: "
67-
@./main_42
68-
@echo "================================================================="
69-
70-
@echo "RLE Encode and Decode - Unoptimized - 5 characters - size 500x500: "
71-
@./main_43
72-
@echo "================================================================="
73-
74-
@echo "RLE Encode and Decode - Optimized OpenMP - 5 characters - size 500x500: "
75-
@./main_44
76-
@echo "================================================================="
77-
78-
79-
80-
81-
@echo "RLE Encode and Decode - Unoptimized - 2 characters - size 800x800: "
82-
@./main_51
83-
@echo "================================================================="
84-
85-
@echo "RLE Encode and Decode - Optimized OpenMP - 2 characters - size 800x800: "
86-
@./main_52
87-
@echo "================================================================="
88-
89-
@echo "RLE Encode and Decode - Unoptimized - 5 characters - size 800x800: "
90-
@./main_53
91-
@echo "================================================================="
92-
93-
@echo "RLE Encode and Decode - Optimized OpenMP - 5 characters - size 800x800: "
94-
@./main_54
95-
@echo "================================================================="
96-
9711

98-
99-
main_11: RLEencode11.cpp
100-
g++ RLEencode11.cpp -o main_11
101-
102-
main_12: RLEencode12.cpp
103-
g++ RLEencode12.cpp -O3 -fopenmp -o main_12
104-
105-
main_13: RLEencode13.cpp
106-
g++ RLEencode13.cpp -o main_13
107-
108-
main_14: RLEencode14.cpp
109-
g++ RLEencode14.cpp -O3 -fopenmp -o main_14
110-
111-
112-
113-
main_21: RLEencode21.cpp
114-
g++ RLEencode21.cpp -o main_21
12+
main_1: RLEencode.cpp
13+
g++ RLEencode.cpp -o main_1
11514

116-
main_22: RLEencode22.cpp
117-
g++ RLEencode22.cpp -O3 -fopenmp -o main_22
15+
main_2: RLEencode12.cpp
16+
g++ RLEencode.cpp -O3 -fopenmp -o main_2
11817

119-
main_23: RLEencode23.cpp
120-
g++ RLEencode23.cpp -o main_23
121-
122-
main_24: RLEencode24.cpp
123-
g++ RLEencode24.cpp -O3 -fopenmp -o main_24
124-
125-
126-
main_31: RLEencode31.cpp
127-
g++ RLEencode31.cpp -o main_31
128-
129-
main_32: RLEencode32.cpp
130-
g++ RLEencode32.cpp -O3 -fopenmp -o main_32
131-
132-
main_33: RLEencode33.cpp
133-
g++ RLEencode33.cpp -o main_33
134-
135-
main_34: RLEencode34.cpp
136-
g++ RLEencode34.cpp -O3 -fopenmp -o main_34
137-
138-
139-
140-
main_41: RLEencode41.cpp
141-
g++ RLEencode41.cpp -o main_41
142-
143-
main_42: RLEencode42.cpp
144-
g++ RLEencode42.cpp -O3 -fopenmp -o main_42
145-
146-
main_43: RLEencode43.cpp
147-
g++ RLEencode43.cpp -o main_43
148-
149-
main_44: RLEencode44.cpp
150-
g++ RLEencode44.cpp -O3 -fopenmp -o main_44
151-
152-
153-
154-
main_51: RLEencode51.cpp
155-
g++ RLEencode51.cpp -o main_51
156-
157-
main_52: RLEencode52.cpp
158-
g++ RLEencode52.cpp -O3 -fopenmp -o main_52
159-
160-
main_53: RLEencode53.cpp
161-
g++ RLEencode53.cpp -o main_53
162-
163-
main_54: RLEencode54.cpp
164-
g++ RLEencode54.cpp -O3 -fopenmp -o main_54

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,48 @@
11
# Run_Length_Encoding_Decoding
2-
A C++ implementation of a function that performs Run-Length Encoding and decoding on a 2-Dimensional char array, plus a HLS implementaion.
2+
Run-Length Encoding (RLE) is one of the oldest algorithms for data-compression available.
3+
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.
4+
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
5+
6+
<p align="center">
7+
<img width="600" height="400" src="https://iq.opengenus.org/content/images/2020/04/rleimg--1-.png">
8+
</p>
9+
10+
In order to implement this algorithm, the following steps should be considered:
11+
12+
## Declare the INPUT DATA:
13+
>* Matrix width (integer)
14+
>* Matrix height (integer)
15+
>* Number of different characters (integer)
16+
>* The used letters (char array)
17+
>* Modify filepaths of input_data.txt , encoded_data.txt , decoded_data.txt
18+
19+
## Generate random INPUT DATA to be ENCODED:
20+
>* Create a random matrix (Matrix width * Matrix height values), that will be used as input data
21+
>* Save the input data in a text file (input_data.txt)
22+
23+
## ENCODE function:
24+
>* Function looks at the data for repetitions of the same character in a row and stores the number of repetitions and the respective character
25+
>* Write the encoded data in a text file (encoded_data.txt)
26+
27+
## DECODE function
28+
>* Function that extracts the characters from the encoded file (encoded_data.txt) and save them in a char array.
29+
>* Transform an array of consecutive char digits (‘1’,’2’,’3’) in an integer number (123)
30+
>* Write the decoded data in a text file (decoded_data.txt)
31+
32+
## PERFORMANCE ANALYSIS
33+
>* Check the execution time of encoding and decoding for unoptimized and optimized code
34+
>* Check the size of input data, encoded data and decoded data
35+
36+
## Usage
37+
38+
Use the Makefile in order to run both recursive and iterative, optimized and unoptimized versions of the Merge Sort algorithm.
39+
40+
```bash
41+
make
42+
```
43+
44+
## Contributing
45+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
46+
47+
48+

0 commit comments

Comments
 (0)