CENG 320
Tanner Reinert
PARTNER LAB and Tristan
Niewenhuis
PROJECT
CODE: INVERSION
• Includes w22 as an inversion flag to
be set when –I is found in the
program initialization.
• Also adds a max gray variable of 255
as to not overstep
• We then use this flag after we have
converted the function to gray to
subtract the assigned values from the
max to then achieve an inverted look.
CODE: FIND MIN/MAX
• We begin by initializing all values
and pointers, staying sure that the
minimum and maximum values start
off as small and as large as possible
respectively.
• Then, we step through the array,
loading each pixel, and comparing it
the minimum and maximum values,
updating if necessary.
• After this runs, each value is packed
into one register to be used
elsewhere.
CODE: CALCULATE SCALE
• This is basically an implementation
of the equation
• (numAsciiChars – 1)/(max – min)
• Additionally, because the result will
have decimal stuff, I shifted the
numerator 16 bits left to keep
precision.
CODE: ASCII ART
• First, I get all the values from
the arguments that I need
• Get the string length
• If contrast, get min and max
• Else, max = 255, and min = 0
• Get the scale (it is left shift by
16 bits)
• 2 nested loops, 1 for going
through rows, and another for
each pixel
• Use the equation i = s*(g-min)
+0.5, but at the end, shift right
16 to undo earlier shift left 16
PROGRAM RESULTS
Original Inverted
Image Ascii
Contrasted
and Inverted
Ascii
Ascii Image Contrast
Ascii
PROGRAM RESULTS
Original Inverted
Image Ascii
Contrasted
and Inverted
Ascii
Ascii Image Contrast
Ascii
PROBLEMS ENCOUNTERED
• Gitlab was a struggle to configure properly
• Accidentally used the 0 and 1 registers to store row index in the ascii_art
function. When calling the printf function, they got all messed up and caused
segmentation faults
• find_min_max callee-saved values weren’t being saved properly
FIN