Overview: Motion-Compensated Coding
Total Page:16
File Type:pdf, Size:1020Kb
Overview: motion-compensated coding Motion-compensated prediction Motion-compensated hybrid coding Motion estimation by block-matching Motion estimation with sub-pixel accuracy Power spectral density of the motion-compensated prediction error Rate-distortion analysis Loop filter Motion compensated coding with sub-pixel accuracy Rate-constrained motion estimation Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 1 Motion-compensated prediction previous frame stationary Δt background current frame x time t y moving object ⎛ d x ⎞ „Displacement vector“ ⎜ d ⎟ shifted ⎝ y ⎠ object 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 Compensated Coding no. 2 Combining transform coding and prediction Transform domain prediction Space domain prediction Q Q T - T - T T −1 T −1 T −1 PT T PTS T T −1 T−1 PT PS Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 3 Motion-compensated hybrid coder Coder Control Control Data Intra-frame DCT DCT Coder - Coefficients Decoder Intra-frame Decoder 0 Motion- Compensated Intra/Inter Predictor Motion Data Motion Estimator Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 4 Motion-compensated hybrid decoder Control Data DCT Coefficients Decoder Intra-frame Decoder 0 Motion- Compensated Intra/Inter Predictor Motion Data Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 5 Block-matching algorithm search range in Subdivide current reference frame frame into blocks. Sk −1 Find one displacement vector for each block. Within a search range, find a best „match“ that minimizes an error measure. Intelligent search strategies can block of current reduce computation. frame Sk Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 6 Block-matching algorithm Reference frame Current frame Block is compared with a Block of pixels is considered shifted array of pixels in the reference frame to determine the best match Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 7 Block-matching algorithm Reference frame Current frame . process repeated for the next block Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 8 Blockmatching: Matching Criterion Sum of Squared Differences to determine similarity Sum of all Current Reference values in block frame frame 2 ⎡ ⎤ SSD(,dxyd )=−∑ ⎣Sk(x,y)Sk−1(x +dx,y +d y)⎦ x,y∈Block Horizontal Vertical shift shift Alternative matching criteria: SAD (Sum of Absolute Differences), cross correlation, . Only integer pixel shifts (so far) Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 9 Integer Pixel Shifts Reference frame Current frame Block is compared with a Block of pixels is considered shifted array of pixels in the reference frame to determine the best match Bernd Girod: EE398B Image Communication II Motion Compensated Coding 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 54 53 52 49 31 21 35 54 54 5453 545352 54535249 53524931 52493121 49312128 312124 2115 62 63 59 60 44 33 40 63 62 6263 626359 62635960 63596044 59604433 60443335 443331 3326 120 114 112 111 80 32 74 121 120 120114 120114112 120114112111 114112111 80 112111 8032 111 803223 803222 3217 130 128 124 125 88 24 79 127 130 130128 130128124 130128124125 128124125 88 124125 8824 125 882417 882420 2413 131 124 127 127 96 42 80 129 131 131124 131124127 131124127 124127 96 127 9642 127 964229 964228 4219 77 71 73 75 63 52 50 78 77 7771 777173 77717375 71737563 73756352 75635247 635246 5229 22 37 37 37 39 40 40 41 41 38 25 Block is compared with a Block of pixels is considered shifted array of pixels in the reference frame to determine the best match Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 11 SSD Values Resulting from Blockmatching 1.6 SSD1.4 1.2 1 0.8 0.6 0.4 Estimated displacement 0.2 Estimated displacement Integer-pixelInteger-pixel accuracy accuracy 0 14 0 12 5 10 8 10 6 Ve 15 2 4 d rtical shift x shift ntal dy Horizo Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 12 Motion-compensated prediction: example Previous frame Current frame Current frame with Motion-compensated displacement vectors Prediction error Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 13 Interpolation of the SSD Minimum SSD Sub-pixel Accurate FitFit parabolaparabola Minimum throughthrough 3>3 points points exactlyapproximately Horizontal shift dx Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 14 2-d Interpolation of SSD Minimum Paraboloid Perfect fit through 6 points Approximate fit through >6 points SSD V e rt ic a l s Bernd Girod: EE398B I h i ft d y mage Communication II Horizontal shift dx Motion Compensated Coding no. 15 Blockmatching: search strategies I Full search ••••••••••••• All possible displacements ••••••••••••• within the search range are ••••••••••••• ••••••••••••• compared. ••••••••••••• Computationally expensive ••••••••••••• d x ••••••••••••• Highly regular, parallelizable ••••••••••••• ••••••••••••• ••••••••••••• ••••••••••••• ••••••••••••• ••••••••••••• d y Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 16 Blockmatching: search strategies II 2D logarithmic search [Jain + Jain, 1981] Iterative comparison of error • • • • 3 •5 •4 •5 measure values at 5 neighboring 5 5 5 • • • • points 3 2 3 4 • • • Logarithmic refinement of the 2 1 2 d x • • • search pattern if 1 1 1 z best match is in the center of the 5- • 1 point pattern z center of search pattern touches the border of the search range d y Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 17 Blockmatching: search strategies III Diamond search [Li, Zeng, Liou, 1994] [Zhu, Ma, 1997] d y d x Start with If best match If best match does not lie large diamond lies in the center in the center of large pattern at of large diamond, diamond, center large (0,0) proceed with diamond pattern at new small diamond best match Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 18 Blockmatching: search strategies IV Most search strategies can be further accelerated by . Predictive motion search z Use median of motion vectors in causal neighborhood as starting point for search. z Additionally test zero-vector as a starting point Early termination z Interrupt summation to calculate SSD or SAD, if value grows too quickly (relative to previous best match) z Stop search, if match is “good enough” (SSD, SAD < threshold) Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 19 Block comparison speed-ups Triangle and Cauchy-Schwarz inequality for SAD and SSE ∑ Sk − Sk−1 ≥ ∑ Sk − Sk −1 = ∑ Sk − ∑ Sk −1 block block block block 22 2 11⎛⎞⎛⎞ ∑∑∑∑()SSkk−≥−−11⎜⎟⎜⎟ SSkk −= Sk − S k − 1 block NN⎝⎠⎝⎠block block block number of terms in sum Strategy: z Compute partial sums for blocks in current and previous frame z Compare blocks based on partial sums z Omit 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] z Sum over 16x16 block z Row wise block projection z Column wise block projection Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 20 Hierarchical blockmatching Displacement vector field Block matching current frame previous frame Filtering and Block subsampling matching Filtering and Block subsampling matching Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 21 Sub-pel accuracy Displacement vector field with 1/2-pel accuracy Block matching Displacement vector field with Interpolation integer-pel accuracy Block matching current frame previousframe Filtering and Block subsampling matching Filtering and Block subsampling matching Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 22 Sub-pel accuracy Interpolate pixel raster of the reference frame to desired fractional pel accuracy (e.g., by bi-linear interpolation) Straightforward extension of displacement vector search to fractional accuracy Example: half-pel accurate displacements ••••••••••••• ••••••••••••• ••••••••••••• •••• ••••••••••••••••• d ••••••••••••• ⎛⎞x ⎛⎞4.5 •••• ⎜⎟=⎜⎟ ••••••••••••••••• d 4.5 ••••••••••••• ⎝⎠y ⎝⎠ ••••••••••••• ••••••••••••• ••••••••••••• ••••••••••••• ••••••••••••• ••••••••••••• Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 23 Bi-linear Interpolation brightness Interpolated Pixel Value Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 24 Bi-linear Interpolation (cont.) I(x’,y’) Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 25 Model for performance analysis of an MCP hybrid coder luminance signal S e R-D optimal intraframe - encoder intraframe decoder e‘ motion s‘ compensated predictor displacement estimate ⎛ dx ⎞ ⎛ Δ x⎞ true displacement ⎜ ⎟ + ⎜ ⎟ displacement error ⎝ d y⎠ ⎝ Δ y⎠ Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 26 Analysis of the motion-compensated prediction error Motion-compensated signal cx( ) =−Δ− sx( x ) nx( ) Prediction error Previous ex( ) =− sx( ) cx( ) frame =−−Δ+sx() sx (x ) nx () x s(x) Current c(x) frame Displacement dx Displacement error Δx x Bernd Girod: EE398B Image Communication II Motion Compensated Coding no. 27 Analysis