IGCSE Computer Science: Data Representation of Text, Sound and Image | IGCSE计算机:文本、声音与图像的数据表示

📚 IGCSE Computer Science: Data Representation of Text, Sound and Image | IGCSE计算机:文本、声音与图像的数据表示

Computers are digital machines. They can only understand and process data in the form of binary digits, 0 and 1. To store and transmit text, sound, and images, computers must convert these real-world forms of information into binary patterns. In this article, we will examine how text, sound, and image data are represented in a computer system, including the key terms, calculation methods, and common exam questions for CIE IGCSE Computer Science.

计算机是数字设备,只能识别和处理由0和1组成的二进制数据。为了存储和传输文本、声音和图像,计算机必须将这些现实世界中的信息转换为二进制编码。本文将详细讲解在CIE IGCSE计算机科学课程中,文本、声音和图像在计算机系统中的数据表示方式,包括关键术语、计算方法以及常见考点。


1. Why Binary Is Used | 为什么使用二进制

All data in a computer is stored as binary digits, or bits. A bit can hold only one of two values: 0 (off) or 1 (on). This is because computer hardware is built from electronic circuits that have two stable states, representing low voltage and high voltage. Using only two states makes the system simple, reliable, and resistant to electrical noise.

计算机中的所有数据均以二进制位(bit)形式存储。一个位只能保存两个值之一:0(断开)或1(接通)。这是因为计算机硬件由电子电路构成,这些电路具有两种稳定状态,分别代表低电压和高电压。仅使用两种状态,使系统简单、可靠,并且抗电子噪声干扰能力强。

When we talk about data representation, we often use these units:

在讨论数据表示时,我们经常使用以下单位:

  • bit (b) – the smallest unit of data | 位(b) – 数据的最小单位
  • byte (B) = 8 bits | 字节(B) = 8位
  • kilobyte (KB) = 1024 bytes | 千字节(KB) = 1024字节
  • megabyte (MB) = 1024 KB | 兆字节(MB) = 1024 KB
  • gigabyte (GB) = 1024 MB | 吉字节(GB) = 1024 MB

2. Representing Text: Character Sets | 文本表示:字符集

Text is represented by assigning a unique binary code to each character. A character set is a list of characters, each with a corresponding binary code. The computer translates the binary code back into the character when displaying text. Without a shared standard, different computers would not be able to exchange text correctly.

文本通过为每个字符分配唯一的二进制编码来表示。字符集是一张字符列表,每个字符都对应一个二进制代码。计算机会在显示文本时将这些二进制编码转换回字符。如果没有统一的标准,不同计算机将无法正确交换文本信息。

There are two main character sets you must know for IGCSE:

在IGCSE考试中,你需要掌握两种主要字符集:

  • ASCII (American Standard Code for Information Interchange) – uses 7 bits per character, allowing 128 different characters (2⁷ = 128). | ASCII(美国信息交换标准代码) – 每个字符使用7位,可表示128种不同字符(2⁷ = 128)。
  • Unicode – uses 16 bits or 32 bits per character, allowing many more characters (2¹⁶ = 65,536 or 2³² over 4 billion). This supports almost all languages and symbols in the world. | Unicode(统一码) – 每个字符使用16位或32位,可表示更多字符(2¹⁶ = 65,536,或2³²超过40亿)。它支持世界上几乎所有语言和符号。

3. ASCII and Unicode Comparison | ASCII与Unicode对比

ASCII was developed in the 1960s and is still widely used for English text. The 7-bit code means one character occupies 7 bits, or slightly less than one byte when stored. In practice, many systems store ASCII in 8-bit bytes, with the leading bit set to 0.

ASCII诞生于20世纪60年代,至今仍广泛用于英文文本。7位编码意味着每个字符占7位,存储时略少于一个字节。在实际应用中,许多系统以8位字节形式存储ASCII,其中最左侧一位设为0。

