Commit Graph
185 Commits
Author SHA1 Message Date
BFlat 7f52db114e Merge pull request #3934 from dotCooCoo/fix/kurbo-linear-cubic-zero-tangent
kurbo: carry 0.13.1 in vendor/ with a stroke fix for zero tangents
2026-11-29 00:25:53 +07:00
BFlat 19c08ce81a Merge pull request #1233 from dotCooCoo/feat/craft-mesh-ops
craft-mesh-ops: mesh operations, a BVH and primitives for the 3D apps
2026-11-28 23:59:52 +07:00
dotCooCoo 0fd83009e3 Merge main into fix/kurbo-linear-cubic-zero-tangent 2026-11-28 08:49:46 -08:00
dotCooCoo 08525664c3 kurbo: a stroke skips zero tangents instead of giving NaN
A collinear cubic that runs back and forth is stroked by
StrokeCtx::do_linear, which steps from cusp to cusp. After rounding, two
cusps can land on the same point, or a cusp on the end point, and the
tangent between them is exactly zero. do_join and do_line divide by the
tangent's length, so the whole outline held NaN coordinates and a
renderer that fills it draws no stroke. do_linear now skips such a step.

The stroker had the same fault for a quadratic or cubic that ends where
it starts with control arms shorter than 1e-6: PathSeg::tangents falls
back to the chord, which is zero. Such a curve is now skipped, as a
zero-length line already is.

The linear_cubic_with_coincident_cusps and tiny_closed_loops tests fail
on the published package. README.craft.md, SOURCE.json and NOTICE list
the patches.
2026-11-27 13:38:22 -08:00
dotCooCoo 5ee624b384 kurbo: keep a copy of the crates.io 0.13.1 package in vendor/
Add the kurbo 0.13.1 package to vendor/ with no file changed, so that a
fix to it can reach the Craft apps through this repository. The package
was published from the v0.13.1 tag of linebender/kurbo, and every file
of the archive is kept.

