Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computer Science - Lecture 2

Similar presentations


Presentation on theme: "Introduction to Computer Science - Lecture 2"— Presentation transcript:

1 Introduction to Computer Science - Lecture 2
Representation of information

2 Binary negative numbers
In order to represent binary positive and negative numbers, one has to assign the first bit for the sign. (0 1011)2=(11)10 (1 1011)2=(-11)10

3 Representation of real numbers
Real numbers can be written in the fixed point notation: (1100,11)2=1*23+1*22+0*21+0*20+1*2-1+1*2-2=12,75

4 Representation of real numbers
Computers use floating point notation It consists of: s - sign (0 - positive, 1 - negative) m - mantissa c - exponent The value of the number in this notation equals: (-1)s (m)2 2c

5 Representation of real numbers
Caution! Mantissa is normalized, i.e. its values are from the set [1,2) As every number in this set can be written as 1,xxxxx, the starting 1 is omitted. As a result, the mantissa 101 is really (1,101)2=(1,625)10 Caution (one more time)! The first bit of the exponent is for the sign. Exponents can be negative.

6 Representation of real numbers
Example: let’s compute the decimal value of x, written with: sign=0, mantissa=1011, exponent=11 x = (-1)0 * (1,1011)2 * (2-1)10 =(1,6875*0.5)10=(0,84375)10

7 Representation of real numbers
Example: let’s convert (3,125)10 to a floating point binary number Step 1: convert the number to binary in floating point notation (3,125)10 = (11,001)2 Step 2: this can be interpreted as s=0, m=11,001, c=0. Now let’s normalize the mantissa: (11,001)2 = 1,1001 * 21 Which yields: s=0 m=1001 c=01

8 Representation of numbers
There is a limited number of numbers to be stored on a fixed number of bits (in the fixed point and floating point notations). Let’s consider, what is the largest number to be stored on 11 bits in the fixed point and floating point notations. In floating point notation, more bits equal better accuracy.

9 Text representation The simplest method of text encoding: let’s assign a number to each character. Standard implementation of the above idea: ASCII (

10 Text representation What about diacritics? - code pages.
Polish diacritics are encoded with: latin2 (ISO ) or Win (CP1250) Nowadays, the Unicode is commonly used. It is implemented in encodings UTF- 8 and UTF-16.

11 Picture representation - color models
In computer graphics it is crucial to represent a color with numbers. Various color models are used, e.g.: RGB CMYK

12 RGB Colors are mixed according to the additive rule of color mixing.

13 RGB Three numbers: R (red), G (green), B (blue) denote the share of each base color in the encoded color. The numbers are written in the hexadecimal system.

14 CMYK Colors are mixed according to the subtractive rule of color mixing.

15 CMYK

16 Sound Acoustic waves (also known as sound waves) are a type of longitudinal waves that propagate by means of adiabatic compression and decompression. Sound - auditory sensation, caused by some soundwaves. There are 4 main properties of sound: Frequency Volume Duration Tone color (timbre)

17 Sound Sound frequency is the frequency of the acoustic wave.
Frequency is measured in Herz (Hz = 1/s) Musical scale is exponential.

18 Sound Auditory spectrum for humans is 16 Hz – 20 000 Hz (=20 kHz)
Dogs have: 15 Hz – Hz Lower sounds - infrasounds, higher - ultrasounds Frequencies > 10 GHz – hypersounds

19 Sound conversion

20 Sampling During conversion of the sound wave to digital data, the signal is sampled. Sampling - process of creating a discrete signal representing the continuous signal with a sequence of values called samples. Samples are taken in regular intervals.

21 Sampling

22 Sampling Sampling interval Ts – time between taking each of the samples Sampling rate – inverted sampling interval. How to choose the sampling rate? Sampling theorem Nyquist-Kotielnikov-Shannon: If a function x(t) contains no frequencies higher than B hertz, it is completely determined by giving its ordinates at a series of points spaced 1/(2B) seconds apart.

23 Sampling - aliasing

24 Sampling In typical scenarios the sampling frequency of Hz is used.

25 Films Digitalized films are defined by a series of parameters.
Each of the parameters is standarized.

26 FPS Frames Per Second The amount of still frames displayed in one second of the film. FPS varied between 6-8 in early cameras to 120 in modern, professional equipment.

27 Interlacing/progressive scan
Interlacing is a technique used to boost FPS It consists in showing frames cut in narrow horizontal lines. In one frame, every even numbered line is not shown, while in another frame - every odd numbered line is blacked out. Interlacing was a standard in television broadcast (PAL, SECAM, NTSC)

28 Aspect ratio

29 Screen resolution Resolution is a number of single pixels in each dimension. The higher resolution, the better image quality. Television broadcast standards contain the information on resolution.

30 Screen resolution - television standards
Standard-definition television (SDTV): 480i (with interlace; standard NTSC uses 486i) 576i (PAL, 720 × 576 with interlace 2 times 288 lines) Enhanced-definition television (EDTV): 480p (720 × 480 progressive scan) 576p (720 × 576 progressive scan) High-definition television (HDTV): 720p (1280 × 720 progressive scan) 1080i (1920 × 1080 with interlace 2 times 540 linii) 1080p (1920 × 1080 progressive scan)

31 Thank you for your attention!


Download ppt "Introduction to Computer Science - Lecture 2"

Similar presentations


Ads by Google