Unicode was designed to solve the limitation of ASCII. Because 7 bits can only represent 128 characters, it is impossible to encode Chinese, Arabic, Greek, or emoji. Unicode includes ASCII as a subset, so ASCII text is also valid Unicode text. Each character occupies 16 bits or 32 bits, which increases file size but greatly expands the range of representable characters.

Unicode的设计初衷是解决ASCII的局限性。由于7位只能表示128个字符,无法编码中文、阿拉伯文、希腊文或表情符号。Unicode将ASCII包含为其子集,因此ASCII文本也是有效的Unicode文本。每个字符占用16位或32位,虽然增大了文件体积,但极大扩展了可表示字符的范围。

The following table summarises the key differences:

下表总结了主要区别:

Feature | 特征 ASCII Unicode
Bits per character | 每字符位数 7 16 or 32
Number of characters | 字符数量 128 65,536 or over 4 billion
Languages supported | 支持语言 English and basic symbols | 英文和基本符号 Almost all world languages | 几乎全球所有语言

4. Calculating Text File Size | 计算文本文件大小

To calculate the size of a text file, multiply the number of characters by the number of bits used per character. Then convert the answer into bytes or larger units if necessary.

计算文本文件的大小时,将字符数量乘以每个字符所占的位数,然后按需将结果转换为字节或更大单位。

Text file size = number of characters × bits per character

文本文件大小 = 字符数 × 每字符位数

For example, a file containing 500 characters encoded in ASCII uses:

例如,一个包含500个字符的文件,使用ASCII编码,其大小为:

500 × 7 = 3500 bits = 437.5 bytes

If the same 500 characters are encoded in Unicode with 16 bits per character:

如果同样的500个字符使用16位Unicode编码:

500 × 16 = 8000 bits = 1000 bytes

So Unicode text files are larger than ASCII text files for the same amount of text.

因此,在相同文本量下,Unicode文本文件比ASCII文本文件占用的空间更大。


5. Representing Sound: Sampling | 声音表示:采样

Sound is an analogue signal. It is a continuous wave of changing air pressure. A computer cannot store this continuous wave directly, because digital data can only represent discrete values. Instead, the computer measures the amplitude of the sound wave at regular intervals, a process called sampling.

声音是一种模拟信号,表现为气压连续变化的波。计算机无法直接存储这种连续波,因为数字数据只能表示离散的值。为此,计算机以固定时间间隔测量声波的振幅,这一过程称为采样。

Sampling converts the continuous analogue signal into a series of digital values. Each measured value is stored as a binary number. When the sound is played back, the computer reconstructs the approximate original wave from these samples.

采样将连续的模拟信号转换为一系列数字值。每个测量值以二进制数存储。播放声音时,计算机根据这些采样值重建近似原始波形。

Two important factors affect the quality and file size of digital sound:

有两个重要因素影响数字声音的质量和文件大小:

  • Sample rate – the number of samples taken per second, measured in hertz (Hz). Higher sample rate means better quality but larger file size. | 采样率 – 每秒采样的次数,单位为赫兹(Hz)。采样率越高,音质越好,但文件体积越大。
  • Sample resolution – the number of bits used to store each sample. More bits give a more precise amplitude value, meaning better quality but larger file size. | 采样分辨率 – 存储每个采样值所用的位数。位数越多,振幅值越精确,音质越好,但文件体积越大。

6. Sample Rate and Sample Resolution in Detail | 采样率与采样分辨率详解

Sample rate directly determines how many amplitude measurements are made every second. For example, if a recording system samples at 44,100 Hz, it takes 44,100 measurements per second. This is the standard rate used for music CDs.

采样率直接决定每秒钟采集多少个振幅值。例如,如果录音系统以44,100 Hz采样,即每秒采集44,100个值。这是音乐CD所使用的标准采样率。

Sample resolution determines how accurately each amplitude measurement is recorded. An 8-bit resolution can represent 256 different amplitude levels (2⁸ = 256). A 16-bit resolution can represent 65,536 different levels (2¹⁶ = 65,536). Clearly, 16-bit sound captures much finer detail than 8-bit sound.

