Clipped noise does not average away
Assumes A black level is multiplied by the balance, Correcting colour costs noise and Two converters and one highlight.
A black level is multiplied by the balance measured what an offset left in the raw channels becomes after a white balance, and it set noise aside with a test for telling the two apart: blur the shadow, and whatever survives the blur is not noise, because noise averages away and an offset does not. That test has a condition in it, and the condition fails in the most ordinary converter there is. Noise averages away only if nothing between the reading and the average has bent it — and the first thing most converters do to a shadow is bend it at zero.
Noise that averages to a tint
Noise clipped at zero has a positive mean, so an average over an area is the signal plus a pedestal — equal in every channel on a black frame, largest in the lamp’s weakest channel on a lit shadow — and the white balance turns it into the colour of the lamp’s inverse.
- At a high amplification, with no black level error at all, a half per cent grey under tungsten averages 1.04 colour differences from the noiseless grey, and a black frame 0.79, almost all of it chroma.
- At a very high amplification a one per cent grey is 2.95 off, with 3.27 units of chroma, and under daylight the same grey is 1.59 off.
- Averaged over sixteen thousand pixels, signed noise falls to 0.28 and clipped noise stays at 3.0. A blur cannot tell the clip’s bias from a pedestal error.
- Pushed four stops in editing, the half per cent grey’s 1.04 becomes 8.98 — the size the pedestal essay found for a black level two thousandths of white too high.
A shadow’s readings straddle zero
A photosite’s count is the light it received plus noise, and the noise has two parts. Photon arrival is random, so the count scatters around its mean by the square root of the mean. The readout electronics add a further scatter of a few electrons that does not depend on the light at all. A sensor adds a fixed pedestal to every reading so that this scatter, near zero light, is not cut off by the analogue-to-digital converter, and raw is not a picture until a converter has subtracted the pedestal again.
After the subtraction, a shadow’s readings are centred on its signal and spread on both sides of it. For a deep shadow the spread is wider than the signal, so a large share of the readings are negative. Nothing is wrong with a negative reading. It is a sample of a distribution whose mean is small and positive, and averaged with its neighbours it contributes exactly what it should.
What happens next is a decision the converter makes, and most converters make it silently. A value stored as an unsigned integer cannot be negative, so it becomes zero. A pipeline written in floating point may keep the negative values through the white balance and then meet a step that assumes its input is non-negative — a logarithm, a power, a lookup table indexed from zero — and clamp there. Either way the lower half of the noise is discarded and the upper half is kept, and what was a symmetric scatter is now a scatter with a positive mean.
Half a normal curve has a mean
The size of that mean has a closed form, and it depends on one number: how many standard deviations the true signal sits above zero.
For a reading with a true value and a normal scatter of standard deviation , the mean after setting negative readings to zero is , where and are the normal distribution’s cumulative and density functions. At zero signal that is , which is 0.399 of a standard deviation. One deviation up it is 0.083 of a deviation, two deviations up 0.008, and three deviations up under half a thousandth.
So the bias is a feature of the bottom few deviations of every channel. A channel whose signal sits four deviations above zero is untouched by the clip, and a channel whose signal sits at one deviation loses a twelfth of its noise’s width to it — a small number in counts, and a large one once a white balance has multiplied it.
The computation above was checked against the integral it stands for, taken numerically over a band twelve deviations wide on either side, and the two agree to a few parts in ten billion of a deviation at five different signal levels.
The channel the lamp starves is nearest the floor
The three raw channels of one grey do not sit at the same distance from zero. A tungsten lamp has little power in the blue, so the blue channel of any grey it lights records a small fraction of what the red channel records — the white balance’s blue gain under that lamp is 6.15 times its red for exactly that reason.
At a high amplification, a two per cent grey under daylight has its three channels at 3.6, 3.3 and 2.4 standard deviations above zero. Under tungsten they are at 3.6, 2.5 and 1.0. The red channels agree because each lamp’s grey is normalised to its own largest channel. The blue channel under tungsten sits on the steep part of the curve, where the clip adds about a twelfth of a deviation to its mean, while its red channel sits where the clip adds nothing measurable.
Then the white balance divides each channel by the lamp’s response in that channel, which multiplies the blue channel by six. The channel that lost the most to the clip is the channel the balance amplifies most, so a clipped shadow under tungsten goes blue for two reasons that compound: it had a larger bias to begin with, and the bias was multiplied by the largest gain.
On a one per cent grey at a very high amplification the three channels’ biases, as shares of the black frame’s bias, are 0.30, 0.51 and 0.82. A lit shadow is not an equal offset at all. It is an offset shaped like the inverse of the lamp, which is the one shape the pedestal essay found the balance cannot leave neutral — and it is worse than the equal offset that essay measured, because it leans the same way the gains do.
A black frame is a pedestal exactly
At zero signal the three channels are equally close to zero, and read noise — added in the electronics after the colour filters — is the same size in counts in all three. So a black frame with its noise clipped carries an offset of exactly in every channel, equal to the last digit, which is the pedestal error of the earlier essay arriving from noise rather than from a mis-estimated black level.
At a high amplification the read noise here is 2.5 thousandths of white, and the equivalent pedestal is a thousandth. At a very high amplification the read noise is 7.5 thousandths and the equivalent pedestal three thousandths — the size the pedestal essay used for its headline, where it turned a two per cent grey 2.4 colour differences away under daylight.
Nothing about the tint distinguishes them, and nothing could. The clipped black frame’s tint lies at −76 degrees of hue under daylight and −99 under tungsten, pointing the same way as the pedestal essay’s tints on a two per cent grey, −77 and −110, which lean further into the blue because a lit grey’s blue channel carries less signal of its own to dilute them. On a black frame the two errors cannot be told apart by their colour, because on a black frame the input to the balance is the same three numbers in both cases.
The blur test, corrected
The pedestal essay offered a test: noise averages away over an area and a pedestal error does not, so a tint that survives a heavy blur is not noise. The premise of the test is the symmetric noise it began with. Clipped noise is not symmetric.
One pixel of a one per cent grey at a very high amplification is 15.9 colour differences from the noiseless grey, whichever way the negative readings are handled, because a single pixel’s noise is enormous at that level. Averaged over sixty-four pixels the two are 4.3 and 4.6; over two hundred and fifty-six, 1.8 and 3.3. From there they part completely. The signed average keeps falling as the square root of the count — 1.15 at a thousand pixels, 0.28 at sixteen thousand — and the clipped average stops falling near 3.0, the value its closed form predicts.
So the test sorts errors correctly into two kinds, and the kinds are not noise and pedestal. They are zero-mean and not zero-mean. A tint that survives a blur has a non-zero mean, and a clip has given the noise one. A tint that survives a heavy blur can be noise, if anything clipped the noise before the blur.
A test that does separate the two uses the property the two errors do not share. A pedestal error is set by the black level estimate and does not depend on how much the sensor’s signal was amplified. A clip’s bias is a fraction of the noise, and the noise in units of white rises with the amplification. The same scene photographed at two amplifications, with the exposure adjusted to match, keeps a pedestal error’s tint and changes a clip’s.
Daylight halves it and does not remove it
A daylight balance spreads its gains much less than a tungsten one, and the tint follows.
Under daylight at a high amplification the half per cent grey is 0.39 off, against 1.04 under tungsten, and the two per cent grey 0.03 against 0.47. At a very high amplification the one per cent grey is 1.59 against 2.95. Two things account for the difference and both are the lamp: daylight’s blue channel sits further above zero, so less of its noise is clipped, and its blue gain is 1.85 rather than 6.15, so what was clipped is multiplied less.
The black frame is the exception, 0.64 under daylight against 0.79 under tungsten at a high amplification. On a black frame every channel is equally close to zero whatever the lamp, so only the gains differ, and the difference is smaller.
The low-amplification sensor state makes the other end of the argument. With the read noise at three ten-thousandths of white the largest tint anywhere on either ramp is 0.08, on the black frame. The clip’s bias belongs to high amplification and deep shadow together, which is exactly the combination a night photograph under artificial light provides.
A push finds it
A tint of one colour difference in a shadow at lightness two is not a visible fault. Shadows are where the eye resolves colour least, and a shadow that stays a shadow keeps its bias out of sight. The trouble begins when the shadow is moved.
A raw editor brightens a shadow by multiplying its raw values before the pipeline runs, which is the right place for an exposure change — a stop is not a stop afterwards established why. It multiplies the clipped mean along with the signal. Unpushed the half per cent grey is 1.04 colour differences off; pushed one stop, 2.05; two stops, 3.44; three, 6.58; four stops, to a lightness of 29, it is 8.98.
That is the lifted-shadow cast the pedestal essay described, reached with a black level that was exactly right. An underexposed night frame at a high amplification, under tungsten, brightened four stops in editing, is a machine for producing it — and the correction the pedestal essay recommended, estimating the black level per frame from the masked photosites, removes none of it, because the black level was never the problem.
The picture clips too
A converter that keeps its raw values signed has not escaped. Every step after the white balance is written for non-negative input somewhere, and the delivered image is certainly non-negative. The average is only safe if it is taken before the first clip, wherever that is.
Averaged in signed raw, a one per cent grey under tungsten at a very high amplification comes back exactly. Clipped and then averaged in raw, it is 2.95 off, with lightness nearly unchanged. Run through the whole pipeline one pixel at a time and averaged on the delivered values — which is what a resize, a thumbnail or a viewer standing back from a print does — it is 3.50 off from signed raw and 2.82 from clipped raw, and now 3.7 and 2.6 units lighter as well. The pipeline’s tone curve clamps its input at zero, the delivered value cannot be negative, and the negative excursions a signed raw value survived are clipped one step later.
The lightening is the same inequality at work on a different axis. An average on the stored values is darker than the average of the light because the encoding is concave; here the average of clipped values is lighter than the value of the average because a clip at zero is convex. The average surface does not look average for the same reason: the order of an average and a nonlinearity decides the answer, and the sign is set by which way the nonlinearity bends.
That places it among the decisions a raw pipeline makes without recording them. One step has no choice found that the reconstruction of the mosaic is forced to the front of the chain; two converters and one highlight found that where the clip at the top of the range sits decides a highlight’s hue, which is why a blown highlight turns rather than simply whitening. The clip at the bottom of the range is the same decision, and what it decides is whether an average taken anywhere later is an average of the scene.
Where a converter can put the average
Three placements return the grey and every other placement does not, so the repair is a matter of order rather than of better estimation.
Average before any clip. A denoiser, a downsampler or a binning step that works on signed raw values — after the black level is subtracted and before anything assumes non-negative input — removes the noise and leaves the signal, exactly, whatever the amplification. A denoiser run on the delivered picture removes the noise and keeps the bias it found there.
Keep the values signed as far as the arithmetic allows. The white balance and the colour matrix are linear, and a negative input passes through both honestly — the matrix enlarges the noise, as correcting colour costs noise measured, but it enlarges both halves of it alike and leaves its mean at zero. The first step that cannot take one is usually the tone curve, and every pixel that reaches it negative has already had its average spoiled for any later operation.
Clip once, late, and after the averages. A picture has to be non-negative in the end. A pipeline that performs its spatial averages first and its clips last has the same delivered pixels for every region that is not averaged, and correct ones for every region that is.
And record where the clip was. A converter’s output does not say whether its shadows were clipped before or after its noise reduction, which is a declared input of exactly the kind a converter’s documentation leaves out. The file that could say so would let a later edit tell a clipped shadow’s cast from a pedestal error’s, which a push and a blur alone cannot.
How the averages were computed
The camera is the same modelled raw pipeline the essays on raw conversion use: a silicon sensor with three dye filters and an infrared-cut filter, a white balance dividing each channel by its response to the lamp, a colour matrix fitted to a chart under that lamp, a tone curve and a clip. Greys are flat reflectances under D65 or illuminant A.
Noise is normal, with a variance of the read noise squared plus the signal divided by the number of photoelectrons at the raw white. The three sensor states are 10,000 photoelectrons at white with 3 of read noise, 800 with 2, and 200 with 1.5 — sizes of the right order for a large sensor at a low and a high amplification and a small one pushed hard, not any particular camera’s datasheet. The clipped means use the closed form above, channel by channel. The blur’s averages are sampled, twenty-four seeded trials at each count, and reported as a root mean square. The per-pixel placements are forty thousand seeded pixels each. Colour differences are ΔE₀₀ against the pipeline’s output for the noiseless grey.
What the model leaves out
The noise is normal to the bottom. At a few photoelectrons the photon count is Poisson rather than normal, and read noise in real sensors has heavier tails than a normal curve, including a scatter of hot and flickering pixels; both change the clip’s bias at the deepest levels, in directions this model does not compute.
The converter is idealised. Real converters clip at different steps, some keep negative values through their noise reduction and some do not, and the mosaic reconstruction — here set aside — mixes neighbouring channels before any clip can act on them one channel at a time, which is the step that makes a grey edge arrive coloured and would spread a clipped channel’s bias into its neighbours.
And the tints are area averages. A picture viewed at full size shows the noise as well as its bias, and whether the cast is noticed through the speckle depends on how far the viewer stands back — which is itself an average, taken by the eye, after every clip.
The habit: a zero-mean error keeps its mean only until it is clipped
Averaging removes an error whose mean is zero, and the claim that a particular error has a zero mean is a claim about everything that has happened to it since it was made. A symmetric scatter stays symmetric through a gain, a matrix and a sum. It does not stay symmetric through a floor, a ceiling, a square, a logarithm or any function that bends.
The move is to find the first nonlinear step between an error’s source and the average that is supposed to remove it, and to ask which side of the average it sits on. If the step comes first, the average is of a biased quantity.
The failure mode is to reason about the error at its source and trust the average at its destination. An average removes noise only if nothing between the noise and the average has bent it, and a clip at zero bends everything below it.
Where the idea comes from
The bias of a truncated normal distribution is textbook statistics, and that clipping negative values in dark frames biases the black level upwards is well known in astronomical imaging, where calibration frames are averaged in quantity and kept in signed or floating-point arithmetic for that reason. Coloured casts in lifted shadows are among the most discussed faults of raw processing.
That the clipped bias lands in the lamp’s starved channel and is multiplied by its largest gain, that it survives the blur test the pedestal essay proposed, and how large it is under two lamps at three amplifications, are worked out here on one modelled sensor.
Still open: what real converters clip, and where
The model shows what a clip costs at each place it could sit. Which place real raw converters actually use — whether their noise reduction runs on signed raw values, where their first clamp is, and whether they treat the masked photosites’ readings the same way — is a property of each converter that its documentation does not state. Measured with a black frame and a dim grey card at a high amplification, the average of the delivered picture against the average of the signed raw values would place each converter on the figure above, and would say which of them deliver a shadow’s cast along with its detail.
What this makes readable
Essays that name this one as a prerequisite.
Named alongside this one
Essays reaching for the same objects. Nobody chose these; they are what the index of named objects makes visible.
- Two lamps decide what one lamp could not camera raw · noise · signal-to-noise · white balance
- A photograph is not a measurement camera raw · clipping · white balance
- A black that is not black clipping · dynamic range
- A camera balances in another basis camera raw · white balance
- A camera cannot record the excitation camera raw · white balance
- A camera profile is a fit camera raw · white balance
What links here
Every essay whose body links to this one.
The objects this essay names
Each one links to every other essay that touches it.
Camera rawClippingDeclared inputDynamic rangeExposureMeanNoiseSignal-to-noiseStructural choiceWhite balance