Home / Camera Sensors / Article
PHOTOLABGUIDE TECHNICAL GUIDE

RAW vs. JPEG vs. HEIF Image Formats: Linear 14-Bit Sensor Data, Demosaicing Pipelines, and Chroma Subsampling (4:4:4 vs. 4:2:0)

💾
Digital Image Signal Processing (ISP) & Compression Architecture

An exhaustive photographic signal-processing dissertation comparing uncompressed 14-bit/16-bit Bayer RAW sensor dumps against 8-bit JPEG (ITU-T T.81 Discrete Cosine Transform) and 10-bit HEIF/HEIC (HEVC H.265 intra-frame coding). We dissect linear ADC code allocation, YCbCr luma-chroma separation, and 4:4:4 vs. 4:2:2 vs. 4:2:0 Chroma Subsampling.

Every time a photographer presses the shutter button on a modern mirrorless or DSLR camera, the silicon CMOS image sensor captures an array of analog electrical charges across millions of monochrome photosites covered by a Red-Green-Blue Color Filter Array (CFA). What happens in the next 50 milliseconds inside the camera’s Image Signal Processor (ISP) determines whether you preserve 16,384 discrete tonal gradations per channel (14-bit RAW) or permanently discard over 98% of the captured radiometric information (8-bit JPEG)!

In this comprehensive digital imaging treatise, we trace the exact mathematical pipeline from raw Analog-to-Digital Converter (ADC) sensor values to finished image containers, explaining why a RAW file is not actually an “image” until demosaiced, how JPEG’s 8×8 Discrete Cosine Transform (DCT) blocks destroy highlight and shadow recovery, and how 10-bit HEIF bridges the gap.

1. What Is a Camera RAW File? Single-Channel Mosaic Matrices vs. RGB Pixels

A common misconception is that a camera RAW file (such as a Canon .CR3, Nikon .NEF, Sony .ARW, Fujifilm .RAF, or Hassleblad .3FR) is simply an uncompressed TIFF image with all three Red, Green, and Blue values stored at every pixel. In reality, a native Bayer or X-Trans RAW file contains only ONE color value per pixel (either Red, OR Green, OR Blue)—stored as a 2D grayscale matrix of 12-bit, 14-bit, or 16-bit linear integer numbers!

  • 3x Smaller Than an Uncompressed 16-Bit RGB TIFF: Because a 45-megapixel Bayer sensor records only one 14-bit luminance integer per photosite (before demosaicing), an uncompressed 14-bit RAW file needs only 45,000,000 × 14 bits ≈ 78.75 Megabytes (or ~45–55 MB when lossless-compressed). Once your RAW converter demosaics that file into a full 3-channel 16-bit RGB image (where every pixel holds Red + Green + Blue 16-bit integers), the file size triples immediately to 270 Megabytes!
  • White Balance Is Metadata-Only in RAW: When you capture a RAW file, the camera does not multiply the Red and Blue pixels by the White Balance gains prior to writing the file. It simply records the raw linear photon count from each photodiode and writes your camera’s Kelvin setting (e.g., 5500K, Tint +4) as a tiny text tag in the EXIF metadata header! This is why changing White Balance from 2800K Tungsten to 6500K Daylight in Lightroom causes zero image degradation or clipping on a RAW file, whereas attempting a 3500K white balance shift on an 8-bit JPEG causes catastrophic color banding and clipped channels!

2. The 5-Stage Destructive Pipeline of an In-Camera 8-Bit JPEG