采样分辨率决定每个振幅测量值记录的精确程度。8位分辨率可以表示256个不同振幅等级(2⁸ = 256)。16位分辨率可以表示65,536个不同等级(2¹⁶ = 65,536)。显然,16位声音比8位声音能够捕获更细腻的细节。

If the sample rate is too low, the digital sound will lose high-frequency information and sound distorted or muffled. According to the Nyquist theorem, the sample rate should be at least twice the highest frequency of the original signal to reconstruct it accurately.

如果采样率过低,数字声音将丢失高频信息,导致声音失真或模糊。根据奈奎斯特定理,采样率至少应为原始信号最高频率的两倍,才能准确地重建声音。


7. Calculating Sound File Size | 计算声音文件大小

The file size of a sound recording can be calculated using this formula:

声音文件的存储大小可以通过以下公式计算:

Sound file size = sample rate × sample resolution × duration × number of channels

声音文件大小 = 采样率 × 采样分辨率 × 时长 × 声道数

In many exam questions, the number of channels is 1 (mono) or 2 (stereo). Let us look at a worked example.

在许多考题中,声道数为1(单声道)或2(立体声)。我们来看一个具体计算实例。

Example: A sound is recorded for 30 seconds with a sample rate of 20,000 Hz, a sample resolution of 16 bits, and in mono (1 channel). What is the file size in bytes?

示例:一段声音被录制30秒,采样率为20,000 Hz,采样分辨率为16位,单声道(1个声道)。文件大小为多少字节?

20,000 × 16 × 30 × 1 = 9,600,000 bits

9,600,000 ÷ 8 = 1,200,000 bytes

1,200,000 ÷ 1024 = 1171.875 KB

So the file size is approximately 1,200,000 bytes or about 1172 KB.

因此文件大小约为1,200,000字节,即约1172 KB。


8. Representing Images: Pixels and Colour Depth | 图像表示:像素与颜色深度

A digital image is made up of a grid of tiny squares called pixels (short for picture elements). Each pixel has a single colour. The computer stores each pixel’s colour as a binary number.

数字图像由称为像素(picture elements的缩写)的小方格网格组成。每个像素具有单一颜色,计算机将这个颜色以二进制数存储。

Colour depth refers to the number of bits used to represent the colour of one pixel. For example, if colour depth is 4 bits, then each pixel can be one of 2⁴ = 16 possible colours. If colour depth is 8 bits, each pixel can be one of 2⁸ = 256 colours. A true-colour image often uses 24 bits per pixel, giving over 16 million colours.

颜色深度是指表示一个像素颜色所用的位数。例如,如果颜色深度为4位,则每个像素可以是2⁴ = 16种颜色之一。如果颜色深度为8位,每个像素可以是2⁸ = 256种颜色之一。真彩色图像通常每像素使用24位,可表示超过1600万种颜色。

The two most important image properties are:

图像最重要的两个属性是:

  • Resolution – the number of pixels in the image, expressed as width × height. Higher resolution means more detail but larger file size. | 分辨率 – 图像中像素的数量,表示为宽 × 高。分辨率越高,细节越丰富,但文件体积越大。
  • Colour depth – the number of bits per pixel. Higher colour depth means more accurate colours but larger file size. | 颜色深度 – 每个像素所用的位数。颜色深度越高,颜色越准确,但文件体积越大。

9. Bitmap Images vs Vector Images | 位图图像与矢量图像

There are two main ways to store images digitally: bitmap and vector. It is important to understand the difference.

数字图像有两种主要存储方式:位图和矢量图。理解两者的区别非常重要。

Feature | 特征 Bitmap | 位图 Vector | 矢量图
Basic unit | 基本单元 Pixel | 像素 Geometric shapes (lines, curves) | 几何图形(线、曲线)
Scaling quality | 缩放质量 Loses quality when enlarged | 放大时质量下降 Scales without losing quality | 缩放不失真
File size | 文件大小 Large for complex images | 复杂图像文件大 Small for simple graphics | 简单图形文件小
Common uses | 常见用途 Photographs | 照片 Logos, diagrams, text | 标志、图表、文字

