Motion-Compensated Noise Reduction of B &W Motion Picture Films
Overview: motion-compensated codinginst.eecs.berkeley.edu/~ee290t/sp04/lectures/02-Motion... ·...
Transcript of Overview: motion-compensated codinginst.eecs.berkeley.edu/~ee290t/sp04/lectures/02-Motion... ·...
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 1
Overview: motion-compensated coding
Motion-compensated predictionMotion-compensated hybrid codingMotion estimation by block-matchingMotion estimation with sub-pixel accuracyPower spectral density of the motion-compensated prediction errorRate-distortion analysisLoop filterMotion compensated coding with sub-pixel accuracyRate-constrained motion estimation
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 2
Motion-compensated prediction
x
stationarybackground
t
previous frame
current frame
dxdy
time t
ymovingobject
Displacement vector shiftedobject
Prediction for the luminance signal S(x,y,t) within the moving object: S (x, y, t) = S(x dx , y dy , t t)
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 3
Motion-compensated hybrid coder
Intra-frame Decoder
Motion-Compensated
Predictor
0
Intra/Inter
Decoder-
CoderControl Control
DataIntra-frameDCT Coder DCTCoefficients
MotionData
MotionEstimator
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 4
Motion-compensated hybrid decoder
ControlData
Intra-frame Decoder
Motion-Compensated
Predictor
0
Intra/Inter
Decoder
DCTCoefficients
MotionData
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 5
Block-matching algorithm
Subdivide every image into square blocks.Find one displacement vector for each block.Within a search range, find a best match that minimizes an error measure.Intelligent search strategies can reduce computation.
search range inprevious frame
block of currentframe
Sk 1
Sk
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 6
Block-matching algorithm
Previous Image Current Image
Rectangular arrayof pixels is selectedas a measurement window
Measurement window iscompared with a shifted arrayof pixels in the other image, to determine the best match
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 7
Block-matching algorithm
Previous Image Current Image
. . . process repeated for anothermeasurement window position.
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 8
Blockmatching: Matching Criterion
Sum of Squared Differences to determine similarity
Alternative matching criteria: SAD (Sum of Absolute Differences), cross correlation, . . . Only integer pixel shifts are possible
2
1msmnt window
( , ) ( , ) ( , )x y k k x ySSD d d S x y S x d y d = + +
Current image
Previous image
Horizontal shift
Vertical shift
Sum all values in measurement
window
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 9
Integer Pixel Shifts
Previous Image Current Image
Rectangular arrayof pixels is selectedas a measurement window
Measurement window iscompared with a shifted arrayof pixels in the other image, to determine the best match
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 10
Integer Pixel Shifts
28 42 42 43 44 40 32 20 29 32 22
30 44 45 45 45 42 30 21 26 27 18
35 54 54 53 52 49 31 21 28 24 15
40 63 62 63 59 60 44 33 35 31 26
74 121 120 114 112 111 80 32 23 22 17
79 127 130 128 124 125 88 24 17 20 13
80 129 131 124 127 127 96 42 29 28 19
50 78 77 71 73 75 63 52 47 46 29
22 37 37 37 39 40 40 41 41 38 25
54 53 52 49 31 21
62 63 59 60 44 33
120 114 112 111 80 32
130 128 124 125 88 24
131 124 127 127 96 42
77 71 73 75 63 52
54 53 52 49 31 21
62 63 59 60 44 33
120 114 112 111 80 32
130 128 124 125 88 24
131 124 127 127 96 42
77 71 73 75 63 52
54 53 52 49 31 21
62 63 59 60 44 33
120 114 112 111 80 32
130 128 124 125 88 24
131 124 127 127 96 42
77 71 73 75 63 52
54 53 52 49 31 21
62 63 59 60 44 33
120 114 112 111 80 32
130 128 124 125 88 24
131 124 127 127 96 42
77 71 73 75 63 52
Rectangular arrayof pixels is selectedas a measurement window
Measurement window iscompared with a shifted arrayof pixels in the other image, to determine the best match
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 11
SSD Values Resulting from Blockmatching
05
1015 2 4
6 810 12
14
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
Horizontal shift dxVertical shift dy
SSD
Estimated displacementInteger-pixel accuracy
Estimated displacementInteger-pixel accuracy
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 12
Motion-compensated prediction: exampleCurrent framePrevious frame
Motion-compensatedPrediction error
Current frame withdisplacement vectors
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 13
Interpolation of the SSD Minimum
Fit parabola through3 points exactly
Sub-pixelAccurateMinimum
Horizontal shift dx
Fit parabolathrough >3 pointsapproximately
SSD
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 14
2-d Interpolation of SSD Minimum
ParaboloidPerfect fit through 6 pointsApproximate fit through >6 points
Horizontal
shift dx
Vertical shift dy
SSD
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 15
Blockmatching: search strategies I
All possible displacements within the search range are compared.Computationally expensiveHighly regular, parallelizable
Full search
dx
dy
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 16
Blockmatching: search strategies II
2D logarithmic search (Jain + Jain, 1981)
1
1
1
1
1
2
2
2
3
3
3
4
4
5
5
55
5
dx
dy
Iterative comparison of error measure values at 5 neighboring pointsLogarithmic refinement of the search pattern if
best match is in the center of the 5-point patterncenter of search pattern touches the border of the search range
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 17
Blockmatching: search strategies III
Computational complexity
Example: max. horizontal, vertical displacement = 6, integer-pel accuracy:
2D logarithmic full search
18 169
21 169
Block comparisons a b
a - for special vector (2,6)b - worst case
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 18
Block comparison speed-upsTriangle and Cauchy-Schwarz inequality for SAD and SSE
Strategy:Compute partial sums for blocks in current and previous frameCompare blocks based on partial sumsOmit full block comparison, if partial sums indicate worse error measure than previous best result
Performance: > 20x speed-up of full search block matching reported by employing [Lin + Tai, IEEE Tr. Commun., May 97]
Sum over 16x16 blockRow wise block projectionColumn wise block projection
Sk Sk 1block Sk Sk 1
block = Sk
block Sk 1
block
( )2 2
21 1 1
block block block block
1 1k k k k k kS S S S S SN N
=
number of terms in sum
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 19
Hierarchical blockmatching
current frame
previous frame
Block matching
Block matching
Block matching
Filtering and subsampling
Displacement vector field
Filtering and subsampling
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 20
Sub-pel accuracy
Block matching
Block matching
Block matching
Displacement vector field with integer-pel accuracy
Block matching
Interpolation
Displacement vector field with sub-pel accuracy
current frame
previous frame
Filtering and subsampling
Filtering and subsampling
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 21
Fractional-pixel accuracy
Interpolate pixel raster of the reference image to desired fractional pixel accuracy (typically by bi-linear interpolation)Straightforward extension of displacement vector search to fractional accuracyExample: half-pixel accurate displacements
4.54.5
x
y
dd
=
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 22
Bi-linear Interpolation
InterpolatedPixel Value
brightness
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 23
Bi-linear Interpolation (cont.)
I(x,y)
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 24
Model for performance analysis of an MCP hybrid coder
R-D optimal intraframe
encoder
intraframe decoder
motion compensated
predictor
e-
luminance signal S
e
s
displacement estimate
dxdy
+ x y
displacement errortrue displacement
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 25
Analysis of the motion-compensated prediction error
Motion-compensated signal
Prediction error
( ) ( ) ( )xc x s x n x=
( ) ( ) ( )( ) ( ) ( )x
e x s x c x
s x s x n x
=
= +Previousframe
Displacement error x
c(x) s(x)x
CurrentframeDisplacement dx
x
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 26
Analysis of m.c. prediction error (cont.)
Motion-compensated prediction error
Power spectrum of prediction error, assuming constant displacement error , statistical independence of s and n
Random displacement error , statistically independent from s, n
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )( ) ( ) ( )x xe x s x c x s x s x n x x x s x n x = = + = +
x( )( )
{ }( )( ) ( ) 1 1 ( )
2 ( ) 1 Re ( )
x x
x
j jee ss nn
jss nn
e e
e
= +
= +
x
{ }( ){ }{ }{ }( )( ){ }( )
( ) 2 ( ) 1 Re ( )
2 ( ) 1 Re ( )
2 ( ) 1 Re ( )
x
x
jee ss nn
jss nn
ss nn
E e
E e
P
= +
= +
= +
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 27
Analysis of m.c. prediction error (cont.)
What is P()?
Same as characteristic function of displacement error, except for signExtension to 2-d
( ) { }
( ) ( ){ }
x
x x
j
jx
P E e
p e d F p
=
= =
Fourier transform of the displacement error pdf!Fourier transform of the displacement error pdf!
{ }( )( , ) 2 ( , ) 1 Re ( , ) ( , )ee x y ss x y x y nn x yP = + noise spectrumFourier transform of the
displacement error pdfp( x , y )
power spectrum ofluminance signal
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 28
Power spectrum of motion-compensated prediction error
frequency x0
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 29
R-D function for MCP with integer-pixel accuracy
assumed uniformly distributed between
Gaussian signal model
Typical parameters for CIF resolution (352 x 288 pixels)
( x , y )T
x = 12
pel
y = 12
line
ss ( x , y ) = A 1+ x
2 + y2
02
32
~0.7 bpp
Minimum bit-rate for given SNR
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 30
Required accuracy of motion compensation
isotropic Gaussian pdf with variance
Typical parameters for CIF resolution (352 x 288 pixels)Minimum bit-rate for SNR = 30 dB
p( x , y )
ss (x ,y ) = A 1+x
2 + y2
02
32
2
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 31
Model of MCP hybrid coder with loop filter
e-
spatial filter
F
intraframe decoder
motion compensated
predictor
luminance signal S
R-D optimal intraframe
encoder
displacement estimate
dxd y
+ x y
displacement errortrue displacement
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 32
Motion-compensated prediction error with loop filter
e x( ) = s x( ) f x( )c x( )= s x( ) f x( )s x x( )+ f x( )n x( )
Prediction errorc x( ) = s x x( ) n x( )
Motion-compensated signal
Previousframe
Displacement error x
c(x) s(x)x
x
CurrentframeDisplacement dx
Impulse response of loop filter
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 33
Spatial power spectrum of m.c. prediction errorwith loop filter
{ }( )2 2( ) ( ) 1 | ( ) | 2Re ( ) ( ) ( ) | ( ) |ee ss nnF F P F = + +
P() 2 -D Fourier transform of displacement error pdfF() 2 -D Fourier transform of f (x, y)uu spatial spectral power density of signal u vector of spatial frequencies ( x , y )n(x, y) noise
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 34
Optimum loop filter
Wiener filter minimizes prediction error variance
Resulting minimum prediction error spectrum
opt( )( ) ( )
( ) ( )ss
ss nn
F P = +
accounts for noiseaccounts for accuracy of motion compensation
2 ( )( ) ( ) 1 | ( ) |( ) ( )
ssee ss
ss nn
P
= +
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 35
Effect of loop filter
Moderately accuratemotion compensation
Very accuratemotion compensation
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 36
Required accuracy of motion compensation with loop filter
isotropic Gaussian pdf with varianceMinimum bit-rate for SNR = 30 dBp( x , y ) 2
~0.8 bpp
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 37
Practical optimum loop filter design
Not practical for loop filter design
To determine Wiener filter from measurements:
opt( )( ) ( )
( ) ( )ss
ss nn
F P = +
Fopt () = sc () cc ()
c(x, y) = r(x d x , y d y )
cross spectrum between s(x,y) andthe motion-compensated signal
Noise psd not knownMotion compensation accuracy not known
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 38
Experimental evaluation of fractional-pixel motion compensation
ITU-R 601 TV signals, 13.5 MHz sampling rate, interlaced, blockwise motion compensation with blocksize16x16
Zoom Voiture
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 39
Influence of noise on theperformance of MCP
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 40
Motion Compensation Performance in H.263
Bit R
ate
[kbp
s]
PSNR [dB]
500
400
300
200
100
0 36 30 24
Intra mode only
Integer-pel accuracy
1/2-pel accuracy
Simulation details: Foreman, QCIF, SKIP=2 Q=4,5,7,10,15,25
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 41
Rate-constrained motion estimation I
displacement error variance
bit-r
ate
Rmotion vectorrate Rm
D
prediction errorrate Re
DRm
=DRe
optimum trade-off:
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 42
Rate-constrained motion estimation II
How to find best motion vector subject to rate constraint?Lagrangian cost function: solve unconstrained problem rather than constrained problem
min D + Rm( )
error measure motion vector rate
Interpret motion search as ECVQ problem.
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 43
Rate-constrained Motion Estimationin H.263 Reference Model TMN-10
0 50 100 150 20026
28
30
32
34
36
38
40
Bit Rate [kbps]
PSN
R [d
B]
TMN-10, w/o rate-constrained motion estimation (TMN-9)
TMN-10, w/ rate-constrained
motion estimation
0 50 100 150 2000
5
10
15
20
Bit Rate [kbps]Pa
rtial
bit-
rate
[kbp
s]
TMN-10, w/ rate-constrained
motion estimation
TMN-10, w/o rate-constrained motion estimation (TMN-9)
Simulation details: Foreman, QCIF, SKIP=2 Q=4,5,7,10,15,25 Annexes D+F
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 44
Video coder control
IntraframeDCT Coder
IntraframeDecoder
Motion-Compensated
Predictor
DecoderInput Video
Coder Control
-
ControlData
DCTCoefficients
Motion Data
0
Intra/Inter
Encoding decisionsCoding modes (intra/inter/motion comp.)Block sizeMotion vectorsQuantizer step sizeSuppression of DCT coefficients
SolutionEmbed rate-constrained motion estimation into mode decision with Lagrangian cost functionCouple Lagrange multiplier to quantizer step size
DifficultiesJoint entropy coding of side informationTemporal dependencies due to DPCM structure
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 45
History of motion-compensated coding
Intraframe coding: only spatial correlation exploitedDCT [Ahmed, Natarajan, Rao 1974], JPEG [1992]
Conditional replenishmentH.120 [1984] (DPCM, scalar quantization)
Frame difference codingH.120 Version 2 [1988]
Motion compensation: integer-pel accurate displacementsH.261 [1991]
Half-pel accurate motion compensationMPEG-1 [1993], MPEG-2/H.262 [1994]
Variable block-size motion compensationH.263 [1996], MPEG-4 [1999]
Complexityincreases
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 46
Efficiency of motion-compensated coding
0 100 200 300 400 50026
28
30
32
34
36
38
Integer-pelmotion
compensation(H.261 1991)
Half-pelmotion
compensation(MPEG-1 1993)
State-of-the-Art:TMN-10Variable
block sizemotion
compensation(H.263 1998)
Framedifference
coding(H.120 1988)
IntraframeDCT coding(DCT 1974, JPEG 1992)
67 %
PSNR[dB]
?
Foreman10 Hz, QCIF
100 frames encoded
Bit-Rate [kbps]
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 47
Efficiency of motion-compensated coding
Mother & Daughter10 Hz, QCIF
100 frames encoded
0 100 200 300 40028
30
32
34
36
38
40
42
IntraframeDCT coding
(JPEG)
ConditionalReplenishment
(H.120)
PSNR[dB]
Variableblock size
motioncompensation(H.263 1996)
60 %
Bit-Rate [kbps]
-
Bernd Girod: EE398B Image Communication II Motion Compensation no. 48
Efficiency of motion-compensated coding
PSNR[dB]
Bit-Rate [kbps]
Mobile & Calendar10 Hz, QCIF
100 frames encoded
0 500 1000 150022
Variableblock size
motioncompensation(H.263 1996)
Integer-pelmotion
compensation(H.261 1991)
IntraframeDCT coding
(JPEG)
35 %40 %
403836343230282624
Overview: motion-compensated codingMotion-compensated predictionMotion-compensated hybrid coderMotion-compensated hybrid decoderBlock-matching algorithmBlock-matching algorithmBlock-matching algorithmBlockmatching: Matching CriterionInteger Pixel ShiftsInteger Pixel ShiftsSSD Values Resulting from BlockmatchingMotion-compensated prediction: exampleInterpolation of the SSD Minimum2-d Interpolation of SSD MinimumBlockmatching: search strategies IBlockmatching: search strategies IIBlockmatching: search strategies IIIBlock comparison speed-upsHierarchical blockmatchingSub-pel accuracyFractional-pixel accuracyBi-linear InterpolationBi-linear Interpolation (cont.)Model for performance analysis of an MCP hybrid coderAnalysis of the motion-compensated prediction errorAnalysis of m.c. prediction error (cont.)Analysis of m.c. prediction error (cont.)Power spectrum of motion-compensated prediction errorR-D function for MCP with integer-pixel accuracyRequired accuracy of motion compensationModel of MCP hybrid coder with loop filterMotion-compensated prediction error with loop filterSpatial power spectrum of m.c. prediction error with loop filterOptimum loop filterEffect of loop filterRequired accuracy of motion compensation with loop filterPractical optimum loop filter designExperimental evaluation of fractional-pixel motion compensationInfluence of noise on theperformance of MCPMotion Compensation Performance in H.263Rate-constrained motion estimation IRate-constrained motion estimation IIRate-constrained Motion Estimationin H.263 Reference Model TMN-10Video coder controlHistory of motion-compensated codingEfficiency of motion-compensated codingEfficiency of motion-compensated codingEfficiency of motion-compensated coding