Commit Graph
68 Commits
Author SHA1 Message Date
aiongg 2df33d2f01 Merge remote-tracking branch 'upstream/main' into sync/main-1116
# Conflicts:
#	Cargo.lock
#	crates/audio/src/lib.rs
#	crates/exr/src/decode.rs
#	crates/font-catalog/src/lib.rs
#	crates/ps/src/lib.rs
#	crates/svg/Cargo.toml
#	crates/text/Cargo.toml
#	crates/text/src/lib.rs
#	crates/video/Cargo.toml
#	crates/video/src/lib.rs
2026-11-16 14:23:07 +00:00
FredApps ddbe78231b craft-video: pass the packet's Adobe APP14 transform to the MJPEG decoder (#1847)
mjpeg::Decoder called craft_jpeg::decode with no Adobe transform, so a
packet with numeric component ids and APP14 transform 0 (RGB as stored)
was converted as YCbCr and came out in the wrong colours. The decoder
now reads the transform with craft_jpeg::adobe_transform, as the JPEG
image readers do. A regression test injects APP14 transforms 0 and 1;
it fails without the fix.
2026-11-16 07:10:48 -05:00
FredApps 341020b2c1 Merge pull request #1757 from el-j/feat/video-mjpeg
craft-video: Motion JPEG decoder and encoder (mjpeg)
2026-11-16 11:18:40 +01:00
Dylan M. Taylor 5c91598ccc Merge pull request #1807 from storytold/fix/av1-zero-quantizer
fix(video): preserve explicit rav1e zero quantizer
2026-11-15 23:44:40 -05:00
Dylan M. Taylor f450b5b591 fix(video): preserve explicit rav1e zero quantizer 2026-11-15 22:33:24 -05:00
aiongg 0835e114ca Fix CI lints: samples referenced in every build, missing docs, rustdoc links, deprecated Ui::id, unused manifest dependencies 2026-11-16 03:03:33 +00:00
FredApps f57db543da raw_video: QuickTime RGB24 always uses even-padded rows; only the last row's pad may be missing 2026-11-16 03:12:25 +01:00
FredApps f428f4d3b0 Merge remote-tracking branch 'origin/main' into w1692 2026-11-16 03:12:24 +01:00
aiongg dffc61a7e0 Merge storytold main 832883b5 (sync 16 Nov)
961 upstream commits since 7bb6c900. Resolutions:
- Test-only conflicts: upstream tests from before the base that our side
  cut stay cut; tests new upstream are kept (audio aac/config, layout,
  encode_format; cms lutfile; media mux; print windows_native, ticket;
  update self_update; xml hostile).
- Code our side moved, with upstream's change carried to the new place:
  craft-media mux roll sample groups (mux/boxes.rs) and writer-start
  offsets with overflow checks (mux/progressive.rs); craft-print's
  shrink-to-fit scale guard (sheets/plan.rs); craft-update's nextest
  archive detection (self_update/detect.rs); craft-vectorcraft-format's
  Tail::write_to_with (container.rs); craft-i18n's pedantic fixes
  (bidi.rs, negotiation.rs).
- craft-ui: the old crate's modules stay removed; gpu_test_lock guarded
  their per-test wgpu renderers, which the snapshot kit does not have.
- New upstream tests in crates that build their integration tests into
  the library's test executable are modules of tests/main.rs (audio
  flac_decode and qoa_oracle, cms, docpath, pcraft-format,
  vectorcraft-format).
