Editing
Data Compression
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''Modeling 'Run-Length Encoding' (A simple lossless algorithm):''' <syntaxhighlight lang="python"> def rle_compress(data): """ Compresses 'AAABBC' into '3A2B1C' """ if not data: return "" compressed = [] count = 1 for i in range(1, len(data)): if data[i] == data[i-1]: count += 1 else: compressed.append(f"{count}{data[i-1]}") count = 1 compressed.append(f"{count}{data[-1]}") return "".join(compressed) raw = "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" comp = rle_compress(raw) print(f"Original: {len(raw)} chars") print(f"Compressed: {comp} ({len(comp)} chars)") print(f"Efficiency: {round((1 - len(comp)/len(raw))*100, 1)}% reduction") </syntaxhighlight> ; Compression Landmarks : '''The 'LZW' Algorithm (1984)''' β The basis for the GIF and ZIP formats, which allowed the early internet to handle images. : '''The 'JPEG' Standard (1992)''' β The invention that made digital photography possible by shrinking 10MB photos into 1MB files. : '''The 'MP3' Revolution (1990s)''' β Changed the music industry forever by making songs small enough to "Share" (and pirate) over slow dial-up modems. : '''H.264 / HEVC''' β The advanced video compression that allows you to watch 4K movies on Netflix without clogging the entire world's internet. </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information