From 94f1d659ba11b9b0cbb8a29bb39504907cf6c237 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 1 Apr 2023 06:43:47 -0700 Subject: [PATCH] Fixes in 2018/bellard Fix command in README.md for macOS: -preview lena.ppm # On MacOS +open -a Preview lena.ppm # On macOS Move warning that the program does not protect against invalid input to the top of the author's comments (seems the best place). Format fixes. Add to .gitignore files that are generated by suggested commands. --- 2018/bellard/.gitignore | 3 +++ 2018/bellard/README.md | 25 ++++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/2018/bellard/.gitignore b/2018/bellard/.gitignore index e4d82a2da..02b46d4fd 100644 --- a/2018/bellard/.gitignore +++ b/2018/bellard/.gitignore @@ -1,3 +1,6 @@ lena.ppm prog small.jpg +fruits.ppm +lena512.ppm +vintage_cars.ppm diff --git a/2018/bellard/README.md b/2018/bellard/README.md index c99f42086..7fa2e8b8c 100644 --- a/2018/bellard/README.md +++ b/2018/bellard/README.md @@ -19,7 +19,7 @@ make ```sh eog lena.ppm # On Linux -preview lena.ppm # On MacOS +open -a Preview lena.ppm # On macOS pngtopnm < Lenna.png | pnmscale 0.25 | cjpeg -arithmetic -dct float -quality 14 > small.jpg ``` @@ -27,22 +27,25 @@ pngtopnm < Lenna.png | pnmscale 0.25 | cjpeg -arithmetic -dct float -quality 14 ## Judges' comments: -The file `small.jpg` will be approximately of the same size as the raw image data -in the program. Compare the level of the detail and the artifacts of +The file `small.jpg` will be approximately of the same size as the raw image +data in the program. Compare the level of the detail and the artifacts of `small.jpg` and `lena.ppm`. -Compressing images is just a matter of simple arithmetic and some magic, isn't it? +Compressing images is just a matter of simple arithmetic and some magic, isn't +it? We could understand some of the arithmetic but none of the magic. -Deciphering the mechanism used for data encoding to make use -of whitespace, braces and semicolons should be a slightly easier task. +Deciphering the mechanism used for data encoding to make use of whitespace, +braces and semicolons should be a slightly easier task. ## Author's comments: -This program outputs a 128x128 RGB image file to the standard output -using the portable pixmap file format (PPM). It contains the famous -"Lena" image which is used in many image compression tests. +Warning: the program is not protected against invalid input. + +This program outputs a 128x128 RGB image file to the standard output using the +portable pixmap file format (PPM). It contains the famous "Lena" image which is +used in many image compression tests. The uncompressed image is 12 times larger than the source code of the program which includes the image data and the complete decoder. The @@ -73,8 +76,8 @@ input. Examples: ``` The original images for [fruits][1] and [vintage cars][2] come from -Wikipedia and were resized to a width of 1024 pixels. Warning: the -program is not protected against invalid input. +Wikipedia and were resized to a width of 1024 pixels. + The program should be portable on any Unix system. On Windows the line `_setmode(0, 32768); _setmode(1, 32768);` must be added at the start of