Sunteți pe pagina 1din 32

Digital Video

Multimedia
Digital Video
A digital camera samples the imaged scene as
discrete frames
Each frame consists of sample values that are
discrete both horizontally and vertically.
Let m and n be the integer indices in the horizontal
and vertical directions and let k be the frame number.
The actual spatial and temporal locations are
x=m
x
, y=m
y
, and k=m
t
.
We may use (m, n, k) to describe a digital video.
25/11/2013 Multimedia Coding and Processing 2
Digital Video
Let N
b
be the number of bits to represent a pixels colour
value.
N
b
= 8 for monochrome video and N
b
= 24 for colour
video.
The data rate, R, is determined by


where f
s,t
, f
s,x
, f
s,y
are the frame rate, samples per line,
and line number per frame respectively.
, , , s t s x s y b
R f f f N =
25/11/2013 Multimedia Coding and Processing 3
Digital Video
Each pixel is render as a rectangular region with a
constant colour for the pixel.
The ratio of the width to the height of this area is
known as Pixel Aspect Ratio (PAR).
PAR relates to the Image Aspect Ratio by


The display device should conform to this PAR to
avoid distortions.
, ,
/ .
s y s x
PAR IAR f f =
25/11/2013 Multimedia Coding and Processing 4
Digital Video
ITU-R developed the BT.601 to standardize the
digital TV format.
To convert a raster scan to a digital video signal,
one need only sample the 1D waveform.
If a total number of f
s,x
samples are taken per line,
the equivalent sampling rate is



, , , ,
.
s s x s y s t s x l
f f f f f f = =
25/11/2013 Multimedia Coding and Processing 5
Digital Video
The sampling rate in BT.601 standard is chosen to
satisfy two constraints:
The horizontal sampling resolution should match the
vertical sampling resolution as close as possible. That is,

x

y
.
The same sampling rate should be used for NTSC and
PAL/SECAM and it should be a multiple of respective
line rates. Thus,
f
s,x
IAR* f
s,y
.

Using f
s
= f
s,x
* f
l
and f
l
= f
s,t
* f
s,y
, we have
f
s
IAR* f
2
s,y
* f
l
.

25/11/2013 Multimedia Coding and Processing 6
Digital Video
f
s
11 and 13 MHz for NTSC and PAL/SECAM.
A number that is closest to both numbers and
satisfies the second criterion is then chosen. We
have
f
s
= 858* f
l
(NTSC) = 864* f
l
(PAL/SECAM) =13.5 MHz.