When you configure your camera to record an 8-bit .JPG file, the camera’s onboard hardware ISP takes the 14-bit linear RAW mosaic and executes five irreversible, mathematically lossy transformations before writing the file to your SD or CFexpress card:

  1. Demosaicing & Baked-In White Balance Multiplication: The ISP interpolates the missing two RGB channels per pixel and permanently multiplies the Red and Blue channels by the active White Balance gains, clipping any highlight channel that exceeds 255.
  2. Non-Linear Gamma / Tone Curve Compression (14-Bit Linear → 8-Bit sRGB): The 16,384 linear levels per channel are mapped through a steep S-curve (Picture Style / Film Simulation) and truncated down to just 256 levels per channel (2^8 = 256)—throwing away 98.4% of the tonal steps!
  3. RGB to YCbCr Color Space Conversion: Because the human retina has far more rod/cone sensitivity to brightness detail than to color hue detail, the JPEG encoder converts (R, G, B) into Y (Luminance / Brightness), Cb (Blue-Difference Chroma), and Cr (Red-Difference Chroma).
  4. Chroma Subsampling (4:2:2 or 4:2:0 Color Decimation): Immediately after separating Luminance (Y) from Color (Cb, Cr), the JPEG encoder permanently throws away 50% to 75% of the color resolution!
  5. 8×8 Block Discrete Cosine Transform (DCT) & Quantization Matrix Rounding: The image is sliced into a grid of 8×8 pixel squares (64 pixels per block), transformed into spatial frequencies via DCT, and divided by a lossy Quantization Table that zeros out fine high-frequency micro-textures!

3. Chroma Subsampling Explained: 4:4:4 vs. 4:2:2 vs. 4:2:0

In both still image compression (JPEG / HEIF / AVIF) and digital cinema acquisition, Chroma Subsampling is denoted by a three-number ratio J : a : b (such as 4:4:4, 4:2:2, or 4:2:0) describing a reference block of 4 pixels wide by 2 pixels high (8 pixels total):

  • J (First Digit = 4): Width of the reference pixel block (4 pixels wide), where all 4 pixels on both rows receive full 100% Luminance (Y) resolution.
  • a (Second Digit): Number of Chroma (Cb, Cr) samples recorded in the first row of 4 pixels.
  • b (Third Digit): Number of independent Chroma samples recorded in the second row of 4 pixels.

Let us compare the exact color resolution retained across the three subsampling tiers:

  • 4:4:4 (Zero Chroma Subsampling — 100% Color Resolution): Every single pixel in both rows retains its own independent Luminance (Y) and Color (Cb, Cr) coordinates. Used in RAW conversion, 16-bit TIFF, PNG, and top-quality studio archiving.
  • 4:2:2 (Horizontal Halving — 50% Color Resolution Discarded): Every pair of horizontal pixels shares a single color value, reducing total uncompressed data bandwidth by 33% with minimal visual loss. Used in high-Bitrate Canon/Nikon “Fine” JPEGs and ProRes 422 video.
  • 4:2:0 (Horizontal & Vertical Halving — 75% Color Resolution Discarded!): A 2×2 square of 4 pixels shares just one single color value! While hardly noticeable on low-contrast natural scenes, 4:2:0 subsampling creates jagged block artifacts along sharp red-on-black text edges, neon signs, and fine architectural color boundaries—and makes clean green-screen chroma keying or HSL color range masking in post-production vastly harder!

4. RAW vs. 10-Bit HEIF vs. 8-Bit JPEG Technical Specification Matrix

The mathematical and structural differences between 14-bit/16-bit camera RAW, 10-bit HEIF (High Efficiency Image File), and legacy 8-bit JPEG are benchmarked below:

Image Container Format Bit Depth & Curve Tonal Steps Per Channel Total Possible Colors Chroma Sampling Shadow Push Latitude Typical 45MP File Size
16-Bit Uncompressed RAW (Medium Format) 16-Bit Linear 65,536 levels / channel 281.4 Trillion Bayer / CFA Mosaic (4:4:4 Post) +5.0 to +6.0 EV Stops 120 MB – 210 MB
14-Bit Lossless RAW (Full-Frame Flagship) 14-Bit Linear 16,384 levels / channel 4.39 Trillion Bayer / CFA Mosaic (4:4:4 Post) +3.5 to +4.5 EV Stops 45 MB – 65 MB
12-Bit Lossy / High-Speed Burst RAW 12-Bit Linear 4,096 levels / channel 68.7 Billion Bayer / CFA Mosaic (4:4:4 Post) +2.5 to +3.0 EV Stops 22 MB – 32 MB
10-Bit HEIF / HEIC (H.265 Intra-Frame) 10-Bit Log / PQ / Gamma 1,024 levels / channel 1.07 Billion YCbCr 4:2:2 or 4:2:0 +1.2 to +1.5 EV Stops 4 MB – 8 MB
8-Bit JPEG (ITU-T T.81 DCT Standard) 8-Bit Gamma (sRGB) 256 levels / channel 16.77 Million YCbCr 4:2:0 (or 4:2:2 Fine) +0.3 to +0.5 EV Stops 6 MB – 14 MB

