Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ jobs:

- run: cargo test --release --locked --no-default-features --features incremental-experiment --lib

# Full TESTING.md correctness pass: pixel-for-pixel and ICC-profile
# comparison against a pinned heif-dec validator over the libheif corpus,
# the ente HEIC fixtures, and the generated HEVC stress corpus.
verify:
runs-on: ubuntu-latest
timeout-minutes: 90
Expand All @@ -61,8 +58,6 @@ jobs:
# profiles in two pinned HEIC fixtures. Newer libpng reports those
# profile issues without leaving heif-dec's oracle PNG empty.
LIBPNG_PIN: 3061454d980de7d53608f594194cfac722721d2a
# HEIC fixture corpus (media/heic/v1/files); bump to pick up
# fixtures added upstream.
ENTE_FIXTURES_PIN: 13c7cf83717140be20b32e6fbb178d5f15ea09ea
steps:
- name: Checkout
Expand Down
30 changes: 0 additions & 30 deletions scripts/gen_stress_corpus.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
#!/usr/bin/env bash
# Generate the HEVC stress corpus into .heic-test-assets/stress-corpus.
#
# These files exercise rare HEVC syntax paths that real camera output does not
# cover: 10/12-bit, 4:2:2, 4:4:4, lossless (transquant bypass, level 8.5,
# identity matrix), transform skip, default and custom (asymmetric) scaling
# lists, cu_qp_delta at small quantization groups, extreme QPs, small CTUs,
# deep transform trees, WPP on/off (including 1-CTB-wide pictures), NxN intra
# partitions, disabled loop filters, and odd/tiny picture sizes. Several of
# these paths carried silent-corruption bugs that the standard corpora never
# reached.
#
# The corpus is generated (not checked in) because this repository tracks no
# image assets. Exact bytes may differ across x265 versions; that is fine —
# the verify harness compares decoded pixels against heif-dec at run time, so
# any conformant encode of these feature combinations is a valid test.
#
# Once the directory exists, scripts/heic_tests.sh includes it in the default
# corpus automatically.
#
# Requires the validator build and the ente fixtures corpus, both of which a
# prior harness run sets up (e.g. `scripts/heic_tests.sh verify --quick`).
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
Expand Down Expand Up @@ -68,8 +47,6 @@ fi
rm -rf "$OUT_DIR" "$SRC_DIR"
mkdir -p "$OUT_DIR" "$SRC_DIR"