Add a workspace exclude, a [patch.crates-io] entry, SOURCE.json with the
archive hash and per-file hashes, a NOTICE section, and the package's
tests in the backend test script, whose other backends now also build
against the copy. Every workspace crate that uses kurbo 0.13 builds
against the copy, so Cargo.lock drops the package's registry source and
checksum.
2026-11-27 13:17:31 -08:00
dotCooCoo 5ccb4d64c1 Merge main into fix/linesweeper-add-many-paths-quadratic 2026-11-26 00:03:39 -08:00
dotCooCoo 795d798def craft-mesh-ops: the crate is the TextureCraft geometry code moved as it is
Replace the crate's sources with TextureCraft crates/geom at 386630e and
MaterialCraft Mesh::subdivided at 3133062, with their tests, so this pull
request is the move alone. The crate keeps the sources' dependencies and
behavior; rustfmt is applied at this repository's 150 columns. Fixes to the
moved code go in separate pull requests.
2026-11-25 23:11:13 -08:00
dotCooCoo a5c89d9d51 Merge main into feat/craft-mesh-ops 2026-11-25 20:45:54 -08:00
dotCooCoo 403d97b6be Merge main into integration/linesweeper 2026-11-25 19:51:20 -08:00
BFlat b5c33cddef Merge pull request #2880 from dotCooCoo/feat/craft-pbr-wgsl
craft-pbr: shading functions as WGSL text for apps' shaders
2026-11-26 10:28:51 +07:00
dotCooCoo 9a56e78aeb Merge main into integration/linesweeper 2026-11-25 19:28:03 -08:00
dotCooCoo a8e1315bc0 Merge main into feat/craft-mesh-ops 2026-11-25 19:26:13 -08:00
BFlat 5632c89adf Merge pull request #729 from dotCooCoo/fix/linesweeper-transversal-negative-dy
linesweeper: curves that cross just after a shared start are not reported as ordered
2026-11-26 10:14:01 +07:00
aiongg cf35f7dbae Merge remote-tracking branch 'upstream/main' into next-sync-1123
# Conflicts:
#	Cargo.toml
#	crates/audio/src/track.rs
2026-11-23 01:29:52 +00:00
FredApps 3de39fd3a5 media-source: play indexed Y4M from bounded byte ranges (#2903)
* media-source: play indexed Y4M from bounded byte ranges

* Preserve Y4M indexing errors and align fractional seek boundaries
2026-11-22 04:58:22 +07:00
dotCooCoo 9acd6d5883 craft-pbr: record the TextureCraft, MaterialCraft and EffectCraft sources in NOTICE
NOTICE lists the files craft-pbr adapts and the reference copies in tests/it/reference, with each repository, path and full revision, under Source provenance as docs/clean-room.md asks.
2026-11-21 09:41:50 -08:00
Dylan M. TayloranddotCooCoo 75d179f8df craft-cdr: move VectorCraft's bounded CDR/CMX reader into craft-libs (#2697)
* craft-cdr: move VectorCraft's bounded CDR/CMX reader into craft-libs (#778)

Moves crates/cdr (vectorcraft-cdr, landed in storytold/vectorcraft#8632)
to craft-libs as craft-cdr: legacy WL (v1-v2), RIFF/cmpr (v3-v13),
ZIP packages and data streams (v14-v27), .cmx (32-bit), provenance
(R1-R63), synthetic test builders, and integration tests.

Co-authored-by: dotCooCoo <RobertLeeLW@gmail.com>

* craft-cdr: address CodeRabbit review findings

- Classify all-zero CMX dash patterns once in Tables::read instead of per-curve
- Validate loda offset table length before reserving offsets Vec capacity

---------

Co-authored-by: dotCooCoo <RobertLeeLW@gmail.com>
2026-11-20 19:12:32 -05:00
aiongg ca58dfe6c9 Merge storytold main into next (19 Nov sync)
Merges main at d7c9632bfb.

- Cargo.toml: both sides' new workspace crates (next's font-subset, harfbuzz-subset-sys and
  host; main's gpu, gpu-null, gpu-providers and gpu-wgpu).
- crates/jpeg: next split lib.rs into modules; main's reduced-size decoding goes to them: the
  scaled IDCT, reconstruction and render_scaled to idct.rs, MAX_SHRINK, reduced_estimate and
  decode_reduced stay public in lib.rs. Main's new test added; the frame test next removed
  stays removed.
- crates/audio, crates/media: next builds the integration tests into the library's test
  executable (autotests off, tests/main.rs); main's new DSD and MPEG-TS mux tests are modules
  there behind their features instead of [[test]] targets, and the mux tests reach their shared
  helper module through the integration module.
- crates/media/src/matroska/track.rs: main's new FFV1 codec-parameter test added; the test
  modules next removed stay removed.
- crates/file-formats: main's JXL capability test, which asks the codec whether JXL reads,
  replaces next's interim check.
2026-11-19 16:22:24 +00:00
texjer 400b2f821d craft-develop: the crate, with inpaint from LightCraft
The first module of the shared develop pipeline (#587): lightcraft-inpaint at
a75497d6, as craft_develop::inpaint. PatchMatch patch completion and the
membrane fill it seeds from, with their tests. Only the paths in two doc
links and two imports changed.

A parity test compares both fills of one scene with what LightCraft's crate
gave at that commit, through craft-render-parity at Tolerance::BASELINE.
2026-11-17 13:00:47 -05:00
aiongg ac3dfd1f53 Merge storytold main into next (17 Nov sync)
storytold main 83cb1133dd (291 commits) into the integration head bab1a99b85; 47 conflicted files.

- Domain test files (metafile, prepress, pdf plates, settings store, heif, media-testkit, atomic): tests next cut stay cut; tests new on main are kept, as trials where the crate's test target runs trials.
- atomic: main's group-bits test and Faulty::set_group go to src/tests.rs. audio: main's GSM and SBC oracles join tests/main.rs. cms constructors, pdf knockout_backdrop and testing_pdf join their crates' one test binary; timeline's preflight tests become src/preflight_tests.rs trials.
- update: main's changes to detect, install (linux, macos) and the tests land in next's split modules. The app's own offer is inspected on a thread of its own, picked up by tick's polling; settle_for_tests settles offers too. Later on a ready update drops the close it asked for. updater_pin_tests.rs stays deleted; its new pin test is in tests/it/update.rs.
- craft-color: main added a different crate at crates/color (the colour tags of compositor and display frames); it is next's craft-color module `tags`, re-exported at the root.
- Old crates/ui (combo, docking, testing, README) and keymap's ui/view.rs stay deleted; main's new crates/ui/src/testing files are dropped with them.
- New crates in the craft facade: ai, control, dds, frame, ipc, media-source, palette, press-print, score, ssip. testkit and xtask are listed outside it.
- Cargo.lock: the union of both locks, resolved by cargo metadata. Workflow: main's nextest Windows leg, with next's --keep-going clippy.
2026-11-17 12:44:52 +00:00
dotCooCoo 81eafc3a29 Merge main into integration/linesweeper 2026-11-16 21:35:13 -08:00
dotCooCoo 3ce3470444 Merge main into feat/craft-mesh-ops 2026-11-16 19:28:46 -08:00
dotCooCoo 6e9efbdba1 Merge main into fix/linesweeper-transversal-negative-dy 2026-11-16 19:26:45 -08:00
dotCooCoo f78c1b302b Merge main into fix/linesweeper-add-many-paths-quadratic 2026-11-16 19:23:16 -08:00
.CooCoo 5724da0f2e linesweeper: short chords at huge x and subnormal line x stay finite and exact (#1258) 2026-11-16 21:36:59 -05: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
dotCooCoo 9f564159c5 Merge main into feat/craft-mesh-ops 2026-11-15 16:45:03 -08:00
Dylan M. Taylor e2e2ce2c88 Retain IJG and SIMD notices for shared JPEG encoding 2026-11-15 12:34:42 +00:00
dotCooCoo c599e9485c Merge main into fix/linesweeper-transversal-negative-dy 2026-11-14 09:11:24 -08:00
dotCooCoo bccb0a15ea Merge main into fix/linesweeper-add-many-paths-quadratic 2026-11-14 09:10:22 -08:00
Dylan M. Taylor 15b013b305 Merge pull request #637 from dotCooCoo/fix/linesweeper-sweep-doc-left-scan
linesweeper: the left intersection scan in docs/sweep.typ compares with alpha^(i+1)
2026-11-14 11:19:24 -05:00
dotCooCoo bb0e0cdd11 Merge fix/linesweeper-chord-huge-x-subnormal (#1258) into integration/linesweeper 2026-11-14 02:12:44 -08:00
dotCooCoo 645fe92a72 Merge main into feat/craft-mesh-ops 2026-11-13 21:08:37 -08:00
dotCooCoo a32a377e03 linesweeper: short chords at huge x and subnormal line x stay finite and exact
fit_quadratic takes a chord for a very short curve. Its constant term
multiplied an x coordinate by a height, which overflowed for x near
1e305 with heights near 1e4, and the difference of the two products was
NaN. When that constant term is not finite, it now takes the line
through the curve's start point with the chord's slope.

line_at_ys took the weighted sum of the x coordinates directly, so a
vertical line at x = 5e-324 gave x = 0 halfway along its height. When
both x coordinates have a magnitude below 2^-500, the sum is taken on
the x coordinates times 2^600 and scaled back.

README.craft.md, SOURCE.json and NOTICE record the local patches.
2026-11-13 20:12:23 -08:00
dotCooCoo 4c1e94606f Merge fix/linesweeper-clippy-lints (#1248) into integration/linesweeper
# Conflicts:
#	vendor/linesweeper/README.craft.md
#	vendor/linesweeper/SOURCE.json
2026-11-13 20:03:31 -08:00
Dylan M. Taylor 840d156fbf Merge current main into image codec extraction 2026-11-14 03:10:53 +00:00
dotCooCoo 453843d534 craft-mesh-ops: mesh operations, a BVH and primitives for the 3D apps
crates/mesh-ops holds the triangle-mesh code that TextureCraft and
MaterialCraft each keep a copy of: area-weighted normals, MikkTSpace
tangents, welding, UV unwrapping, the UV-space G-buffer, primitives
with UVs, a BVH (feature `bvh`) and the orbit camera. It is the
craft-mesh-ops crate of RFC-0032
(https://github.com/storytold/craft-contrib/pull/50). Each app switches
to it in its own pull request.

The code is TextureCraft's crates/geom at 386630ee, with
Mesh::subdivided from MaterialCraft's crates/geom at 31330629. Their 30
tests are unchanged. The index check before tangent generation and its
two tests are from TextureCraft #386 by simonhull.

Added to the moved code:

- Functions that take positions, normals, UVs and indices as plain
  slices (bounds, smooth_normals, tangents, weld, unwrap_uvs,
  UvGBuffer::from_slices, Bvh::from_slices), and `Limits` with a
  default for each count. They check the counts, every index and every
  value before any work and return a MeshOpsError.
- try_ forms of append, subdivision, the primitives, the G-buffer and
  the BVH. The existing forms keep their signatures: they clamp, or
  return the mesh unchanged or an empty result.
- `rayon` and `serde` are the optional features `parallel` and `serde`.

Behavior of the moved code that changes:

- A mesh with an index past its vertices, which made MikkTSpace panic,
  a non-finite position, normal or UV, or only triangles that are
  degenerate after the division below gets per-triangle tangents
  without the MikkTSpace call. Positions and UVs outside 1e-6 to
  1e6, and normals that are not near unit length, are divided by their
  largest magnitude first.
- Submesh ranges are added in u64 and have to cover whole triangles.
  append returns the mesh unchanged where a rebased index or range does
  not fit in u32, keeps the attribute arrays as long as the positions,
  and gives a side without a material list one unnamed material.
- subdivided takes midpoints as half-sums, keeps each submesh on its
  own triangles and carries polygon diagonals to the four children.
- Mesh::bounds leaves out non-finite positions. normalize_to reaches
  the requested radius for a mesh near f32::MAX or smaller than 1e-4.
- The BVH leaves out triangles with a non-finite corner. A ray with a
  non-finite origin or direction, a zero direction or a NaN tmax, a
  nearest query with a non-finite point or a NaN or negative distance,
  and a box query with a NaN coordinate find nothing. The ray test's
  determinant cutoff follows the size of the triangle, and the nearest
  search includes a point exactly at the distance.
- The primitives return an empty mesh for a non-finite size or one that
  overflows a coordinate, where they built a mesh from a NaN size, and
  the box returns one for a negative, NaN or zero half size, where it
  panicked or gave NaN UVs.
- UvGBuffer::new clamps each side to 8192 and skips a triangle more
  than 1e18 texels from the UV origin.
- auto_unwrap gives the same layout at every scale and leaves the mesh
  unchanged when it returns an error. weld_ids keeps its grid of 1e-6
  of the diagonal for a diagonal under 1e-6.
- OrbitCamera::frame leaves the camera unchanged for a box it cannot
  frame.

TextureCraft #277, #416, #253, #413 and #360 are open on the same files.
The finite-value check that #253 adds to Mesh::validate is included;
the rest of these pull requests is not.

mikktspace 0.3.0 is MIT OR Apache-2.0. Its src/generated.rs carries the
2011 notice of Morten S. Mikkelsen's C original, which
crates/mesh-ops/ATTRIBUTION.md reproduces.
2026-11-13 15:47:41 -08:00
aiongg 3e4b679592 Merge storytold main 7bb6c900 (sync 13 Nov)
# Conflicts:
#	Cargo.toml
2026-11-13 23:41:57 +00:00
Dylan M. Taylor 888bffcbb3 Add shared DWG-DXF byte bridge 2026-11-13 22:45:07 +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 9430f2807e Add shared image codec facade 2026-11-13 00:17:04 -05:00
dotCooCoo 32ffa0b58a Merge main into fix/linesweeper-sweep-doc-left-scan 2026-11-12 09:02:06 -08:00
dotCooCoo 6274c80715 Merge main into integration/linesweeper 2026-11-12 08:46:07 -08:00
dotCooCoo 7c9a633bba Merge main into fix/linesweeper-transversal-negative-dy 2026-11-12 08:43:25 -08:00
dotCooCoo bf50dcfcfa Merge main into fix/linesweeper-add-many-paths-quadratic 2026-11-12 08:43:18 -08:00
.CooCoo d624d5895a linesweeper: line_segment's doc says it can return an exited segment
A segment that exits at a sweep line keeps its position until the sweep advances, and segment_range leaves it out.

---------

Co-authored-by: dotCooCoo <RobertLeeLW@gmail.com>
2026-11-12 10:06:02 -05:00
aiongg 673e9e8e63 Workspace, build tooling and CI: the cl command, profiles, one feature set, workflows 2026-11-12 14:09:31 +00:00
e9e1da3a58 craft-raw: Canon CR3 (CRX), header plans and the remaining preview branches (#1070)
* craft-raw: the file-format layer of camera raw files, with DNG and CRW

A new crate for #587 and #778: bytes in, the sensor data out as a neutral
RawImage (samples, CFA, levels, active area, crop, orientation, colour tags,
opcode lists, profile tables), and back for DNG. One Cargo feature per format:
dng (read and write), jxl (JPEG XL DNG), crw (through craft-crw).

The base is LightCraft's crates/raw at 5ff567a4: dng, dngwrite, tiffraw,
unpack, ljpeg, jxl, semantic, preview, the parsing half of opcodes, profile
and gaintable, the model and probe. Demosaicing and everything after it stay
with the develop pipeline.

Ported from PhotoCraft's and FilmCraft's DNG readers, each with a test: the
default crop's per-tag defaults, an unusable crop falling back to the active
area, non-finite white levels, the white default of a linearized image, the
AsShotWhiteXY range, 8-bit-only lossy JPEG, lossy tiles that must cover their
part of the image, and the CinemaDNG frame tags.

* craft-raw: Hasselblad 3FR and FFF (feature hasselblad)

RawFormat::CfaTiff decodes: the DNG-layout reader plus what these files add.
Uncompressed data or Hasselblad's lossless JPEG (selection value 8), RGGB when
no CFAPattern is stated, an FFF's colour matrix from the 3FR header it embeds,
and the 8-bit RGB preview handed on as a baseline TIFF.

Moved from LightCraft's vendor/hasselblad.rs at 5ff567a4 with its tests.
Ported from PhotoCraft's reader: four BlackLevel values without a
BlackLevelRepeatDim are one per CFA site in a file that is not a DNG.

* craft-raw: Minolta MRW, Epson ERF, Mamiya MEF and Kodak DCS520C

Four formats only LightCraft decodes, one feature each (mrw, erf, mef, kodak),
moved from its vendor modules at 5ff567a4 with their tests; the MRW block
container comes from lightcraft-meta. src/shared.rs holds the level helpers
the maker decoders share.

ERF and MEF state no white balance: the estimate LightCraft made from the
preview is develop-side work, so wb_multipliers is None for them here.

* craft-raw: shared scan budget for tagged previews, tile-sized lossy JPEG budget, bound on Deflate tile padding

Ported from storytold/lightcraft#3695. Candidate preview ranges are deduplicated and charged to one byte
budget and one header-walk budget; a lossy JPEG decoded for a tile may hold no more samples than the tile
rounded up to whole MCUs (and never more than Limits::max_lossy_tile_samples); a Deflate chunk whose nominal
size is mostly padding outside the image is refused before it is inflated.

* craft-raw: lossless JPEG sample bound per referenced byte; previews larger than the file are passed over

Ported from storytold/lightcraft#3910 (the parts whose code is in craft-raw today). check_image refuses a
lossless JPEG image that declares more than 32 samples per referenced byte, counted once per chunk that points
at the bytes so identical tiles stored once still decode. The Hasselblad RGB preview search passes over an
image whose pixel bytes exceed the file and still takes a smaller complete one.

* craft-raw: test for the Deflate padding bound

* craft-raw: Pentax PEF and Samsung SRW

Moved from LightCraft crates/raw (vendor/pef.rs, vendor/srw.rs) at 5ff567a4. The Huffman difference decoder
and bit reader that PEF shares with the Nikon, Panasonic and Sony codings become the huffman module.

* craft-raw: Canon CR2, with sRAW and mRAW

Moved from LightCraft crates/raw (vendor/cr2.rs, vendor/cr2/sraw.rs) at 5ff567a4. The white-balance presets a
CR2 lists come back as data in ColorData::kelvin_presets (the ordering from LightCraft's kelvin_presets.rs;
the temperature and tint arithmetic stays with the developer).

* craft-raw: an sRAW preview larger than the file is refused before its buffer is reserved

Ported from storytold/lightcraft#3910 (cr2::sraw::read_preview).

* WIP craft-raw: Nikon NEF/NRW (does not compile yet: limits threading, develop() calls in tests)

* craft-raw: Nikon NEF/NRW, with PhotoCraft's maker-note compression routing and 12-bit D4 white level

* craft-raw: Panasonic RW2 / RWL / RAW, every raw format

* craft-raw: RW2 format 8 refuses strips stating fewer bits than samples

Ported from storytold/lightcraft#3910.

* craft-raw: RW2 format 8 refuses samples above the declared bit depth

Ported from storytold/photocraft#11838.

* craft-raw: the RW2 format 8 robustness seed carries a valid stream

Its random payload decoded only while out-of-depth samples were clamped; mutations now start from a file that decodes.

* craft-raw: Fujifilm RAF, uncompressed and compressed, with lens corrections

* craft-raw: compressed RAF stripes cap their capacity hint at the stripe's bits

Ported from storytold/lightcraft#3910.

* craft-raw: test RAF orientation and camera from the embedded JPEG's Exif

* WIP craft-raw: Olympus ORF

* craft-raw: RAF embedded preview, and its range from the header alone (bounded_preview)

* craft-raw: Olympus ORF, the uncompressed layouts, with its maker-note preview and WB_GLevel

* WIP craft-raw: Sony ARW

* craft-raw: tiled lossless ARW decodes hold one group of tiles at a time

Ported from storytold/lightcraft#3910.

* craft-raw: dark 12-bit uncompressed ARWs keep Sony's 14-bit levels, and the DNG writer's depth holds the white level

Ported from storytold/lightcraft#3429.

* craft-raw: Sony ARW family, docs, seeds and the derivation records

* WIP craft-raw: Canon CR3

* craft-raw: Canon CR3 (CRX) through craft-metadata's container, header plans, CR3 previews and the coverage records

---------

Co-authored-by: radialmonster <radial@gmail.com>
Co-authored-by: wnanbei <wnanbei@gmail.com>
Co-authored-by: lownlyrider <lownlyrider@gmail.com>
2026-11-11 22:01:07 -05:00
a7a00c7b0a craft-raw: Olympus ORF (uncompressed) (#1032)
* craft-raw: the file-format layer of camera raw files, with DNG and CRW

A new crate for #587 and #778: bytes in, the sensor data out as a neutral
RawImage (samples, CFA, levels, active area, crop, orientation, colour tags,
opcode lists, profile tables), and back for DNG. One Cargo feature per format:
dng (read and write), jxl (JPEG XL DNG), crw (through craft-crw).

The base is LightCraft's crates/raw at 5ff567a4: dng, dngwrite, tiffraw,
unpack, ljpeg, jxl, semantic, preview, the parsing half of opcodes, profile
and gaintable, the model and probe. Demosaicing and everything after it stay
with the develop pipeline.

Ported from PhotoCraft's and FilmCraft's DNG readers, each with a test: the
default crop's per-tag defaults, an unusable crop falling back to the active
area, non-finite white levels, the white default of a linearized image, the
AsShotWhiteXY range, 8-bit-only lossy JPEG, lossy tiles that must cover their
part of the image, and the CinemaDNG frame tags.

* craft-raw: Hasselblad 3FR and FFF (feature hasselblad)

RawFormat::CfaTiff decodes: the DNG-layout reader plus what these files add.
Uncompressed data or Hasselblad's lossless JPEG (selection value 8), RGGB when
no CFAPattern is stated, an FFF's colour matrix from the 3FR header it embeds,
and the 8-bit RGB preview handed on as a baseline TIFF.

Moved from LightCraft's vendor/hasselblad.rs at 5ff567a4 with its tests.
Ported from PhotoCraft's reader: four BlackLevel values without a
BlackLevelRepeatDim are one per CFA site in a file that is not a DNG.

* craft-raw: Minolta MRW, Epson ERF, Mamiya MEF and Kodak DCS520C

Four formats only LightCraft decodes, one feature each (mrw, erf, mef, kodak),
moved from its vendor modules at 5ff567a4 with their tests; the MRW block
container comes from lightcraft-meta. src/shared.rs holds the level helpers
the maker decoders share.

ERF and MEF state no white balance: the estimate LightCraft made from the
preview is develop-side work, so wb_multipliers is None for them here.

* craft-raw: shared scan budget for tagged previews, tile-sized lossy JPEG budget, bound on Deflate tile padding

Ported from storytold/lightcraft#3695. Candidate preview ranges are deduplicated and charged to one byte
budget and one header-walk budget; a lossy JPEG decoded for a tile may hold no more samples than the tile
rounded up to whole MCUs (and never more than Limits::max_lossy_tile_samples); a Deflate chunk whose nominal
size is mostly padding outside the image is refused before it is inflated.

* craft-raw: lossless JPEG sample bound per referenced byte; previews larger than the file are passed over

Ported from storytold/lightcraft#3910 (the parts whose code is in craft-raw today). check_image refuses a
lossless JPEG image that declares more than 32 samples per referenced byte, counted once per chunk that points
at the bytes so identical tiles stored once still decode. The Hasselblad RGB preview search passes over an
image whose pixel bytes exceed the file and still takes a smaller complete one.

* craft-raw: test for the Deflate padding bound

* craft-raw: Pentax PEF and Samsung SRW

Moved from LightCraft crates/raw (vendor/pef.rs, vendor/srw.rs) at 5ff567a4. The Huffman difference decoder
and bit reader that PEF shares with the Nikon, Panasonic and Sony codings become the huffman module.

* craft-raw: Canon CR2, with sRAW and mRAW

Moved from LightCraft crates/raw (vendor/cr2.rs, vendor/cr2/sraw.rs) at 5ff567a4. The white-balance presets a
CR2 lists come back as data in ColorData::kelvin_presets (the ordering from LightCraft's kelvin_presets.rs;
the temperature and tint arithmetic stays with the developer).

* craft-raw: an sRAW preview larger than the file is refused before its buffer is reserved

Ported from storytold/lightcraft#3910 (cr2::sraw::read_preview).

* WIP craft-raw: Nikon NEF/NRW (does not compile yet: limits threading, develop() calls in tests)

* craft-raw: Nikon NEF/NRW, with PhotoCraft's maker-note compression routing and 12-bit D4 white level

* craft-raw: Panasonic RW2 / RWL / RAW, every raw format

* craft-raw: RW2 format 8 refuses strips stating fewer bits than samples

Ported from storytold/lightcraft#3910.

* craft-raw: RW2 format 8 refuses samples above the declared bit depth

Ported from storytold/photocraft#11838.

* craft-raw: the RW2 format 8 robustness seed carries a valid stream

Its random payload decoded only while out-of-depth samples were clamped; mutations now start from a file that decodes.

* craft-raw: Fujifilm RAF, uncompressed and compressed, with lens corrections

* craft-raw: compressed RAF stripes cap their capacity hint at the stripe's bits

Ported from storytold/lightcraft#3910.

* craft-raw: test RAF orientation and camera from the embedded JPEG's Exif

* WIP craft-raw: Olympus ORF

* craft-raw: RAF embedded preview, and its range from the header alone (bounded_preview)

* craft-raw: Olympus ORF, the uncompressed layouts, with its maker-note preview and WB_GLevel

---------

Co-authored-by: radialmonster <radial@gmail.com>
Co-authored-by: wnanbei <wnanbei@gmail.com>
2026-11-11 20:48:30 -05:00
b471b84fd4 craft-raw: Fujifilm RAF (#1016)
* craft-raw: the file-format layer of camera raw files, with DNG and CRW

A new crate for #587 and #778: bytes in, the sensor data out as a neutral
RawImage (samples, CFA, levels, active area, crop, orientation, colour tags,
opcode lists, profile tables), and back for DNG. One Cargo feature per format:
dng (read and write), jxl (JPEG XL DNG), crw (through craft-crw).

The base is LightCraft's crates/raw at 5ff567a4: dng, dngwrite, tiffraw,
unpack, ljpeg, jxl, semantic, preview, the parsing half of opcodes, profile
and gaintable, the model and probe. Demosaicing and everything after it stay
with the develop pipeline.

Ported from PhotoCraft's and FilmCraft's DNG readers, each with a test: the
default crop's per-tag defaults, an unusable crop falling back to the active
area, non-finite white levels, the white default of a linearized image, the
AsShotWhiteXY range, 8-bit-only lossy JPEG, lossy tiles that must cover their
part of the image, and the CinemaDNG frame tags.

* craft-raw: Hasselblad 3FR and FFF (feature hasselblad)

RawFormat::CfaTiff decodes: the DNG-layout reader plus what these files add.
Uncompressed data or Hasselblad's lossless JPEG (selection value 8), RGGB when
no CFAPattern is stated, an FFF's colour matrix from the 3FR header it embeds,
and the 8-bit RGB preview handed on as a baseline TIFF.

Moved from LightCraft's vendor/hasselblad.rs at 5ff567a4 with its tests.
Ported from PhotoCraft's reader: four BlackLevel values without a
BlackLevelRepeatDim are one per CFA site in a file that is not a DNG.

* craft-raw: Minolta MRW, Epson ERF, Mamiya MEF and Kodak DCS520C

Four formats only LightCraft decodes, one feature each (mrw, erf, mef, kodak),
moved from its vendor modules at 5ff567a4 with their tests; the MRW block
container comes from lightcraft-meta. src/shared.rs holds the level helpers
the maker decoders share.

ERF and MEF state no white balance: the estimate LightCraft made from the
preview is develop-side work, so wb_multipliers is None for them here.

* craft-raw: shared scan budget for tagged previews, tile-sized lossy JPEG budget, bound on Deflate tile padding

Ported from storytold/lightcraft#3695. Candidate preview ranges are deduplicated and charged to one byte
budget and one header-walk budget; a lossy JPEG decoded for a tile may hold no more samples than the tile
rounded up to whole MCUs (and never more than Limits::max_lossy_tile_samples); a Deflate chunk whose nominal
size is mostly padding outside the image is refused before it is inflated.

* craft-raw: lossless JPEG sample bound per referenced byte; previews larger than the file are passed over

Ported from storytold/lightcraft#3910 (the parts whose code is in craft-raw today). check_image refuses a
lossless JPEG image that declares more than 32 samples per referenced byte, counted once per chunk that points
at the bytes so identical tiles stored once still decode. The Hasselblad RGB preview search passes over an
image whose pixel bytes exceed the file and still takes a smaller complete one.

* craft-raw: test for the Deflate padding bound

* craft-raw: Pentax PEF and Samsung SRW

Moved from LightCraft crates/raw (vendor/pef.rs, vendor/srw.rs) at 5ff567a4. The Huffman difference decoder
and bit reader that PEF shares with the Nikon, Panasonic and Sony codings become the huffman module.

* craft-raw: Canon CR2, with sRAW and mRAW

Moved from LightCraft crates/raw (vendor/cr2.rs, vendor/cr2/sraw.rs) at 5ff567a4. The white-balance presets a
CR2 lists come back as data in ColorData::kelvin_presets (the ordering from LightCraft's kelvin_presets.rs;
the temperature and tint arithmetic stays with the developer).

* craft-raw: an sRAW preview larger than the file is refused before its buffer is reserved

Ported from storytold/lightcraft#3910 (cr2::sraw::read_preview).

* WIP craft-raw: Nikon NEF/NRW (does not compile yet: limits threading, develop() calls in tests)

* craft-raw: Nikon NEF/NRW, with PhotoCraft's maker-note compression routing and 12-bit D4 white level

* craft-raw: Panasonic RW2 / RWL / RAW, every raw format

* craft-raw: RW2 format 8 refuses strips stating fewer bits than samples

Ported from storytold/lightcraft#3910.

* craft-raw: RW2 format 8 refuses samples above the declared bit depth

Ported from storytold/photocraft#11838.

* craft-raw: the RW2 format 8 robustness seed carries a valid stream

Its random payload decoded only while out-of-depth samples were clamped; mutations now start from a file that decodes.

* craft-raw: Fujifilm RAF, uncompressed and compressed, with lens corrections

* craft-raw: compressed RAF stripes cap their capacity hint at the stripe's bits

Ported from storytold/lightcraft#3910.

* craft-raw: test RAF orientation and camera from the embedded JPEG's Exif

* craft-raw: RAF embedded preview, and its range from the header alone (bounded_preview)

---------

Co-authored-by: radialmonster <radial@gmail.com>
Co-authored-by: wnanbei <wnanbei@gmail.com>
2026-11-11 20:33:51 -05:00