Skip to content

Latest commit

 

History

History
116 lines (86 loc) · 6.63 KB

BENCHMARKS.md

File metadata and controls

116 lines (86 loc) · 6.63 KB

Benchmarks

heifer 0.10.2 against the other HEIC decoders and encoders, measured in December 2026, on an Apple M5 (4 performance + 6 efficiency cores), macOS 27.0.1. Reproduce with python3 benchmarks/run.py (macOS, ffmpeg with libx265, numpy).

Competitors: heic-rs 0.1.5, heic 0.1.6, heic-decoder 0.1.1, zune-heic 0.5.0, still265 0.6.1, ffmpeg 9.0.2, and Apple's ImageIO (sips, hardware HEVC).

Test files: the 9 Portrait backgrounds of macOS (Apple photos, 1920×1080), a 12 MP image encoded by Apple and by heifer, an image with transparency and a 10-bit gradient (generated by the script).

Decoding

Fidelity: PSNR of the 8-bit RGB output against Apple's decoder (what Apple's apps show). Times: median of 5 runs, summed over the 13 files.

Decoder Files decoded 1 thread 10 threads Fidelity vs Apple (median / worst)
heifer 13/13 603 ms 144 ms 50.2 / 49.3 dB
heifer8 13/13 575 ms 124 ms 50.2 / 49.3 dB
heic-rs 13/13 728 ms 158 ms 48.1 / 39.7 dB
heic 13/13 1164 ms 1172 ms 47.0 / 32.6 dB
heic-decoder 13/13 888 ms 229 ms 48.7 / 39.8 dB
zune-heic 4/13 317 ms 337 ms 47.2 / 32.6 dB
zune-heic+hw 13/13 121 ms 120 ms 39.9 / 6.9 dB

12 MP photo encoded by Apple (48 tiles):

Decoder 1 thread 10 threads Fidelity vs Apple
heifer 89 ms 17 ms 49.3 dB
heifer8 82 ms 14 ms 49.3 dB
heic-rs 104 ms 18 ms 48.1 dB
heic 174 ms 174 ms 47.2 dB
heic-decoder 134 ms 33 ms 48.7 dB
zune-heic 114 ms 125 ms 47.3 dB
zune-heic+hw 23 ms 23 ms 47.3 dB

