Show an OpenEXR file's main picture as After Effects does

The picture of an OpenEXR file is now craft-exr's main picture: the
unprefixed R, G, B (and A) of the first part that has all three, else
the first part's unprefixed Y (and A) as grey. A file of named layers
only (Blender's ViewLayer.Combined.R, a compositor's Image.R) has none
and shows black at its display window's size, opaque, as After Effects
shows it; it still imports and its layers stay readable by effects
(EXtractoR, Cryptomatte, the 3D Channel effects).

The own picture choice (the beauty pass by name, data passes, the first
channel as grey) is gone. The picture's channels keep a fill of 0
outside the data window even in a part named like depth, so the picture
of such a file stays what the image crate shows. The golden hashes of
the named-layer files are re-pinned (their channels are unchanged), and
the docs describe the new rule.
This commit is contained in:
vangel76 committed 2026-11-16 22:30:46 +01:00
1 parent ccd4c75f4f
commit d671f6e45b
11 files changed
+273 -261

No files matched your search

+3 -2
View File
@@ -39,8 +39,9 @@ fn extractor_shows_the_chosen_layer_and_channels_of_a_layered_exr() {
assert_eq!(r["errors"], json!([]), "the file imports: {r}");
s.execute("comp.new", json!({"name": "EXR", "width": 8, "height": 4, "frameRate": 24, "duration": 1})).unwrap();
let layer = s.execute("layer.addItem", json!({"item": r["items"][0]})).unwrap()["layer"].clone();
// The picture is the colour layer (diffuse: orange).
assert!(near(px(&s), [1.0, 0.735, 0.0]), "{:?}", px(&s));
// No unnamed R, G, B: no main picture, black as in After Effects (the layers are reached by
// name, below).
assert!(near(px(&s), [0.0, 0.0, 0.0]), "{:?}", px(&s));
let ch = s.execute("layer.channels", json!({"layer": layer})).unwrap();
let names: Vec<&str> = ch["layers"].as_array().unwrap().iter().filter_map(|l| l["name"].as_str()).collect();
+68 -108
View File
@@ -13,7 +13,6 @@
//! This module holds the naming and picture rules they share, and whole-file reads of bytes.
use craft_exr::decode::PartInfo;
use effectcraft_raster::channels3d::split_channel;
use effectcraft_raster::{AuxChannels, Image};
use effectcraft_render::reads::FileStamp;
@@ -42,21 +41,6 @@ pub fn unsupported_compression(bytes: &[u8]) -> Option<&'static str> {
parts.iter().any(|p| p.compression.starts_with("HTJ2K")).then_some(crate::exr_index::HTJ2K)
}
/// How the `image` crate's OpenEXR decoder would show a file: the first part with exact `R`, `G`
/// and `B` channels (alpha `A` when it has one, else opaque), placed in the display window with
/// 0 outside the data window.
#[derive(Clone, Copy, Debug, PartialEq)]
pub(crate) enum Rgb {
/// No part has R, G and B: the decoder refuses the file (a multi-layer file, shown with
/// [`layered_image`]'s rule).
None,
/// The channels (indices into [`ExrIndex::channels`]) hold exactly what it would show.
Planes([usize; 3], Option<usize>),
/// The planes can't stand in for it (a depth-named channel, whose plane is filled with the
/// background depth, or another display window): decode with the `image` crate.
Unsupported,
}
/// How many bytes of decoded planes the plane store keeps by itself until the caches' budget is
/// set (then it follows the footage frames' cap, see [`crate::exr_planes::set_budget`]: the whole
/// common budget on the desktop, #3298), like the frame cache's default
@@ -97,79 +81,37 @@ pub fn read_exr_channels(bytes: &[u8]) -> Option<AuxChannels> {
Some(aux_of(&index, &ids, planes))
}
/// Names of the beauty pass, most preferred first, matched against the last part of a layer's
/// name (Blender's `ViewLayer.Combined` is `Combined`): Blender's Combined pass and its
/// compositor's File Output default `Image`, the beauty / rgba / rgb / color of Nuke, Arnold and
/// V-Ray.
const BEAUTY: [&str; 7] = ["combined", "beauty", "image", "rgba", "rgb", "color", "colour"];
/// A data pass, never the picture: Cryptomatte (`CryptoMaterial00`), depth, mist, normals,
/// motion vectors, positions, UVs and object / material indices.
fn is_data_layer(layer: &str) -> bool {
let last = layer.rsplit('.').next().unwrap_or(layer).to_ascii_lowercase();
last.starts_with("crypto")
|| ["z", "uv", "id", "mist", "indexob", "indexma"].contains(&last.as_str())
|| ["depth", "normal", "vector", "position", "velocity", "motion", "objectid", "materialid"].iter().any(|k| last.contains(k))
}
/// The layer whose colour a multi-layer file shows (see [`layered_image`]).
fn picture_layer<'a>(aux: &AuxChannels, layers: &[&'a str]) -> Option<&'a str> {
// Colour layers: three different channels (not one channel, such as depth, shown in all).
let rgb: Vec<&str> = layers
.iter()
.copied()
.filter(|l| {
let [r, g, b, _] = aux.layer_rgba(l);
!r.is_empty() && !g.is_empty() && !b.is_empty() && r != g
})
.collect();
let last = |l: &str| l.rsplit('.').next().unwrap_or(l).to_ascii_lowercase();
let pictures = || rgb.iter().filter(|l| !is_data_layer(l));
// The unnamed layer (plain R, G, B), then the beauty pass by name.
rgb.iter()
.find(|l| l.is_empty())
.or_else(|| BEAUTY.iter().find_map(|k| rgb.iter().find(|l| last(l) == *k)))
.or_else(|| pictures().find(|l| ["combined", "beauty"].iter().any(|k| last(l).contains(k))))
.or_else(|| pictures().next())
.or_else(|| layers.iter().find(|l| !is_data_layer(l)))
.or_else(|| rgb.first())
.or_else(|| layers.first())
.copied()
}
/// The planes a multi-layer file's picture is made of (see [`layered_image`]): red, green, blue
/// (one channel thrice for grey) and alpha, by name. Only the names of `aux` are read.
pub(crate) fn picture_names(aux: &AuxChannels) -> Option<([String; 3], Option<String>)> {
let layers = aux.layers();
let colour = picture_layer(aux, &layers)?;
let names = aux.layer_rgba(colour);
// A layer without R, G and B channels shows its first channel as grey.
let first = aux.names().into_iter().find(|n| split_channel(n).0 == colour).unwrap_or_default();
let pick = |k: usize| names.get(k).map(String::as_str).filter(|n| !n.is_empty()).unwrap_or(first).to_string();
let a = names.get(3).filter(|n| !n.is_empty() && aux.get(n).is_some()).cloned();
Some(([pick(0), pick(1), pick(2)], a))
}
/// The picture of a multi-layer OpenEXR file without an unnamed RGB layer (Blender's
/// `ViewLayer.Combined.R`, the compositor's `Image.R`, Nuke's `beauty.R`, …), which the image
/// decoder rejects. After Effects shows a file's main RGBA channels and leaves the other layers
/// to EXtractoR; here that is the beauty pass by name (`BEAUTY`), else the first colour layer
/// that is not a data pass (never Cryptomatte, depth or normals, #412), else the first channel
/// as grey. Linear, straight RGBA as the file stores it. `None` when it is not a readable EXR.
/// Only the picture's channels are decoded (in a multi-part file the other parts aren't read).
pub fn layered_image(bytes: &[u8]) -> Option<image::DynamicImage> {
/// The main picture of an OpenEXR file's bytes ([`crate::exr_index::MainPicture`]), linear,
/// straight RGB(A) as the file stores it (a `Y` picture as grey); a file without one (named
/// layers only, as Blender's `ViewLayer.Combined.R`) is black at its display window's size, as
/// After Effects shows it (its layers are reached by name, EXtractoR). Only the picture's
/// channels are decoded (in a multi-part file the other parts aren't read). `None` when it is
/// not a readable EXR.
pub fn picture_image(bytes: &[u8]) -> Option<image::DynamicImage> {
let mut src = std::io::Cursor::new(bytes);
let index = crate::exr_index::build(&mut src, FileStamp::Virtual).ok()?;
let (ids, rgb, a) = index.picture.clone()?;
let (w, h) = index.size();
let (w, h) = (u32::try_from(w).ok()?, u32::try_from(h).ok()?);
let n = (w as usize).checked_mul(h as usize)?;
let Some(picture) = &index.picture else {
let len = n.checked_mul(3)?;
let mut data: Vec<f32> = Vec::new();
data.try_reserve_exact(len).ok()?;
data.resize(len, 0.0);
return image::Rgb32FImage::from_raw(w, h, data).map(image::DynamicImage::ImageRgb32F);
};
let ([r, g, b], a) = picture.rgba()?;
let ids = index.picture_ids();
let (planes, _) = read_planes(&mut src, &index, &ReadRequest::full(ids.clone()));
let aux = aux_of(&index, &ids, planes.ok()?);
let [r, g, b] = [aux.get(&rgb[0])?, aux.get(&rgb[1])?, aux.get(&rgb[2])?];
let a = match &a {
Some(n) => Some(aux.get(n)?),
let planes = planes.ok()?;
let plane = |id: usize| ids.iter().position(|i| *i == id).and_then(|at| planes.get(at));
let (r, g, b) = (plane(r)?, plane(g)?, plane(b)?);
let a = match a {
Some(a) => Some(plane(a)?),
None => None,
};
let n = (aux.width as usize).checked_mul(aux.height as usize)?;
let mut data = Vec::with_capacity(n.checked_mul(4)?);
let mut data = Vec::new();
data.try_reserve_exact(n.checked_mul(if a.is_some() { 4 } else { 3 })?).ok()?;
for i in 0..n {
data.extend([r.get(i)?, g.get(i)?, b.get(i)?].map(|v| *v));
if let Some(a) = a {
@@ -177,19 +119,24 @@ pub fn layered_image(bytes: &[u8]) -> Option<image::DynamicImage> {
}
}
match a {
Some(_) => image::Rgba32FImage::from_raw(aux.width, aux.height, data).map(image::DynamicImage::ImageRgba32F),
None => image::Rgb32FImage::from_raw(aux.width, aux.height, data).map(image::DynamicImage::ImageRgb32F),
Some(_) => image::Rgba32FImage::from_raw(w, h, data).map(image::DynamicImage::ImageRgba32F),
None => image::Rgb32FImage::from_raw(w, h, data).map(image::DynamicImage::ImageRgb32F),
}
}
/// The size and alpha of a layered file's picture ([`layered_image`]) from its headers alone
/// (import). `None` when it is not a readable EXR.
pub(crate) fn layered_size(bytes: &[u8]) -> Option<(u32, u32, bool)> {
/// The size and alpha of an OpenEXR file's main picture ([`picture_image`]) from its headers
/// alone (import; a file without one is its display window, opaque). `None` when it is not a
/// readable EXR.
pub(crate) fn picture_size(bytes: &[u8]) -> Option<(u32, u32, bool)> {
let mut src = std::io::Cursor::new(bytes);
let index = crate::exr_index::build(&mut src, FileStamp::Virtual).ok()?;
let (_, _, a) = index.picture.as_ref()?;
let (w, h) = index.size();
Some((w as u32, h as u32, a.is_some()))
Some((u32::try_from(w).ok()?, u32::try_from(h).ok()?, index.picture.as_ref().is_some_and(|p| p.has_alpha())))
}
/// The black picture of a file without a main picture, `w` × `h`, opaque (no alpha channel).
pub(crate) fn black_picture(w: u32, h: u32, op: AlphaOp) -> Image {
float_to_image(w, h, op, |_| [0.0, 0.0, 0.0, 1.0])
}
/// The picture made of planes `rgb` and `a` (opaque without one) of `aux`, as
@@ -375,8 +322,11 @@ mod tests {
assert!(read_exr_channels(&bytes.into_inner()).is_none());
}
/// A file of named layers only (Blender's single-part multilayer) imports at its display
/// window's size and shows black, opaque, as After Effects does; its layers stay readable by
/// effects (EXtractoR, Cryptomatte) and nothing is an error.
#[test]
fn layered_exr_without_an_unnamed_rgb_layer_imports() {
fn layered_exr_without_an_unnamed_rgb_layer_imports_black() {
use exr::prelude::*;
let (w, h) = (4usize, 2usize);
let ch = |n: &str, v: f32| AnyChannel::new(n, FlatSamples::F32(vec![v; w * h]));
@@ -389,8 +339,13 @@ mod tests {
assert_eq!((f.width, f.height, f.alpha), (4, 2, effectcraft_project::AlphaMode::Ignore));
let pool = crate::MediaPool::new();
pool.add_bytes("/layers.exr", b.clone());
let px = pool.frame_at(&f, effectcraft_time::Tick::ZERO).unwrap().get(1, 1);
assert!((px[0] - 1.0).abs() < 1e-4 && px[1] > 0.3 && px[1] < 0.6 && px[2] < 1e-4 && px[3] == 1.0, "diffuse, sRGB-encoded: {px:?}");
let img = pool.frame_at(&f, effectcraft_time::Tick::ZERO).unwrap();
assert_eq!((img.width, img.height), (4, 2));
assert_eq!(img.get(1, 1), [0.0, 0.0, 0.0, 1.0], "black, opaque");
use effectcraft_render::FootageSource;
let effects = pool.aux(effectcraft_project::ItemId(1), &f, effectcraft_time::Tick::ZERO).expect("the layers, for effects");
assert_eq!(effects.get("diffuse.R").unwrap(), [1.0; 8].as_slice());
assert_eq!(effects.get("depth.Z").unwrap(), [7.0; 8].as_slice());
let aux = read_exr_channels(&b).unwrap();
assert_eq!(aux.layers(), ["depth", "diffuse"]);
assert_eq!(aux.layer_rgba("diffuse"), ["diffuse.R", "diffuse.G", "diffuse.B", ""].map(String::from));
@@ -427,7 +382,7 @@ mod tests {
assert!(aux.get("ViewLayer.Combined.R").is_some());
}
/// Straight RGBA of [`layered_image`] at pixel 0 for a file of single-value channels.
/// Straight RGBA of [`picture_image`] at pixel 0 for a file of single-value channels.
fn picture<S: AsRef<str>>(channels: &[(S, f32)]) -> Vec<f32> {
use exr::prelude::*;
let (w, h) = (2usize, 2usize);
@@ -435,15 +390,17 @@ mod tests {
let image = Image::from_layer(Layer::new((w, h), LayerAttributes::default(), Encoding::FAST_LOSSLESS, AnyChannels::sort(list.into())));
let mut bytes = std::io::Cursor::new(Vec::new());
image.write().to_buffered(&mut bytes).unwrap();
let img = layered_image(bytes.get_ref()).unwrap().to_rgba32f();
let img = picture_image(bytes.get_ref()).unwrap().to_rgba32f();
assert_eq!(img.dimensions(), (2, 2), "the display window's size");
img.get_pixel(0, 0).0.to_vec()
}
/// #412: a Blender compositor File Output (multilayer) names its beauty pass `Image`, and its
/// Cryptomatte layers (lowercase `r, g, b, a`) sort first. The picture was CryptoMaterial00;
/// it is the Image layer, and data passes are never the picture.
/// The main picture is After Effects': the unprefixed `R`, `G`, `B` (`A`), else `Y` (`A`) as
/// grey. A file of named layers only (Blender's multilayer `ViewLayer.Combined.R`, a
/// compositor's `Image.R`, Cryptomatte, depth) has none and shows black, opaque (#412 chose a
/// beauty pass by name before; its layers are reached by name, EXtractoR).
#[test]
fn layered_exr_shows_the_beauty_pass_not_cryptomatte() {
fn the_picture_is_the_unprefixed_channels_else_black() {
let mut blender = vec![];
for layer in ["CryptoMaterial00", "CryptoMaterial01", "CryptoMaterial02"] {
blender.extend(["r", "g", "b", "a"].map(|c| (format!("{layer}.{c}"), 0.9)));
@@ -452,8 +409,8 @@ mod tests {
blender.extend(["R", "G", "B", "A"].map(|c| (format!("{layer}.{c}"), v)));
}
blender.push(("Mist.Z".into(), 0.7));
assert_eq!(picture(&blender), [0.5; 4], "the Image layer");
// Blender's render-layer names and Nuke's beauty.
let black = [0.0, 0.0, 0.0, 1.0];
assert_eq!(picture(&blender), black, "named layers only: no Image or beauty pass by name");
assert_eq!(
picture(&[
("ViewLayer.CryptoObject00.r", 0.9),
@@ -463,12 +420,15 @@ mod tests {
("ViewLayer.Combined.G", 0.2),
("ViewLayer.Combined.B", 0.2)
]),
[0.2, 0.2, 0.2, 1.0]
black,
"Blender's Combined pass"
);
// No beauty name: the first colour layer that isn't a data pass.
let no_beauty: Vec<(String, f32)> = blender.iter().filter(|(n, _)| !n.starts_with("Image")).cloned().collect();
assert_eq!(picture(&no_beauty), [0.3; 4], "GlossCol, not Cryptomatte");
// Only data and a grey pass: the grey pass, not depth.
assert_eq!(picture(&[("Depth.Z", 9.0), ("AO.Y", 0.25)]), [0.25, 0.25, 0.25, 1.0]);
assert_eq!(picture(&[("Depth.Z", 9.0), ("AO.Y", 0.25)]), black, "a layer's Y is not the picture");
// Unprefixed channels are, whatever the named layers beside them.
assert_eq!(picture(&[("R", 0.1), ("G", 0.2), ("B", 0.3), ("Image.R", 0.9)]), [0.1, 0.2, 0.3, 1.0]);
assert_eq!(picture(&[("R", 0.1), ("G", 0.2), ("B", 0.3), ("A", 0.5)]), [0.1, 0.2, 0.3, 0.5]);
// Luminance: grey, with its alpha.
assert_eq!(picture(&[("Y", 0.25)]), [0.25, 0.25, 0.25, 1.0]);
assert_eq!(picture(&[("A", 0.5), ("Y", 0.25), ("diffuse.R", 0.9)]), [0.25, 0.25, 0.25, 0.5]);
}
}
+55 -43
View File
@@ -18,13 +18,14 @@ use std::collections::{HashMap, VecDeque};
use std::io::SeekFrom;
use std::sync::{Arc, Mutex, PoisonError};
use craft_exr::channels::ColorLayout;
use craft_exr::decode::{Limits, PartInfo, Window};
use craft_exr::seek;
use effectcraft_raster::AuxChannels;
use effectcraft_raster::channels3d::BACKGROUND_DEPTH;
use effectcraft_render::reads::FileStamp;
use crate::exr_channels::{MAX_DISPLAY_PIXELS, Rgb, channel_name, is_depth, parse_manifest, part_name, picture_names};
use crate::exr_channels::{MAX_DISPLAY_PIXELS, channel_name, is_depth, parse_manifest, part_name};
use crate::exr_read::{ExrSource, Opened, ReadSeek};
/// One channel of the file, in file order (parts in order, each part's channels as its header
@@ -40,6 +41,30 @@ pub(crate) struct IndexChannel {
pub(crate) fill: f32,
}
/// A file's main picture: its channels (indices into [`ExrIndex::channels`]) in the layout's
/// order, `R`, `G`, `B` (`A`) or `Y` (`A`).
#[derive(Clone, Debug, PartialEq)]
pub(crate) struct MainPicture {
pub(crate) layout: ColorLayout,
pub(crate) ids: Vec<usize>,
}
impl MainPicture {
/// The red, green, blue and alpha channels (a `Y` picture is grey: `Y` three times).
pub(crate) fn rgba(&self) -> Option<([usize; 3], Option<usize>)> {
let id = |i: usize| self.ids.get(i).copied();
match self.layout {
ColorLayout::Rgb | ColorLayout::Rgba => Some(([id(0)?, id(1)?, id(2)?], id(3))),
ColorLayout::Y | ColorLayout::YA => Some(([id(0)?; 3], id(1))),
}
}
/// It has an alpha channel.
pub(crate) fn has_alpha(&self) -> bool {
matches!(self.layout, ColorLayout::Rgba | ColorLayout::YA)
}
}
/// What an OpenEXR file holds ([`get`]).
pub(crate) struct ExrIndex {
/// The headers and chunk tables, as `craft-exr` reads them.
@@ -49,12 +74,10 @@ pub(crate) struct ExrIndex {
/// The first part's display window: every plane covers it.
pub(crate) display: Window,
pub(crate) channels: Vec<IndexChannel>,
/// How the `image` crate's decoder would show the file (indices into `channels`).
pub(crate) rgb: Rgb,
/// A file the decoder refuses ([`Rgb::None`]): the channels its picture is made of
/// ([`picture_names`]: red, green, blue and alpha by name) and every channel answering to
/// one of those names (lookups ignore case).
pub(crate) picture: Option<(Vec<usize>, [String; 3], Option<String>)>,
/// The file's main picture ([`craft_exr::channels::main_picture`]), as After Effects shows
/// it: `None` for a file of named layers only (it shows black; effects reach its layers by
/// name).
pub(crate) picture: Option<MainPicture>,
/// The names only (planes empty), manifests and aliases: for the channel lists and for
/// resolving what effects declare. Never handed to an effect.
pub(crate) names: Arc<AuxChannels>,
@@ -66,20 +89,19 @@ impl ExrIndex {
(self.display.width as usize, self.display.height as usize)
}
/// The channels the picture is made of: the image crate's choice ([`Rgb::Planes`]) or the
/// layered rule's. `None`: the planes can't make it (decode with the `image` crate).
pub(crate) fn picture_ids(&self) -> Option<Vec<usize>> {
match self.rgb {
Rgb::Planes([r, g, b], a) => Some([Some(r), Some(g), Some(b), a].into_iter().flatten().collect()),
Rgb::None => self.picture.as_ref().map(|(ids, _, _)| ids.clone()),
Rgb::Unsupported => None,
}
/// The channels the picture is made of, in file order (none for a file without a main
/// picture).
pub(crate) fn picture_ids(&self) -> Vec<usize> {
let mut ids = self.picture.as_ref().map(|p| p.ids.clone()).unwrap_or_default();
ids.sort_unstable();
ids.dedup();
ids
}
/// Every channel but the picture's (what [`crate::exr_planes`] means by all channels: the
/// picture is kept converted, by the media pool, not as planes too).
pub(crate) fn aux_ids(&self) -> Vec<usize> {
let picture = self.picture_ids().unwrap_or_default();
let picture = self.picture_ids();
(0..self.channels.len()).filter(|i| !picture.contains(i)).collect()
}
@@ -185,17 +207,19 @@ pub(crate) fn build(src: &mut dyn ReadSeek, stamp: FileStamp) -> Result<ExrIndex
channels.push(IndexChannel { name, part: pi, channel: ci, fill });
}
}
let rgb = rgb_of(parts, display, &channels);
let picture = main_picture(parts, &channels);
// The picture's channels are colour (0 outside the data window, as After Effects and the
// `image` crate show it), even in a part whose name reads as depth (`depth.R`).
for id in picture.iter().flat_map(|p| &p.ids) {
if let Some(c) = channels.get_mut(*id) {
c.fill = 0.0;
}
}
let mut names = AuxChannels::new(display.width, display.height, 1.0);
names.channels = channels.iter().map(|c| (c.name.clone(), vec![])).collect();
names.manifests = manifests;
names.aliases = aliases;
let picture = picture_names(&names).map(|(rgb, a)| {
// Planes are looked up by name ignoring case, so every channel that could answer is read.
let ids = channels.iter().enumerate().filter(|(_, c)| rgb.iter().chain(&a).any(|k| k.eq_ignore_ascii_case(&c.name))).map(|(i, _)| i).collect();
(ids, rgb, a)
});
Ok(ExrIndex { file, stamp, display, channels, rgb, picture, names: Arc::new(names) })
Ok(ExrIndex { file, stamp, display, channels, picture, names: Arc::new(names) })
}
/// The Cryptomatte manifests of the headers (`cryptomatte/<key>/name` and `…/manifest`, in any
@@ -217,26 +241,14 @@ fn manifests(parts: &[PartInfo]) -> Vec<(String, Vec<(String, u32)>)> {
out
}
/// How the `image` crate's decoder would show the file: the first part with exact `R`, `G` and
/// `B` channels (alpha `A` when it has one), unless its planes can't stand in for it (a
/// depth-named channel, filled with the background depth outside the data window, or a part
/// with its own display window).
fn rgb_of(parts: &[PartInfo], display: Window, channels: &[IndexChannel]) -> Rgb {
for (pi, p) in parts.iter().enumerate() {
let find = |c: &str| p.channels.iter().position(|ch| ch.name == c);
let (Some(r), Some(g), Some(b)) = (find("R"), find("G"), find("B")) else { continue };
let id = |ci: usize| channels.iter().position(|c| c.part == pi && c.channel == ci);
let picked = [Some(r), Some(g), Some(b), find("A")];
let ids: Vec<Option<usize>> = picked.iter().map(|c| c.and_then(id)).collect();
let (Some(Some(r)), Some(Some(g)), Some(Some(b))) = (ids.first(), ids.get(1), ids.get(2)) else { return Rgb::Unsupported };
let a = ids.get(3).copied().flatten();
let depth = [Some(*r), Some(*g), Some(*b), a].iter().flatten().any(|i| channels.get(*i).is_some_and(|c| is_depth(&c.name)));
if depth || p.display_window != display {
return Rgb::Unsupported;
}
return Rgb::Planes([*r, *g, *b], a);
}
Rgb::None
/// The file's main picture by the OpenEXR convention, as After Effects shows it
/// ([`craft_exr::channels::main_picture`]: the unprefixed `R`, `G`, `B` (`A`) of the first part
/// that has them, else the first unprefixed `Y` (`A`)), as channel ids. The parts' channels are
/// matched as stored (a part's own `R`, not the `part.R` plane name).
fn main_picture(parts: &[PartInfo], channels: &[IndexChannel]) -> Option<MainPicture> {
let (part, layout, picked) = craft_exr::channels::main_picture(parts.iter().map(|p| p.channels.iter().map(|c| c.name.as_str())))?;
let ids = picked.iter().map(|ci| channels.iter().position(|c| c.part == part && c.channel == *ci)).collect::<Option<Vec<usize>>>()?;
Some(MainPicture { layout, ids })
}
/// At most this many files are indexed, and their indexes take at most [`INDEXED_BYTES`]; the
+32 -35
View File
@@ -34,7 +34,7 @@ use effectcraft_render::reads::ReadFile;
use crate::convert::AlphaOp;
use crate::exr_channels::CACHE_BUDGET;
use crate::exr_channels::{Rgb, planes_picture};
use crate::exr_channels::{black_picture, planes_picture};
use crate::exr_index::{self, ExrIndex, IndexError};
use crate::exr_read::{ExrSource, Opened, ReadError, ReadRequest, read_planes};
@@ -1139,10 +1139,10 @@ pub(crate) enum Picture {
Legacy,
}
/// The picture of the OpenEXR at `path` made of its planes: the channels the `image` crate's
/// decoder would show, or a multi-layer file's colour layer (see
/// [`crate::exr_channels::layered_image`]). With `extra` (an effect reads the footage's
/// channels) those channels are read in the same pass and kept for the effects.
/// The picture of the OpenEXR at `path` made of its planes: its main picture
/// ([`crate::exr_index::MainPicture`]), or black for a file without one (named layers only).
/// With `extra` (an effect reads the footage's channels) those channels are read in the same
/// pass and kept for the effects.
pub(crate) fn picture(path: &str, source: &ExrSource, op: AlphaOp, extra: Option<&AuxNeed>) -> Picture {
let mut extra = extra;
for _ in 0..3 {
@@ -1153,14 +1153,17 @@ pub(crate) fn picture(path: &str, source: &ExrSource, op: AlphaOp, extra: Option
Err(IndexError::Unsupported(why)) => return Picture::Done(Err(why.to_string())),
Err(_) => return Picture::Legacy,
};
let Some(ids) = index.picture_ids() else { return Picture::Legacy };
let mut want = Want { all: false, ids: ids.into_iter().collect() };
let mut want = Want { all: false, ids: index.picture_ids().into_iter().collect() };
if let Some(need) = extra {
match need_ids(&index, need) {
Some(more) => want.ids.extend(more),
None => want.all = true,
}
}
// (no main picture and nothing for the effects: black, nothing read)
if !want.all && want.ids.is_empty() {
return Picture::Done(picture_of(&index, None, op).ok_or_else(|| "the picture can't be made".to_string()));
}
let by = if extra.is_some() { Use::Picture } else { Use::Other };
let batch = match store().get_opened(path, source, &index, &want, by, opened, since) {
Ok(b) => b,
@@ -1175,12 +1178,12 @@ pub(crate) fn picture(path: &str, source: &ExrSource, op: AlphaOp, extra: Option
// (the whole file's decode says why)
Err(Refused::Stopped | Refused::Unreadable) => return Picture::Legacy,
};
let img = picture_of(&index, &batch, op);
let img = picture_of(&index, Some(&batch), op);
// The picture is kept by the pool once converted, not twice: its planes go, but for those
// an effect names (EXtractoR reading "R").
if img.is_some() {
let named = extra.and_then(|n| need_ids(&index, n)).unwrap_or_default();
let picture: BTreeSet<usize> = index.picture_ids().unwrap_or_default().into_iter().filter(|id| !named.contains(id)).collect();
let picture: BTreeSet<usize> = index.picture_ids().into_iter().filter(|id| !named.contains(id)).collect();
let keep: BTreeSet<usize> = batch.ids.iter().copied().filter(|id| !picture.contains(id)).collect();
store().keep_only(path, batch, &keep);
}
@@ -1192,27 +1195,20 @@ pub(crate) fn picture(path: &str, source: &ExrSource, op: AlphaOp, extra: Option
Picture::Legacy
}
/// The picture of the file `index` describes, made of the planes of `batch`.
fn picture_of(index: &ExrIndex, batch: &Batch, op: AlphaOp) -> Option<Image> {
let aux = &batch.aux;
match index.rgb {
Rgb::Planes([r, g, b], a) => {
let a = match a {
Some(a) => Some(batch.plane(a)?),
None => None,
};
planes_picture(aux, [batch.plane(r)?, batch.plane(g)?, batch.plane(b)?], a, op)
}
Rgb::None => {
let (_, rgb, a) = index.picture.as_ref()?;
let a = match a {
Some(n) => Some(aux.get(n)?),
None => None,
};
planes_picture(aux, [aux.get(&rgb[0])?, aux.get(&rgb[1])?, aux.get(&rgb[2])?], a, op)
}
Rgb::Unsupported => None,
}
/// The picture of the file `index` describes, made of the planes of `batch` (black, opaque, for
/// a file without a main picture, which needs no planes).
fn picture_of(index: &ExrIndex, batch: Option<&Batch>, op: AlphaOp) -> Option<Image> {
let Some(main) = &index.picture else {
let (w, h) = index.size();
return Some(black_picture(u32::try_from(w).ok()?, u32::try_from(h).ok()?, op));
};
let batch = batch?;
let ([r, g, b], a) = main.rgba()?;
let a = match a {
Some(a) => Some(batch.plane(a)?),
None => None,
};
planes_picture(&batch.aux, [batch.plane(r)?, batch.plane(g)?, batch.plane(b)?], a, op)
}
/// The picture of the OpenEXR at `path` (as [`picture`]) of only the display rows `rows`: those
@@ -1225,10 +1221,11 @@ pub(crate) fn picture_rows(path: &str, source: &ExrSource, op: AlphaOp, rows: (i
Err(IndexError::Unsupported(why)) => return Picture::Done(Err(why.to_string())),
Err(_) => return Picture::Legacy,
};
let Some(mut ids) = index.picture_ids() else { return Picture::Legacy };
// (in file order: the planes are looked up by id)
ids.sort_unstable();
ids.dedup();
let ids = index.picture_ids();
if ids.is_empty() {
return Picture::Done(picture_of(&index, None, op).ok_or_else(|| "the picture can't be made".to_string()));
}
let opened = match opened {
Some(o) => Ok(o),
None => source.open(),
@@ -1257,7 +1254,7 @@ pub(crate) fn picture_rows(path: &str, source: &ExrSource, op: AlphaOp, rows: (i
let file = ReadFile::new(path, opened.stamp);
crate::reads::note(file.clone());
let batch = Batch { index: index.clone(), ids, all: false, aux: Arc::new(aux), file };
match picture_of(&index, &batch, op) {
match picture_of(&index, Some(&batch), op) {
Some(img) => Picture::Done(Ok(img)),
None => Picture::Legacy,
}
@@ -1286,7 +1283,7 @@ fn aux_of(path: &str, source: &ExrSource, need: &AuxNeed, with_picture: bool) ->
None => Want { all: true, ids: BTreeSet::new() },
};
if with_picture {
want.ids.extend(index.picture_ids().unwrap_or_default());
want.ids.extend(index.picture_ids());
}
match store().get_opened(path, source, &index, &want, Use::Other, opened, since) {
Ok(b) => return Some(b.aux.clone()),
+44 -8
View File
@@ -197,6 +197,42 @@ fn multipart_channels_are_found_by_their_stored_names() {
assert!(names.channels.iter().all(|(_, p)| p.is_empty()), "no pixels decoded");
}
/// The main picture is the first part with unprefixed `R`, `G`, `B`: a depth part before it
/// isn't the picture (nor read for it), the second part's RGBA is.
#[test]
fn a_depth_part_first_leaves_the_picture_to_the_rgba_part() {
let bytes = write(vec![part(Some("depth"), &[("Z", false)], SIZE, Compression::ZIP1), part(Some("beauty"), &RGBA, SIZE, Compression::ZIP1)], SIZE);
let file = Temp::new("depth-first", &bytes);
let f = crate::probe(&file.0).unwrap();
assert_eq!((f.width, f.height), (SIZE.0 as u32, SIZE.1 as u32));
let index = crate::exr_index::get(&f.path, &ExrSource::Bytes(bytes.as_slice().into())).unwrap();
let names: Vec<&str> = index.picture.as_ref().unwrap().ids.iter().map(|i| index.channels[*i].name.as_str()).collect();
assert_eq!(names, ["beauty.R", "beauty.G", "beauty.B", "beauty.A"]);
let img = crate::MediaPool::new().frame_at(&f, Tick::ZERO).unwrap();
assert_eq!(bits(&img), bits(&image_crates(&bytes, &f)), "the RGBA part, as the image crate shows it");
let d = decodes_of(&f.path);
assert_eq!(d.last().unwrap().stats.chunks, [0, SIZE.1], "only the RGBA part's chunks");
}
/// A luminance file (`Y` only, no `R`, `G`, `B`) is grey, as before.
#[test]
fn a_luminance_file_is_grey() {
let bytes = write(vec![part(None, &[("Y", true)], SIZE, Compression::ZIP1)], SIZE);
let file = Temp::new("luminance", &bytes);
let f = crate::probe(&file.0).unwrap();
let path = f.path.clone();
let source = ExrSource::Bytes(bytes.as_slice().into());
let Picture::Done(Ok(img)) = picture(&path, &source, AlphaOp::of(&f, FloatCurve::Linear), None) else { panic!("a picture") };
for (i, px) in img.data.iter().enumerate() {
let y = f16::from_f32(value(i, 0, false)).to_f32();
assert_eq!([px[0], px[1], px[2], px[3]], [y, y, y, 1.0], "pixel {i}");
}
assert_eq!(
bits(&crate::MediaPool::new().frame_at(&f, Tick::ZERO).unwrap()),
bits(&crate::convert::dynamic_to_image(&crate::exr_channels::picture_image(&bytes).unwrap(), AlphaOp::of(&f, FloatCurve::Srgb)))
);
}
/// #3271: footage whose effects read 3 channels decodes its picture with them in one pass: one
/// read of the file's chunks, one decode, for the picture and the effect.
#[test]
@@ -302,7 +338,7 @@ fn a_request_not_covered_decodes_only_what_is_missing() {
let source = ExrSource::Bytes(bytes);
let store = PlaneStore::new(CACHE_BUDGET);
let index = crate::exr_index::get(path, &source).unwrap();
let picture: BTreeSet<usize> = index.picture_ids().unwrap().into_iter().collect();
let picture: BTreeSet<usize> = index.picture_ids().into_iter().collect();
let normal: BTreeSet<usize> = index.ids_named(["normal.R", "normal.G"]).into_iter().collect();
store.get(path, &source, &index, &Want { all: false, ids: picture.clone() }, Use::Other).unwrap();
let b = store.get(path, &source, &index, &Want { all: false, ids: normal.clone() }, Use::Other).unwrap();
@@ -570,7 +606,7 @@ fn picture_from_planes_is_the_image_crates() {
for (k, bytes) in files.iter().enumerate() {
let path = format!("/3271-planes-{k}.exr");
let source = ExrSource::Bytes(bytes.as_slice().into());
assert!(matches!(crate::exr_index::get(&path, &source).unwrap().rgb, Rgb::Planes(..)), "file {k}");
assert!(crate::exr_index::get(&path, &source).unwrap().picture.is_some(), "file {k}");
let img = crate::probe::load_oriented(bytes, Some(image::ImageFormat::OpenExr)).unwrap();
for alpha in [AlphaMode::Straight, AlphaMode::Premultiplied, AlphaMode::Ignore] {
for curve in [FloatCurve::Srgb, FloatCurve::Linear, FloatCurve::Gamma24] {
@@ -761,7 +797,7 @@ fn picture_from_planes_with_data_window_offsets_is_the_image_crates() {
for (k, bytes) in files.iter().enumerate() {
let path = format!("/3271-offsets-{k}.exr");
let source = ExrSource::Bytes(bytes.as_slice().into());
assert!(matches!(crate::exr_index::get(&path, &source).unwrap().rgb, Rgb::Planes(..)), "file {k}");
assert!(crate::exr_index::get(&path, &source).unwrap().picture.is_some(), "file {k}");
let f = Footage::default();
let Picture::Done(Ok(got)) = picture(&path, &source, AlphaOp::of(&f, FloatCurve::Linear), None) else { panic!("file {k}: a picture") };
let img = crate::probe::load_oriented(bytes, Some(image::ImageFormat::OpenExr)).unwrap();
@@ -780,7 +816,7 @@ fn a_failed_request_fails_only_requests_as_large() {
let source = ExrSource::Bytes(bytes.into());
let store = PlaneStore::new(CACHE_BUDGET);
let index = crate::exr_index::get(path, &source).unwrap();
let picture = Want { all: false, ids: index.picture_ids().unwrap().into_iter().collect() };
let picture = Want { all: false, ids: index.picture_ids().into_iter().collect() };
let all = Want { all: true, ids: (0..4).collect() };
let held = store.get(path, &source, &index, &picture, Use::Picture).unwrap();
assert_eq!(store.get(path, &source, &index, &all, Use::Other).err(), Some(Refused::Unreadable));
@@ -846,7 +882,7 @@ fn a_hostile_data_window_is_refused_not_allocated() {
assert!(!crate::exr_index::safe_to_decode(&bytes));
assert!(crate::exr_index::build(&mut std::io::Cursor::new(bytes.as_slice()), FileStamp::Virtual).is_err());
assert!(crate::exr_channels::read_exr_channels(&bytes).is_none());
assert!(crate::exr_channels::layered_image(&bytes).is_none());
assert!(crate::exr_channels::picture_image(&bytes).is_none());
let b: Arc<[u8]> = bytes.into();
assert!(crate::probe_bytes(&path, b.clone()).is_err(), "import refuses it");
let pool = crate::MediaPool::new();
@@ -877,7 +913,7 @@ fn damaged_files_never_panic() {
let mut bad = good.clone();
bad[at] ^= [0xff, 0x80, 0x01, 0x7f][i % 4];
let _ = crate::exr_channels::read_exr_channels(&bad);
let _ = crate::exr_channels::layered_image(&bad);
let _ = crate::exr_channels::picture_image(&bad);
let mut src = std::io::Cursor::new(bad.as_slice());
if let Ok(ix) = crate::exr_index::build(&mut src, FileStamp::Virtual) {
let req = ReadRequest { rows: Some(3..9), level: 1, ..ReadRequest::full((0..ix.channels.len()).collect()) };
@@ -940,7 +976,7 @@ fn an_invalid_channel_list_is_refused() {
for bad in [zero, swapped] {
assert!(crate::exr_index::build(&mut std::io::Cursor::new(bad.as_slice()), FileStamp::Virtual).is_err());
assert!(crate::exr_channels::read_exr_channels(&bad).is_none());
assert!(crate::exr_channels::layered_image(&bad).is_none());
assert!(crate::exr_channels::picture_image(&bad).is_none());
}
}
@@ -1497,7 +1533,7 @@ fn a_failed_picture_leaves_the_other_channels_readable() {
let store = PlaneStore::new(CACHE_BUDGET);
let source = ExrSource::Bytes(bytes);
let index = crate::exr_index::get(path, &source).unwrap();
let picture = Want { all: false, ids: index.picture_ids().unwrap().into_iter().collect() };
let picture = Want { all: false, ids: index.picture_ids().into_iter().collect() };
assert!(matches!(store.get(path, &source, &index, &picture, Use::Other), Err(Refused::TooLarge(_))));
assert!(store.get(path, &source, &index, &picture, Use::Other).is_err(), "remembered");
let rest = store.get(path, &source, &index, &Want { all: true, ids: Default::default() }, Use::Other).expect("the other channels");
+2 -2
View File
@@ -1668,8 +1668,8 @@ impl Inner {
Ok(img) => Ok(dynamic_to_image(&img, op)),
// Over the size limit: the layered fallback would allocate its planes anyway.
Err(e @ image::ImageError::Limits(_)) => Err(MediaError::Decode(format!("{path}: {e}"))),
// A multi-layer OpenEXR file without an unnamed RGB layer: its colour layer.
Err(e) => match crate::exr_channels::layered_image(&bytes) {
// An OpenEXR file the decoder refuses (no unnamed RGB): its main picture, or black.
Err(e) => match crate::exr_channels::picture_image(&bytes) {
Some(img) => Ok(dynamic_to_image(&img, op)),
None => Err(MediaError::Decode(format!("{path}: {e}"))),
},
+4 -3
View File
@@ -292,9 +292,10 @@ fn probe_still_bytes(path: &str, bytes: &[u8], fmt: image::ImageFormat) -> Resul
(w, h, dec.color_type().has_alpha())
}
Err(e) => {
// A multi-layer OpenEXR file without an unnamed RGB layer: its picture's size and
// alpha from the headers alone (#3271), no pixels decoded.
let size = (fmt == image::ImageFormat::OpenExr).then(|| crate::exr_channels::layered_size(bytes)).flatten();
// An OpenEXR file without an unnamed RGB part (a `Y` picture, or named layers only,
// shown black): its picture's size and alpha from the headers alone (#3271), no
// pixels decoded.
let size = (fmt == image::ImageFormat::OpenExr).then(|| crate::exr_channels::picture_size(bytes)).flatten();
size.ok_or_else(|| MediaError::Decode(format!("{path}: {e}")))?
}
};
+55 -52
View File
@@ -248,8 +248,8 @@ fn files() -> Vec<(&'static str, Vec<u8>, bool)> {
true,
),
(
// The image crate shows the part "depth" (the first with R, G and B), whose planes are
// filled with the background depth outside its data window: decoded by the image crate.
// The picture is the part "depth" (the first with R, G and B, as the image crate shows
// it): its channels are colour, 0 outside the data window, despite the part's name.
"multipart_depth_named_rgb_zip16",
write(
vec![
@@ -336,7 +336,10 @@ fn hashes(name: &str, bytes: &[u8], aux_first: bool) -> Vec<(String, u64, bool)>
out
}
/// Hashes taken on main before #474's shared decode (`EXR_GOLDEN_PRINT=1`).
/// Hashes taken on main before #474's shared decode (`EXR_GOLDEN_PRINT=1`). The pictures of
/// the files of named layers only (`layered_*`, `multipart_blender5_rle`) were re-pinned when the
/// picture became After Effects' main picture (black for those files, their channels unchanged),
/// and `multipart_depth_named_rgb_zip16`'s channels when the picture's channels kept a fill of 0.
const PINNED: &[(&str, &str, u64)] = &[
("rgba_half_zip16", "probe", 0x0a32e074a28c1f66),
("rgba_half_zip16", "probed/linear", 0xa84600283dce98f6),
@@ -352,12 +355,12 @@ const PINNED: &[(&str, &str, u64)] = &[
("rgb_float_piz", "ignore/linear", 0xa6e8fbbad371a2ae),
("rgb_float_piz", "preserve_rgb", 0xa6e8fbbad371a2ae),
("rgb_float_piz", "aux", 0x554623d237c2e5ef),
("layered_rle", "probe", 0x0a32e074a28c1f66),
("layered_rle", "probed/linear", 0xa84600283dce98f6),
("layered_rle", "straight/linear", 0xf028e1367a2fbb30),
("layered_rle", "premul/linear", 0xa84600283dce98f6),
("layered_rle", "ignore/linear", 0xa90a57f9a67f7468),
("layered_rle", "preserve_rgb", 0xc8e0050f5efe75b7),
("layered_rle", "probe", 0x6a38346c4c5662d5),
("layered_rle", "probed/linear", 0x63d9c6245f75ef06),
("layered_rle", "straight/linear", 0x63d9c6245f75ef06),
("layered_rle", "premul/linear", 0x63d9c6245f75ef06),
("layered_rle", "ignore/linear", 0x63d9c6245f75ef06),
("layered_rle", "preserve_rgb", 0x63d9c6245f75ef06),
("layered_rle", "aux", 0xa6b9bd9f02c192ad),
("unnamed_rgb_plus_layers_zip1", "probe", 0x0a32e074a28c1f66),
("unnamed_rgb_plus_layers_zip1", "probed/linear", 0xa84600283dce98f6),
@@ -380,12 +383,12 @@ const PINNED: &[(&str, &str, u64)] = &[
("multipart_diffuse_then_beauty_zip1", "ignore/linear", 0xa90a57f9a67f7468),
("multipart_diffuse_then_beauty_zip1", "preserve_rgb", 0xa90a57f9a67f7468),
("multipart_diffuse_then_beauty_zip1", "aux", 0x6724d6dfd56a04cb),
("multipart_blender5_rle", "probe", 0x0a32e074a28c1f66),
("multipart_blender5_rle", "probed/linear", 0xa84600283dce98f6),
("multipart_blender5_rle", "straight/linear", 0xf028e1367a2fbb30),
("multipart_blender5_rle", "premul/linear", 0xa84600283dce98f6),
("multipart_blender5_rle", "ignore/linear", 0xa90a57f9a67f7468),
("multipart_blender5_rle", "preserve_rgb", 0xc8e0050f5efe75b7),
("multipart_blender5_rle", "probe", 0x6a38346c4c5662d5),
("multipart_blender5_rle", "probed/linear", 0x63d9c6245f75ef06),
("multipart_blender5_rle", "straight/linear", 0x63d9c6245f75ef06),
("multipart_blender5_rle", "premul/linear", 0x63d9c6245f75ef06),
("multipart_blender5_rle", "ignore/linear", 0x63d9c6245f75ef06),
("multipart_blender5_rle", "preserve_rgb", 0x63d9c6245f75ef06),
("multipart_blender5_rle", "aux", 0x522ae4819dd92e89),
("unnamed_rgb_window_smaller_zip16", "probe", 0x0a32e074a28c1f66),
("unnamed_rgb_window_smaller_zip16", "probed/linear", 0x19eb3b1a88d108a7),
@@ -401,19 +404,19 @@ const PINNED: &[(&str, &str, u64)] = &[
("rgb_float_window_larger_piz", "ignore/linear", 0x8e3847d48f9967a6),
("rgb_float_window_larger_piz", "preserve_rgb", 0x8e3847d48f9967a6),
("rgb_float_window_larger_piz", "aux", 0x7ccc9f86e6ff6140),
("layered_window_smaller_zip16", "probe", 0x0a32e074a28c1f66),
("layered_window_smaller_zip16", "probed/linear", 0x19eb3b1a88d108a7),
("layered_window_smaller_zip16", "straight/linear", 0x2c73f9acaa936420),
("layered_window_smaller_zip16", "premul/linear", 0x19eb3b1a88d108a7),
("layered_window_smaller_zip16", "ignore/linear", 0x3b86057d18a16bf0),
("layered_window_smaller_zip16", "preserve_rgb", 0x5b999014e4a64bb2),
("layered_window_smaller_zip16", "probe", 0x6a38346c4c5662d5),
("layered_window_smaller_zip16", "probed/linear", 0x63d9c6245f75ef06),
("layered_window_smaller_zip16", "straight/linear", 0x63d9c6245f75ef06),
("layered_window_smaller_zip16", "premul/linear", 0x63d9c6245f75ef06),
("layered_window_smaller_zip16", "ignore/linear", 0x63d9c6245f75ef06),
("layered_window_smaller_zip16", "preserve_rgb", 0x63d9c6245f75ef06),
("layered_window_smaller_zip16", "aux", 0x443480a1d789e63c),
("layered_window_larger_piz", "probe", 0x0a32e074a28c1f66),
("layered_window_larger_piz", "probed/linear", 0x443afe4029748836),
("layered_window_larger_piz", "straight/linear", 0xb32b44880f746826),
("layered_window_larger_piz", "premul/linear", 0x443afe4029748836),
("layered_window_larger_piz", "ignore/linear", 0xaa01706accce2cc4),
("layered_window_larger_piz", "preserve_rgb", 0xb2cbb40b10bc56b4),
("layered_window_larger_piz", "probe", 0x6a38346c4c5662d5),
("layered_window_larger_piz", "probed/linear", 0x63d9c6245f75ef06),
("layered_window_larger_piz", "straight/linear", 0x63d9c6245f75ef06),
("layered_window_larger_piz", "premul/linear", 0x63d9c6245f75ef06),
("layered_window_larger_piz", "ignore/linear", 0x63d9c6245f75ef06),
("layered_window_larger_piz", "preserve_rgb", 0x63d9c6245f75ef06),
("layered_window_larger_piz", "aux", 0xb7d91c8eea56a772),
("unnamed_rgb_plus_layers_tiled_zip16", "probe", 0x0a32e074a28c1f66),
("unnamed_rgb_plus_layers_tiled_zip16", "probed/linear", 0x7612f20634fe957e),
@@ -422,12 +425,12 @@ const PINNED: &[(&str, &str, u64)] = &[
("unnamed_rgb_plus_layers_tiled_zip16", "ignore/linear", 0xbbf236635dcaac90),
("unnamed_rgb_plus_layers_tiled_zip16", "preserve_rgb", 0x15b555a243d79613),
("unnamed_rgb_plus_layers_tiled_zip16", "aux", 0x3d1439eed2202e41),
("layered_tiled_rle", "probe", 0x0a32e074a28c1f66),
("layered_tiled_rle", "probed/linear", 0xa84600283dce98f6),
("layered_tiled_rle", "straight/linear", 0xf028e1367a2fbb30),
("layered_tiled_rle", "premul/linear", 0xa84600283dce98f6),
("layered_tiled_rle", "ignore/linear", 0xa90a57f9a67f7468),
("layered_tiled_rle", "preserve_rgb", 0xc8e0050f5efe75b7),
("layered_tiled_rle", "probe", 0x6a38346c4c5662d5),
("layered_tiled_rle", "probed/linear", 0x63d9c6245f75ef06),
("layered_tiled_rle", "straight/linear", 0x63d9c6245f75ef06),
("layered_tiled_rle", "premul/linear", 0x63d9c6245f75ef06),
("layered_tiled_rle", "ignore/linear", 0x63d9c6245f75ef06),
("layered_tiled_rle", "preserve_rgb", 0x63d9c6245f75ef06),
("layered_tiled_rle", "aux", 0xa6b9bd9f02c192ad),
("unnamed_rgb_plus_layers_mipmapped_zip16", "probe", 0x0a32e074a28c1f66),
("unnamed_rgb_plus_layers_mipmapped_zip16", "probed/linear", 0xa84600283dce98f6),
@@ -436,12 +439,12 @@ const PINNED: &[(&str, &str, u64)] = &[
("unnamed_rgb_plus_layers_mipmapped_zip16", "ignore/linear", 0xa90a57f9a67f7468),
("unnamed_rgb_plus_layers_mipmapped_zip16", "preserve_rgb", 0xc8e0050f5efe75b7),
("unnamed_rgb_plus_layers_mipmapped_zip16", "aux", 0x27cc9b53d0862db1),
("layered_mipmapped_piz", "probe", 0x0a32e074a28c1f66),
("layered_mipmapped_piz", "probed/linear", 0xa84600283dce98f6),
("layered_mipmapped_piz", "straight/linear", 0xf028e1367a2fbb30),
("layered_mipmapped_piz", "premul/linear", 0xa84600283dce98f6),
("layered_mipmapped_piz", "ignore/linear", 0xa90a57f9a67f7468),
("layered_mipmapped_piz", "preserve_rgb", 0xc8e0050f5efe75b7),
("layered_mipmapped_piz", "probe", 0x6a38346c4c5662d5),
("layered_mipmapped_piz", "probed/linear", 0x63d9c6245f75ef06),
("layered_mipmapped_piz", "straight/linear", 0x63d9c6245f75ef06),
("layered_mipmapped_piz", "premul/linear", 0x63d9c6245f75ef06),
("layered_mipmapped_piz", "ignore/linear", 0x63d9c6245f75ef06),
("layered_mipmapped_piz", "preserve_rgb", 0x63d9c6245f75ef06),
("layered_mipmapped_piz", "aux", 0xa6b9bd9f02c192ad),
("unnamed_rgb_plus_layers_decreasing_zip1", "probe", 0x0a32e074a28c1f66),
("unnamed_rgb_plus_layers_decreasing_zip1", "probed/linear", 0x19eb3b1a88d108a7),
@@ -450,12 +453,12 @@ const PINNED: &[(&str, &str, u64)] = &[
("unnamed_rgb_plus_layers_decreasing_zip1", "ignore/linear", 0x3b86057d18a16bf0),
("unnamed_rgb_plus_layers_decreasing_zip1", "preserve_rgb", 0x5b999014e4a64bb2),
("unnamed_rgb_plus_layers_decreasing_zip1", "aux", 0x8f78d3233450acf3),
("layered_decreasing_rle", "probe", 0x0a32e074a28c1f66),
("layered_decreasing_rle", "probed/linear", 0xa84600283dce98f6),
("layered_decreasing_rle", "straight/linear", 0xf028e1367a2fbb30),
("layered_decreasing_rle", "premul/linear", 0xa84600283dce98f6),
("layered_decreasing_rle", "ignore/linear", 0xa90a57f9a67f7468),
("layered_decreasing_rle", "preserve_rgb", 0xc8e0050f5efe75b7),
("layered_decreasing_rle", "probe", 0x6a38346c4c5662d5),
("layered_decreasing_rle", "probed/linear", 0x63d9c6245f75ef06),
("layered_decreasing_rle", "straight/linear", 0x63d9c6245f75ef06),
("layered_decreasing_rle", "premul/linear", 0x63d9c6245f75ef06),
("layered_decreasing_rle", "ignore/linear", 0x63d9c6245f75ef06),
("layered_decreasing_rle", "preserve_rgb", 0x63d9c6245f75ef06),
("layered_decreasing_rle", "aux", 0xa6b9bd9f02c192ad),
("unnamed_rgb_plus_layers_uncompressed", "probe", 0x0a32e074a28c1f66),
("unnamed_rgb_plus_layers_uncompressed", "probed/linear", 0xa27668bf31d9426b),
@@ -464,12 +467,12 @@ const PINNED: &[(&str, &str, u64)] = &[
("unnamed_rgb_plus_layers_uncompressed", "ignore/linear", 0xb3276cc5126776d4),
("unnamed_rgb_plus_layers_uncompressed", "preserve_rgb", 0xdee1105fa6e6822a),
("unnamed_rgb_plus_layers_uncompressed", "aux", 0x854a5e84e7aaa5c2),
("layered_uncompressed", "probe", 0x0a32e074a28c1f66),
("layered_uncompressed", "probed/linear", 0xa84600283dce98f6),
("layered_uncompressed", "straight/linear", 0xf028e1367a2fbb30),
("layered_uncompressed", "premul/linear", 0xa84600283dce98f6),
("layered_uncompressed", "ignore/linear", 0xa90a57f9a67f7468),
("layered_uncompressed", "preserve_rgb", 0xc8e0050f5efe75b7),
("layered_uncompressed", "probe", 0x6a38346c4c5662d5),
("layered_uncompressed", "probed/linear", 0x63d9c6245f75ef06),
("layered_uncompressed", "straight/linear", 0x63d9c6245f75ef06),
("layered_uncompressed", "premul/linear", 0x63d9c6245f75ef06),
("layered_uncompressed", "ignore/linear", 0x63d9c6245f75ef06),
("layered_uncompressed", "preserve_rgb", 0x63d9c6245f75ef06),
("layered_uncompressed", "aux", 0xa6b9bd9f02c192ad),
("uint_rgb_zip16", "probe", 0x0a32e074a28c1f66),
("uint_rgb_zip16", "probed/linear", 0xed89310ef0cdb9fd),
@@ -484,7 +487,7 @@ const PINNED: &[(&str, &str, u64)] = &[
("multipart_depth_named_rgb_zip16", "premul/linear", 0x869374e9b0384cea),
("multipart_depth_named_rgb_zip16", "ignore/linear", 0x3b86057d18a16bf0),
("multipart_depth_named_rgb_zip16", "preserve_rgb", 0x3b86057d18a16bf0),
("multipart_depth_named_rgb_zip16", "aux", 0x0fa56884e83b4417),
("multipart_depth_named_rgb_zip16", "aux", 0x6651502f552749d5),
];
#[test]
+3 -2
View File
@@ -340,8 +340,9 @@ build real projects through these interfaces; they are worked examples of everyt
* **OCIO effects**: with Configuration ▸ Custom, `configFile` is a `.ocio` path or the config's
text; `effect.warning {layer, effect}` says what Effect Controls warns about (a config it
can't read, a colour space it lacks, transforms that pass colours through) or `null`.
* **Multi-layer OpenEXR**: the footage shows the beauty pass (an unnamed RGBA layer, else
Combined / Beauty / Image / RGBA…, never Cryptomatte or depth). `layer.channels {layer}`
* **Multi-layer OpenEXR**: the footage shows the main picture as After Effects does (the
unprefixed `R`, `G`, `B` (`A`) of the first part with them, else `Y` as grey; a file of named
layers only, such as Blender's `ViewLayer.Combined.R`, is black). `layer.channels {layer}`
lists a footage layer's EXR layers and
channels (`{"layers":[{"name":"diffuse","rgba":["diffuse.R","diffuse.G","diffuse.B",""]}]}`);
EXtractoR shows them when its `red` / `green` / `blue` / `alpha` are set to those names
+6 -5
View File
@@ -117,11 +117,12 @@ false` goes back to Use Source File Timecode). Cineon Settings: `{"logConversion
Float OpenEXR renders hold linear light; EffectCraft sRGB-encodes them as they are read, like
After Effects with Interpret As Linear Light for 32 bpc, unless the item preserves RGB (above).
A multi-layer file shows its main RGBA channels, as in After Effects. Renders that keep every
pass in named layers (Blender's `ViewLayer.Combined`, its compositor's File Output `Image`,
Nuke's `beauty`) show the beauty pass: the layer named Combined, Beauty, Image, RGBA, RGB or
Color, else the first colour layer that isn't a data pass. Cryptomatte, depth, mist, normals,
vectors, positions and IDs are never the picture. EXtractoR reads every other layer and channel.
A multi-layer file shows its main picture, as in After Effects: the channels without a layer
prefix, `R`, `G`, `B` (and `A`) of the first part that has all three, else the first part's `Y`
(and `A`) as grey. Renders that keep every pass in named layers (Blender's
`ViewLayer.Combined`, its compositor's File Output `Image`, Nuke's `beauty.R`) have no main
picture and show black at the file's size, as After Effects shows them; EXtractoR (and
Cryptomatte and the 3D Channel effects) read every layer and channel by name.
Footage on its own keeps only the channels of its picture (a single-part file still
decompresses all of its pixels to read them). Once an effect reads an item's channels
+1 -1
View File
@@ -454,7 +454,7 @@ Mocha and Cineware are third-party and not counted.
| Category | Effects | Notes |
|---|---|---|
| 3D Channel | 3D Channel Extract, Cryptomatte, Depth Matte, Depth of Field, EXtractoR, Fog 3D, ID Matte, IDentifier | Read auxiliary channels: multi-layer OpenEXR (any `layer.channel`, Cryptomatte manifests from the header; EXtractoR picks a layer and channels from popups of the footage's layers and channels, `layer.channels`, #295; the footage itself shows the beauty pass, never Cryptomatte or depth, #412) or the compositor's own depth / layer-ID / normal / UV / Cryptomatte pass for precomps of 3D comps. |
| 3D Channel | 3D Channel Extract, Cryptomatte, Depth Matte, Depth of Field, EXtractoR, Fog 3D, ID Matte, IDentifier | Read auxiliary channels: multi-layer OpenEXR (any `layer.channel`, Cryptomatte manifests from the header; EXtractoR picks a layer and channels from popups of the footage's layers and channels, `layer.channels`, #295; the footage itself shows After Effects' main picture: the unprefixed RGB(A), else Y, else black) or the compositor's own depth / layer-ID / normal / UV / Cryptomatte pass for precomps of 3D comps. |
| Immersive Video | VR Blur, VR Chromatic Aberrations, VR Color Gradients, VR Converter, VR De-Noise, VR Digital Glitch, VR Fractal Noise, VR Glow, VR Plane to Sphere, VR Rotate Sphere, VR Sharpen, VR Sphere to Plane | Seam-aware equirectangular processing (wrap-around, pole continuation, latitude-scaled filters), mono / over-under / side-by-side layouts; VR Converter between equirectangular, cube maps (4:3, 3:2, 6:1), sphere map and 2D. |
| Color Correction | OCIO CDL / Color Space / Display / File / Look Transform, Color Stabilizer | Built-in minimal OCIO-style config (ACES2065-1, ACEScg, ACEScct, sRGB, Rec.709, Rec.2020, Display P3, linear variants, XYZ) from published matrices and transfer functions; `.cube` / `.3dl` / `.csp` / `.spi1d` / `.spi3d` / `.spimtx` LUTs and ASC `.cc` / `.ccc` / `.cdl`. Custom `.ocio` config files are read from the OCIO v2 documentation (Configuration ▸ Custom: colorspaces and display colorspaces with the scene / display reference spaces joined by the default view transform, roles, displays with v1 and v2 views, view transforms, looks; Matrix, File, Exponent, ExponentWithLinear, Log, LogAffine, CDL, Range, Allocation, ColorSpace, Look, DisplayView, Builtin (matrices and display curves) and Group transforms), so Blender 4.x / 5.x configs give the Standard, AgX, Filmic and False Color views (#410). Grading Primary / Tone transforms, the ACES output and gamut-compression builtins and HLG pass colours through, and the effect shows a warning naming them (`effect.warning`). |
| Distort | CC Flo Motion, Liquify, Rolling Shutter Repair | Liquify strokes are effect data replayed into a displacement mesh (`liquify.stroke` / `liquify.clear` commands; no interactive viewer brush yet). Rolling Shutter Repair uses the KLT tracker. |