diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4270cab --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "ostream": "cpp", + "chrono": "cpp" + } +} \ No newline at end of file diff --git a/lab1/images/1rotated.ppm b/lab1/images/1rotated.ppm new file mode 100644 index 0000000..5b25936 Binary files /dev/null and b/lab1/images/1rotated.ppm differ diff --git a/lab1/images/2rotated.ppm b/lab1/images/2rotated.ppm new file mode 100644 index 0000000..c4203b2 Binary files /dev/null and b/lab1/images/2rotated.ppm differ diff --git a/lab1/src/a.out b/lab1/src/a.out index 6331fab..7363198 100644 Binary files a/lab1/src/a.out and b/lab1/src/a.out differ diff --git a/lab1/src/detail_times.txt b/lab1/src/detail_times.txt index 1e2c434..398a219 100644 --- a/lab1/src/detail_times.txt +++ b/lab1/src/detail_times.txt @@ -33,3 +33,5 @@ ../images/5.ppm 0.352959 ../images/6.ppm 0.497504 ../images/7.ppm 1.79435 +../images/1.ppm 0.00378666 +../images/2.ppm 0.0142673 diff --git a/lab1/src/image_sharpener.cpp b/lab1/src/image_sharpener.cpp index f158146..5263273 100644 --- a/lab1/src/image_sharpener.cpp +++ b/lab1/src/image_sharpener.cpp @@ -103,6 +103,38 @@ struct image_t* S2_find_details(struct image_t *input_image, struct image_t *smo return details; } +struct image_t* Rotate_image(struct image_t *input_image) +{ + // TODO + int width = input_image->width; + int height = input_image->height; + + struct image_t* rotated = new struct image_t; + rotated->height = width; + rotated->width = height; + rotated->image_pixels = new uint8_t**[height]; + + for(int i = 0; i < rotated->height; i++) + { + rotated->image_pixels[i] = new uint8_t*[rotated->width]; + for(int j = 0; j < rotated->width; j++) + rotated->image_pixels[i][j] = new uint8_t[3]; + } + + for(int i = 1; i < rotated->height-1; i++) + { + for(int j = 1; j < rotated->width-1; j++) + { + for(int k = 0; k < 3; k++) + { + rotated->image_pixels[i][j][k] = input_image->image_pixels[j][i][k]; + } + } + } + + return rotated; +} + struct image_t* S3_sharpen(struct image_t *input_image, struct image_t *details_image) { // TODO @@ -159,9 +191,11 @@ int main(int argc, char **argv) auto startsharp = chrono::high_resolution_clock::now(); struct image_t *sharpened_image = S3_sharpen(input_image, details_image); auto endsharp = std::chrono::high_resolution_clock::now(); + + struct image_t *rotated_image = Rotate_image(input_image); auto startwrite = chrono::high_resolution_clock::now(); - write_ppm_file(argv[2], sharpened_image); + write_ppm_file(argv[2], rotated_image); auto endwrite = std::chrono::high_resolution_clock::now(); chrono::duration readduration = endread - startread; diff --git a/lab1/src/read_times.txt b/lab1/src/read_times.txt index 092213e..44c8ca3 100644 --- a/lab1/src/read_times.txt +++ b/lab1/src/read_times.txt @@ -33,3 +33,5 @@ ../images/5.ppm 0.366631 ../images/6.ppm 0.711473 ../images/7.ppm 1.80572 +../images/1.ppm 0.0197896 +../images/2.ppm 0.0329337 diff --git a/lab1/src/sharp_times.txt b/lab1/src/sharp_times.txt index a6fa605..3827297 100644 --- a/lab1/src/sharp_times.txt +++ b/lab1/src/sharp_times.txt @@ -33,3 +33,5 @@ ../images/5.ppm 0.396153 ../images/6.ppm 0.804332 ../images/7.ppm 2.54863 +../images/1.ppm 0.00357817 +../images/2.ppm 0.0139955 diff --git a/lab1/src/smooth_times.txt b/lab1/src/smooth_times.txt index e68cfc9..88f9625 100644 --- a/lab1/src/smooth_times.txt +++ b/lab1/src/smooth_times.txt @@ -33,3 +33,5 @@ ../images/5.ppm 0.448171 ../images/6.ppm 1.03631 ../images/7.ppm 2.50061 +../images/1.ppm 0.00590421 +../images/2.ppm 0.0222273 diff --git a/lab1/src/write_times.txt b/lab1/src/write_times.txt index 928ccc8..8cfcfd1 100644 --- a/lab1/src/write_times.txt +++ b/lab1/src/write_times.txt @@ -33,3 +33,5 @@ ../images/5.ppm 0.127681 ../images/6.ppm 0.322058 ../images/7.ppm 1.0496 +../images/1.ppm 0.00731258 +../images/2.ppm 0.02392 diff --git a/lab3/3_process_scheduling.pdf b/lab3/3_process_scheduling.pdf new file mode 100644 index 0000000..6a200a6 Binary files /dev/null and b/lab3/3_process_scheduling.pdf differ diff --git a/lab3/schedule_format.txt b/lab3/schedule_format.txt new file mode 100644 index 0000000..67fd1b2 --- /dev/null +++ b/lab3/schedule_format.txt @@ -0,0 +1,8 @@ +CPU0 +P1,1 0 0 +P2,1 1 3 +P1,1 4 7 +P2,1 8 10 +P3,1 11 12 +P2,1 13 15 +