Failures: zune-heic on 38ba6f5cf9.heic (ERR: NalErrors(Generic("end_of_sub_stream_one_bit was 0!"))); zune-heic on 3b6c2d0177.heic (ERR: NalErrors(Generic("end_of_sub_stream_one_bit was 0!"))); zune-heic on 582d81e02d.heic (ERR: NalErrors(Generic("end_of_sub_stream_one_bit was 0!"))); zune-heic on a29a71bd3a.heic (ERR: NalErrors(Generic("end_of_sub_stream_one_bit was 0!"))); zune-heic on be880a5d0e.heic (ERR: NalErrors(Generic("end_of_sub_stream_one_bit was 0!"))); zune-heic on e344de67c7.heic (ERR: NalErrors(Generic("end_of_sub_stream_one_bit was 0!"))); zune-heic on e6036430ec.heic (ERR: NalErrors(Generic("end_of_sub_stream_one_bit was 0!"))); zune-heic on f1de131216.heic (ERR: NalErrors(Generic("end_of_sub_stream_one_bit was 0!"))); zune-heic on gradient10.heic (ERR: NalErrors(ParameterOutOfRange { limit: 8, value: 10, fi).

zune-heic+hw decodes with Apple's hardware decoder (VideoToolbox) and uses unsafe code; the others are software decoders.

Encoding

All encoders produce 4:2:0, except still265-slow-444 (4:4:4, which hardware decoders of phones usually do not support). BD-rate: average size difference at equal quality, against heifer (negative: smaller files than heifer). Quality is the PSNR of the decoded image against the source, decoded by heifer (which reads every file correctly) and by Apple (what Apple's apps show).

photo

Encoder BD-rate (decoded by heifer) BD-rate (decoded by Apple) Time per file 1 thread
heifer reference reference 318 ms 979 ms
still265-fast +14.2% +14.1% 187 ms same
still265-slow +0.1% +0.1% 352 ms same
still265-slow-444 +0.1% +0.1% 359 ms same
apple (hardware) +51.0% +50.5% 89 ms —

graphics

Encoder BD-rate (decoded by heifer) BD-rate (decoded by Apple) Time per file 1 thread
heifer reference reference 65 ms 165 ms
still265-fast +23.4% +22.6% 55 ms same
still265-slow +1.7% -2.1% 101 ms same
still265-slow-444 +1.7% -2.1% 102 ms same
apple (hardware) +211.5% +195.2% 67 ms —

photo12

Encoder BD-rate (decoded by heifer) BD-rate (decoded by Apple) Time per file 1 thread
heifer reference reference 625 ms 3402 ms
still265-fast +14.0% +13.6% 601 ms same
still265-slow +0.5% +0.1% 1036 ms same
still265-slow-444 +0.5% +0.1% 1081 ms same
apple (hardware) +37.0% +35.4% 195 ms —

still265 writes a colr box that Apple's decoder and ffmpeg do not honour: its files show wrong colours in Apple's apps ("wrong colours" above). still265 runs on one thread; heifer encodes tiles on all cores.

HEVC encoder vs x265

BD-rate of heifer's HEVC encoder against x265 (PSNR 6:1:1 and SSIM on YUV, photo):

x265 preset BD-rate (PSNR) BD-rate (SSIM)
ultrafast -20.3% -22.0%
medium -4.9% +4.5%
slow -2.7% +3.4%

Against libheif

libheif 1.23.7, with libde265 1.1.3 for decoding and x265 4.3 for encoding, through heif-convert and heif-enc (Homebrew builds). Same machine and files.

Decoding the four real photos of tests/fixtures/real: time of the whole command, PNG output included, median of 5 runs. heifer uses the PNG encoder of the image crate; libheif is given --png-compression-level 1, close to its speed (its default level is about four times slower here). PSNR against Apple's decoder.

File heifer decode heifer → PNG libheif → PNG PSNR heifer PSNR libheif
Xiaomi, 5 MP 13 ms 40 ms 201 ms 47.9 dB 47.4 dB
iPhone 13 Pro, 12 MP 19 ms 84 ms 375 ms 49.6 dB 49.5 dB
8000×6000, 48 MP 105 ms 314 ms 1744 ms 50.4 dB 48.9 dB
Galaxy S24 Ultra, 200 MP 189 ms 809 ms 3897 ms 50.4 dB 50.3 dB

Encoding photo12.png, median of 3 runs each. PSNR and SSIM against the source, decoded by heifer.

Encoder Quality Size bpp PSNR SSIM Time
heifer 40 62 KB 0.041 31.5 dB 0.9252 404 ms
heifer 60 245 KB 0.161 38.6 dB 0.9768 588 ms
heifer 75 567 KB 0.372 44.1 dB 0.9895 856 ms
heifer 85 939 KB 0.616 47.0 dB 0.9934 1052 ms
heifer 95 1523 KB 0.999 49.1 dB 0.9955 1230 ms
libheif x265 30 184 KB 0.121 36.7 dB 0.9745 702 ms
libheif x265 40 322 KB 0.212 39.9 dB 0.9847 798 ms
libheif x265 50 538 KB 0.353 42.8 dB 0.9904 886 ms
libheif x265 60 884 KB 0.580 45.5 dB 0.9938 1078 ms
libheif x265 70 1469 KB 0.964 47.3 dB 0.9956 1316 ms
libheif x265 80 2511 KB 1.647 48.5 dB 0.9964 1640 ms

At equal PSNR, libheif's files are 20.5% larger than heifer's (Bjøntegaard, size difference at matched quality).

At equal SSIM, libheif's files are 13.6% smaller than heifer's (Bjøntegaard, size difference at matched SSIM).