5. Inside the JPEG 8×8 Discrete Cosine Transform (DCT) and Quantization Matrix

Why do heavily compressed 8-bit JPEG images exhibit characteristic 8×8 square “mosquito noise” ringing and blocky stair-stepping across smooth sky gradients? To understand JPEG artifacts, we must examine the mathematical engine inside the ITU-T T.81 / ISO 10918-1 JPEG encoder after Chroma Subsampling has completed:

  1. 8×8 Macroblock Partitioning: Each channel plane (Luminance Y at full resolution, and Chroma Cb, Cr at quarter 4:2:0 resolution) is sliced into independent tiles of 8×8 pixels (64 pixels per block). Because every 8×8 block is processed in complete isolation without knowing what its neighboring block is doing, sharp discontinuous boundaries appear between adjacent 8-pixel squares at low quality settings!
  2. 2D Discrete Cosine Transform (DCT-II): Using Fourier-related cosine basis functions, the encoder converts the 64 spatial pixel brightness values inside each 8×8 square into a 64-element matrix of Spatial Frequencies:
    • Top-Left Corner Coefficient F(0,0) (The DC Coefficient): Represents the average overall brightness of the entire 8×8 block (0 Hz spatial frequency).
    • The Remaining 63 Coefficients (The AC Coefficients): Moving toward the bottom-right corner F(7,7) represents progressively finer horizontal, vertical, and diagonal high-frequency micro-details (such as eyelash texture, fabric weave, and fine sensor grain).
  3. The Lossy Quantization Matrix Division (Where “JPEG Quality 1–100” Lives!): Up to this point, the DCT transform is mathematically reversible. Now comes the destructive step: the 64 frequency coefficients are divided element-by-element by an 8×8 Quantization Table (scaled by your JPEG Quality slider from 1 to 100) and rounded to the nearest integer! Because the numbers in the bottom-right corner of the Quantization Matrix are large (e.g., 50 to 99), nearly all fine high-frequency AC coefficients are rounded down to 0, 0, 0, 0...!
  4. Zig-Zag Run-Length Encoding (RLE) & Huffman Entropy Coding: Scanning the 8×8 matrix in a diagonal zig-zag pattern groups all those trailing zeros together into a single compact token (“End of Block”), achieving 10:1 to 20:1 file size reduction!

6. 10-Bit HEIF / HEIC (High Efficiency Image File): Why H.265 Beats 1992 JPEG

Introduced on modern flagship cameras (Canon EOS R series, Sony Alpha series, Nikon Z series) and smartphones, HEIF (High Efficiency Image File Format, standardized under ISO/IEC 23008-12 using `.HIF` or `.HEIC` extensions) replaces JPEG’s 1992-era 8×8 DCT engine with the modern HEVC (H.265) intra-frame video compression engine:

  • 10-Bit Color Depth (1,024 Tonal Steps vs. JPEG’s 256 Steps): By encoding 10 bits per channel (1.07 billion colors) instead of 8 bits (16.7 million colors), 10-bit HEIF completely eliminates the ugly stair-stepped luminance banding seen in 8-bit JPEG blue skies, sunset gradients, and studio backdrop vignettes!
  • Variable Coding Tree Units (CTUs from 4×4 up to 64×64 Pixels): Instead of forcing every region of the image into rigid 8×8 pixel squares like JPEG, HEIF dynamically adapts its block size! Smooth, featureless sky regions are grouped into massive 64×64 pixel blocks with 35 angular intra-prediction modes (preventing blocky stair-stepping while slashing file size in half), whereas intricate eyelashes and foliage are subdivided down to tiny 4×4 pixel blocks to preserve razor-sharp edges!
  • HDR PQ (SMPTE ST 2084 Perceptual Quantizer) and HLG Support: While standard 8-bit JPEG is locked to a SDR (Standard Dynamic Range) gamma curve peaking at 100 nits, 10-bit HEIF natively supports HDR PQ and Hybrid Log-Gamma (HLG)—allowing modern cameras to record 10-stop HDR still images that illuminate specular sun reflections at 1,000+ nits on modern OLED displays!