10. Calculating Image File Size | 计算图像文件大小

To calculate the file size of a bitmap image, use this formula:

计算位图图像文件大小,使用以下公式:

Image file size = image width × image height × colour depth

图像文件大小 = 图像宽度 × 图像高度 × 颜色深度

Example: An image has dimensions 200 × 150 pixels and a colour depth of 8 bits. What is the file size in bytes?

示例:一幅图像尺寸为200 × 150像素,颜色深度为8位。文件大小为多少字节?

200 × 150 × 8 = 240,000 bits

240,000 ÷ 8 = 30,000 bytes

30,000 ÷ 1024 = 29.3 KB

Therefore the image file size is 30,000 bytes, which is approximately 29.3 KB.

因此,该图像文件大小为30,000字节,约等于29.3 KB。


11. Lossy and Lossless Compression | 有损压缩与无损压缩

Large files use more storage space and take longer to transmit. Compression is the process of reducing the file size. There are two types of compression you need to know.

大文件占用更多存储空间,并且传输时间更长。压缩是减少文件大小的过程。你需要了解两种压缩类型。

Lossless compression reduces file size without losing any data. The original file can be perfectly reconstructed. It works by finding repeated patterns and representing them more efficiently. Examples include text file compression and PNG image compression. This method is used when accuracy is essential, such as in medical images or text documents.

无损压缩在压缩文件时不会丢失任何数据,原始文件可以被完美重建。它通过查找重复模式并用更高效的方式表示来实现压缩。例子包括文本文件压缩和PNG图像压缩。在数据准确性至关重要的场景中,如医学图像或文本文档,通常使用无损压缩。

Lossy compression permanently removes some data from the file. The restored file is not exactly the same as the original, but the difference may be difficult to notice. Lossy compression achieves much smaller file sizes. Examples include MP3 audio files and JPEG images. It is acceptable for photos and music where perfect accuracy is not required.

有损压缩会永久性地移除文件中的部分数据,恢复后的文件与原始文件不完全相同,但这种差异可能难以察觉。有损压缩可以大幅减小文件大小。例子包括MP3音频文件和JPEG图像。对于不要求完美精确度的照片和音乐,使用有损压缩是可接受的。


12. Summary and Exam Tips | 总结与考试要点

In this article, we covered the three main forms of data representation: text, sound, and image. Text is encoded using character sets such as ASCII and Unicode. Sound is sampled in regular intervals with a specific sample rate and sample resolution. Images are stored as grids of pixels with a certain colour depth. File size calculations follow simple multiplication formulas, and compression helps reduce storage and transmission costs.

本文涵盖了三种主要的数据表示形式:文本、声音和图像。文本通过ASCII和Unicode等字符集编码;声音以固定间隔进行采样,涉及特定的采样率和采样分辨率;图像以具有特定颜色深度的像素网格存储。文件大小计算遵循简单的乘法公式,而压缩有助于降低存储和传输成本。

Before your CIE IGCSE exam, remember these key points:

在参加CIE IGCSE考试之前,请牢记以下要点:

  • Know the difference between bit, byte, KB, MB, and GB. | 掌握位、字节、KB、MB和GB之间的区别。
  • Memorise the three file size formulas for text, sound, and image. | 牢记文本、声音和图像三种文件大小的计算公式。
  • Remember that Unicode uses more bits per character than ASCII, giving a larger range of characters. | 记住Unicode每个字符使用的位数比ASCII多,因此字符范围更大。
  • Understand that increasing sample rate, sample resolution, or colour depth improves quality but increases file size. | 理解提高采样率、采样分辨率或颜色深度会提升质量,但也会增加文件大小。
  • Be able to explain why lossy compression cannot restore the original data, while lossless compression can. | 能够解释为什么有损压缩无法恢复原始数据,而无损压缩可以。
  • Always show your working in calculation questions and state the units clearly. | 在计算题中务必写出计算过程,并明确写出单位。

Published by TutorHao | Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version