Upscaling HDR Photographs: What 16-bit Actually Buys You
"Upgrade to 16-bit before you upscale" is advice you will find in every second tutorial, and it is usually repeated without a number attached. So I measured it: a known ripple of known amplitude placed on a flat patch, pushed through a 4× downsample and a 4× bicubic upsample, with the intermediate quantised to 8 and to 16 bits. The result is not "16-bit is better". It is that 16-bit preserves the ripple to between 97.3% and 100.4% at every level I tested, while an 8-bit intermediate drops to 0% above display code 253 — and that the same 16 bits buy you nothing at all if you tone-map before you grade. Two different failures, two different fixes, and only one of them is about bit depth.
The setup, and why a real HDR file would not have made this easier
I do not have an HDR camera, and borrowing one would have replaced a measurement with a photograph. So the scene-referred master is built from a real 8-bit photograph with three operations, all of them stated:
- Linearise the sRGB photo (
srgb_dec), giving linear light in 0..1. - Multiply by a smooth exposure ramp of 1× at the left edge to 4× at the right, so the frame contains regions at genuinely different scene luminances rather than one flat level.
- Add one specular source, a Gaussian of σ = 91.8 px peaking at 40× the local level, placed at 86% of the width and 30% of the height — the dark right-hand third of the frame, which is where a real window or lamp would sit.
That float array is the master. Everything downstream — the tone map, the quantisation, the
resampling — is measured against it. The tone curve is Reinhard, L/(1+L), followed
by sRGB encoding; it is not the only tone curve in the world, and the numbers would shift with a
different one, but the shape of every result here comes from the sRGB encoding at the top of the
range, which is shared by every tone curve that ends in a display.
The reason a real HDR file would not have helped: the question is not "how much information does an HDR file contain" but "how much of it survives the trip to an 8-bit display and back". That trip is what I measure, and the source only needs to contain something above 1.0 in linear light, which the specular does by a factor of 40.
Experiment 1 — a known ripple, eight levels, two bit depths
A flat 128×128 patch at linear luminance L0 carries a sine of period 16 px and relative amplitude a in linear light. The patch is box-downsampled 4× in linear light (which is what a sensor does), tone-mapped, quantised, then bicubic-upsampled 4×. The recovered amplitude is measured by averaging the patch to a 1-D column profile — which divides quantisation noise by √128 — and fitting the known period to that profile. The same estimator is used for every variant, so a difference between rows is a difference in the data, not in the fitting.
The figure of merit is retention relative to the float pipeline, not relative to the ideal. The float pipeline itself only delivers 83.9–84.9% of the ideal amplitude, and that 15% is interpolation loss common to every variant; dividing it out leaves bit depth alone.
| Linear L₀ | Display code | Codes/stop | Ripple span (codes) | 8-bit, quantise after upscale | 8-bit, stored at low res | 16-bit |
|---|---|---|---|---|---|---|
| 0.02 | 38.3 | 16.94 | 8.60 | 99.3% | 92.9% | 100.0% |
| 0.20 | 113.5 | 32.11 | 17.87 | 99.7% | 103.3% | 100.0% |
| 1.0 | 187.5 | 25.67 | 17.09 | 101.0% | 94.0% | 100.0% |
| 4.0 | 231.1 | 11.00 | 8.42 | 101.0% | 96.0% | 100.0% |
| 16.0 | 248.3 | 3.28 | 2.67 | 105.1% | 94.3% | 100.1% |
| 32.0 | 251.6 | 1.69 | 1.40 | 108.4% | 114.2% | 100.1% |
| 64.0 | 253.3 | 0.86 | 0.71 | 110.0% | 0.0% | 100.2% |
| 128.0 | 254.1 | 0.43 | 0.36 | 0.0% | 0.0% | 99.9% |
Three things in that table matter more than the headline.
The 8-bit failure is a cliff, not a slope
At code 251.6 the 8-bit intermediate still delivers 108.4% of the float pipeline's amplitude — above 100%, because rounding can push an already-quantised signal up as easily as down. One row later, at code 253.3, the ripple spans 0.71 of a single code and the same pipeline delivers 0.0%. There is no gradual degradation to plan around; there is a threshold, and it sits where the ripple span drops below one code. Everything above it is not "slightly worse", it is empty. The 16-bit intermediate at the same level delivers 100.2%.
A 16-bit tone-mapped intermediate is nearly a no-op below the cliff
Between code 38 and code 232 the two depths are within 3% of each other, and the 8-bit one is sometimes ahead. That is not measurement noise: with a ripple spanning 8 to 18 codes, rounding to 8 bits costs almost nothing, and the residual difference is sub-code rounding that lands on either side. The whole benefit of 16 bits in this experiment is confined to the top ~1.7 stops of the display range. If your image has no content there, 16 bits changes nothing — which, for a properly-exposed mid-key photograph, is most of the time.
Storing 8-bit at the low resolution collapses one step earlier
The "stored at low res" column quantises the downsampled image and then interpolates, which is what a genuinely 8-bit downscaled capture is. Below the cliff it tracks the post-upscale quantisation within noise (mean 101.9% vs 100.2% of the float pipeline, across the 36 rows under code 232) — but it fails one row earlier: at L₀ = 64 with a = 0.20, where the ripple spans 4.91 codes, quantising after the upscale still delivers 110.0% and quantising before it delivers 0.0%. The mechanism is straightforward: an 8-bit grid at 1/4 resolution has 16× fewer samples carrying the same quantisation step, and bicubic interpolation cannot recover information the low-resolution grid already threw away. The practical consequence is small but free: if you are going to keep an 8-bit intermediate anyway, quantise at the output resolution, not the capture resolution.
The correction I had to make. My first version of this experiment measured retention against the ideal amplitude and reported 8-bit at 78.7% and 16-bit at 84.7% at code 38 — a plausible-sounding "16-bit is 6 points better in the shadows". That was an artefact: both numbers were dominated by the same 15% interpolation loss, and the "6 point gap" was the difference between two estimates of a number that was mostly noise. Dividing by the float pipeline instead is what turned the shadow rows into 99–100% and the highlight rows into 0% vs 100%. The first version of this measurement was wrong in the direction that produces a nice story.
Experiment 2 — do those 16 bits survive a +2 stop lift?
This is the claim 16-bit intermediates are usually sold on: headroom for grading. So I graded. Take the scene from the setup, run it through the same 4×/4× trip, and lift the result by +2 stops (×4 in linear light) at the end. Compare four intermediates, plus the workflow that puts the grade before the tone map:
| Intermediate | Codes in highlight band, after | False white (%) | PSNR shadow | PSNR mid | PSNR all | PSNR highlight |
|---|---|---|---|---|---|---|
| 8-bit, tone-mapped | 56 | 7.93 | 18.34 dB | 24.91 dB | 24.25 dB | 48.67 dB |
| 16-bit, tone-mapped | 60 | 7.99 | 18.34 dB | 24.91 dB | 24.25 dB | 48.67 dB |
| 16-bit, linear (scene-referred) | 45 | 8.25 | 16.25 | 24.16 | 22.58 | 52.39 dB |
| float, linear | 45 | 8.29 | 16.16 | 24.09 | 22.50 | 52.39 dB |
| grade in linear, then tone-map | 86 | 0.00 | 18.18 | 28.08 | 24.97 |
The 8-bit and 16-bit rows are identical to two decimal places on every metric. This is not a rounding coincidence: after tone mapping, the pixels that matter for the lift are the ones already squeezed into the top 1% of the display range, and both depths have the same number of codes there — 8-bit has 256 and 16-bit has 256 display codes once the tone map has already been applied and the result re-quantised to a display image. The 16 bits were spent before the lift was applied.
The scene-referred rows also fail, and the reason is more interesting than the bit count. The lift is applied to a signal that has already been through the 4× downsample in linear light. The highlight band is 40× the local level; ×4 takes it to 160×, and Reinhard maps 160 to 0.9938 — still not clipped, but compressed into three tenths of a code. The linear intermediates preserve those three tenths faithfully (that is what 16 bits is for) and the tone map then throws them away at the display. Preserving precision in a representation whose final step discards it is not a gain.
The row that works moves the grade before the tone map, so the ×4 is applied where the signal still has range to move into instead of where it has 3.4 codes left. It lands 3.2 dB ahead on the mid band (28.08 vs 24.91), 0.7 dB ahead overall, with zero false clipping and 86 codes in the highlight against 56 — 1.5× more distinct values.
It does not win everywhere, and the exception is worth stating because it is the counter-argument to "just grade in linear". On the shadow band it is 0.16 dB behind (18.18 vs 18.34), and on the highlight band it is 8.6 dB behind (40.11 vs 48.67) — because the tone-mapped intermediates had already clipped 7.9% of the frame to pure white, and two identical clipped regions agree with each other perfectly. The high-band PSNR is rewarding the pipeline for destroying the same data in both images. That is why the table above uses false clipping instead: 0.00% against 7.93% is the number that means something, and it is the one the PSNR column hides.
What this means in practice. "Use 16-bit before upscaling" is correct advice for exactly one workflow: a scene-referred linear (or log) intermediate, graded before the tone map, where the extra bits are still present at the moment the grade happens. In the workflow most people actually run — decode to display 8-bit, upscale, then brighten — 16 bits is a label on a file that was already truncated, and my measurement of that difference is 0.00 dB.
Experiment 3 — where the capacity goes, and why 8-bit has more stops than you think
The top of the range is fragile for a reason that is visible without any upscaling at all. The sRGB encoding is roughly a cube root below the linear segment and a power law above it, so the number of codes per stop is not constant — it peaks near mid-grey and collapses towards white:
| Linear L | Display code | Codes per stop | Stops remaining to 1.0 display | Peak-to-peak span of a 20% ripple |
|---|---|---|---|---|
| 0.1 | 85.0 | 28.46 | 10.12 | 15.12 codes |
| 0.2 | 113.5 | 32.11 | 9.12 | 17.87 codes |
| 1.0 | 187.5 | 25.67 | 6.80 | 17.09 codes |
| 4.0 | 231.1 | 11.00 | 4.80 | 8.42 codes |
| 16.0 | 248.3 | 3.28 | 2.80 | 2.67 codes |
| 32.0 | 251.6 | 1.69 | 1.80 | 1.40 codes |
| 55.0 | 253.0 | 1.00 | 1.02 | 0.83 codes |
| 128.0 | 254.1 | 0.43 | −0.20 | 0.36 codes |
Codes-per-stop crosses 1.0 at linear luminance 54.98, which is display code 252.99. Above that point a full stop of scene luminance is representable only as a fraction of a code, so it is either rounded away or promoted to the next code — the choice is made by the rounding rule, not by the data. A 20% ripple has a peak-to-peak span of 0.36 codes at L = 128, which is the arithmetic behind the 0.0% retention in experiment 1.
The useful surprise is the total: display code 0 to 254 spans 19.49 stops. An 8-bit display image is not a 14-stop container; the non-linearity buys back more range than the 8 bits cost. The problem was never total capacity. It is the allocation: 10.82 stops live below code 128, 4.14 between 128 and 235, and 0.59 between 253 and 254 — half a stop compressed into the last single code. The last column is the same collapse from the other direction: at L = 128 a 20% ripple spans 0.36 of one code, and by L = 254 there is nothing left for it to modulate.
Does a real photograph live there?
On the source photo used for these experiments: mean code 110.8, 99th percentile code 232.0, 10.95% of pixels above code 200, 0.63% above 235, 0.29% above 240, and 0.07% above 253. So on this one frame the genuinely starved region is a tenth of a percent of the pixels — consistent with experiment 1, where the 8-bit penalty only appears above code 253. On a frame exposed for the highlights, or after a +2 stop lift, that tenth of a percent becomes the whole subject.
What this changes about how you upscale an HDR photograph
Three decisions, in order of how much they are worth:
- Order of operations beats bit depth. The single largest measured gain here was moving the grade before the tone map: +3.2 dB on the mid band, 0.7 dB overall, and false clipping from 7.9% to 0.00%. Neither an 8-bit nor a 16-bit intermediate could match that by changing precision alone.
- If you keep an 8-bit intermediate, keep it at output resolution. Quantising before the upscale is not measurably worse below code 232, but it collapses one row earlier — at L₀ = 64 with a 20% ripple it delivers 0.0% where the post-upscale quantisation still delivers 110.0%.
- 16-bit does have one clear, narrow win. In the top ~1.7 stops, where a tone-mapped 8-bit image has run out of codes, a 16-bit intermediate preserves detail that an 8-bit one flattens to a constant. If the frame has a window, a lamp, or a specular surface, that is the region you are looking at when you complain that "the highlights look plastic".
None of these are permission to reconstruct information that is not there. The ripple in experiment 1 exists in the master and is either carried or destroyed by the pipeline; the frequencies lost to the 4× downsample are lost regardless of depth, which is why the float pipeline caps out at 84.9% of the ideal even with no quantisation at all. When the source really is a single low-resolution frame and the goal is a larger one, the choice of resampler and the pixel budget matter more than the container — which is the measurement behind UpgoLAB's browser upscaler, and the reason it is worth knowing which of these two problems you actually have before you change any settings.
Reproducing the numbers
Everything above comes from one script; the model, the estimator, and the reference are all in it. The only non-obvious part is the estimator: the 1-D projection is what makes the difference between 0% and 100% meaningful instead of noise.
import numpy as np
from PIL import Image
def enc(x):
x = np.clip(x, 0.0, 1.0)
return np.where(x <= 0.0031308, 12.92 * x, 1.055 * np.power(x, 1 / 2.4) - 0.055)
def tm_gray(L): # Reinhard + sRGB encode, display 0..1
return enc(L / (1.0 + L))
def quant(x, bits): # x is display 0..1
m = 2 ** bits - 1
return np.clip(np.round(x * m), 0, m) / m
def prof_amp(img, period=16.0): # 1-D projection: noise / sqrt(rows)
p = img.mean(axis=0)
x = np.arange(len(p), dtype=float)
A = np.stack([np.sin(2*np.pi*x/period), np.cos(2*np.pi*x/period),
np.ones(len(p))], 1)
c, *_ = np.linalg.lstsq(A, p, rcond=None)
return float(np.hypot(c[0], c[1]))
# patch -> down 4x in LINEAR light -> tone map -> quantise -> bicubic up 4x
L0, a = 64.0, 0.20
xx = np.arange(128)[None, :]
Lin = L0 * (1.0 + a * np.sin(2*np.pi*xx/16.0))
low = tm_gray(Lin.reshape(32, 4, 32, 4).mean(axis=(1, 3)))
up = np.asarray(Image.fromarray(low.astype(np.float32), "F")
.resize((128, 128), Image.BICUBIC), dtype=np.float64)
print(prof_amp(quant(up, 8) * 255) / prof_amp(up * 255)) # 1.100 (8-bit)
print(prof_amp(quant(up, 16) * 255) / prof_amp(up * 255)) # 1.002 (16-bit)
# codes per stop, and where it falls below one
d = lambda L: float(tm_gray(np.array([L]))[0]) * 255
print(d(2.0) - d(1.0), d(110.0) - d(55.0)) # 25.67, 0.55
Runs in about five seconds on a laptop CPU; no GPU, no dataset, no network. The full script sweeps twelve levels × four amplitudes × five variants and produces every table on this page.