Analog-to-digital converter Created 2026-10-18 Updated 2026-10-20
An analog-to-digital converter produces a discrete numerical code from an input voltage. Its specifications include input range, resolution, conversion rate, input impedance, offset, gain error and nonlinearity. A uniform -bit converter covering voltage span has nominal spacing . The uniform-quantization error bound applies to rounding inside the range, while clipping is a different error. Sampling and quantization are separate operations: neither sufficient sampling rate nor a large bit count alone guarantees accurate reconstruction.
Equal-width bin entropy 2026-10-14
Partition into bins of width , and let the discrete random variable record the bin containing . This is a quantization of . Its probability mass function is
and its discrete information entropy is . Let be the average probability density within bin . Rearrangement gives the exact finite-bin identity
For a continuous probability density on , uniform continuity makes the bin averages converge uniformly to the density. Since is continuous at zero with the stated convention, the right-hand side converges to . Thus the increasing resolution cost is ; differential entropy is the remaining offset, rather than the entire discrete encoding cost.
For a continuous uniform distribution, every bin has probability , and exactly. For the continuous uniform distribution's squared transformation above, the exact bin probabilities are
The diagram computes these masses directly, including the bin next to the integrable singularity. It compares their corrected information entropy with the analytic differential entropy .
Figure 1.
Removing the bin-resolution cost reveals differential entropy
. The left plot shows discrete information entropy increasing with the number of equal-width bins. The right subtracts and compares with the exact differential entropy of a uniform input and its squared transformation. Every plotted point comes from the stated exact probability mass functions; no observations are fitted. Details.
Lossy block averaging 2026-10-13
This toy image compression method stores one rounded arithmetic mean for each disjoint block of grayscale pixels. The quantization rule is round to the nearest integer, with exact halves rounded upward. Each stored value is an unsigned eight-bit integer. Reconstruction fills the original block with that value, a form of nearest-neighbor interpolation. Averaging already discards information; rounding can discard more.
Here is an exact source array. Index rows and columns by and define
The floor function makes constant within each block; the indicator function adds 1 only to its upper-left pixel. All values are integers from 20 to 215. Each block therefore has the exact form
For example, the upper-left block has arithmetic mean and is stored as 40. The block immediately to its right is stored as 52. The complete stored array is specified by for . Its first row is ; its last is .
This toy file format again has eight-bit width and height fields followed by a one-bit mode: 0 means raw eight-bit grayscale pixels, 1 means the rounded block arithmetic means. This profile accepts only width and height 16. The decoder knows the block size and reconstruction rule from the format, reads the 64 stored values in row order, and repeats each across its corresponding block. The original 256 pixels cost payload bits; the 64 stored values cost payload bits. The reduction is . These payload counts exclude the common 17-bit file header; complete sizes are 2065 and 529 bits, or 2072 and 536 bits after final zero padding to eight-bit units. There is no stored codebook or additional prediction rule.
The empirical mean squared error averages squared differences over the 256 original pixel positions:
Every block has the same four errors, so this value is exact in squared stored shade units. If the unrounded arithmetic mean could be reconstructed, the error would instead be ; eight-bit quantization adds . That hypothetical comparison does not count fractional means as free eight-bit values.
The broad shade pattern survives, while the alternating bright and dark pixels vanish. Indeed, a second source with every block constant at produces the identical stored array : exact decoding of both sources is impossible. This makes the storage benefit and the lost detail visible at once. Block averaging is useful for a coarse preview when the individual pixels are dispensable; choosing an acceptable mean squared error or visual result is part of the application, not a guarantee supplied by the encoder.
Figure 1.
Rounded 2 by 2 block means reduce the payload by 75 percent while destroying fine detail
. Details.
Uniform signal sampling at rate multiplies a continuous signal by a time-domain Dirac comb, giving frequency-domain replicas spaced by :
If a baseband signal is restricted to and , these replicas can be separated by an ideal reconstruction filter. Frequencies differing by integer multiples of have the same sampled phase progression; for real signals they fold into the interval from zero to . This ambiguity is aliasing.
Figure 1.
Two different continuous cosine frequencies produce the same samples when one lies above Nyquist
. Source. Details.
For example, and cosines produce identical sample values. Apply an analogue Anti-aliasing filter before digitization and choose enough sample-rate margin for its finite transition band. A digital filter applied afterward cannot distinguish components already folded onto one another. Out-of-band noise also aliases unless filtered. The sample rate sets temporal/spectral coverage; quantization resolution sets amplitude precision and is a separate limitation. Bandpass Signal sampling has additional conditions beyond the simple baseband rule.[ref]
Digital acquisition converts a continuous voltage signal into timed numerical samples. A practical chain is a suitably buffered and amplified sensor signal, an analogue anti-aliasing filter, a sampling or sample-and-hold stage, an analog-to-digital converter, and a clocked data-storage system. Choose the gain so that the interesting variation uses the available input range without clipping. Finite input impedance can load a sensor, so an appropriate buffer or operational amplifier may be needed.
Sampling makes time discrete. If the conditioned signal is confined below frequency , choose a sampling rate , allowing a transition band for the physical filter. The Nyquist–Shannon sampling theorem permits ideal reconstruction of a suitably bandlimited function from exact samples. Without filtering, components separated by integer multiples of have identical samples; in particular real sinusoids at and can be indistinguishable. This aliasing cannot generally be undone by later digital filtering. Oversampling can ease filter design, but does not replace the requirement to suppress unwanted high-frequency content before sampling.
Amplitude quantization is separate from sampling. A uniform -bit converter covering voltage span has step . Rounding an in-range input gives the uniform-quantization error bound . If the rounding errors can additionally be modeled as uniform and uncorrelated, their standard deviation is . This statistical estimate is not a guarantee for a constant input or a coherent periodic signal. More bits increase resolution, but accuracy also depends on voltage-reference calibration, offset, gain error, nonlinearity and electronic noise. Out-of-range signals clip and invalidate the rounding bound.
Clock quality matters too. Timing jitter gives a voltage error approximately ; for a sinusoid its scale grows with . A clock calibration error biases measured frequencies and time intervals. Simultaneous multichannel signals need known relative timing, and the sampling and analogue settling times must be appropriate to the signal bandwidth.
For channels the raw recording rate is approximately bits per second, before overhead, so storage and sustained transfer speed must prevent missing data. Store units, channel identities, timestamps, sampling rate, input ranges and calibration information along with the readings. Preserve the original samples when applying digital filters or other processing. Averaging can improve precision for independent fluctuating errors, but cannot restore aliased frequencies, clipped peaks or a fixed rounding bias. Digital recording makes reproducible analysis and transmission possible when its sampling, amplitude and timing limitations are all controlled.
For a real signal with highest frequency , the Nyquist–Shannon sampling theorem gives the nominal Nyquist sampling rate
To cover an arbitrary component exactly at the band edge, choose : a sine sampled at exactly can have every sample equal to zero for an unfortunate phase. Practical aliasing suppression also calls for a margin above the nominal limiting rate.
With rounding to the nearest digitizer level, quantization with step has the uniform-quantization error bound
Thus the stated digitizer meets the requested nominal amplitude precision per sample, assuming no clipping or other errors. The bandwidth sets the nominal minimum sampling rate; the level spacing sets the rounding precision. Strictly, the sampling theorem reconstructs exactly from exact samples. A uniform error bound on the entire reconstructed continuous waveform is not guaranteed by the level spacing and sampling rate alone; that stronger requirement needs a specified reconstruction and noise model.
Pixel Created 2026-10-13 Updated 2026-10-31
A pixel is one picture element at an indexed position in a raster image. It can contain a single grayscale value or several colour components. The word can also refer to a physical display element; the indexed element of the stored image is the meaning used here. One stored pixel need not occupy exactly one physical display element when the image is resized. Microsoft's bitmap documentation likewise distinguishes an image's grid and its numerical colour representation.[ref]
Separate position from value: raster sampling and reconstruction concerns the spatial grid, while sample depth concerns how many bits encode each component. Four times as many pixels can describe a finer grid without improving the quantization of any value. Conversely, more bits per sample can distinguish more shades without locating an edge more precisely.
In the binary example under run-length encoding, one bit per pixel selects black or white. In the grayscale example under lossy block averaging, eight bits per pixel select one of 256 codes. Calling them codes keeps their numerical values distinct from the physical light that a display emits.
Quantization maps numerical values to a specified discrete collection of representable values. In lossy block averaging, maps block arithmetic means in to eight-bit integers. Thus and . Different means can share a stored value, making this step irreversible.
A point-sampling model assigns to a pixel on a grid, where is a continuous function representing an image signal. An area-sampling model instead assigns the average value of a function over a specified footprint. These are different models: a narrow feature between point samples can be missed, whereas its contribution to an area sample depends on its width and shade. Neither model says that the recorded value uniquely determines everything inside a grid cell.
Figure 1.
A toy raster grid, two reconstructions, and distinct signals with identical samples
. Details.
The upper panels start with exactly the same array. Nearest-neighbor interpolation repeats its values into a display; successive linear interpolations in the two coordinate directions produce a smoother display. Original sample positions are marked. Both displays use 384 output pixels, but only the same 24 recorded values. The extra values follow the chosen interpolation rule. Between-grid appearance is inferred, not independently recorded.
Spatial resolution needs a stated meaning. A grid over a rectangle of width and height has nominal cell pitches and . Over the same rectangle, doubling both dimensions halves these pitches and quadruples the pixel count. That is a finer grid, not a guarantee of more recoverable detail. Blurring before sampling, quantization and aliasing can make different originals share the same recorded array. Enlarging the rectangle without adding samples instead increases the displayed pitch.
A reproducible computational demonstration makes the ambiguity exact. Take the one-dimensional profiles and , repeated identically along every row. Sample at for . Since , the fact that the sine is a periodic function gives . Both yield , although at they give approximately and . The lower panel draws both originals and their common samples: no operation on those samples alone can identify the original profile. This is aliasing in an ideal point-sampling model, without image noise or rounding.
The Nyquist–Shannon sampling theorem describes reconstruction under a bandwidth restriction and ideal sampling assumptions; it does not grant uniqueness for arbitrary image signals from a finite raster image.[ref] The beautiful lesson is constructive: choose what detail the grid should preserve before sampling, and choose a reconstruction rule suited to the information actually retained.
Sample depth 2026-10-14
The sample depth is the number of bits allocated to one stored sample. An unsigned -bit integer has codes, . This is per component, not automatically per pixel: three eight-bit components require 24 payload bits per pixel. A raster image with pixels and such components requires payload bits before data compression, padding or a file header.
For a toy normalized shade , define uniform quantization with endpoints included by
The floor function implements rounding to the nearest code, with exact halves rounded upward. The reconstruction step is , and . For , the levels are ; for they are . Increasing sample depth refines this value grid without changing the spatial grid. These levels are uniform in ; if is encoded sRGB, they are not uniform in relative luminance.
PNG uses a bit-depth field per sample or palette index. Its grayscale type without alpha permits 1, 2, 4, 8 or 16 bits per sample; its truecolour type permits 8 or 16 bits per component. These are format-specific restrictions, not a rule for every raster image.[ref]
Rounding a voltage to the nearest level in a uniform grid of spacing gives a quantization error of magnitude at most , provided the input is within the converter's range. This follows because each grid point represents the interval bounded by the midpoints to its two neighbors. Clipping invalidates the bound.
The bound concerns recorded samples, whereas the Nyquist–Shannon sampling theorem concerns reconstruction from exact samples of a bandlimited function. If a reconstruction is , its error is , so a general bound involves , not simply . Thus sampling bandwidth and per-sample rounding precision are distinct specifications. Under an additional uniform independent-error model, the quantization-noise standard deviation is , an rms statement rather than a worst-case reconstruction guarantee.