7. Why Linear 14-Bit RAW Still Crushes Both 10-Bit HEIF and 8-Bit JPEG in Post

If 10-bit HEIF offers 1,024 tonal steps per channel and half the file size of JPEG, can professional wedding, landscape, or commercial photographers abandon 14-bit RAW and shoot 10-bit HEIF? No! Here are the three physical and mathematical reasons why 14-bit RAW remains non-negotiable for serious post-production:

  1. 16x More Tonal Precision (16,384 Linear Steps vs. 1,024 Non-Linear Steps): Every extra bit doubles tonal resolution. Going from 10-bit HEIF (2^10 = 1,024) to 14-bit RAW (2^14 = 16,384) provides 16 times more discrete brightness levels per channel (and 16-bit Medium Format RAW provides 64 times more levels!).
  2. Un-Baked White Balance and Camera Calibration Matrices: Even a 10-bit HEIF has already gone through demosaicing, white balance multiplication, and a non-linear YCbCr matrix conversion in-camera. If you shoot a portrait under mixed 2700K tungsten and 5600K window light in HEIF, the blue channel in the tungsten shadows is already multiplied and quantized, whereas a 14-bit RAW file lets you generate two separate virtual copies white-balanced for each illuminant with zero mathematical degradation.
  3. Future-Proof AI Demosaicing and Denoising (DxO PureRAW / Lightroom Denoise AI): Modern convolutional neural network (CNN) raw processors operate directly on the undemosaiced linear Bayer/X-Trans sensor mosaic—simultaneously removing photon shot noise, correcting lens chromatic aberration, and reconstructing sub-pixel Nyquist detail before RGB interpolation even occurs! Once an image is demosaiced into a JPEG or HEIF in-camera, raw-domain AI denoising is permanently impossible.

EXIF, IPTC, and XMP Metadata Containers Inside RAW, JPEG, and HEIF

Beyond pixel luminance and chrominance matrices, every photographic image format acts as a relational database wrapper housing three distinct standardized metadata schemas: EXIF (Exchangeable Image File Format) for hardware telemetry (shutter speed, aperture, ISO, focal length, lens serial number, GPS coordinates), IPTC-IIM / Core for journalistic copyright, captioning, and licensing rights, and Adobe XMP (Extensible Metadata Platform) for non-destructive parametric edit instructions. Importantly, while JPEG limits each APP1 metadata segment to 64 Kilobytes, both HEIF and TIFF/RAW containers support multi-megabyte metadata payloads—including embedded dual-illuminant color profiles, depth maps, and full-size JPEG preview thumbnails.

âš¡
Field Recording Workflow: When to Use RAW vs. Dual-Card RAW + JPEG/HEIF

1. Slot 1 (CFexpress Type B / A): Always record 14-Bit Lossless Compressed RAW as your master archival and editing negative.
2. Slot 2 (UHS-II SD Card): Record redundant 14-Bit RAW backup for critical commercial/wedding assignments, OR record Fine 4:2:2 JPEG / 10-Bit HEIF when shooting sports and press events where immediate FTP smartphone transmission to editors is required within 60 seconds of the play.

TC

Taryn Crooks

Senior Photolabguide Specialist

Senior Agricultural Researcher & Livestock Husbandry Specialist at Photolabguide. Dedicated to advancing sustainable flock management, genetic conservation, and precision ovine nutrition.

Leave a Comment