# --- Source images: one natural photo (from the fixtures corpus) at several
# odd sizes and bit depths, plus synthetic gradients/noise/edges/flat.
log "Generating source images"
"$HEIF_DEC" "$PHOTO_HEIC" "$SRC_DIR/photo_full.png" >/dev/null 2>&1 \
|| fail "heif-dec could not decode $PHOTO_HEIC"
Expand Down Expand Up @@ -141,7 +118,6 @@ enc() {

log "Encoding stress corpus into $OUT_DIR"

# Baseline quality sweep on diverse content
enc q30_photo_odd photo_odd.png -q 30
enc q85_vs_photo_odd photo_odd.png -q 85 -p preset=veryslow
enc q50_noise noise.png -q 50
Expand All @@ -151,32 +127,27 @@ enc q95_flat flat.png -q 95
enc q50_tiny tiny.png -q 50
enc q10_photo_small photo_small.png -q 10

# Lossless (transquant bypass, level 8.5, identity matrix RGB)
enc lossless_photo_small photo_small.png -L
enc lossless_edges edges.png -L
enc lossless_noise noise.png -L
enc lossless_444_nxn edges.png -L -p preset=veryslow

# Chroma formats
enc c422_photo_small photo_small.png -q 60 -p chroma=422
enc c444_photo_small photo_small.png -q 60 -p chroma=444
enc c422_edges edges.png -q 60 -p chroma=422
enc c444_noise noise.png -q 60 -p chroma=444
enc c444_nxn photo_small.png -q 70 -p chroma=444 -p preset=veryslow -p tu-intra-depth=4

# CTU / transform tree geometry
enc ctu16_photo_small photo_small.png -q 50 -p x265:ctu=16
enc ctu32_tu4_edges edges.png -q 50 -p x265:ctu=32 -p tu-intra-depth=4
enc ctu16_tiny tiny.png -q 50 -p x265:ctu=16

# WPP variants (including 1-CTB-wide pictures) and extreme QPs
enc nowpp_photo_small photo_small.png -q 50 -p x265:wpp=0
enc wpp_narrow narrow.png -q 50
enc wpp_narrow2 narrow2.png -q 65
enc qp51_photo_small photo_small.png -p x265:qp=51
enc qp0_edges edges.png -p x265:qp=0

# Rare residual / coefficient paths
enc tskip_edges edges.png -q 50 -p x265:tskip=1
enc tskip_noise noise.png -q 40 -p x265:tskip=1
enc culossless_photo photo_small.png -q 50 -p x265:cu-lossless=1
Expand All @@ -191,7 +162,6 @@ enc nostrong_photo photo_small.png -q 50 -p x265:strong-intra-smoothing=0
enc cip_photo_small photo_small.png -q 50 -p x265:constrained-intra=1
enc rdoq_psy_noise noise.png -q 60 -p x265:rdoq-level=2 -p x265:psy-rdoq=10

# High bit depths (16-bit PNG sources)
enc bd10_photo16 photo16.png -q 60 -b 10
enc bd10_gradient gradient16.png -q 60 -b 10
enc bd10_lossless_grad gradient16.png -L -b 10
Expand Down
12 changes: 0 additions & 12 deletions scripts/heic_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ use std::fs::File;
use std::io::BufReader;
use std::process::ExitCode;

/// Extracts the decompressed iCCP colour profile from a PNG.
///
/// Exit codes: 0 = profile written to the output path, 3 = the PNG carries
/// no profile, 1 = the PNG could not be read, 2 = usage error.
fn main() -> ExitCode {
let args: Vec<String> = std::env::args().collect();
if args.len() != 3 {
Expand Down Expand Up @@ -773,11 +769,6 @@ is_ente_fixtures_files_dir() {
find "$dir" -type f \( -iname '*.heif' -o -iname '*.heic' -o -iname '*.avif' \) -print -quit 2>/dev/null | grep -q .
}

# The ente test-fixtures HEIC corpus is part of the default corpus. It is
# fetched on demand into the gitignored asset directory (sparse clone of only
# the HEIC fixture subtree) and never checked into this repository. Best
# effort: if it is missing and cannot be fetched, a warning is printed and the
# default corpus falls back to the libheif dirs only.
ensure_ente_fixtures() {
local files_dir
files_dir="$(ente_fixtures_files_dir)"
Expand Down Expand Up @@ -816,8 +807,6 @@ default_corpus_dirs() {
if ensure_ente_fixtures; then
ente_fixtures_files_dir
fi
# Locally generated HEVC stress corpus (scripts/gen_stress_corpus.sh or
# `scripts/heic_tests.sh gen-stress`); included when present.
if [[ -d "$ASSET_ROOT/stress-corpus" ]]; then
printf '%s\n' "$ASSET_ROOT/stress-corpus"
fi
Expand Down Expand Up @@ -1070,7 +1059,6 @@ png_to_rgba() {
# the Rust PNG must carry byte-identical profile data. A Rust-only profile
# is allowed and expected: the Rust decoder synthesizes an ICC profile from
# nclx colour information, which heif-dec does not embed.
# Prints a failure description and returns 1 on mismatch.
compare_png_icc() {
local ref_png="$1" rust_png="$2" prefix="$3"
local ref_label="${4:-validator}" rust_label="${5:-rust}"
Expand Down
25 changes: 2 additions & 23 deletions src/heic-decoder/error.rs
Original file line number Diff line number Diff line change
@@ -1,38 +1,17 @@
//! Error types for HEVC decoding.

use alloc::string::String;
use core::fmt;

/// Errors specific to HEVC decoding.
#[derive(Debug)]
#[non_exhaustive]
pub enum HevcError {
AllocationFailed,
/// Invalid NAL unit.
InvalidNalUnit(&'static str),
/// Invalid bitstream.
InvalidBitstream(&'static str),
/// Missing required parameter set.
MissingParameterSet(&'static str),
/// Invalid parameter set.
InvalidParameterSet {
/// Parameter set type, for example "SPS" or "PPS".
kind: &'static str,
/// Description of the issue.
msg: String,
},
/// CABAC decoding error.
InvalidParameterSet { kind: &'static str, msg: String },
CabacError(&'static str),
/// Unsupported profile/level.
UnsupportedProfile {
/// HEVC profile IDC.
profile: u8,
/// HEVC level IDC.
level: u8,
},
/// Unsupported feature.
UnsupportedProfile { profile: u8, level: u8 },
Unsupported(&'static str),
/// Decoding error.
DecodingError(&'static str),
}

Expand Down
Loading
Loading