Data storage and compression
Diperkenalkan
15:06
Mengapa Komputer Menggunakan Biner
Di dalam prosesor terdapat miliaran sakelar kecil. Setiap satu hanya bisa menyala atau mati. Itulah semua yang secara fisik dimiliki komputer — tidak ada angka tiga, tidak ada tujuh, tidak ada…
Narasi bahasa Inggris · takarir bahasa Inggris dan 中文 yang dapat dipilih
Dalam pelajaran ini
| English | Makna |
|---|---|
| Data storage | |
| sound file | |
| Compression/kəmˈpreʃn/ | Representing data using fewer bits; lossless methods preserve all original data, while lossy methods discard some information. |
| bit/bɪt/ | A binary digit, taking the value zero or one. |
| nibble/ˈnɪbl/ | A group of four bits. |
| byte/baɪt/ | A group of eight bits, commonly used as a unit of data storage. |
| kibibyte/ˈkɪbɪbaɪt/ | |
| binary/ˈbaɪnəri/ | A number system using base two, with the digits zero and one. |
| colour depth/ˈkʌlə depθ/ | The number of bits used to represent a pixel's colour, determining how many encoded colour values are available. |
| sample rate/ˈsæmpl reɪt/ | |
| sample resolution/ˈsæmpl ˌrezəˈluːʃn/ | |
| bpp | |
| Lossless/ˈlɒsləs/ | Describing compression from which the original data can be recovered exactly. |
| run-length encoding/rʌn leŋθ enˈkəʊdɪŋ/ | Pengkodean panjang-lari |
| run/rʌn/ | |
| Lossy/ˈlɒsi/ | Describing compression that discards some original information so it cannot be perfectly recovered. |
| resolution/ˌrezəˈluːʃn/ | Here, the pixel dimensions of a bitmap image, such as its width and height in pixels. |
| program files | |
| Hz | |
| characters/ˈkærɪktəz/ | A text unit such as a letter, digit, punctuation mark or other symbol. |
Memampatkan fail supaya lebih kecil
- Penyimpanan data diukur dalam unit yang setiap langkah naik oleh 1024.
- Kita boleh mengira saiz fail imej atau bunyi.
- Pemampatan kemudian menjadikan fail lebih kecil.
Mengukur penyimpanan
- bit (satu 0/1) · nibble (4 bit) · byte (8 bit).
- Kemudian setiap unit adalah 1024× dari sebelumnya (karena $1024 = 2^{10}$): kibibyte (KiB) = 1024 byte, mebibyte (MiB) = 1024 KiB, gibibyte (GiB) = 1024 MiB, tebibyte (TiB) = 1024 GiB.
- Selalu bagi dengan 1024 (bukan 1000) untuk naik ke satu unit.

Komputer merepresentasikan semua data sebagai biner — deretan panjang 0 dan 1.
How many bytes are in 1 kibibyte (KiB)?
Kesulitan 2/5 · 140 koin + bonus kecil pada penyelesaian pertama hari ini
1 KiB = 1024 bytes (each storage unit steps up by 1024 = 2^10).
Match each storage/compression idea to its meaning.
Kesulitan 2/5 · 140 koin + bonus kecil pada penyelesaian pertama hari ini
File size grows with detail; compression shrinks it, losslessly or lossily.
Menghitung ukuran file
- Gambar (bits) $=$ lebar × tinggi × kedalaman warna.
- Suara (bits) $=$ tingkat sampel × resolusi sampel × detik.
- Bagi dengan 8 untuk byte, lalu bagi dengan 1024 untuk KiB, lagi untuk MiB.
- mis. $1024 \times 1024$ pada 16 bpp $= 16\,777\,216$ bit $= 2$ MiB.
An image is 100 × 100 pixels with a colour depth of 24 bits. What is its size in bits?
Kesulitan 2/5 · 140 koin + bonus kecil pada penyelesaian pertama hari ini
width × height × colour depth = 100 × 100 × 24 = 240 000 bits.
Kompresi
- Kompresi lossless membuat file lebih kecil tanpa kehilangan permanen — aslinya dapat dibangun kembali secara presisi. Pengkodean panjang lari (RLE) menyimpan serangkaian pengulangan sekali (mis.
WWWWWWWW→ "8 W"). - Kompresi lossy membuatnya jauh lebih kecil dengan menghapus data secara permanen (resolusi/tingkat sampel lebih rendah).
- Gunakan lossless untuk teks dan file program; lossy untuk foto, musik, dan video.

Pengkodean panjang lari menyimpan serangkaian pengulangan sekali, sebagai pasangan (jumlah, nilai): 8 W, lalu 4 R.
Run-length encoding shrinks repeats
Compression makes a file smaller. Run-length encoding replaces a run of identical values with one value plus a count — lossless, and best when the data has long runs.
Lossless compression:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Lossless keeps all the data (e.g. RLE); lossy permanently discards some.
Run-length encoding (RLE) compresses data by:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
RLE replaces a run like WWWWWWWW with "8 W" — great when data has many repeats.
Lossy compression is most appropriate for:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Lossy suits media where a slight quality loss buys a much smaller file; exact data needs lossless.
Kartu ini baru, jadi ditampilkan dalam bahasa Inggris sampai terjemahannya siap.
Worked example: a sound file, then RLE
A 10-second sound is recorded at 8000 Hz 赫兹 with a sample resolution of 16 bits. Find its size in KiB. Then compress the line WWWWWWBBBW with run-length encoding.
- Multiply, then step up the units:
- RLE stores each run as a count and a value: 6W 3B 1W. Ten characters 字符 become three pairs, and nothing is lost, so this is lossless compression.

An image is 100 pixels wide and 50 pixels high, with a colour depth of 8 bits. What is its size in bytes?
Kesulitan 2/5 · 140 koin + bonus kecil pada penyelesaian pertama hari ini
$100 \times 50 \times 8 = 40\,000$ bits, and $40\,000 \div 8 = 5000$ bytes.
Which file must be compressed with a lossless method?
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
If even one bit of a program changes, it will not run correctly; photos, music and video can lose detail people do not notice.
Anda telah memahaminya
- unit penyimpanan naik dengan faktor 1024 (KiB, MiB, GiB, TiB)
- ukuran gambar = lebar × tinggi × kedalaman warna (bits); suara = tingkat × resolusi × detik
- lossless = pemulihan presisi (RLE); lossy = lebih kecil, kehilangan permanen
- lossless untuk teks/program; lossy untuk foto/musik/video
Apa yang salah? Hanya tim situs yang dapat melihatnya.