- The 22 new crates are optional members of the craft facade.
2026-11-16 01:52:09 +00:00
el-j 252c959167 Merge remote-tracking branch 'origin/main' into feat/video-mjpeg 2026-11-16 02:22:43 +01:00
FredApps c3ad96bfd8 video: honour QuickTime RGB row padding; require BGRX masks for BI_BITFIELDS
Addresses the CodeRabbit review on #1692: odd-width raw RGB rows carry a pad byte,
and BI_BITFIELDS is only BGRX with the matching masks (new from_avi_bitfields).
2026-11-16 02:14:30 +01:00
Dylan M. Taylor d99d0d3f9d Merge main preserving AVIF threading and SGI features 2026-11-15 19:32:43 -05:00
FredApps 4216b943ed Merge remote-tracking branch 'origin/main' into w-codex/shared-raw-video 2026-11-16 00:40:36 +01:00
FredApps dd46f41b9a video: cover every raw layout, label and v210/planar path 2026-11-16 00:40:34 +01:00
Dylan M. Taylor 4c254242de Merge pull request #1142 from vangel76/perf/hevc-residual-decode
HEVC decoding about 4% fewer instructions on one thread
2026-11-15 18:31:24 -05:00
Dylan M. Taylor faa36fc2ea Merge pull request #1140 from vangel76/perf/av1-wavefront-3106
AV1 decoding about 1.7x as fast with many threads
2026-11-15 18:28:38 -05:00
Dylan M. Taylor 1c39341f96 Forward opt-in threading to rav1e encoder dependencies 2026-11-15 18:24:32 -05:00
FredApps 59b4f1e8c2 image-codecs: decode AVIF pixels with the pure-Rust AV1 decoder (#778) (#1601)
* image-codecs: decode AVIF pixels with craft-video's pure-Rust AV1 decoder

New optional `avif-decode` feature (native targets) reads still AVIF
files: the HEIF/ISOBMFF item graph, grids, clap/irot/imir, alpha
auxiliary images (including premultiplied), 8/10/12-bit 4:0:0, 4:2:0,
4:2:2 and 4:4:4, nclx/ICC colour, Exif and XMP, and PQ/HLG to linear
F32 through cicp::linearize as the HEIF path does.

The container walk follows LightCraft #3017 by @emmertex. Every size is
checked against the caller's Limits before the AV1 decoder runs, the
decoder's memory budget is capped by max_alloc, and the decode is
wrapped in catch_unwind so a decoder panic becomes an error.

Fixtures are tiny ffmpeg/libaom files; the 4:2:0 planes match libdav1d
bit for bit. Adds a decode_avif fuzz target.

Part of storytold/craft-libs#778.

* image-codecs, video: address review on the AVIF decoder

- clap: width and height are unsigned fractions, the offsets have signed
  numerators, so 0x80000000/0x40000000 is a width of 2, not -2.
- An item with clap, irot or imir more than once (repeated ipma records)
  is refused before any canvas work, instead of rotating 261120 times.
- Matrix coefficients 10 (BT.2020 constant luminance) is refused rather
  than converted with the non-constant-luminance equations.
- An alpha plane whose own transforms differ from the colour's is refused
  rather than composed in the wrong place; none, or the colour's, still
  decode.
- craft-video: Decoder::set_shown_budget lowers the per-chunk byte cap on
  shown pictures (never above 1 GiB), and the AVIF decoder sets it to
  max_alloc, so a payload of many shown pictures is refused before they
  are built.
2026-11-15 23:25:25 +01:00
el-j 0281d0951b craft-video: Motion JPEG decoder and encoder (mjpeg)
A frame-level wrapper over craft-jpeg: packets decode to gray or RGB
frames (Annex K Huffman tables put in for AVI MJPG packets that have
none) and frames encode to baseline JPEG packets. Checked against
ffmpeg as a black-box oracle in both directions.

Part of #1510.
2026-11-15 22:19:12 +01:00
Dylan M. Taylor b63ab73fa3 video: share uncompressed AVI and QuickTime sample decoding 2026-11-15 17:59:49 +00:00
Dylan M. Taylor d1f67cae22 Merge pull request #1578 from el-j/feat/video-ffv1
craft-video: FFV1 lossless video (version 3, range coder) decoder and encoder
2026-11-15 12:22:53 -05:00
vangel76andClaude Sonnet 5.5 e07edcee5d Merge upstream/main into perf/hevc-residual-decode
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 14:16:57 +01:00
vangel76andClaude Sonnet 5.5 472e064b74 Merge upstream/main into perf/av1-wavefront-3106
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 14:13:59 +01:00
el-j 5ab7a6035c craft-video: FFV1 lossless video, version 3 range-coder decoder and encoder
Adds the ffv1 feature (RFC 9043): YCbCr (any 2^n subsampling, gray,
optional transparency) and RGB through the JPEG 2000 reversible colour
transform, 8 to 16 bits, any slice raster, slice and configuration
record CRCs. Not covered yet: the Golomb-Rice coder, versions 0 and 1,
inter frames.

Part of #1509
2026-11-15 13:06:49 +01:00
Dylan M. Taylor 9d088c77ea Support buffered output from tiled AV1 encoder 2026-11-15 11:25:41 +00:00
Dylan M. Taylor 92c0b49b5e feat(video): support tiled AV1 for large frames (#1453)
* feat(video): add tiled AV1 large-frame fallback

* feat(video): expose tiled AV1 speed preset

* fix(video): use clamped AV1 keyframe interval
2026-11-14 20:38:28 -05:00
Dylan M. Taylor 1a4cf6d0ba Merge pull request #1195 from alehel/craft-video/mpeg2-encode-b
craft-video: MPEG-2 encoder, second step: B pictures (#1133)
2026-11-14 19:39:11 -05:00
alehel c83e8ba250 craft-video: MPEG-2 encoder: flush and timestamp fixes from review (#1133)
- flush ends the GOP for average bitrate too: the budget of the pictures
  the GOP did not get is taken back, so flushed short GOPs no longer
  raise the bitrate.
- A lone picture flushed before a second sets the step gets dts = pts - 1,
  so decoding times still increase if encoding goes on.
- Presentation times whose decoding time does not fit in an i64 are
  refused with BadTimestamp before any state changes.
- Tests: the skip range test uses an f_code that can carry its vector, and
  the reconstruction count is checked before comparing pictures.
2026-11-15 00:07:33 +01:00
Dylan M. Taylor d6cd7836d3 feat(video,image-codecs,stream-codecs): add encode_with_key, encode_avif_hdr, and decode_ccitt_raw (#1369) 2026-11-14 16:15:44 -05:00
aiongg deeb91802f Lints: doc links, test lint allowances, struct update in tests, wildcard imports, dead code 2026-11-14 02:35:35 +00:00
aiongg 0c586294ea Lints: fix clippy and rustdoc findings in ui-contract, i18n, heif, mesh, video, audio, doc and the doc links 2026-11-14 00:35:31 +00:00
aiongg 577055bc34 Merge storytold main 3c59a2aa5 into craft-framework (sync 13 Nov)
202 upstream commits since 6cb00467a. Resolutions:
- craft-window, craft-platform: ours. Upstream's frame policy v2, restore
  store and GNOME light/wait_first are the versions carried on 28 Oct;
  ours moved place() to craft-behavior and kept LayoutWatch and the
  appearance/portal.rs split.
- craft-timeline: ours. craft-time (crates/time) lands as upstream wrote
  it and is not yet used by craft-timeline.
- Old crates/ui modules stay removed. Upstream's frosted backdrops, shape
  gallery, dialog tabs and the iconic flyout top-edge rendering are not
  carried. The #1094 model half is in craft-behavior's dock:
  Group::flyout_offset and Action::MoveFlyoutTop.
- craft-update: #586 Save and Update, the install probe on the check
  thread and quiet per-user MSI self-updates, carried into updater.rs,
  stack_dialogs.rs, install/windows.rs and self_update/helper.rs.
- craft-jpeg: progressive Huffman decoding, carried into huffman.rs,
  parse.rs and scan.rs.
- craft-print: the driver settings dialog's new tests and the bounded
  XML parse's tests, as trials.
- Test-only conflicts: upstream tests from before the base that our side
  cut stay cut; tests new upstream are kept.
2026-11-13 17:11:48 +00:00
Dylan M. Taylor 166ad3e46a craft-video: preserve FilmCraft H.264 search starts 2026-11-13 14:19:12 +00:00
alehel c298ac8bd2 craft-video: MPEG-2 encoder, second step: B pictures (#1133)
B pictures between anchors (b_pictures 0..=4, default 2) with reordering:
pictures go in in display order, packets come out in decoding order with
dts one picture interval before the presentation times. Closed or open
GOPs; the leading B pictures of a closed GOP predict backward only.

B macroblocks are forward, backward or interpolated, from a search per
direction seeded with the P picture's vectors scaled to the distance, or
skipped (previous directions with the predictors, kept inside the
reference). Rate control adds TM5's B complexity (K_b 1.4); a constant
quantiser codes B pictures at 1.25 times it.
2026-11-13 13:38:33 +01:00
Dylan M. Taylor d9419a111a Merge pull request #1136 from alehel/craft-video/mpeg2-encode-ip
craft-video: MPEG-2 encoder, first step: I and P pictures (#1133)
2026-11-13 05:41:51 -05:00
Dylan M. Taylor ba12997467 Merge pull request #1175 from alehel/claude/avi-muxer
craft-media: AVI muxer (AviWriter)
2026-11-13 05:41:45 -05:00
Dylan M. Taylor ea24422ae9 Merge pull request #1154 from storytold/codex/778-h264-picnum
video: harden H.264 and configure frame limits
2026-11-13 03:49:15 -05:00
Dylan M. Taylor 9814469613 Bound extreme H264 POC cycle arithmetic 2026-11-13 07:24:13 +00:00
Dylan M. Taylor 56a1f2b7c4 Avoid premature saturation in H264 type 1 POC 2026-11-13 07:11:12 +00:00
alehel 7af2f8e868 craft-media: AVI muxer (AviWriter)
Write AVI files: hdrl with avih and one strl (strh, strf, strn, indx) per
stream, odml/dmlh, an interleaved movi and idx1. Past the RIFF limit
(default 1 GiB) the file continues in OpenDML RIFF AVIX extensions with
ix## standard indexes and an indx super index per stream.

- VideoSpec::for_codec builds the stream from CodecParams; MPEG-4 Part 2
  is tagged FMP4.
- Audio is timed by bytes (PCM-style) or one packet per chunk.
- Bad options and chunks are errors; finish() closes a readable file
  after a failed write.

Tests read the files back through this crate's demuxer by every index,
and through ffmpeg (decode identical to the sources, seeks through the
index, ffprobe fields), in one RIFF and across AVIX extensions. The
MPEG-4 encoder tests play its packets from an AVI file.
2026-11-13 07:34:28 +01:00
alehel 1df8d98c85 craft-video: MPEG-2 encoder, first step: I and P pictures (#1133)
The start of MPEG-2 encoding in craft_video::mpeg2 (feature
mpeg2-encode): progressive frame pictures, closed I/P GOPs, 4:2:0 Main
Profile and 4:2:2 Profile, constant quantiser or single-pass average
bitrate with adaptive quantisation, half-sample motion search.

The encoder shares the decoder's code tables, IDCT, dequantisation and
motion compensation, so the decoder outputs exactly the encoder's
reconstruction. B pictures, a VBV guarantee, interlaced coding and DVD
or broadcast presets are later steps of #1133.

The mpeg2 feature is split into mpeg2-decode and mpeg2-encode; mpeg2
still turns on both.
2026-11-13 07:34:05 +01:00
Dylan M. Taylor 07a4cd0fc7 #778: preserve consumer VP8 frame limits 2026-11-13 06:05:39 +00:00
Dylan M. Taylor 7316e4e223 fix: clear workspace baseline gates on Rust 1.100 2026-11-13 03:13:53 +00:00
Dylan M. Taylor 2253894e2f fix: satisfy Rust 1.100 workspace clippy 2026-11-13 01:39:26 +00:00
Dylan M. Taylor 4cca9be2ab video: configure bounded decoder frame limits 2026-11-13 01:10:32 +00:00
Dylan M. Taylor 6fa8323991 video: saturate extreme H.264 picture order values 2026-11-13 00:44:21 +00:00
Dylan M. Taylor 409b0036f8 video: bound H.264 picture number arithmetic 2026-11-13 00:37:31 +00:00
vangel76 14913a18c2 Merge remote-tracking branch 'upstream/main' into HEAD
# Conflicts:
#	crates/video/src/av1/decode/decoder.rs
2026-11-12 22:18:38 +01:00
vangel76andClaude Sonnet 5.5 9541787aa9 hevc: simplify scaling-list condition for clippy nonminimal_bool
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 22:17:58 +01:00
vangel76andClaude Sonnet 5.5 c25999c8a4 hevc decode: dequantise while decoding residuals, table-driven sig_coeff contexts
Each coefficient is scaled (8.6.3) as it is decoded and stored in a list of
(index, value) instead of a separate pass over the bounding box. Only the
coefficient bounding box is cleared before the list is scattered into it. DC-only
blocks add the inverse-DC constant straight to the prediction. sig_coeff_flag
ctxInc comes from a per-sub-block table, last_sb / last_pos from inverse scan
tables. Merge candidates use the fixed five-entry list instead of a Vec.

Same change as storytold/Filmcraft#3188 (residual part), ported onto craft-video.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 21:51:12 +01:00