/************************* * Owen Sullivan * CPSC 2310-002 * opsulli@clemson.edu *************************/ I encountered a few problems while working on this program: 1. The functions I had used in Lab 8 and PA1 to discard comments in PPM headers were apparently broken under certain circumstances. I had only built them to discard comments according to the input image we had been given for both of those assignments, so a slight change in the PPM header layout caused problems in my program. I had to re-write portions of my discard functions. 2. My implementation of the function that reads pixel values (after the PPM header has been read) worked for Lab 8 and PA1, but did not work for PA2 because some values were being read incorrectly when the R, G, or B values were less than 3 digits. I re-wrote this portion as well. 3. While writing my encode function, I discovered that my decode function (which had previously worked) was not properly ignoring pixel values that equated to a value greater than 128 on the ASCII table. I fixed this by only printing characters that were not evenly divisible by 128. 4. When I tested my completed program on cerf15, I found that there were a few edge cases where ASCII values would be off by 1 bit. I fixed this by making sure my binary arrays were being set to all 0s before converting from decimal to binary. 5. At the last minute, I decided to make my program such that it could accept as many characters to encode as there are pixels in an image. This required a bit of hackery, as I rely on scansets with width specifiers. Once I thought I had everything complete, the output was being cut off by a few characters. It turns out the answer was closing the input FILE pointers before trying to decode the image (I assume because two pointers were sharing access to a file). I think this assignment was a greater challenge than PA1, and being able to re-use many of the functions from Lab 8 and PA1 was extremely helpful. I think that this is a much more useful program than anything I've previously written in C (not C++), so I liked this project overall. The one thing that I disliked is the requirement to use a bitwise operator; it wasn't difficult, but all of the operations that could be replaced by a bitwise operation were easier to implement without bitwise operators. It felt like the bitwise operation requirement was looming over my head throughout the assignment, and I worried about being able to find somewhere to fit it in without having to completely re-write functional portions of my program. I used the bitwise AND operation in my clearBinaryArray function (found in EncodeDecode.h/EncodeDecode.c) to set the values of array elements which represent a 9-bit binary string to 0, which was necessary to re-use the binary arrays in loops. Because bitwise AND will only return a 1 if both operands are 1, bitwise AND with 0 as one of the operands will always result in 0.