encoding.info
You are hereSourcePredictionTransformEntropy codingFiltersFramesDecisionsRate controlPerceptionQualityBitstreamSettingsEncoder map
Page 4 of 4 in Measuring quality

Test design pitfalls

Measuring quality · concept · added 2026-11-15

In Brief:
An encoder comparison is an experiment. Settings, source preparation, metric, picture size and pooling can each change its conclusion with no change to the encoder's code. Choose them to fit the question the test is meant to answer, and report them.

An encoder comparison is a small experiment: encode, measure, summarize, compare. Each step has a choice in it that can change the conclusion with no change to the encoder's code. This page collects the ones the last three pages ran into, and shows one more with numbers: how per-frame scores are pooled into one.

Four places a test can go wrong

1. Encode
Were both encoders set up for the same goal?
2. Measure
Which metric, at what picture size?
3. Pool
How did many frame scores become one?
4. Compare
Curves or single points? How much content?
Conceptual illustration: the four steps of a comparison, each with the question to ask of it.

Pool the same frames two ways

Twenty frames: ten of the cat out of focus, then ten with grain. At the left end of the slider every frame is coded at quantization parameter (QP) 28. Moving right codes the soft frames finer and the grainy frames coarser by the same number of steps. Peak signal-to-noise ratio (PSNR) is computed per frame, then summarized two ways. The mean of the frame values averages decibels. The pooled-error value averages the frames' squared error first and converts once. The demo treats every frame as equally long and measures luma only. x264 prints both kinds, weighting each frame by its duration: "Mean" averages the frame values of one plane, and "Global" converts the squared error of all planes and frames once.

22 and 34
← 28 for every frame16 soft, 40 grainy →
Frame 1
Decoded
Frame 11
Decoded
PSNR of each frame, dB, against frame number
Gray: each frameTeal dashes: mean of frame valuesCoral dots: pooled error
Mean frame PSNR
Pooled-error PSNR
Worst frame
Modeled bits change

Simplified demo: the frames are invented and each is coded on its own, intra only, in 4×4 blocks at the nominal H.264 step, luma only. Modeled bits charge each nonzero level the length of a signed Exp-Golomb code and each zero half a bit, an invented price list; the change is against QP 28 for every frame. The shaded half of the plot is the grainy frames. No rate control runs: the slider stands in for an encoder that quantizes easy frames finer and hard frames coarser, and the total of modeled bits changes with it. The line of differences subtracts the two-decimal values shown.

At QPs 22 and 34:

Neither summary is wrong, and neither says which allocation a viewer would prefer. They answer different questions, so a result has to say which one it is.

For frames of equal size and weight the pooled value is never above the mean of frame values.

The two formulas, and the gap in this demo
Mean frame PSNR =
  10 × log10(255² / G)
Pooled-error PSNR =
  10 × log10(255² / A)

G is the geometric mean of the frames' mean squared errors and A is their arithmetic mean. An arithmetic mean is never below a geometric mean, which fixes the order of the two summaries, and they agree only when every frame has the same error. Here they are 0.38 dB apart at QP 28 for every frame and 8.20 dB apart at the right end.

A checklist

Each item, with its reason
  • Decide the question before the settings. To ask how efficiently an encoder can code for a metric, use settings meant for that metric and say so: x264 has --tune psnr and --tune ssim for it, and warns when PSNR or structural similarity is measured with its psychovisual optimization on. To ask how a configuration you will deploy behaves, keep its settings, measure that output with each metric, and look at it. Encoding again with another tuning for each metric answers the first question, not the second. Where encoding effort matters to the conclusion, record the preset, encoding time, hardware and threads; a preset's name does not make two encoders' effort equal.
  • Line the pictures up, and keep a record. Match frames, crop, size, bit depth and color range before scoring: an offset of one frame changes a full-reference score by itself. Keep the source, encoder version and command line, achieved bitrate, metric version or model, scaler and pooling rule with the result.
  • Measure at one size, chosen for the metric's model and the viewing setup. For a smaller decode with a full-size reference, the documentation of Video Multi-Method Assessment Fusion (VMAF) says to scale the decode up to the reference's size before measuring, and not to compare scores computed at different sizes.
  • Say how frames were pooled. VMAF reports the plain mean of its frame scores by default, and its documentation lists a pooling option in several of its command-line tools: harmonic mean, median, minimum and low percentiles. Say whether frames count equally or by duration, and for several clips give each clip's result beside the aggregate.
  • Compare curves, not points. Equal QP is not equal bitrate. Use several points a side and report the range they cover.
  • Use more than one kind of content. On the previous page the best picture size at 1000 bits differed between two versions of one cat.
  • Look at the pictures. Metrics disagree, and none of these pages measured a viewer.

Sources

Read 2026-11-15 and 2026-11-16, at the commits linked.