This gives the 525/60 and 625/60 signals.
25/11/2013 Multimedia Coding and Processing 7
Digital Video
25/11/2013 Multimedia Coding and Processing 8
Active
Area
720 pels
858 pels
122
pels
16
pels
480
lines
525
lines
Active
Area
720 pels
864 pels
132
pels
12
pels
576
lines
625
lines
NTSC PAL/SECAM
Digital Video
Note that both formats have the same
number (720) of active pixels/line.
Note that the pixel width-to-height ratio is not
1.
PAR=
x
/
y
= IAR*f '
s,y
/f '
s,x
PAR
NTSC
= (4/3)*480/720 = 8/9
PAR
PAL
= (4/3)*576/720 = 16/15
25/11/2013 Multimedia Coding and Processing 9
Digital Video - BT.601
BT.601 also uses the YCbCr representation.
The YCbCr values (0-255) are related to the RGB
values (0-255) by
0.257 0.504 0.098 16
0.148 0.291 0.439 128
0.439 0.368 0.071 128
b
r
Y R
C G
C B
( ( ( (
( ( ( (
= +
( ( ( (
( ( ( (


25/11/2013 Multimedia Coding and Processing 10
Digital Video - BT.601
The inverse relation is
1.164 0.000 1.596 16
1.164 0.392 0.813 128
1.164 2.017 0.000 128
b
r
R Y
G C
B C

( ( (
( ( (
=
( ( (
( ( (


25/11/2013 Multimedia Coding and Processing 11
Spatial Sampling Rate
Human eyes are less sensitive to colour differenc than
brightness.
Chrominance values are sampled at lower frequency than
the luminance value.
4:2:2 format. Each chrominance component, Cb and Cr,
are usually sampled at half of the sampling rate of the
luminance component.
4:1:1 format. Each chrominance component is sampled at
of the sampling rate of the luminance component.
4:2:0 format. Each chrominance component is sampled at
of the sampling rate both horizontally and vertically.
4:4:4 format. The chrominance values are sampled at the
same rate as the luminance values.
25/11/2013 Multimedia Coding and Processing 12
Chrominance Subsampling
25/11/2013 Multimedia Coding and Processing 13
4:2:2 format
Each 22 Y pixels
2Cb & 2Cr pixels
(horizontal subsampling)
4:1:1 format
Each 22 Y pixels
1Cb & 1Cr pixels
(4:1 horizontal subsampling)
Y
Cb
Cr
Chrominance Subsampling
25/11/2013 Multimedia Coding and Processing 14
4:4:4 format
Each 22 Y pixels
4Cb & 4Cr pixels
(no subsampling)
4:2:0 format
Each 22 Y pixels
1Cb & 1Cr pixels
(2:1 subsampling both
horizontally and vertically)
Y
Cb
Cr
Video Quality Measure
( ) ( ) ( )
2
2
1 2
,
1
, , , ,
e
k m n
MSE m n k m n k
N
o = =

25/11/2013 Multimedia Coding and Processing 15


Mean Square Error (MSE)


PSNR

Mean Absolute Difference (MAD)
( ) ( )
1 2
,
1
, , , ,
k m n
MAD m n k m n k
N
=

2
max max
10 10
2
10log 20log
e e
PSNR

o o
= =
Computer Video Formats
CGA Colour Graphics Adapter
Resolutions: 320 200 pixels with 4 colours (2 bits)
(320x200) pixels 2 bits/pixel = 15.625 KB/image
EGA Enhanced Graphics Adapter
Resolutions: 640 350 pixels with 16 colours (4 bits)
(640x350) pixels 4 bits/pixel = 109.375 KB/image
25/11/2013 Multimedia Coding and Processing 16
Computer Video Formats
VGA Video Graphics Array
Resolution: 640 x 480 pixels with 256 colours (8 bits)
(640x480) pixels x 8 bits/pixel = 300 KB/image
XGA Extended Graphics Array
Resolution: 640 x 480 pixels with 65,536 colours (16 bits) or 1024
x 768 pixels with 256 colours
(640x480) pixels x 16 bits/pixel = 600 KB/image
(1024x768) pixels x 8 bits/pixel = 768 KB/image
SVGA Super VGA
Resolution: 800 x 600 pixels with 16,777,216 colours (24 bits) or
1024 x 768 pixels with 65,536 colours (16 bits)
(800x600) pixels x 24 bits/pixel = 1.37 MB/image
(1024x768) pixels x 16 bits/pixel = 1.5 MB/image
25/11/2013 Multimedia Coding and Processing 17
Sampling
Digitization of an analog waveform
Take samples at different temporal
locations
Frequency of taking samples: sampling rate
Amplitude of taken samples: quantization
Objective: To maintain the information of
the original analog waveform
25/11/2013 Multimedia Coding and Processing 18
Sampling Rate
Sampling rate is the no. of samples taken per unit time
Affects whether the no. of samples are enough to reproduce
the waveform.
25/11/2013 Multimedia Coding and Processing 19
time
0 1 2 3 4 5 6 7 8 9 10 11 12
E.g. if only 1 sample per period
Reproduced waveform
= a straight line
Nyquist Sampling Theorem
For lossless digitization, the sampling rate must be at
least twice of the maximum frequency
That is, at least 2 samples must be obtained within
each cycle. Otherwise, either the maximum or the
minimum amplitude in a period is gone; leading to
loss of information in the digitization process.
25/11/2013 Multimedia Coding and Processing 20
time
0 1 2 3 4 5 6 7 8 9 10 11 12
Sampling & Compression
When the sampling rate is reduced,
Fewer samples are accessed per unit time
Lower temporal resolution
Object size is reduced
The information of the higher frequency
waveforms is also lost
25/11/2013 Multimedia Coding and Processing 21
Quantization
Consider using a decimal number to describe a value. Each digit
has ten different values.
One digit specifies 10 different values (0-9)
Two digits specifies 100 different values (0-99)
Three digits specifies 1000 different values (0-999).
Each additional digit increases the range by 10 times.

Consider using a binary number to describe a sample value.
Each additional digit(bit) doubles the range of values.

25/11/2013 Multimedia Coding and Processing 22
Quantization
Quantization of a sample the mapping of
values to integral values in describing a
sample value. Mathematically,



No. of bits, N
b
= log
2
(no. of integral values)
25/11/2013 Multimedia Coding and Processing 23

) , ( sgn / ) , ( ) , ( y x U y x U y x V A =
Quantization
Analog: A continuous
slope
Digital: steps in the
stairs
25/11/2013 Multimedia Coding and Processing 24
Step size
More bits better resolution
More values(v) need more bits(b): v s 2
b

8 bits: 256 values
16 bits: 65,536 values
24 bits: 16,777,216 values
Affects the step size in the reproduced
waveform
More bits smaller step size better
sample quality
25/11/2013 Multimedia Coding and Processing 25
No. of Bits Affects Quality
Consider a sine value, original values in the sine curve are
0.707, 1.0, 0.707, 0, -0.707, -1.0, -0.707, 0, ...
Values in binary representation are
0.10110101, 1, 0.10110101, 0, -0.10110101, -1, -
0.10110101, 0,
25/11/2013 Multimedia Coding and Processing 26
time
0 1 2 3 4 5 6 7 8 9 10 11 12
No. of Bits Affects Quality
Values in 7-bit quantization are
0.101101, 1.000, 0.101101, 0.000, -0.101101, -1.000, -0.101101,
0.000,
Quantized value in decimal becomes
0.703125, 1, 0.703125, 0, -0.703125, -1, -0.703125, 0,

25/11/2013 Multimedia Coding and Processing 27
time
0 1 2 3 4 5 6 7 8 9 10 11 12
No. of Bits Affects Quality
Values in 4-bit quantization are
0.101, 1.000, 0.101, 0.000, -0.101, -1.000, -0.101, 0.000,
Quantized value in decimal becomes
0.625, 1, 0.625, 0, -0.625, -1, -0.625, 0,

25/11/2013 Multimedia Coding and Processing 28
time
0 1 2 3 4 5 6 7 8 9 10 11 12
Quantization and Compression
When the no. of integral values to represent a
sample is reduced,
The number of bits per sample is reduced
Lower sample resolution
Object size is reduced
The quality of each sample value is also reduced
25/11/2013 Multimedia Coding and Processing 29
Summary to Sampling and
Quantization
Digitization of the analog waveform involves
sampling and quantization.
Sampling rate must be at least twice of the
highest frequency to avoid loss of information
No. of bits in quantization affects the quality of
each sample value
Object size are reduced with loss of information
by lowering the sampling rate and number of
sample values.
25/11/2013 Multimedia Coding and Processing 30
Data Representations Summary
Computer graphics are represented using the coordinates on
the screen.
Computer animations are done by updating changes to the
frame buffers and these changes are drawn on the display
Images are represented as 2D pixels. Each pixel can be
represented using RGB, YUV, YCbCr, or CMYK.
A/D converters digitize an analog wave by taking samples of
amplitudes at fixed time intervals.
A video is represented as an array of frames. 24 to 30 frames
should be displayed per second to show full motions.
25/11/2013 Multimedia Coding and Processing 31
Exercise
A sine curve of maximum amplitude of 16 is sampled
at 6 times per cycle and the sample values are
quantized using 8 bits. Alternatively, the sine curve
may be sampled at 8 times per cycle and the sample
values are quantized using 6 bits.
Find the Mean Absolute Difference of each quantized
curves with the original sine curve.
Find the Mean Square Errors of the two quantized
curves.
Compare the PSNR of the two quantized curves.

25/11/2013 Multimedia Coding and Processing 32

S-ar putea să vă placă și