Digital Information: Converting Analog Data to Binary Flashcards
can you store more BIG files in a computer or small files
small
compression
algorithms to reduce the amount of space needed to represent a file
how many types of compression are there and what are they
lossless and lost (2)
lossless compression
algorithms reduce the size of files without losing any information in the file
lossy compression
algorithms reduce the size of files by discarding the less important information in a file
what type of compression affects file quality? explain why
lossy because some info is taken away from the files while in lossless they are reduced without taking anything away
how do computers compress text
by finding repeating phrases (common) and making them a sign
example of how text is compressed in real life
like how people say u instead of you or lol instead of out loud
what can be compressed
things that repeat at least twice in a sequence
phrases, words, parts of words (th) [like the in the, this, thought,etc.]
all text files can be compressed
true or false
false
compression always makes a smaller file
true or false
false because sometimes it can require more bytes
how do computers compress image files (what process)
run length encoding (RLE)
why is it particularly important to compress image files
bc they’re like super fat files that take up a bunch of space
how does RLE work
the computer replaces each row (of the image – like the little boxes) with numbers that say how many consecutive pixels are the same color (like 5 reds)
RLE always starts coding with the number of _____ pixels
white
if a row does not start with the color white then how is RLE coded
it just begins with 0 whites
how would a row with: 3 white pixels, 2 red pixels, 5 white pixels, 2 red pixels, then 4 white pixels be represented
with the bit representations of the numbers 3,2,5,2,4
can you make a perfect representation of an image from RLE coding
yes
does RLE coding always reduce the size of a file? why or why not?
no because it is very rare that the same exact color repeats over and over again so you will need different combinations of 0 and 1 to show different numbers so it would be super long and so much stuff yk which would be a bigger file
where is RLE used irl
fax machines
why do fax machines use RLE
bc they only print in black and white
Huffman coding
assigning shorter codes to more frequently occurring characters and longer codes to less frequent characters
all types of compression code in what
bits
example of huffman coding
A and G are assigned one more bit because they are the least common letters in the sequence.
If they were only assigned 2 bits, there would be confusion when decoding messages. Imagine we had the following code:
a - 01
c - 00
g - 10
t - 1
If I asked you to decode the message 101, it would not be clear whether the original message was ta or gt.