Skip to content

Data compression

Python for AP CS Principles Lesson 3 1:44 English narration · English + 中文 subtitles burned in

space play · ←/→ 5s · j/l 10s · f fullscreen · ,/. speed

Chapters

Transcript
Data costs space to store and time to send, so we compress it — and there are two kinds. 数据存起来要占空间,发出去要花时间,所以我们把它压缩—— 而压缩有两种。
Lossless makes a file smaller while keeping every single bit. 无损压缩把文件变小,同时把每一个位都保留下来。
Follow one file down and back: it shrinks, and when you open it you get the exact original, not something close to it. 跟着一个文件走一趟:它缩小了, 而当你打开它,你拿回的是"原原本本"的原件,不是很接近的东西。
It works by spotting patterns and writing them shorter — eight A's, then three B's. 它靠的是找出规律再写得更短——8 个 A,然后 3 个 B。
Lossy is the other kind, and it gets much smaller — but by throwing data away. 有损是另一种,它能小得多——但代价是"扔掉"数据。
Follow the same journey and look at the bottom: it is close, but it is not the same file. 走同样的一趟,看底下那一格: 它很接近,但它已经不是同一个文件了。
You cannot get the exact original back, ever. 你永远拿不回原原本本的原件。
What it throws away are details your eye or ear barely notices, which is exactly why it can shrink so much further. 它扔掉的,是你的眼睛或耳朵几乎察觉不到的细节, 这也正是它能缩得多得多的原因。
So the exam question is always which one, and why. 所以考题永远是:选哪一种,为什么。
Use lossless when every detail must be exact: text, code, a zip file, a spreadsheet. 当每一个细节都必须精确时,用无损: 文字、代码、zip 压缩包、电子表格。
Use lossy when a small drop in quality is fine and small size matters: photos, music, video. 当质量掉一点点没关系、而体积很要紧时,用有损: 照片、音乐、视频。
The trade-off never changes — perfect data, or small size. 这个取舍从来不变——要完整的数据,还是要小的体积。
Four things to take with you. 带走四点。
One: compression saves storage space and sending time. 第一:压缩省下存储空间和传输时间。
Two: lossless gives back the exact original, every bit. 第二:无损把原原本本的原件还给你,一位不少。
Three: lossy throws data away and cannot give it back. 第三:有损扔掉数据,而且还不回来。
Four: the trade-off is perfect data against small size. 第四:这个取舍是"完整的数据"对"小的体积"。
Now answer the compression questions below. 现在去下面回答关于压缩的问题。

Log in or create account

IGCSE, A-Level & AP