Data storage and compression
הוצג
15:06
למה מחשבים משתמשים במערכת סבוכה
בתוך מעבד יש מיליארדים של מתגים זעירים. כל אחד מהם יכול להיות רק בדלק או בכיבוי. זהו כל מה שיש למחשב פיזית — אין שלושים, אין שבעים, אין…
קריינות באנגלית · כתוביות באנגלית ובסינית 中文 שאפשר להחליף ביניהן
בשיעור הזה
| English | משמעות |
|---|---|
| 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ɪŋ/ | אנקודינג באורך ריצה |
| 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. |
קמיטת קבצים
- אחסון נתונים נמדד ביחידות שכל אחת עולה ב-1024.
- ניתן לחשב את גודל קובץ תמונה או צליל.
- דחיסה מאפשרת להקטין קבצים.
מדידת אחסון
- ביט (ביט אחד 0/1) · ניבל (4 ביטים) · בייט (8 ביטים).
- כל יחידה היא 1024× הקודמת לה (מכיוון $1024 = 2^{10}$): קיבייט (KiB) = 1024 בייטים, מבייט (MiB) = 1024 קיבייטים, גיבייט (GiB) = 1024 מבייטים, טיבייט (TiB) = 1024 גיבייטים.
- תמיד לחלק ב-1024 (לא ב-1000) כדי לעלות ליחידה הבאה.

מחשבים מייצגים כל נתונים כבינרי — שרשראות ארוכות של 0 ו-1.

How many bytes are in 1 kibibyte (KiB)?
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
1 KiB = 1024 bytes (each storage unit steps up by 1024 = 2^10).
Match each storage/compression idea to its meaning.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
File size grows with detail; compression shrinks it, losslessly or lossily.
חישוב גודל קובץ
- תמונה (ביטים) $=$ רוחב × גובה × עומק צבע.
- צליל (ביטים) $=$ תדירות דגימה × רזולוציית דגימה × שניות.
- חלוקה ב-8 לבייט, ואז חלוקה ב-1024 לקיבייט, שוב לגיבייט.
- לדוגמה: $1024 \times 1024$ ב-16 bpp $= 16\,777\,216$ ביטים $= 2$ MiB.
An image is 100 × 100 pixels with a colour depth of 24 bits. What is its size in bits?
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
width × height × colour depth = 100 × 100 × 24 = 240 000 bits.
דחיסה
- דחיסה ללא אובדן הופכת קובץ לקטן יותר בלי אובדן נצחי—ניתן לשחזר את המקור בדיוק. הידד-אורך (RLE) מאחסן רצף של חזרות פעם אחת (למשל
WWWWWWWW→ "8 W"). - דחיסה עם אובדן מקטינה אותו במיוחד על ידי הסרת נתונים לצמיתות (רזולוציה/קצב דגימה נמוכים).
- השתמש ב-ללא אובדן עבור טקסט וקבצי תוכנה; ב-עם אובדן לתמונות, מוזיקה ווידאו.

הידד-אורך מאחסן רצף של חזרות פעם אחת, כזוג (כמות, ערך): 8 W, ולאחר מכן 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:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Lossless keeps all the data (e.g. RLE); lossy permanently discards some.
Run-length encoding (RLE) compresses data by:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
RLE replaces a run like WWWWWWWW with "8 W" — great when data has many repeats.
Lossy compression is most appropriate for:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Lossy suits media where a slight quality loss buys a much smaller file; exact data needs lossless.
הכרטיס הזה חדש, לכן הוא מוצג באנגלית עד שהתרגום שלו יהיה מוכן.
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?
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
$100 \times 50 \times 8 = 40\,000$ bits, and $40\,000 \div 8 = 5000$ bytes.
Which file must be compressed with a lossless method?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
If even one bit of a program changes, it will not run correctly; photos, music and video can lose detail people do not notice.
הבנתך מושלמת
- יחידות אחסון עוברות צניחה ב-1024 (KiB, MiB, GiB, TiB)
- גודל תמונה = רוחב × גובה × עומק צבע (ביטים); קול = קצב × רזולוציה × שניות
- ללא אובדן = שחזור מדויק (RLE); עם אובדן = קטן יותר, עם אובדן נצחי
- ללא אובדן לטקסט/תוכנות; עם אובדן לתמונות/מוזיקה/וידאו
מה השתבש? רק צוות האתר רואה זאת.