Media Compression · Study deck
Media Compression Mechanics: Audio, Image, and Video — Part 2
T is the target block and R is the reference frame indexed relative to the target block’s origin.
Broker Bex is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Explain how a masking threshold lets an audio encoder remove perceptually irrelevant
- Explain: T is the target block and R is the reference frame indexed relative to the target block’s origin.
- Explain: The reconstructed block for each choice is then its prediction.
- Explain: At (2,0) pixels, P1=[100105101106] levels, so SAD is 0+1+1+0=2 levels summed over four samples.
Major section
Motion information identifies a reference prediction
The reference supplies a prediction while the residual preserves its unexplained difference.
- A bounded search can select a low-distortion reference candidate.Sum of absolute differences compares the target with displaced reference samples to find the candidate used for prediction.
- The selected displacement is the motion vector.The decoder can apply that vector to its reference frame to construct the same predicted block.
- The residual is the target minus its prediction.The chapter writes E=T-P, preserving the information that the shifted reference block failed to explain.
- A good prediction can leave smaller and less structured residual values.The encoder still needs motion information and a transformed, quantized, entropy-coded residual before transport can carry the result.
I am matching a target video block against candidates in an earlier reference frame. I need a displacement and the remaining difference before deciding how much the reference actually explains.
Major section
Five small residuals make a promising prediction
A sparse small-valued residual is a useful candidate for economical coding.
- The worked residual has five non-zero samples among sixteen positions.Every non-zero magnitude is one, so the prediction leaves a sparse, small-valued block for the transform stage.
- The transform can describe what the prediction missed.Motion compensation changes the transform input to the residual instead of replacing transform and quantization.
- The decoder needs both prediction and decoded residual information.The decoded block is prediction plus decoded residual; lossy quantization can make it differ from the original target.
- Sparse residuals are promising inputs rather than guaranteed mode winners.The encoder must count the motion information and coded residual before deciding whether prediction costs less than an intra block.
Activity 1 · Work it out
✎ Count the residual before choosing a mode

I need the residual count before I believe this prediction saves bits.
Copy these residual rows: 0,0,1,0; 0,-1,1,0; 0,0,0,0; 1,0,0,-1. Count non-zero samples and their magnitudes. Explain why a scene cut can reverse the prediction advantage.
4 minutes · Pen and paper · Answer: Activity 1
Major section
Mode costs and rate examples need honest boundaries
A coding advantage must survive the actual mode comparison and the evidence behind the reported rates.
- A scene cut can make an intra block cheaper than prediction.A poor reference leaves a large residual whose cost, plus motion information, may exceed a self-contained coded block.
- The lecture’s rate ranges are examples rather than current codec targets.Wideband audio is listed at 224 kbps raw and 8-12 kbps compressed, with results dependent on content and settings.
- The raw-video comparison can illustrate scale without promising a universal result.The 720p example is 530 Mbps raw versus 0.768-1.536 Mbps compressed, described as about 345-690 times reduction.
- The still-image row cannot support an honest compression ratio.The printed 30-300 MB compressed range is larger than the 3.14 MB raw image, so no honest compression ratio follows.
Major section
Under the Hood: Predict Motion, Then Code the Error (continued)
Prediction has changed what the transform must describe; it has not replaced the transform.
- A has the smallest sum, so its displacement supplies the motion vector and its samples supply the prediction.
- In reconstruction, the decoder fetches the same prediction and adds the decoded residual.
- This gives the residual matrix above.
Major section
Under the Hood: Predict Motion, Then Code the Error (continued)
The mean absolute error is 5/16=0.3125.
- Quantization can change residual samples, so a decoded block may differ from the target.
- If a scene cut makes most residual magnitudes large, the motion vector plus residual can cost more than intra coding.
- B has seven, so DB=7×12=7.
Major section
Under the Hood: Predict Motion, Then Code the Error (continued)
Five absolute differences are 1 and the rest are 0, so SADA=5.
- Candidate B has the same samples as A except that row 1, column 1 and row 3, column 2 are each one greater.
- Each change adds 1 to the sum, so SADB=5+1+1=7.
- Candidate C has the same samples as B except that row 3, column 1 is one greater.
Major section
Under the Hood: Predict Motion, Then Code the Error (continued)
This chapter supplies the lower mechanism: references produce predictions, predictions produce residuals, and residuals still traverse transform, quantization, and lossless packing.
- Real-Time Protocol Workflows owns the RTP/RTCP hand-off shown at the source diagram's boundary; it is not re-taught here.
- To compare coded choices, an encoder can score each decoded reconstruction with J=D+λR.
- Real totals and decoded residuals depend on the coding choices.
Major section
Under the Hood: Predict Motion, Then Code the Error (continued)
A has five errors of magnitude 1, so DA=5×12=5.
- Their value is the scale of the mechanism's payoff and the reminder that content and encoder settings control the result.
- It may have intended kBytes, but this chapter does not guess.
- A product record should instead measure the actual images, encoder, quality setting, and decoder path.
Major section
Audio, images, and video control different errors
The audio, image, and video mechanisms each have a distinct limit on acceptable loss.
- Masking can hide selected audio error below a signal-dependent threshold.An exceeded threshold can make distortion audible, so noise placement needs the intended listening conditions.
- The DCT can concentrate image energy before quantization discards detail.JPEG ordering can expose the resulting zeros to compact packing without being the stage that creates lossy rounding.
- Video prediction can reduce the information that residual coding must describe.A poor reference can instead make the combined vector and residual more expensive than an intra alternative.
- A defensible compression result needs content, settings, and valid units.The chapter’s rejected still-image range shows why an internally inconsistent comparison cannot become a measured saving.
Major section
Summary (continued)
Motion compensation builds a predicted block, and the residual keeps what the prediction missed.
- Error can exceed a perceptual threshold, and quantization discards detail.
- A poor motion predictor can cost more than an intra-coded block.
- Compression ranges depend on the content and settings used to measure them; they are not fixed traits of a codec.
Major section
media-compression-mechanics-audio-image-and-video (continued)
Psychoacoustic masking raises the hearing threshold in a way that depends on the sound.
- An audio coder can place some error below that threshold, where it is less audible.
- JPEG zig-zag order groups those zeros for run-length and entropy coding.
- For video, motion estimation selects a shift in a reference frame.
Deck summary
The receiver must still be able to use the result
The intended receiver and measured coding path define whether the saving is useful.
- An inaudible-looking error still needs a relevant listening test.A signal-dependent masking model guides distortion allocation but cannot make every listener and playback path equivalent.
- Image compression needs energy concentration, lossy rounding, and compact packing.DCT coefficients, quantization, zig-zag order, and entropy coding have distinct roles in the final representation.
- An earlier frame is useful only when its prediction earns a saving.The mode decision must compare the full motion-information and residual cost with the intra-coded alternative.
- A claimed reduction needs measurements with consistent quantities and units.Actual images, encoder settings, and decoder paths provide a sounder record than silently repairing the rejected still-image source range.
Retrieval practice
Recall check

Broker Bex says: answer from memory, then check your reasoning.
Q1A scene cut makes the best motion-compensated prediction differ greatly from the target block. What should the encoder conclude?
Show answer
Answer: C Motion compensation is a rate-distortion choice.
Print reference
Answers
Answer key.
- C · Motion compensation is a rate-distortion choice.
Print reference
Activity 1 answer
Model answer.
Work it out: Five of sixteen samples are non-zero and every magnitude is one. This is a sparse transform input. A scene cut may create many large residuals, making motion-vector plus residual cost exceed an intra-coded block; compare actual mode costs.