ONE STAGE OF A CHAIN — WHAT ARRIVES, WHAT LEAVES, WHAT BREAKS DOWNSTREAM
Where This Sits In The Encoding Pipeline
A video encoder is not one algorithm but eight stages in a fixed order, and the order is not arbitrary: each stage exists because the one before it made its job possible. This tool models one of them. The chain below links to the other seven.
Motion Estimation Simulator — finds where each block moved to, then codes the difference instead of the block
- What arrives
- A P or B frame together with its reference frames.
- What leaves
- A motion vector per block, and a residual — precisely what the prediction got wrong.
- What the next stage assumes
- Quantization receives a residual, not a picture. Residuals sit close to zero almost everywhere, which is exactly why quantizing them is cheap.
- What goes wrong here
- A poor match does not produce a wrong picture, it produces an expensive one. The residual carries more energy, and the same quantizer setting then emits more bits for it. This stage changes the size of the output rather than any of its settings.
Problem solved in full
-
The search window derived from 225 positions per block 5 steps
A full motion search checks 225 positions per block, 14 400 in total. Work out the search window from that, and what a fast search buys.
-
225 is a perfect square, and that is the clue: the search is a square window of 15 by 15 candidate displacements, which means −7 to +7 pixels in each direction.
-
Dividing the total by the per-block count gives the number of blocks the frame was cut into.
-
The cost grows with the square of the search radius, so widening the window is expensive fast: radius 7 costs 225 positions, radius 15 costs 961, radius 31 costs 3969.
-
That quadratic is why fast searches exist. A three-step search samples nine points, refines, and repeats — 27 positions instead of 225.
-
Eight times cheaper, and not equivalent: it descends toward a local minimum and can walk past the true best match if the error surface has more than one dip.
Answer
The tool prints 14400 points searched at 225.0 per block. The trade is the whole of practical video encoding: full search is optimal and quadratic in the radius, so every encoder ships a heuristic instead and accepts occasionally choosing a worse vector. You can see half the cost of being wrong in the Residual Energy (MSE) row: a bad vector leaves a larger residual, and a larger residual is more data to code. Fast motion search is not an approximation to save time in the abstract; it is a bet that the bits lost to imperfect vectors are fewer than the bits you could spend elsewhere.
-
References (2)
- Block matching and motion vectors as the standard uses them: T. Wiegand, G. J. Sullivan, G. Bjontegaard and A. Luthra, "Overview of the H.264/AVC video coding standard." IEEE Transactions on Circuits and Systems for Video Technology 13(7), 560–576, 2003.
- The diamond search this tool implements alongside full search: S. Zhu and K.-K. Ma, "A new diamond search algorithm for fast block-matching motion estimation." IEEE Transactions on Image Processing 9(2), 287–290, 2000.