比较提交
10
次代码提交
| 作者 | SHA1 | 提交日期 | |
|---|---|---|---|
|
|
a5a2bddeb3 | ||
|
|
11a8851828 | ||
|
|
8bd2ba91fa | ||
|
|
9f5c9a1237 | ||
|
|
54e68b4810 | ||
|
|
bb5ede7be4 | ||
|
|
70a50ab445 | ||
|
|
5b8ef04f7e | ||
|
|
a1e49e2eb5 | ||
|
|
d0b4e9d2ba |
没有与搜索条件相匹配的文件
@@ -0,0 +1,104 @@
|
||||
#pragma once
|
||||
#include "DYPremultiplied.h"
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Independent from the frozen grade ABI. Values are Dayu-owned, append-only IDs.
|
||||
namespace dycm {
|
||||
inline constexpr unsigned Version = 1;
|
||||
inline constexpr const char *Engine = "OpenColorIO-2.5.2";
|
||||
inline constexpr const char *Config = "studio-config-v2.2.0_aces-v1.3_ocio-v2.4";
|
||||
enum class Space : unsigned {
|
||||
ACES2065=1, ACEScg=2, ACEScc=3, ACEScct=4,
|
||||
Linear709=10, Gamma22_709=11, SRGB=12, Linear2020=13,
|
||||
AppleLog=100, ARRI_LogC3=101, ARRI_LogC4=102, BMD_Gen5=103,
|
||||
CanonLog2=104, CanonLog3=105, PanasonicVLog=106, REDLog3G10=107,
|
||||
SonySLog3=108, SonySLog3Cine=109, SonyVeniceSLog3=110, SonyVeniceSLog3Cine=111,
|
||||
DaVinciIntermediate=112
|
||||
};
|
||||
enum class Output : unsigned {
|
||||
Rec709_100=1, SRGB_100=2, DisplayP3_100=3, Rec709D60_100=4,
|
||||
Rec2020_100=5, Rec2020PQ_1000=6, Rec2020HLG_1000=7,
|
||||
P3D60_48=8, P3DCI_48=9, P3D65_48=10
|
||||
};
|
||||
enum class Alpha { Straight, Premultiplied };
|
||||
struct SpaceInfo { Space id; const char *label; const char *ocioName; };
|
||||
struct OutputInfo { Output id; const char *label; const char *display; const char *view; };
|
||||
std::span<const SpaceInfo> spaces();
|
||||
std::span<const OutputInfo> outputs();
|
||||
const SpaceInfo &spaceInfo(Space);
|
||||
const OutputInfo &outputInfo(Output);
|
||||
|
||||
struct Settings {
|
||||
unsigned version=Version;
|
||||
bool enabled=false;
|
||||
Space input=Space::ACEScg, working=Space::ACEScct;
|
||||
Output output=Output::Rec709_100;
|
||||
// Explicit scene-domain LMT, before the display/output transform.
|
||||
bool referenceGamutCompression=false;
|
||||
void validate() const;
|
||||
std::string key() const;
|
||||
};
|
||||
struct ShaderTexture {
|
||||
unsigned dimensions=0,width=0,height=0,depth=0,channels=0;
|
||||
bool linear=false;
|
||||
std::vector<float> values;
|
||||
};
|
||||
struct MetalProgram {std::string source;std::vector<ShaderTexture> textures;};
|
||||
|
||||
// Immutable processor, independent of OCIO environment variables and monitor state.
|
||||
// A no-op never normalizes or unpremultiplies pixels (including hidden RGB).
|
||||
class Transform {
|
||||
public:
|
||||
static Transform identity();
|
||||
static Transform convert(Space from, Space to);
|
||||
static Transform display(Space from, Output to, bool gamutCompression=false);
|
||||
bool isIdentity() const;
|
||||
const std::string &key() const;
|
||||
void apply(std::span<DYCompositeRGBA> pixels, Alpha alpha) const;
|
||||
// Shader resources are copied from the fixed built-in config; no filesystem
|
||||
// LUT loading, process-global config, or dynamic uniform is allowed here.
|
||||
MetalProgram metalProgram() const;
|
||||
private:
|
||||
struct Impl;
|
||||
std::shared_ptr<const Impl> impl;
|
||||
explicit Transform(std::shared_ptr<const Impl>);
|
||||
};
|
||||
|
||||
struct Plan {
|
||||
Settings settings;
|
||||
Transform input, output;
|
||||
static Plan compile(const Settings &);
|
||||
std::string key() const;
|
||||
};
|
||||
|
||||
enum class FrameStage : unsigned { Input, Output, ToLinear, FromLinear, Count };
|
||||
enum class ToolDomain : unsigned { Working, Linear, Segmented };
|
||||
// An immutable platform profile conversion at a frame boundary. This interface
|
||||
// keeps host ICC objects out of archives and the portable grading engine.
|
||||
class PhysicalTransform {
|
||||
public:
|
||||
virtual ~PhysicalTransform() = default;
|
||||
virtual bool isIdentity() const = 0;
|
||||
virtual void apply(std::span<DYCompositeRGBA>, Alpha) const = 0;
|
||||
virtual std::string key() const = 0;
|
||||
};
|
||||
// The frame executor depends on this immutable contract, not on OCIO itself.
|
||||
// Header-only legacy render tests therefore do not acquire a runtime dependency.
|
||||
class FramePipeline {
|
||||
public:
|
||||
virtual ~FramePipeline() = default;
|
||||
virtual void validate() const = 0;
|
||||
virtual const Settings &settings() const = 0;
|
||||
virtual const Transform &transform(FrameStage) const = 0;
|
||||
virtual bool isIdentity(FrameStage) const = 0;
|
||||
virtual void apply(FrameStage, std::span<DYCompositeRGBA>, Alpha) const = 0;
|
||||
virtual std::string key() const = 0;
|
||||
// Input boundary runs before the declared input transform; Output runs
|
||||
// after the complete ODT. Intermediate tool domains have no ICC boundary.
|
||||
virtual std::shared_ptr<const PhysicalTransform> physicalBoundary(FrameStage) const {return {};}
|
||||
};
|
||||
std::shared_ptr<const FramePipeline> compileFramePipeline(const Settings &);
|
||||
} // namespace dycm
|
||||
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include <cmath>
|
||||
struct DYCompositeRGBA {float r,g,b,a;};
|
||||
inline DYCompositeRGBA dyPMFinite(DYCompositeRGBA p){return {std::isfinite(p.r)?p.r:0,std::isfinite(p.g)?p.g:0,std::isfinite(p.b)?p.b:0,std::isfinite(p.a)?p.a:0};}
|
||||
inline DYCompositeRGBA dyPMUnpremultiply(DYCompositeRGBA p){float a=p.a>1e-5f?p.a:1e-5f;return dyPMFinite({p.r/a,p.g/a,p.b/a,p.a});}
|
||||
inline DYCompositeRGBA dyPMPremultiply(DYCompositeRGBA p){return dyPMFinite({p.r*p.a,p.g*p.a,p.b*p.a,p.a});}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"sourceRepository": "https://dayu.media/git/dayu/dayu-colorplate.git",
|
||||
"sourceCommit": "f8950384e514685c8809fe8e8ee2dd5f16ad0bd7",
|
||||
"files": [
|
||||
{
|
||||
"path": "Core/DYColorManagement.hpp",
|
||||
"sourceSHA256": "78f6c2d5acdb611368370c3c9050d02d3a807f79b6f409906a4be7680a0c3746"
|
||||
},
|
||||
{
|
||||
"path": "Sources/DYColorManagement.cpp",
|
||||
"sourceSHA256": "68648a1d2b1e4be8d3c59679e47d4b07de239ec2b5196dc1eb99b59af2ba6306"
|
||||
},
|
||||
{
|
||||
"path": "Sources/DYColorManagementGPU.h",
|
||||
"sourceSHA256": "ed724b0cc73e27d8e238862bad120570939401e27f127d7afaf48c0e198cc4d7"
|
||||
},
|
||||
{
|
||||
"path": "Sources/DYColorManagementGPU.mm",
|
||||
"sourceSHA256": "dd2c68a3b29baae0cd19b86e224d70a49c222010e6232a56e13d7500285ff1c5"
|
||||
},
|
||||
{
|
||||
"path": "Sources/DYColorManagementState.h",
|
||||
"sourceSHA256": "5c39f949d83c160977b2cf6793ace991c0d66c81846c29dfd3bc705703b1c514"
|
||||
},
|
||||
{
|
||||
"path": "Sources/DYColorManagementState.mm",
|
||||
"sourceSHA256": "2e0035b59d0ff028530b0766c07c143b76f12c4b785d404fd7aff1e46ed8d9eb"
|
||||
},
|
||||
{
|
||||
"path": "Sources/DYColorProfile.h",
|
||||
"sourceSHA256": "38685ea23cbfe5686c1ade7ae8cf2eff231fd222e9d480245d3732ce5fecf7bb"
|
||||
},
|
||||
{
|
||||
"path": "Sources/DYColorProfile.mm",
|
||||
"sourceSHA256": "ccf1d6bf401c7d11fb4a2a745ee1e399d45cc99b62eba61e3818a582ab8c672c"
|
||||
},
|
||||
{
|
||||
"path": "Tools/build_ocio.py",
|
||||
"sourceSHA256": "ba1004e4d788590a44ae8ce2e124dcd65ee3b6b50d834cd615013d6355e6500b"
|
||||
}
|
||||
],
|
||||
"adaptations": [
|
||||
"Dedicated com.dayu.color runtime cache",
|
||||
"Standalone RGBA/alpha header, excluding unrelated layer engine",
|
||||
"No dependency on the sibling installed application"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
#include "../Core/DYColorManagement.hpp"
|
||||
#include <OpenColorIO/OpenColorIO.h>
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
namespace O = OCIO_NAMESPACE;
|
||||
namespace dycm {
|
||||
namespace {
|
||||
constexpr SpaceInfo spaceTable[] = {
|
||||
{Space::ACES2065,"ACES2065-1 / AP0 线性","ACES2065-1"},
|
||||
{Space::ACEScg,"ACEScg / AP1 线性","ACEScg"},
|
||||
{Space::ACEScc,"ACEScc","ACEScc"}, {Space::ACEScct,"ACEScct","ACEScct"},
|
||||
{Space::Linear709,"Rec.709 线性","Linear Rec.709 (sRGB)"},
|
||||
{Space::Gamma22_709,"Rec.709 Gamma 2.2","Gamma 2.2 Encoded Rec.709"},
|
||||
{Space::SRGB,"sRGB","sRGB Encoded Rec.709 (sRGB)"},
|
||||
{Space::Linear2020,"Rec.2020 线性","Linear Rec.2020"},
|
||||
{Space::AppleLog,"Apple Log","Apple Log"},
|
||||
{Space::ARRI_LogC3,"ARRI LogC3 / EI800","ARRI LogC3 (EI800)"},
|
||||
{Space::ARRI_LogC4,"ARRI LogC4","ARRI LogC4"},
|
||||
{Space::BMD_Gen5,"Blackmagic Film Gen 5 / Wide Gamut","BMDFilm WideGamut Gen5"},
|
||||
{Space::CanonLog2,"Canon Log2 / Cinema Gamut D55","CanonLog2 CinemaGamut D55"},
|
||||
{Space::CanonLog3,"Canon Log3 / Cinema Gamut D55","CanonLog3 CinemaGamut D55"},
|
||||
{Space::PanasonicVLog,"Panasonic V-Log / V-Gamut","V-Log V-Gamut"},
|
||||
{Space::REDLog3G10,"RED Log3G10 / REDWideGamutRGB","Log3G10 REDWideGamutRGB"},
|
||||
{Space::SonySLog3,"Sony S-Log3 / S-Gamut3","S-Log3 S-Gamut3"},
|
||||
{Space::SonySLog3Cine,"Sony S-Log3 / S-Gamut3.Cine","S-Log3 S-Gamut3.Cine"},
|
||||
{Space::SonyVeniceSLog3,"Sony Venice S-Log3 / S-Gamut3","S-Log3 Venice S-Gamut3"},
|
||||
{Space::SonyVeniceSLog3Cine,"Sony Venice S-Log3 / S-Gamut3.Cine","S-Log3 Venice S-Gamut3.Cine"},
|
||||
{Space::DaVinciIntermediate,"DaVinci Intermediate / Wide Gamut","DaVinci Intermediate WideGamut"}
|
||||
};
|
||||
constexpr OutputInfo outputTable[] = {
|
||||
{Output::Rec709_100,"Rec.709 / 100 nit","Rec.1886 Rec.709 - Display","ACES 1.0 - SDR Video"},
|
||||
{Output::SRGB_100,"sRGB / 100 nit","sRGB - Display","ACES 1.0 - SDR Video"},
|
||||
{Output::DisplayP3_100,"Display P3 / 100 nit","Display P3 - Display","ACES 1.0 - SDR Video"},
|
||||
{Output::Rec709D60_100,"Rec.709 / D60 模拟 / 100 nit","Rec.1886 Rec.709 - Display","ACES 1.0 - SDR Video (D60 sim on D65)"},
|
||||
{Output::Rec2020_100,"Rec.2020 SDR / 100 nit","Rec.1886 Rec.2020 - Display","ACES 1.0 - SDR Video"},
|
||||
{Output::Rec2020PQ_1000,"Rec.2020 PQ / 1000 nit","Rec.2100-PQ - Display","ACES 1.1 - HDR Video (1000 nits & Rec.2020 lim)"},
|
||||
{Output::Rec2020HLG_1000,"Rec.2020 HLG / 1000 nit","Rec.2100-HLG - Display","ACES 1.1 - HDR Video (1000 nits & Rec.2020 lim)"},
|
||||
{Output::P3D60_48,"P3 D60 / 48 nit","P3-D60 - Display","ACES 1.0 - SDR Cinema"},
|
||||
{Output::P3DCI_48,"P3 DCI / 48 nit","P3-DCI - Display","ACES 1.0 - SDR Cinema (D60 sim on DCI)"},
|
||||
{Output::P3D65_48,"P3 D65 / 48 nit","P3-D65 - Display","ACES 1.0 - SDR Cinema"}
|
||||
};
|
||||
O::ConstConfigRcPtr config() {
|
||||
static const auto value=[] {auto c=O::Config::CreateFromBuiltinConfig(Config);c->validate();return c;}();
|
||||
return value;
|
||||
}
|
||||
std::string prefix(){return std::string("dayu-cms:")+std::to_string(Version)+":"+Engine+":"+Config+":";}
|
||||
}
|
||||
std::span<const SpaceInfo> spaces(){return spaceTable;}
|
||||
std::span<const OutputInfo> outputs(){return outputTable;}
|
||||
const SpaceInfo &spaceInfo(Space id){for(auto &s:spaceTable)if(s.id==id)return s;throw std::invalid_argument("Unknown color space ID");}
|
||||
const OutputInfo &outputInfo(Output id){for(auto &s:outputTable)if(s.id==id)return s;throw std::invalid_argument("Unknown output transform ID");}
|
||||
void Settings::validate() const {
|
||||
if(version!=Version)throw std::invalid_argument("Unsupported color management version");
|
||||
spaceInfo(input);spaceInfo(working);outputInfo(output);
|
||||
if(working!=Space::ACEScc&&working!=Space::ACEScct&&working!=Space::ACEScg)
|
||||
throw std::invalid_argument("Unsupported ACES grading space");
|
||||
}
|
||||
std::string Settings::key() const {
|
||||
validate();return prefix()+std::to_string(enabled)+":"+std::to_string(unsigned(input))+":"+
|
||||
std::to_string(unsigned(working))+":"+std::to_string(unsigned(output))+":"+std::to_string(referenceGamutCompression);
|
||||
}
|
||||
struct Transform::Impl {
|
||||
std::string key;
|
||||
std::vector<O::ConstProcessorRcPtr> processors;
|
||||
std::vector<O::ConstCPUProcessorRcPtr> cpus;
|
||||
bool identity=true;
|
||||
bool decodeCC=false,encodeCC=false;
|
||||
Impl(std::string k,std::vector<O::ConstProcessorRcPtr> steps={},bool decode=false,bool encode=false):key(std::move(k)),processors(std::move(steps)),decodeCC(decode),encodeCC(encode) {
|
||||
identity=!decode&&!encode;
|
||||
for(auto &p:processors){auto cpu=p->getOptimizedCPUProcessor(O::OPTIMIZATION_LOSSLESS);identity=identity&&cpu->isNoOp();cpus.push_back(cpu);}
|
||||
}
|
||||
};
|
||||
// Academy ACEScc analytic encoding. The pinned OCIO config's cc entry uses a
|
||||
// 4096-sample LUT; use AP1 linear at that boundary to avoid LUT approximation.
|
||||
static float encodeCC(float x){return x<=0?float((-16.+9.72)/17.52):float((std::log2(x<1.f/32768?1./65536+double(x)*.5:double(x))+9.72)/17.52);}
|
||||
static float decodeCC(float x){return x<float((9.72-15.)/17.52)?float((std::exp2(double(x)*17.52-9.72)-1./65536)*2):float(std::min(std::exp2(double(x)*17.52-9.72),65504.));}
|
||||
Transform::Transform(std::shared_ptr<const Impl> value):impl(std::move(value)){}
|
||||
Transform Transform::identity(){return Transform(std::make_shared<Impl>(prefix()+"identity"));}
|
||||
Transform Transform::convert(Space from,Space to) {
|
||||
auto &source=spaceInfo(from);auto &destination=spaceInfo(to);
|
||||
if(from==to)return identity();
|
||||
return Transform(std::make_shared<Impl>(prefix()+"space:"+std::to_string(unsigned(from))+":"+std::to_string(unsigned(to)),
|
||||
std::vector<O::ConstProcessorRcPtr>{config()->getProcessor(from==Space::ACEScc?"ACEScg":source.ocioName,"ACEScg"),
|
||||
config()->getProcessor("ACEScg",to==Space::ACEScc?"ACEScg":destination.ocioName)},from==Space::ACEScc,to==Space::ACEScc));
|
||||
}
|
||||
Transform Transform::display(Space from,Output to,bool gamutCompression) {
|
||||
auto &source=spaceInfo(from);auto &destination=outputInfo(to);const char *sourceName=from==Space::ACEScc?"ACEScg":source.ocioName;
|
||||
auto group=O::GroupTransform::Create();
|
||||
if(gamutCompression){
|
||||
auto look=O::LookTransform::Create();look->setSrc("ACEScg");look->setDst("ACEScg");
|
||||
look->setLooks("ACES 1.3 Reference Gamut Compression");group->appendTransform(look);
|
||||
}
|
||||
auto view=O::DisplayViewTransform::Create();view->setSrc("ACEScg");view->setDisplay(destination.display);view->setView(destination.view);
|
||||
group->appendTransform(view);
|
||||
return Transform(std::make_shared<Impl>(prefix()+"display:"+std::to_string(unsigned(from))+":"+std::to_string(unsigned(to))+":"+std::to_string(gamutCompression),
|
||||
std::vector<O::ConstProcessorRcPtr>{config()->getProcessor(sourceName,"ACEScg"),config()->getProcessor(group)},from==Space::ACEScc));
|
||||
}
|
||||
bool Transform::isIdentity() const{return impl->identity;}
|
||||
const std::string &Transform::key() const{return impl->key;}
|
||||
void Transform::apply(std::span<DYCompositeRGBA> pixels,Alpha alpha) const {
|
||||
if(alpha!=Alpha::Straight&&alpha!=Alpha::Premultiplied)throw std::invalid_argument("Unknown alpha representation");
|
||||
if(isIdentity()||pixels.empty())return;
|
||||
std::array<DYCompositeRGBA,4096> scratch;
|
||||
std::array<float,4096> originalAlpha;
|
||||
for(size_t offset=0;offset<pixels.size();offset+=scratch.size()){
|
||||
size_t count=std::min(scratch.size(),pixels.size()-offset);
|
||||
for(size_t i=0;i<count;i++){
|
||||
auto p=dyPMFinite(pixels[offset+i]);originalAlpha[i]=p.a;
|
||||
if(alpha==Alpha::Premultiplied)p=dyPMUnpremultiply(p);
|
||||
if(impl->decodeCC){p.r=decodeCC(p.r);p.g=decodeCC(p.g);p.b=decodeCC(p.b);}
|
||||
p.a=1;scratch[i]=p;
|
||||
}
|
||||
O::PackedImageDesc image(scratch.data(),long(count),1,4);
|
||||
for(auto &cpu:impl->cpus){cpu->apply(image);for(size_t i=0;i<count;i++)scratch[i]=dyPMFinite(scratch[i]);}
|
||||
for(size_t i=0;i<count;i++){
|
||||
auto p=dyPMFinite(scratch[i]);p.a=originalAlpha[i];
|
||||
if(impl->encodeCC){p.r=encodeCC(p.r);p.g=encodeCC(p.g);p.b=encodeCC(p.b);}
|
||||
pixels[offset+i]=alpha==Alpha::Premultiplied?dyPMPremultiply(p):p;
|
||||
}
|
||||
}
|
||||
}
|
||||
MetalProgram Transform::metalProgram() const {
|
||||
if(isIdentity())return {"float4 dyOCIO(float4 p) { return p; }\n",{}};
|
||||
MetalProgram program;auto &source=program.source;std::string calls;
|
||||
for(size_t step=0;step<impl->processors.size();step++){
|
||||
auto desc=O::GpuShaderDesc::CreateShaderDesc();desc->setLanguage(O::GPU_LANGUAGE_MSL_2_0);
|
||||
std::string function="dyCMSBase"+std::to_string(step),prefix="dyCMS"+std::to_string(step)+"_";
|
||||
desc->setFunctionName(function.c_str());desc->setResourcePrefix(prefix.c_str());
|
||||
impl->processors[step]->getOptimizedGPUProcessor(O::OPTIMIZATION_LOSSLESS)->extractGpuShaderInfo(desc);
|
||||
if(desc->getNumUniforms())throw std::runtime_error("Fixed CMS transform unexpectedly requires dynamic uniforms: "+key());
|
||||
source+=desc->getShaderText();size_t firstTexture=program.textures.size();
|
||||
// OCIO's generic shader blends camera-log branches arithmetically. In MSL,
|
||||
// 0 * an overflowing inactive linear branch becomes NaN. Select the branch
|
||||
// as the CPU does, without changing the active curve or clamping HDR.
|
||||
const std::string branch="isAboveBreak * logSeg + ( float3(1., 1., 1.) - isAboveBreak ) * linSeg";
|
||||
for(size_t pos=0;(pos=source.find(branch,pos))!=std::string::npos;){
|
||||
const std::string replacement="select(linSeg, logSeg, isAboveBreak > float3(0.5))";
|
||||
source.replace(pos,branch.size(),replacement);pos+=replacement.size();
|
||||
}
|
||||
for(const char *boundary:{"linear_break","log_break"})for(int component=0;component<3;component++){
|
||||
auto c=std::to_string(component);
|
||||
std::string match="(outColor.rgb["+c+"] > "+boundary+"["+c+"]) ? 1.0 : 0.0";
|
||||
std::string replacement="(outColor.rgb["+c+"] < "+boundary+"["+c+"]) ? 0.0 : 1.0";
|
||||
for(size_t pos=0;(pos=source.find(match,pos))!=std::string::npos;){source.replace(pos,match.size(),replacement);pos+=replacement.size();}
|
||||
}
|
||||
// The public MSL wrapper takes 3D textures/samplers first, then 1D/2D pairs.
|
||||
auto copyTexture=[&](ShaderTexture t,const float *values,O::Interpolation interpolation){
|
||||
uint64_t count=uint64_t(t.width)*t.height*t.depth*t.channels;
|
||||
if(!values||!count||count>32*1024*1024||(interpolation!=O::INTERP_NEAREST&&interpolation!=O::INTERP_LINEAR&&interpolation!=O::INTERP_TETRAHEDRAL))
|
||||
throw std::runtime_error("Unsupported CMS shader texture: "+key());
|
||||
t.linear=interpolation==O::INTERP_LINEAR;t.values.assign(values,values+count);program.textures.push_back(std::move(t));
|
||||
};
|
||||
for(unsigned i=0;i<desc->getNum3DTextures();i++){
|
||||
const char *name=nullptr,*sampler=nullptr;unsigned edge=0;O::Interpolation interpolation;const float *values=nullptr;
|
||||
desc->get3DTexture(i,name,sampler,edge,interpolation);desc->get3DTextureValues(i,values);
|
||||
if(edge>256)throw std::runtime_error("CMS 3D texture is too large");
|
||||
copyTexture({3,edge,edge,edge,3,false,{}},values,interpolation);
|
||||
}
|
||||
for(unsigned i=0;i<desc->getNumTextures();i++){
|
||||
const char *name=nullptr,*sampler=nullptr;unsigned width=0,height=0;O::GpuShaderDesc::TextureType channels;O::GpuShaderDesc::TextureDimensions dimensions;O::Interpolation interpolation;const float *values=nullptr;
|
||||
desc->getTexture(i,name,sampler,width,height,channels,dimensions,interpolation);desc->getTextureValues(i,values);
|
||||
if(width>16384||height>16384)throw std::runtime_error("CMS texture is too large");
|
||||
unsigned dim=dimensions==O::GpuShaderDesc::TEXTURE_1D?1:2;
|
||||
copyTexture({dim,width,height,1,channels==O::GpuShaderDesc::TEXTURE_RED_CHANNEL?1u:3u,false,{}},values,interpolation);
|
||||
if(interpolation==O::INTERP_LINEAR){
|
||||
// Hardware samplers quantize the interpolation fraction. Near the
|
||||
// ACEScc toe this becomes measurable; interpolate fetched float
|
||||
// texels explicitly using the same LUT values as the CPU.
|
||||
std::string helper="dyCMSLookup"+std::to_string(program.textures.size()-1),text;
|
||||
if(dim==1)text="float4 "+helper+"(texture1d<float> t,float uv){float q=clamp(uv*float(t.get_width())-0.5f,0.f,float(t.get_width()-1));uint a=uint(floor(q)),b=min(a+1,t.get_width()-1);return mix(t.read(a),t.read(b),q-float(a));}\n";
|
||||
else text="float4 "+helper+"(texture2d<float> t,float2 uv){uint2 size=uint2(t.get_width(),t.get_height());float2 q=clamp(uv*float2(size)-0.5f,float2(0),float2(size-1));uint2 a=uint2(floor(q)),b=min(a+1,size-1);float2 f=q-float2(a);return mix(mix(t.read(a),t.read(uint2(b.x,a.y)),f.x),mix(t.read(uint2(a.x,b.y)),t.read(b),f.x),f.y);}\n";
|
||||
std::string match=std::string(name)+".sample("+sampler+", ",replacement=helper+"("+name+", ";
|
||||
for(size_t pos=0;(pos=source.find(match,pos))!=std::string::npos;){source.replace(pos,match.size(),replacement);pos+=replacement.size();}
|
||||
source=text+source;
|
||||
}
|
||||
}
|
||||
calls+="p="+function+"(";
|
||||
for(size_t i=firstTexture;i<program.textures.size();i++){auto suffix=std::to_string(i);calls+="dyBound"+suffix+",dySampler"+suffix+",";}
|
||||
calls+="p);p=select(float4(0),p,isfinite(p));\n";
|
||||
}
|
||||
source+="\nfloat dyCCEncode(float x) {return x<=0?((-16.f+9.72f)/17.52f):((log2(x<1.f/32768.f?1.f/65536.f+x*.5f:x)+9.72f)/17.52f);}\n";
|
||||
source+="float dyCCDecode(float x) {return x<((9.72f-15.f)/17.52f)?((exp2(x*17.52f-9.72f)-1.f/65536.f)*2.f):min(exp2(x*17.52f-9.72f),65504.f);}\nfloat4 dyOCIO(";
|
||||
for(size_t i=0;i<program.textures.size();i++){
|
||||
auto suffix=std::to_string(i);source+="texture"+std::to_string(program.textures[i].dimensions)+"d<float> dyBound"+suffix+", sampler dySampler"+suffix+", ";
|
||||
}
|
||||
source+="float4 p) {\n";
|
||||
if(impl->decodeCC)source+="p.rgb=float3(dyCCDecode(p.r),dyCCDecode(p.g),dyCCDecode(p.b));\n";
|
||||
source+=calls;
|
||||
if(impl->encodeCC)source+="p=select(float4(0),p,isfinite(p));p.rgb=float3(dyCCEncode(p.r),dyCCEncode(p.g),dyCCEncode(p.b));\n";
|
||||
source+="return p;}\n";return program;
|
||||
}
|
||||
Plan Plan::compile(const Settings &s){
|
||||
s.validate();return {s,s.enabled?Transform::convert(s.input,s.working):Transform::identity(),
|
||||
s.enabled?Transform::display(s.working,s.output,s.referenceGamutCompression):Transform::identity()};
|
||||
}
|
||||
std::string Plan::key()const{return settings.key();}
|
||||
namespace {
|
||||
class CompiledFramePipeline final : public FramePipeline {
|
||||
Plan plan;
|
||||
Transform toLinear,fromLinear;
|
||||
public:
|
||||
explicit CompiledFramePipeline(const Settings&s):plan(Plan::compile(s)),
|
||||
toLinear(Transform::convert(s.working,Space::ACEScg)),
|
||||
fromLinear(Transform::convert(Space::ACEScg,s.working)){validate();}
|
||||
void validate()const override {plan.settings.validate();if(!plan.settings.enabled)throw std::invalid_argument("A frame CMS pipeline must be enabled");}
|
||||
const Settings&settings()const override{return plan.settings;}
|
||||
const Transform&transform(FrameStage stage)const override{
|
||||
switch(stage){case FrameStage::Input:return plan.input;case FrameStage::Output:return plan.output;
|
||||
case FrameStage::ToLinear:return toLinear;case FrameStage::FromLinear:return fromLinear;
|
||||
default:throw std::invalid_argument("Invalid frame CMS stage");}
|
||||
}
|
||||
bool isIdentity(FrameStage stage)const override{return transform(stage).isIdentity();}
|
||||
void apply(FrameStage stage,std::span<DYCompositeRGBA>pixels,Alpha alpha)const override{transform(stage).apply(pixels,alpha);}
|
||||
std::string key()const override{return plan.key();}
|
||||
};
|
||||
}
|
||||
std::shared_ptr<const FramePipeline> compileFramePipeline(const Settings&s){
|
||||
s.validate();return s.enabled?std::make_shared<const CompiledFramePipeline>(s):nullptr;
|
||||
}
|
||||
} // namespace dycm
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Metal/Metal.h>
|
||||
#include "../Core/DYColorManagement.hpp"
|
||||
|
||||
// Own one immutable pipeline per transform/device. The caller commits and checks
|
||||
// its frame command buffer, so CMS joins the existing frame transaction.
|
||||
@interface DYColorManagementGPU : NSObject
|
||||
@property(nonatomic,readonly,copy) NSString *transformKey;
|
||||
@property(nonatomic,readonly) uint64_t retainedTextureBytes;
|
||||
- (instancetype)initWithDevice:(id<MTLDevice>)device transform:(const dycm::Transform&)transform error:(NSError**)error;
|
||||
- (instancetype)initWithDevice:(id<MTLDevice>)device transform:(const dycm::Transform&)transform
|
||||
resourceBudget:(uint64_t)bytes error:(NSError**)error;
|
||||
- (BOOL)encodeInput:(id<MTLTexture>)input output:(id<MTLTexture>)output
|
||||
alpha:(dycm::Alpha)alpha commandBuffer:(id<MTLCommandBuffer>)command
|
||||
workspaceBudget:(uint64_t)bytes error:(NSError**)error;
|
||||
@end
|
||||
|
||||
struct DYColorManagementCacheStatistics {
|
||||
NSUInteger entries=0;
|
||||
uint64_t retainedTextureBytes=0, builds=0, hits=0, evictions=0;
|
||||
};
|
||||
// Immutable device/transform resources shared by independent frame requests.
|
||||
// Limits bound cache ownership, not resources still leased by active frames.
|
||||
// Every frame must also charge its leased tables to its own resource budget.
|
||||
@interface DYColorManagementGPUCache : NSObject
|
||||
+ (instancetype)sharedCache;
|
||||
- (instancetype)initWithCountLimit:(NSUInteger)count textureByteLimit:(uint64_t)bytes;
|
||||
- (DYColorManagementGPU*)pipelineWithDevice:(id<MTLDevice>)device
|
||||
transform:(const dycm::Transform&)transform resourceBudget:(uint64_t)bytes error:(NSError**)error;
|
||||
- (DYColorManagementCacheStatistics)statistics;
|
||||
- (void)removeAllObjects;
|
||||
@end
|
||||
@@ -0,0 +1,130 @@
|
||||
#import "DYColorManagementGPU.h"
|
||||
#include <stdexcept>
|
||||
namespace {
|
||||
NSError *failure(NSString *text){return [NSError errorWithDomain:@"com.dayu.colorplate.cms" code:1 userInfo:@{NSLocalizedDescriptionKey:text}];}
|
||||
}
|
||||
@implementation DYColorManagementGPU {
|
||||
id<MTLDevice> _device;
|
||||
id<MTLComputePipelineState> _pipeline;
|
||||
NSString *_transformKey;
|
||||
NSArray *_textures,*_samplers;
|
||||
uint64_t _lutBytes;
|
||||
}
|
||||
- (NSString*)transformKey{return _transformKey;}
|
||||
- (uint64_t)retainedTextureBytes{return _lutBytes;}
|
||||
- (instancetype)initWithDevice:(id<MTLDevice>)device transform:(const dycm::Transform&)transform error:(NSError**)error {
|
||||
return [self initWithDevice:device transform:transform resourceBudget:128*1024*1024 error:error];
|
||||
}
|
||||
- (instancetype)initWithDevice:(id<MTLDevice>)device transform:(const dycm::Transform&)transform resourceBudget:(uint64_t)bytes error:(NSError**)error {
|
||||
if(!(self=[super init]))return nil;
|
||||
try {
|
||||
if(!device)throw std::invalid_argument("色彩管理需要可用的显卡");
|
||||
_device=device;_transformKey=[NSString stringWithUTF8String:transform.key().c_str()];
|
||||
auto program=transform.metalProgram();NSMutableArray *textures=[NSMutableArray new],*samplers=[NSMutableArray new];
|
||||
if(program.textures.size()>16)throw std::runtime_error("色彩管理查找表数量超过限制");
|
||||
std::string source="#include <metal_stdlib>\nusing namespace metal;\n"+program.source;
|
||||
source+="\nkernel void dyCMSFrame(texture2d<float,access::read> src [[texture(0)]], texture2d<float,access::write> dst [[texture(1)]], ";std::string arguments;
|
||||
for(size_t i=0;i<program.textures.size();i++){
|
||||
auto &t=program.textures[i];auto suffix=std::to_string(i);
|
||||
source+="texture"+std::to_string(t.dimensions)+"d<float> dyBound"+suffix+" [[texture("+std::to_string(i+2)+")]], sampler dySampler"+suffix+" [[sampler("+suffix+")]], ";
|
||||
arguments+="dyBound"+suffix+",dySampler"+suffix+",";
|
||||
auto d=[MTLTextureDescriptor new];d.pixelFormat=MTLPixelFormatRGBA32Float;d.textureType=t.dimensions==3?MTLTextureType3D:(t.dimensions==1?MTLTextureType1D:MTLTextureType2D);d.width=t.width;d.height=t.height;d.depth=t.depth;d.storageMode=MTLStorageModeShared;d.usage=MTLTextureUsageShaderRead;
|
||||
uint64_t limit=std::min(bytes,uint64_t(128)*1024*1024);
|
||||
if(_lutBytes>limit||uint64_t(t.width)*t.height*t.depth*16>limit-_lutBytes)throw std::runtime_error("色彩管理查找表超过预算");
|
||||
id<MTLTexture> texture=[device newTextureWithDescriptor:d];if(!texture)throw std::runtime_error("无法分配色彩查找表");_lutBytes+=texture.allocatedSize;if(_lutBytes>limit)throw std::runtime_error("色彩管理查找表超过预算");
|
||||
std::vector<float> rgba(uint64_t(t.width)*t.height*t.depth*4,1);
|
||||
for(size_t p=0;p<t.values.size()/t.channels;p++)for(unsigned c=0;c<3;c++)rgba[p*4+c]=t.values[p*t.channels+(t.channels==1?0:c)];
|
||||
if(t.dimensions==3)[texture replaceRegion:MTLRegionMake3D(0,0,0,t.width,t.height,t.depth) mipmapLevel:0 slice:0 withBytes:rgba.data() bytesPerRow:t.width*16 bytesPerImage:t.width*t.height*16];
|
||||
else [texture replaceRegion:MTLRegionMake2D(0,0,t.width,t.height) mipmapLevel:0 withBytes:rgba.data() bytesPerRow:t.dimensions==1?0:t.width*16];
|
||||
MTLSamplerDescriptor *sd=[MTLSamplerDescriptor new];sd.minFilter=sd.magFilter=t.linear?MTLSamplerMinMagFilterLinear:MTLSamplerMinMagFilterNearest;sd.sAddressMode=sd.tAddressMode=sd.rAddressMode=MTLSamplerAddressModeClampToEdge;sd.normalizedCoordinates=YES;
|
||||
id<MTLSamplerState> sampler=[device newSamplerStateWithDescriptor:sd];if(!sampler)throw std::runtime_error("无法分配色彩查找表采样器");[textures addObject:texture];[samplers addObject:sampler];
|
||||
}
|
||||
_textures=[textures copy];_samplers=[samplers copy];
|
||||
source+="constant uint &premult [[buffer(0)]], uint2 xy [[thread_position_in_grid]]) {\nif(any(xy >= uint2(src.get_width(),src.get_height()))) return;\nfloat4 p=src.read(xy);\n";
|
||||
if(!transform.isIdentity()){
|
||||
// Same finite and alpha-floor contract as Core/DYPremultiplied.h.
|
||||
// Alpha is excluded from the OCIO processor, including gamma ops.
|
||||
source+="p=select(float4(0),p,isfinite(p));float a=p.a;\nif(premult) { p.rgb/=max(a,1e-5f);p=select(float4(0),p,isfinite(p)); }\np=dyOCIO("+arguments+"float4(p.rgb,1));p=select(float4(0),p,isfinite(p));p.a=a;\nif(premult){p.rgb*=a;p=select(float4(0),p,isfinite(p));}\n";
|
||||
}
|
||||
source+="dst.write(p,xy);}\n";
|
||||
MTLCompileOptions *options=[MTLCompileOptions new];options.languageVersion=MTLLanguageVersion3_1;options.fastMathEnabled=NO;
|
||||
id<MTLLibrary> library=[device newLibraryWithSource:[NSString stringWithUTF8String:source.c_str()] options:options error:error];
|
||||
if(!library)return nil;
|
||||
id<MTLFunction> function=[library newFunctionWithName:@"dyCMSFrame"];
|
||||
if(!function)throw std::runtime_error("色彩管理显卡函数缺失");
|
||||
_pipeline=[device newComputePipelineStateWithFunction:function error:error];
|
||||
if(!_pipeline)return nil;
|
||||
return self;
|
||||
}catch(const std::exception &e){if(error)*error=failure([NSString stringWithUTF8String:e.what()]);return nil;}
|
||||
}
|
||||
- (BOOL)encodeInput:(id<MTLTexture>)input output:(id<MTLTexture>)output alpha:(dycm::Alpha)alpha commandBuffer:(id<MTLCommandBuffer>)command workspaceBudget:(uint64_t)bytes error:(NSError**)error {
|
||||
try {
|
||||
if(alpha!=dycm::Alpha::Straight&&alpha!=dycm::Alpha::Premultiplied)throw std::invalid_argument("色彩管理透明度表示无效");
|
||||
auto valid=[&](id<MTLTexture> t){return t&&t.device.registryID==_device.registryID&&t.pixelFormat==MTLPixelFormatRGBA32Float&&t.textureType==MTLTextureType2D&&t.sampleCount==1&&t.mipmapLevelCount==1&&t.width&&t.height&&t.width<=16384&&t.height<=16384&&uint64_t(t.width)*t.height<=uint64_t(64)*1024*1024;};
|
||||
if(!valid(input)||!valid(output)||input==output||input.width!=output.width||input.height!=output.height)
|
||||
throw std::invalid_argument("色彩管理需要独立、同尺寸的 RGBA32Float 纹理");
|
||||
if((input.usage!=MTLTextureUsageUnknown&&!(input.usage&MTLTextureUsageShaderRead))||(output.usage!=MTLTextureUsageUnknown&&!(output.usage&MTLTextureUsageShaderWrite)))
|
||||
throw std::invalid_argument("色彩管理纹理缺少读写用途");
|
||||
if(!command||command.commandQueue.device.registryID!=_device.registryID||command.status!=MTLCommandBufferStatusNotEnqueued)
|
||||
throw std::invalid_argument("色彩管理帧命令不可写入");
|
||||
if(_lutBytes>bytes||input.allocatedSize>bytes-_lutBytes||output.allocatedSize>bytes-_lutBytes-input.allocatedSize)
|
||||
throw std::runtime_error("色彩管理超过图像预算");
|
||||
id<MTLComputeCommandEncoder> encoder=[command computeCommandEncoder];
|
||||
if(!encoder)throw std::runtime_error("色彩管理显卡编码器不可用");
|
||||
uint32_t pm=alpha==dycm::Alpha::Premultiplied;
|
||||
[encoder setComputePipelineState:_pipeline];[encoder setTexture:input atIndex:0];[encoder setTexture:output atIndex:1];[encoder setBytes:&pm length:sizeof(pm) atIndex:0];
|
||||
for(NSUInteger i=0;i<_textures.count;i++){[encoder setTexture:_textures[i] atIndex:i+2];[encoder setSamplerState:_samplers[i] atIndex:i];}
|
||||
NSUInteger x=_pipeline.threadExecutionWidth,y=std::min(NSUInteger(8),_pipeline.maxTotalThreadsPerThreadgroup/x);
|
||||
[encoder dispatchThreads:MTLSizeMake(input.width,input.height,1) threadsPerThreadgroup:MTLSizeMake(x,y,1)];[encoder endEncoding];
|
||||
return YES;
|
||||
}catch(const std::exception &e){if(error)*error=failure([NSString stringWithUTF8String:e.what()]);return NO;}
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation DYColorManagementGPUCache {
|
||||
NSMutableDictionary<NSString*,DYColorManagementGPU*> *_entries;
|
||||
NSMutableArray<NSString*> *_order;
|
||||
NSUInteger _countLimit;
|
||||
uint64_t _byteLimit;
|
||||
DYColorManagementCacheStatistics _statistics;
|
||||
}
|
||||
+ (instancetype)sharedCache {
|
||||
static DYColorManagementGPUCache *cache;static dispatch_once_t once;
|
||||
dispatch_once(&once,^{cache=[[self alloc]initWithCountLimit:32 textureByteLimit:uint64_t(128)*1024*1024];});
|
||||
return cache;
|
||||
}
|
||||
- (instancetype)init {return [self initWithCountLimit:32 textureByteLimit:uint64_t(128)*1024*1024];}
|
||||
- (instancetype)initWithCountLimit:(NSUInteger)count textureByteLimit:(uint64_t)bytes {
|
||||
if((self=[super init])){_entries=[NSMutableDictionary new];_order=[NSMutableArray new];_countLimit=count;_byteLimit=bytes;}
|
||||
return self;
|
||||
}
|
||||
- (DYColorManagementGPU*)pipelineWithDevice:(id<MTLDevice>)device transform:(const dycm::Transform&)transform resourceBudget:(uint64_t)bytes error:(NSError**)error {
|
||||
if(!device){if(error)*error=failure(@"色彩管理需要可用的显卡");return nil;}
|
||||
NSString *key=[NSString stringWithFormat:@"%llu:%s",(unsigned long long)device.registryID,transform.key().c_str()];
|
||||
// Coalesce simultaneous first frames. Compilation happens on the caller's
|
||||
// render queue; the cache never calls back into a frame or holds its buffers.
|
||||
@synchronized(self){
|
||||
DYColorManagementGPU *pipeline=_entries[key];
|
||||
if(pipeline){
|
||||
if(pipeline.retainedTextureBytes>bytes){if(error)*error=failure(@"色彩管理查找表超过预算");return nil;}
|
||||
[_order removeObject:key];[_order addObject:key];_statistics.hits++;return pipeline;
|
||||
}
|
||||
pipeline=[[DYColorManagementGPU alloc]initWithDevice:device transform:transform resourceBudget:bytes error:error];
|
||||
if(!pipeline)return nil;_statistics.builds++;
|
||||
uint64_t cost=pipeline.retainedTextureBytes;
|
||||
if(!_countLimit||cost>_byteLimit)return pipeline;
|
||||
while(_order.count&&(_order.count>=_countLimit||cost>_byteLimit-_statistics.retainedTextureBytes)){
|
||||
NSString *old=_order.firstObject;_statistics.retainedTextureBytes-=_entries[old].retainedTextureBytes;
|
||||
[_entries removeObjectForKey:old];[_order removeObjectAtIndex:0];_statistics.evictions++;
|
||||
}
|
||||
_entries[key]=pipeline;[_order addObject:key];_statistics.retainedTextureBytes+=cost;
|
||||
return pipeline;
|
||||
}
|
||||
}
|
||||
- (DYColorManagementCacheStatistics)statistics {
|
||||
@synchronized(self){auto value=_statistics;value.entries=_entries.count;return value;}
|
||||
}
|
||||
- (void)removeAllObjects {
|
||||
@synchronized(self){[_entries removeAllObjects];[_order removeAllObjects];_statistics.retainedTextureBytes=0;}
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#import <Foundation/Foundation.h>
|
||||
#include "../Core/DYColorManagement.hpp"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
typedef NS_ENUM(NSInteger,DYCMSInputMode){DYCMSInputDeclared=0,DYCMSInputHostProfile=1};
|
||||
// Root-level authoring state. Integration must explicitly whitelist this class;
|
||||
// missing state in older documents means the unchanged unmanaged pipeline.
|
||||
@interface DYColorManagementState : NSObject <NSSecureCoding,NSCopying>
|
||||
@property(nonatomic) NSInteger version,inputSpace,workingSpace,outputTransform;
|
||||
@property(nonatomic) DYCMSInputMode inputMode;
|
||||
@property(nonatomic) BOOL enabled,referenceGamutCompression;
|
||||
@property(nonatomic,copy) NSString *engineIdentifier,*configIdentifier;
|
||||
- (BOOL)getSettings:(dycm::Settings*)settings error:(NSError* _Nullable * _Nullable)error;
|
||||
- (nullable NSData*)archiveDataWithError:(NSError* _Nullable * _Nullable)error;
|
||||
+ (nullable instancetype)stateFromArchiveData:(NSData*)data error:(NSError* _Nullable * _Nullable)error;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,77 @@
|
||||
#import "DYColorManagementState.h"
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
namespace {
|
||||
NSError *failure(NSString *message){return [NSError errorWithDomain:@"com.dayu.colorplate.cms-state" code:1 userInfo:@{NSLocalizedDescriptionKey:message}];}
|
||||
NSArray<NSString*> *keys(){return @[@"version",@"inputMode",@"inputSpace",@"workingSpace",@"outputTransform",@"enabled",@"referenceGamutCompression",@"engineIdentifier",@"configIdentifier"];}
|
||||
}
|
||||
@implementation DYColorManagementState
|
||||
+ (BOOL)supportsSecureCoding{return YES;}
|
||||
- (instancetype)init {
|
||||
if((self=[super init])){dycm::Settings s;_version=2;_inputMode=DYCMSInputDeclared;_inputSpace=NSInteger(s.input);_workingSpace=NSInteger(s.working);_outputTransform=NSInteger(s.output);_enabled=s.enabled;_referenceGamutCompression=s.referenceGamutCompression;
|
||||
_engineIdentifier=[NSString stringWithUTF8String:dycm::Engine];_configIdentifier=[NSString stringWithUTF8String:dycm::Config];}
|
||||
return self;
|
||||
}
|
||||
- (BOOL)getSettings:(dycm::Settings*)settings error:(NSError**)error {
|
||||
try {
|
||||
if(!settings)throw std::invalid_argument("色彩管理参数目的地缺失");
|
||||
if(![_engineIdentifier isKindOfClass:NSString.class]||![_configIdentifier isKindOfClass:NSString.class]||![_engineIdentifier isEqualToString:[NSString stringWithUTF8String:dycm::Engine]]||![_configIdentifier isEqualToString:[NSString stringWithUTF8String:dycm::Config]])
|
||||
throw std::invalid_argument("工程使用了不支持的色彩转换组件版本");
|
||||
for(NSNumber *value in @[@(_version),@(_inputSpace),@(_workingSpace),@(_outputTransform)])
|
||||
if(value.longLongValue<0||value.unsignedLongLongValue>std::numeric_limits<unsigned>::max())throw std::invalid_argument("色彩管理标识超出范围");
|
||||
if((_version!=1&&_version!=2)||(_inputMode!=DYCMSInputDeclared&&_inputMode!=DYCMSInputHostProfile)||(_version==1&&_inputMode!=DYCMSInputDeclared))throw std::invalid_argument("色彩管理输入方式或归档版本无效");
|
||||
dycm::Settings s;s.enabled=_enabled;s.input=dycm::Space(_inputSpace);s.working=dycm::Space(_workingSpace);s.output=dycm::Output(_outputTransform);s.referenceGamutCompression=_referenceGamutCompression;
|
||||
s.validate();if(_inputMode==DYCMSInputHostProfile)s.input=dycm::Space::ACEScg;*settings=s;return YES;
|
||||
}catch(const std::exception &e){if(error)*error=failure([NSString stringWithUTF8String:e.what()]);return NO;}
|
||||
}
|
||||
- (void)encodeWithCoder:(NSCoder*)coder {
|
||||
dycm::Settings s;NSError *error=nil;if(![self getSettings:&s error:&error]){[coder failWithError:error];return;}
|
||||
for(NSString *key in @[@"version",@"inputSpace",@"workingSpace",@"outputTransform"])[coder encodeInteger:[[self valueForKey:key]integerValue] forKey:key];
|
||||
if(_version>=2)[coder encodeInteger:_inputMode forKey:@"inputMode"];
|
||||
[coder encodeBool:_enabled forKey:@"enabled"];[coder encodeBool:_referenceGamutCompression forKey:@"referenceGamutCompression"];
|
||||
[coder encodeObject:_engineIdentifier forKey:@"engineIdentifier"];[coder encodeObject:_configIdentifier forKey:@"configIdentifier"];
|
||||
}
|
||||
- (instancetype)initWithCoder:(NSCoder*)coder {
|
||||
if(!(self=[self init]))return nil;
|
||||
for(NSString *key in keys())if(![key isEqual:@"inputMode"]&&![coder containsValueForKey:key]){[coder failWithError:failure(@"色彩管理归档不完整")];return nil;}
|
||||
for(NSString *key in @[@"version",@"inputSpace",@"workingSpace",@"outputTransform"])[self setValue:@([coder decodeIntegerForKey:key]) forKey:key];
|
||||
if((_version>=2)!=[coder containsValueForKey:@"inputMode"]){[coder failWithError:failure(@"色彩管理输入方式与归档版本不一致")];return nil;}
|
||||
_inputMode=_version>=2?DYCMSInputMode([coder decodeIntegerForKey:@"inputMode"]):DYCMSInputDeclared;
|
||||
// Keyed archives distinguish CFBoolean from integer NSNumber. The boolean
|
||||
// decoder already rejects integer 0/1/2; an integer decoder rejects our own
|
||||
// valid encodeBool fields. Do not coerce either representation via KVC.
|
||||
_enabled=[coder decodeBoolForKey:@"enabled"];
|
||||
_referenceGamutCompression=[coder decodeBoolForKey:@"referenceGamutCompression"];
|
||||
if(coder.error)return nil;
|
||||
_engineIdentifier=[[coder decodeObjectOfClass:NSString.class forKey:@"engineIdentifier"]copy];_configIdentifier=[[coder decodeObjectOfClass:NSString.class forKey:@"configIdentifier"]copy];
|
||||
dycm::Settings s;NSError *error=nil;if(![self getSettings:&s error:&error]){[coder failWithError:error];return nil;}return self;
|
||||
}
|
||||
- (id)copyWithZone:(NSZone*)zone {
|
||||
DYColorManagementState *copy=[[[self class]allocWithZone:zone]init];
|
||||
for(NSString *key in keys())[copy setValue:[self valueForKey:key] forKey:key];return copy;
|
||||
}
|
||||
- (BOOL)isEqual:(id)object {
|
||||
if(object==self)return YES;if(![object isMemberOfClass:self.class])return NO;
|
||||
for(NSString *key in keys()){id a=[self valueForKey:key],b=[object valueForKey:key];if(a!=b&&![a isEqual:b])return NO;}return YES;
|
||||
}
|
||||
- (NSUInteger)hash {
|
||||
NSUInteger value=1469598103934665603ull;
|
||||
for(NSString *key in keys())value=(value^[[self valueForKey:key]hash])*1099511628211ull;return value;
|
||||
}
|
||||
- (NSData*)archiveDataWithError:(NSError**)error {
|
||||
dycm::Settings s;if(![self getSettings:&s error:error])return nil;
|
||||
@try{return [NSKeyedArchiver archivedDataWithRootObject:self requiringSecureCoding:YES error:error];}
|
||||
@catch(NSException *exception){if(error)*error=failure(@"无法保存色彩管理设置");return nil;}
|
||||
}
|
||||
+ (instancetype)stateFromArchiveData:(NSData*)data error:(NSError**)error {
|
||||
if(![data isKindOfClass:NSData.class]||!data.length||data.length>16384){if(error)*error=failure(@"色彩管理归档大小无效");return nil;}
|
||||
@try{
|
||||
id decoded=[NSKeyedUnarchiver unarchivedObjectOfClass:self fromData:data error:error];
|
||||
// Foundation permits some scalar classes even with a specific root
|
||||
// whitelist. Check the returned root before exposing typed state.
|
||||
if(![decoded isMemberOfClass:self]){if(error)*error=failure(@"色彩管理归档根对象无效");return nil;}
|
||||
dycm::Settings s;if(![decoded getSettings:&s error:error])return nil;return decoded;
|
||||
}
|
||||
@catch(NSException *exception){if(error)*error=failure(@"无法读取色彩管理设置");return nil;}
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <Metal/Metal.h>
|
||||
#include "../Core/DYColorManagement.hpp"
|
||||
#include <optional>
|
||||
#include <atomic>
|
||||
|
||||
// A physical RGB profile conversion, separate from a declared camera encoding
|
||||
// or an ACES display rendering transform. Profiles and keys are immutable.
|
||||
@interface DYColorProfile : NSObject
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
- (instancetype)initWithSource:(CGColorSpaceRef)source target:(CGColorSpaceRef)target error:(NSError**)error;
|
||||
// Encoded ACES ODT values to a real host/display profile. In particular, HLG
|
||||
// uses the BT.2100 reference EOTF before the physical profile conversion.
|
||||
- (instancetype)initWithDisplayOutput:(dycm::Output)output target:(CGColorSpaceRef)target error:(NSError**)error;
|
||||
@property(nonatomic,readonly) CGColorSpaceRef source;
|
||||
@property(nonatomic,readonly) CGColorSpaceRef target;
|
||||
@property(nonatomic,readonly) BOOL identity;
|
||||
@property(nonatomic,readonly,copy) NSString*key;
|
||||
// Opaque fingerprint metadata only, never decoded as an authoring field.
|
||||
@property(nonatomic,readonly,copy) NSData*sourceDescription;
|
||||
@property(nonatomic,readonly,copy) NSData*targetDescription;
|
||||
// No additional display tone mapping or [0,1] clipping. The selected physical
|
||||
// profile still defines its own transfer-function range and extrapolation.
|
||||
// Output storage is private. Input remains untouched on success or failure.
|
||||
- (std::optional<std::vector<DYCompositeRGBA>>)convertPixels:(std::span<const DYCompositeRGBA>)input
|
||||
alpha:(dycm::Alpha)alpha budget:(uint64_t)bytes cancelled:(const std::atomic_bool*)cancelled error:(NSError**)error;
|
||||
@end
|
||||
|
||||
@interface DYColorProfileGPU : NSObject
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
- (instancetype)initWithDevice:(id<MTLDevice>)device profile:(DYColorProfile*)profile error:(NSError**)error;
|
||||
- (BOOL)renderInput:(id<MTLTexture>)input output:(id<MTLTexture>)output alpha:(dycm::Alpha)alpha
|
||||
workspaceBudget:(uint64_t)bytes cancelled:(const std::atomic_bool*)cancelled error:(NSError**)error;
|
||||
@end
|
||||
|
||||
// Nominal output profile. For conversion use initWithDisplayOutput:target:;
|
||||
// Apple's HLG profile alone is not the reference BT.2100 chromatic EOTF.
|
||||
CGColorSpaceRef DYCreateCMSOutputColorSpace(dycm::Output output) CF_RETURNS_RETAINED;
|
||||
@@ -0,0 +1,132 @@
|
||||
#import "DYColorProfile.h"
|
||||
#import <CoreImage/CoreImage.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#include <mutex>
|
||||
#include <stdexcept>
|
||||
#include <simd/simd.h>
|
||||
|
||||
namespace {
|
||||
struct CacheClear {CIContext*context;~CacheClear(){[context clearCaches];}};
|
||||
NSError*failure(NSString*message){return [NSError errorWithDomain:@"com.dayu.colorplate.profile" code:1 userInfo:@{NSLocalizedDescriptionKey:message}];}
|
||||
void check(const std::atomic_bool*cancelled){if(cancelled&&cancelled->load())throw std::runtime_error("颜色配置转换已取消");}
|
||||
void validAlpha(dycm::Alpha alpha){if(alpha!=dycm::Alpha::Straight&&alpha!=dycm::Alpha::Premultiplied)throw std::invalid_argument("颜色配置透明度表示无效");}
|
||||
void admission(uint64_t pixels,uint64_t bytes){if(!pixels||pixels>uint64_t(64)*1024*1024||pixels>bytes/(6*sizeof(DYCompositeRGBA)))throw std::runtime_error("颜色配置转换的估算工作集超过预算");}
|
||||
NSData*description(CGColorSpaceRef space){
|
||||
if(!space||CGColorSpaceGetModel(space)!=kCGColorSpaceModelRGB)throw std::invalid_argument("颜色转换需要明确的 RGB 配置");
|
||||
CGColorSpaceRef device=CGColorSpaceCreateDeviceRGB();bool unspecified=CFEqual(space,device);CGColorSpaceRelease(device);if(unspecified)throw std::invalid_argument("Device RGB 没有明确的原色和传递函数");
|
||||
CFPropertyListRef plist=CGColorSpaceCopyPropertyList(space);if(!plist)throw std::runtime_error("无法保存颜色配置描述");
|
||||
NSData*data=[NSPropertyListSerialization dataWithPropertyList:CFBridgingRelease(plist) format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];
|
||||
if(!data.length||data.length>16*1024*1024)throw std::runtime_error("颜色配置描述无效或超过限制");
|
||||
return data;
|
||||
}
|
||||
NSString*fingerprint(NSData*data){unsigned char digest[CC_SHA256_DIGEST_LENGTH];CC_SHA256(data.bytes,(CC_LONG)data.length,digest);NSMutableString*result=[NSMutableString new];for(auto c:digest)[result appendFormat:@"%02x",c];return result;}
|
||||
NSDictionary*options(bool software){
|
||||
CGColorSpaceRef working=CGColorSpaceCreateWithName(kCGColorSpaceACESCGLinear);if(!working)throw std::runtime_error("无法建立线性颜色转换空间");
|
||||
NSMutableDictionary*value=[@{kCIContextWorkingColorSpace:CFBridgingRelease(working),kCIContextWorkingFormat:@(kCIFormatRGBAf),kCIContextOutputPremultiplied:@YES,kCIContextCacheIntermediates:@NO}mutableCopy];if(software)value[kCIContextUseSoftwareRenderer]=@YES;return value;
|
||||
}
|
||||
void configure(CIRenderDestination*d,CGColorSpaceRef target){d.colorSpace=target;d.alphaMode=CIRenderDestinationAlphaPremultiplied;d.clamped=NO;d.dithered=NO;d.flipped=NO;}
|
||||
bool render(CIContext*context,CIImage*image,CIRenderDestination*destination,size_t width,size_t height,NSError**error){
|
||||
NSError*underlying=nil;auto task=[context startTaskToRender:image fromRect:CGRectMake(0,0,width,height) toDestination:destination atPoint:CGPointZero error:&underlying];
|
||||
if(!task||![task waitUntilCompletedAndReturnError:&underlying]){if(error)*error=underlying?:failure(@"系统颜色配置转换未完成");return false;}return true;
|
||||
}
|
||||
id<MTLTexture>rootTexture(id<MTLTexture>t){while(t.parentTexture)t=t.parentTexture;return t;}
|
||||
bool aliases(id<MTLTexture>a,id<MTLTexture>b){a=rootTexture(a);b=rootTexture(b);return a==b||(a.buffer&&a.buffer==b.buffer)||(a.iosurface&&a.iosurface==b.iosurface)||(a.heap&&a.heap==b.heap);}
|
||||
CGColorSpaceRef calibrated(double rx,double ry,double gx,double gy,double bx,double by,double wx,double wy,double gamma){
|
||||
simd_double3 white={wx/wy,1,(1-wx-wy)/wy};simd_double3x3 primaries={simd_double3{rx/ry,1,(1-rx-ry)/ry},simd_double3{gx/gy,1,(1-gx-gy)/gy},simd_double3{bx/by,1,(1-bx-by)/by}};auto scales=simd_mul(simd_inverse(primaries),white);
|
||||
CGFloat w[3]={white.x,white.y,white.z},g[3]={gamma,gamma,gamma},matrix[9];for(int c=0;c<3;c++)for(int r=0;r<3;r++)matrix[c*3+r]=primaries.columns[c][r]*scales[c];return CGColorSpaceCreateCalibratedRGB(w,nullptr,g,matrix);
|
||||
}
|
||||
DYCompositeRGBA decodeHLG(DYCompositeRGBA p){
|
||||
// BT.2100 reference display: 1000 cd/m2, gamma 1.2, black 0. Apple's
|
||||
// physical linear profile uses ISO HDR reference white 203 cd/m2.
|
||||
// Signed extension is explicit; finite values are not clipped to [0,1].
|
||||
auto inverse=[](float c){float v=fabsf(c);return copysignf(v<=.5f?v*v/3.f:(expf((v-.55991073f)/.17883277f)+.28466892f)/12.f,c);};p.r=inverse(p.r);p.g=inverse(p.g);p.b=inverse(p.b);
|
||||
float scale=(1000.f/203.f)*powf(fabsf(.2627f*p.r+.6780f*p.g+.0593f*p.b),.2f);p.r*=scale;p.g*=scale;p.b*=scale;return dyPMFinite(p);
|
||||
}
|
||||
}
|
||||
@interface DYColorProfile ()
|
||||
@property(nonatomic,readonly) CGColorSpaceRef conversionSource;
|
||||
@property(nonatomic,readonly) BOOL decodeHLG;
|
||||
@end
|
||||
CGColorSpaceRef DYCreateCMSOutputColorSpace(dycm::Output output){
|
||||
switch(output){
|
||||
case dycm::Output::Rec709_100:case dycm::Output::Rec709D60_100:return calibrated(.64,.33,.30,.60,.15,.06,.3127,.3290,2.4);
|
||||
case dycm::Output::SRGB_100:return CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
||||
case dycm::Output::DisplayP3_100:return CGColorSpaceCreateWithName(kCGColorSpaceDisplayP3);
|
||||
case dycm::Output::Rec2020_100:return calibrated(.708,.292,.170,.797,.131,.046,.3127,.3290,2.4);
|
||||
case dycm::Output::Rec2020PQ_1000:return CGColorSpaceCreateWithName(kCGColorSpaceITUR_2100_PQ);
|
||||
case dycm::Output::Rec2020HLG_1000:return CGColorSpaceCreateWithName(kCGColorSpaceITUR_2100_HLG);
|
||||
case dycm::Output::P3D60_48:return calibrated(.68,.32,.265,.69,.15,.06,.32168,.33767,2.6);
|
||||
case dycm::Output::P3DCI_48:return CGColorSpaceCreateWithName(kCGColorSpaceDCIP3);
|
||||
case dycm::Output::P3D65_48:return calibrated(.68,.32,.265,.69,.15,.06,.3127,.3290,2.6);
|
||||
}return nullptr;
|
||||
}
|
||||
@implementation DYColorProfile {
|
||||
CGColorSpaceRef _source,_target,_conversionSource;BOOL _identity,_decodeHLG;NSString*_key;NSData*_sourceDescription,*_targetDescription;CIContext*_cpu;std::mutex _mutex;
|
||||
}
|
||||
- (CGColorSpaceRef)source{return _source;}
|
||||
- (CGColorSpaceRef)target{return _target;}
|
||||
- (BOOL)identity{return _identity;}
|
||||
- (NSString*)key{return _key;}
|
||||
- (NSData*)sourceDescription{return _sourceDescription;}
|
||||
- (NSData*)targetDescription{return _targetDescription;}
|
||||
- (CGColorSpaceRef)conversionSource{return _conversionSource?:_source;}
|
||||
- (BOOL)decodeHLG{return _decodeHLG;}
|
||||
- (instancetype)initWithSource:(CGColorSpaceRef)source target:(CGColorSpaceRef)target error:(NSError**)error {
|
||||
if(!(self=[super init]))return nil;try{_sourceDescription=description(source);_targetDescription=description(target);_source=CGColorSpaceRetain(source);_target=CGColorSpaceRetain(target);_identity=CFEqual(source,target);_key=[NSString stringWithFormat:@"dayu-profile:1:%@:%@",fingerprint(_sourceDescription),fingerprint(_targetDescription)];return self;}catch(const std::exception&e){if(error)*error=failure(@(e.what()));return nil;}
|
||||
}
|
||||
- (instancetype)initWithDisplayOutput:(dycm::Output)output target:(CGColorSpaceRef)target error:(NSError**)error {
|
||||
CGColorSpaceRef source=DYCreateCMSOutputColorSpace(output);self=[self initWithSource:source target:target error:error];if(source)CGColorSpaceRelease(source);if(!self)return nil;
|
||||
if(output==dycm::Output::Rec2020HLG_1000){_conversionSource=CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearITUR_2020);if(!_conversionSource){if(error)*error=failure(@"无法建立 HLG 参考输出空间");return nil;}_decodeHLG=YES;_identity=NO;_key=[_key stringByAppendingString:@":reference-hlg:1000:203:v1"];}
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc{if(_source)CGColorSpaceRelease(_source);if(_target)CGColorSpaceRelease(_target);if(_conversionSource)CGColorSpaceRelease(_conversionSource);}
|
||||
- (std::optional<std::vector<DYCompositeRGBA>>)convertPixels:(std::span<const DYCompositeRGBA>)input alpha:(dycm::Alpha)alpha budget:(uint64_t)bytes cancelled:(const std::atomic_bool*)cancelled error:(NSError**)error {
|
||||
try{validAlpha(alpha);check(cancelled);if(input.empty()||input.size()>uint64_t(64)*1024*1024)throw std::invalid_argument("颜色转换输入大小无效");if(input.size()>bytes/(2*sizeof(DYCompositeRGBA)))throw std::runtime_error("颜色转换副本超过预算");if(_identity)return std::vector<DYCompositeRGBA>(input.begin(),input.end());admission(input.size(),bytes);
|
||||
std::lock_guard<std::mutex>lock(_mutex);check(cancelled);@autoreleasepool{@try{
|
||||
if(!_cpu)_cpu=[CIContext contextWithOptions:options(true)];if(!_cpu)throw std::runtime_error("无法建立 CPU 颜色转换");
|
||||
CacheClear cleanup{_cpu};std::vector<DYCompositeRGBA>result(input.size());std::vector<DYCompositeRGBA>opaque(std::min(size_t(4096),input.size()));
|
||||
for(size_t offset=0;offset<input.size();offset+=opaque.size()){
|
||||
check(cancelled);size_t count=std::min(opaque.size(),input.size()-offset);
|
||||
for(size_t i=0;i<count;i++){auto p=dyPMFinite(input[offset+i]);if(alpha==dycm::Alpha::Premultiplied)p=dyPMUnpremultiply(p);if(_decodeHLG)p=decodeHLG(p);p.a=1;opaque[i]=p;}
|
||||
NSData*data=[NSData dataWithBytesNoCopy:opaque.data() length:count*sizeof(DYCompositeRGBA) freeWhenDone:NO];auto image=[CIImage imageWithBitmapData:data bytesPerRow:count*16 size:CGSizeMake(count,1) format:kCIFormatRGBAf colorSpace:self.conversionSource];
|
||||
auto destination=[[CIRenderDestination alloc]initWithBitmapData:result.data()+offset width:count height:1 bytesPerRow:count*16 format:kCIFormatRGBAf];configure(destination,_target);
|
||||
if(!image||!render(_cpu,image,destination,count,1,error)){[_cpu clearCaches];return std::nullopt;}
|
||||
for(size_t i=0;i<count;i++){auto p=dyPMFinite(result[offset+i]);p.a=dyPMFinite(input[offset+i]).a;result[offset+i]=alpha==dycm::Alpha::Premultiplied?dyPMPremultiply(p):p;}
|
||||
}[_cpu clearCaches];check(cancelled);return result;
|
||||
}@catch(NSException*e){[_cpu clearCaches];if(error)*error=failure(e.reason?:@"CPU 颜色转换异常");return std::nullopt;}}
|
||||
}catch(const std::exception&e){if(error)*error=failure(@(e.what()));return std::nullopt;}
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation DYColorProfileGPU {
|
||||
id<MTLDevice>_device;id<MTLCommandQueue>_queue;DYColorProfile*_profile;CIContext*_context;
|
||||
id<MTLComputePipelineState>_prepare,_restore;std::mutex _mutex;
|
||||
}
|
||||
- (instancetype)initWithDevice:(id<MTLDevice>)device profile:(DYColorProfile*)profile error:(NSError**)error {
|
||||
if(!(self=[super init]))return nil;try{
|
||||
if(!device||!profile)throw std::invalid_argument("颜色配置或显卡缺失");_device=device;_profile=profile;_queue=[device newCommandQueue];if(!_queue)throw std::runtime_error("无法建立颜色转换队列");
|
||||
if(profile.identity)return self;_context=[CIContext contextWithMTLCommandQueue:_queue options:options(false)];if(!_context)throw std::runtime_error("无法建立显卡颜色转换");
|
||||
NSString*source=@"#include <metal_stdlib>\nusing namespace metal;\nfloat4 safe(float4 p){return select(float4(0),p,isfinite(p));}\nkernel void prepare(texture2d<float,access::read> src [[texture(0)]],texture2d<float,access::write> dst [[texture(1)]],constant uint2& options [[buffer(0)]],uint2 p [[thread_position_in_grid]]){if(any(p>=uint2(src.get_width(),src.get_height())))return;float4 c=safe(src.read(p));if(options.x)c=safe(float4(c.rgb/max(c.a,1e-5f),c.a));if(options.y){float3 v=abs(c.rgb);c.rgb=sign(c.rgb)*select((exp((v-.55991073f)/.17883277f)+.28466892f)/12.f,v*v/3.f,v<=.5f);c.rgb*=1000.f/203.f*pow(abs(dot(c.rgb,float3(.2627f,.6780f,.0593f))),.2f);c=safe(c);}dst.write(float4(c.rgb,1),p);}\nkernel void restore(texture2d<float,access::read> original [[texture(0)]],texture2d<float,access::read> converted [[texture(1)]],texture2d<float,access::write> dst [[texture(2)]],constant uint2& options [[buffer(0)]],uint2 p [[thread_position_in_grid]]){if(any(p>=uint2(dst.get_width(),dst.get_height())))return;float a=safe(original.read(p)).a;float3 rgb=safe(converted.read(p)).rgb;if(options.x)rgb*=a;dst.write(safe(float4(rgb,a)),p);}";
|
||||
auto options=[MTLCompileOptions new];options.languageVersion=MTLLanguageVersion3_1;options.fastMathEnabled=NO;auto library=[device newLibraryWithSource:source options:options error:error];if(!library)return nil;
|
||||
_prepare=[device newComputePipelineStateWithFunction:[library newFunctionWithName:@"prepare"] error:error];_restore=[device newComputePipelineStateWithFunction:[library newFunctionWithName:@"restore"] error:error];if(!_prepare||!_restore)return nil;return self;
|
||||
}catch(const std::exception&e){if(error)*error=failure(@(e.what()));return nil;}
|
||||
}
|
||||
- (BOOL)renderInput:(id<MTLTexture>)input output:(id<MTLTexture>)output alpha:(dycm::Alpha)alpha workspaceBudget:(uint64_t)bytes cancelled:(const std::atomic_bool*)cancelled error:(NSError**)error {
|
||||
try{validAlpha(alpha);check(cancelled);auto valid=[&](id<MTLTexture>t){return t&&t.device.registryID==_device.registryID&&t.textureType==MTLTextureType2D&&t.pixelFormat==MTLPixelFormatRGBA32Float&&t.width&&t.height&&t.width<=16384&&t.height<=16384&&t.sampleCount==1&&t.mipmapLevelCount==1&&!t.framebufferOnly&&t.storageMode!=MTLStorageModeMemoryless;};
|
||||
if(!valid(input)||!valid(output)||input.width!=output.width||input.height!=output.height||aliases(input,output))throw std::invalid_argument("颜色转换需要同设备、同尺寸且独立的 RGBA32Float 纹理");
|
||||
if((input.usage!=MTLTextureUsageUnknown&&!(input.usage&MTLTextureUsageShaderRead))||(output.usage!=MTLTextureUsageUnknown&&!(output.usage&MTLTextureUsageShaderWrite)))throw std::invalid_argument("颜色转换纹理缺少读写用途");
|
||||
if(uint64_t(input.width)*input.height>uint64_t(64)*1024*1024)throw std::invalid_argument("颜色转换图像过大");
|
||||
if(input.allocatedSize>bytes||output.allocatedSize>bytes-input.allocatedSize)throw std::runtime_error("颜色转换纹理超过预算");
|
||||
std::lock_guard<std::mutex>lock(_mutex);check(cancelled);@autoreleasepool{@try{
|
||||
CacheClear cleanup{_context};auto finish=[&](id<MTLCommandBuffer>b){if(!b)throw std::runtime_error("颜色转换命令缺失");[b commit];[b waitUntilCompleted];if(b.status!=MTLCommandBufferStatusCompleted)throw std::runtime_error(b.error.localizedDescription.UTF8String?:"颜色转换命令未完成");check(cancelled);};
|
||||
if(_profile.identity){auto command=[_queue commandBuffer];auto blit=[command blitCommandEncoder];if(!blit)throw std::runtime_error("无法复制恒等颜色图像");[blit copyFromTexture:input sourceSlice:0 sourceLevel:0 sourceOrigin:MTLOriginMake(0,0,0) sourceSize:MTLSizeMake(input.width,input.height,1) toTexture:output destinationSlice:0 destinationLevel:0 destinationOrigin:MTLOriginMake(0,0,0)];[blit endEncoding];finish(command);return YES;}
|
||||
admission(uint64_t(input.width)*input.height,bytes);auto desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA32Float width:input.width height:input.height mipmapped:NO];desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;
|
||||
auto opaque=[_device newTextureWithDescriptor:desc],converted=[_device newTextureWithDescriptor:desc];if(!opaque||!converted)throw std::runtime_error("无法分配颜色转换图像");uint64_t actual=input.allocatedSize+output.allocatedSize+opaque.allocatedSize+converted.allocatedSize;
|
||||
if(actual>bytes||2*uint64_t(input.width)*input.height*16>bytes-actual)throw std::runtime_error("颜色转换实际纹理及估算系统工作区超过预算");
|
||||
auto dispatch=[&](id<MTLComputePipelineState>pipeline,NSArray*textures){check(cancelled);auto command=[_queue commandBuffer];auto encoder=[command computeCommandEncoder];if(!encoder)throw std::runtime_error("无法建立颜色转换编码器");[encoder setComputePipelineState:pipeline];for(NSUInteger i=0;i<textures.count;i++)[encoder setTexture:textures[i] atIndex:i];uint32_t parameters[2]={alpha==dycm::Alpha::Premultiplied,uint32_t(_profile.decodeHLG)};[encoder setBytes:parameters length:sizeof(parameters) atIndex:0];NSUInteger x=pipeline.threadExecutionWidth,y=std::min(NSUInteger(8),pipeline.maxTotalThreadsPerThreadgroup/x);[encoder dispatchThreads:MTLSizeMake(input.width,input.height,1) threadsPerThreadgroup:MTLSizeMake(x,y,1)];[encoder endEncoding];finish(command);};
|
||||
dispatch(_prepare,@[input,opaque]);auto image=[CIImage imageWithMTLTexture:opaque options:@{kCIImageColorSpace:(__bridge id)_profile.conversionSource,kCIImageToneMapHDRtoSDR:@NO}];auto destination=[[CIRenderDestination alloc]initWithMTLTexture:converted commandBuffer:nil];configure(destination,_profile.target);
|
||||
if(!image||!render(_context,image,destination,input.width,input.height,error)){[_context clearCaches];return NO;}check(cancelled);dispatch(_restore,@[input,converted,output]);[_context clearCaches];return YES;
|
||||
}@catch(NSException*e){[_context clearCaches];if(error)*error=failure(e.reason?:@"显卡颜色转换异常");return NO;}}
|
||||
}catch(const std::exception&e){if(error)*error=failure(@(e.what()));return NO;}
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,11 @@
|
||||
# 固定版本的公开色彩管理依赖
|
||||
|
||||
这里保留 OpenColorIO 2.5.2 及其六个静态依赖、ARM SIMD 头文件的原始源码压缩包,供离线恢复与构建。不是已安装的依赖目录或编译产物。每个来源 URL、版本、字节数、SHA-256 和许可证见 `dependencies.lock.json`;原压缩包包含完整版权声明。
|
||||
|
||||
`python3 Tools/build_ocio.py` 在产品固定缓存的 `cms-runtime` 中编译 Release arm64/macOS 14.6,使用私有命名空间 `DayuOCIO_2_5_2`,不链接 Homebrew 动态库,不在构建时下载源码。需要 Xcode 和 CMake 3.24 以上(本机为 4.4.4)。缓存修改有两处:下载入口改为已校验的本地源码包;禁用 `OCIO_OPTIMIZATION_FLAGS` 环境覆盖,防止宿主环境悄悄改变工程精度。上游转换算法保持原样。构建有进程锁,所有实际静态库均校验后才复用。
|
||||
|
||||
固定 Studio 配置 `studio-config-v2.2.0_aces-v1.3_ocio-v2.4`,不使用随升级漂移的 `studio-config-latest`。OCIO 软件版本、配置版本和 ACES 系统版本是三个独立标识。完整输出使用 DisplayViewTransform;显示编码转换不能替代 ACES 输出渲染。
|
||||
|
||||
大鱼的 ACEScc 边界使用 [Academy 公开公式](https://docs.acescentral.com/encodings/acescc/) 与 AP1 线性衔接,避免此配置 ACEScc 的 4096 点查表近似。ACEScct 和相机/显示转换仍用固定 OCIO 配置。CPU/GPU选择 `OPTIMIZATION_LOSSLESS`,输出域和透明度政策由独立模块验证。
|
||||
|
||||
当前为独立模块准备,尚未接入产品渲染、工程归档或界面。正式33及旧工程不受影响。后续集成时须将这些许可证装入发行 APP,并验证 CPU/Metal、透明度、旧工程旁路以及宿主输入/输出边界。
|
||||
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"version": 1,
|
||||
"namespace": "DayuOCIO_2_5_2",
|
||||
"builtin_config": "studio-config-v2.2.0_aces-v1.3_ocio-v2.4",
|
||||
"sources": [
|
||||
{
|
||||
"name": "OpenColorIO",
|
||||
"version": "2.5.2",
|
||||
"url": "https://codeload.github.com/AcademySoftwareFoundation/OpenColorIO/tar.gz/refs/tags/v2.5.2",
|
||||
"archive": "OpenColorIO-2.5.2.tar.gz",
|
||||
"bytes": 14182890,
|
||||
"sha256": "722601e01b78b7a12da4829cb450674935f404b0e508f3f20046fa77570e3272",
|
||||
"licenses": [
|
||||
"licenses/OpenColorIO.txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "expat",
|
||||
"version": "2.7.2",
|
||||
"url": "https://codeload.github.com/libexpat/libexpat/tar.gz/R_2_7_2",
|
||||
"archive": "expat-2.7.2.tar.gz",
|
||||
"bytes": 8439887,
|
||||
"sha256": "d09e2dd23398805cec1bac2860304714c96dc2fde629a7a1a77d0880ab7cd242",
|
||||
"licenses": [
|
||||
"licenses/expat.txt",
|
||||
"licenses/expat-1.txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "yaml-cpp",
|
||||
"version": "0.8.0",
|
||||
"url": "https://codeload.github.com/jbeder/yaml-cpp/tar.gz/0.8.0",
|
||||
"archive": "yaml-cpp-0.8.0.tar.gz",
|
||||
"bytes": 1017151,
|
||||
"sha256": "fbe74bbdcee21d656715688706da3c8becfd946d92cd44705cc6098bb23b3a16",
|
||||
"licenses": [
|
||||
"licenses/yaml-cpp.txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Imath",
|
||||
"version": "3.2.1",
|
||||
"url": "https://codeload.github.com/AcademySoftwareFoundation/Imath/tar.gz/v3.2.1",
|
||||
"archive": "Imath-3.2.1.tar.gz",
|
||||
"bytes": 689041,
|
||||
"sha256": "b2c8a44c3e4695b74e9644c76f5f5480767355c6f98cde58ba0e82b4ad8c63ce",
|
||||
"licenses": [
|
||||
"licenses/Imath.txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pystring",
|
||||
"version": "1.1.4",
|
||||
"url": "https://codeload.github.com/imageworks/pystring/tar.gz/v1.1.4",
|
||||
"archive": "pystring-1.1.4.tar.gz",
|
||||
"bytes": 19184,
|
||||
"sha256": "49da0fe2a049340d3c45cce530df63a2278af936003642330287b68cefd788fb",
|
||||
"licenses": [
|
||||
"licenses/pystring.txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "minizip-ng",
|
||||
"version": "4.0.10",
|
||||
"url": "https://codeload.github.com/zlib-ng/minizip-ng/tar.gz/4.0.10",
|
||||
"archive": "minizip-ng-4.0.10.tar.gz",
|
||||
"bytes": 773269,
|
||||
"sha256": "c362e35ee973fa7be58cc5e38a4a6c23cc8f7e652555daf4f115a9eb2d3a6be7",
|
||||
"licenses": [
|
||||
"licenses/minizip-ng.txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "zlib",
|
||||
"version": "1.3.1",
|
||||
"url": "https://codeload.github.com/madler/zlib/tar.gz/v1.3.1",
|
||||
"archive": "zlib-1.3.1.tar.gz",
|
||||
"bytes": 1572744,
|
||||
"sha256": "17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c",
|
||||
"licenses": [
|
||||
"licenses/zlib.txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sse2neon",
|
||||
"version": "227cc413fb2d50b2a10073087be96b59d5364aea",
|
||||
"url": "https://codeload.github.com/DLTcollab/sse2neon/tar.gz/227cc413fb2d50b2a10073087be96b59d5364aea",
|
||||
"archive": "sse2neon-227cc413fb2d50b2a10073087be96b59d5364aea.tar.gz",
|
||||
"bytes": 136342,
|
||||
"sha256": "3427a495743bb6fd1b5f9f806b80f57d67b1ac7ccf39a5f44aedd487fd7e6da1",
|
||||
"licenses": [
|
||||
"licenses/sse2neon.txt"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
Copyright 2013 Colour Developers
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
|
||||
@@ -0,0 +1,11 @@
|
||||
Copyright Contributors to the OpenEXR Project. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,26 @@
|
||||
Copyright Contributors to the OpenColorIO Project.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,21 @@
|
||||
Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
|
||||
Copyright (c) 2001-2025 Expat maintainers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,21 @@
|
||||
Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
|
||||
Copyright (c) 2001-2025 Expat maintainers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,17 @@
|
||||
Condition of use and distribution are the same as zlib:
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgement in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright (c) 2008-present Contributors to the Pystring project.
|
||||
All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2015-2024 SSE2NEON Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2008-2015 Jesse Beder.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,22 @@
|
||||
Copyright notice:
|
||||
|
||||
(C) 1995-2022 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
二进制
二进制文件未显示。
二进制文件未显示。
二进制文件未显示。
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build the pinned color runtime offline; no Homebrew libraries or implicit downloads."""
|
||||
from pathlib import Path
|
||||
import fcntl, hashlib, json, os, re, shutil, subprocess, tarfile
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
VENDOR = ROOT / 'ThirdParty/ColorManagement'
|
||||
CACHE = Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/cms-runtime')
|
||||
|
||||
def digest(path):
|
||||
return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
def extract(archive, destination):
|
||||
with tarfile.open(archive) as tf:
|
||||
for member in tf.getmembers():
|
||||
path = (destination / member.name).resolve()
|
||||
if destination not in path.parents or member.isdev():
|
||||
raise ValueError('Unsafe source archive member')
|
||||
if member.issym() or member.islnk():
|
||||
target = ((path.parent if member.issym() else destination) / member.linkname).resolve()
|
||||
if target != destination and destination not in target.parents:
|
||||
raise ValueError('Unsafe source archive link')
|
||||
# Python 3.9 on the supported build machine has no extraction filter API.
|
||||
tf.extractall(destination)
|
||||
|
||||
def _build():
|
||||
lock = json.loads((VENDOR / 'dependencies.lock.json').read_text())
|
||||
archives = {}
|
||||
for item in lock['sources']:
|
||||
archive = VENDOR / 'sources' / item['archive']
|
||||
if archive.stat().st_size != item['bytes'] or digest(archive) != item['sha256']:
|
||||
raise ValueError('Source checksum mismatch: ' + item['name'])
|
||||
archives[item['name']] = (archive, item['sha256'])
|
||||
cmake = shutil.which('cmake') or '/opt/homebrew/bin/cmake'
|
||||
compiler = subprocess.check_output(['xcrun', 'clang++', '--version'], text=True)
|
||||
sdk = subprocess.check_output(['xcrun', '--show-sdk-version'], text=True).strip()
|
||||
identity = hashlib.sha256((json.dumps(lock, sort_keys=True) + Path(__file__).read_text() + compiler + sdk).encode()).hexdigest()
|
||||
CACHE.mkdir(parents=True, exist_ok=True)
|
||||
stamp = CACHE / 'build.json'
|
||||
if stamp.exists():
|
||||
previous = json.loads(stamp.read_text())
|
||||
if previous.get('identity') == identity and all(Path(p).is_file() and digest(Path(p)) == sha for p, sha in previous['libraries'].items()):
|
||||
return previous
|
||||
source_dir, build_dir, install = CACHE / 'source', CACHE / 'build', CACHE / 'install'
|
||||
# These are dedicated generated directories; no product APP or user source lives here.
|
||||
for path in (source_dir, build_dir, install):
|
||||
if path.exists(): shutil.rmtree(path)
|
||||
path.mkdir()
|
||||
extract(archives['OpenColorIO'][0], source_dir)
|
||||
source = source_dir / 'OpenColorIO-2.5.2'
|
||||
modules = source / 'share/cmake/modules/install'
|
||||
# Keep upstream's dependency options and target wiring, replacing only network retrieval.
|
||||
for name, (archive, sha) in archives.items():
|
||||
if name == 'OpenColorIO': continue
|
||||
filename = modules / ('Install' + ('ZLIB' if name == 'zlib' else name) + '.cmake')
|
||||
text = filename.read_text()
|
||||
text, count = re.subn(r'(?m)^\s*GIT_REPOSITORY[^\n]*\n\s*GIT_TAG[^\n]*',
|
||||
'\n URL "' + str(archive) + '"\n URL_HASH SHA256=' + sha + '\n DOWNLOAD_EXTRACT_TIMESTAMP TRUE', text)
|
||||
if count != 1: raise ValueError('Upstream install recipe changed: ' + name)
|
||||
text = re.sub(r'(?m)^\s*GIT_(CONFIG|SHALLOW)[^\n]*\n', '', text)
|
||||
filename.write_text(text)
|
||||
# This is a private, versioned runtime. A host's OCIO_OPTIMIZATION_FLAGS
|
||||
# must not silently override the precision explicitly chosen by the product.
|
||||
processor = source / 'src/OpenColorIO/Processor.cpp'
|
||||
text = processor.read_text()
|
||||
text, count = re.subn(r'OptimizationFlags EnvironmentOverride\(OptimizationFlags oFlags\)\n\{.*?\n\}',
|
||||
'OptimizationFlags EnvironmentOverride(OptimizationFlags oFlags)\n{\n return oFlags; // Dayu: fixed per-processor precision; ignore process environment.\n}', text, flags=re.S)
|
||||
if count != 1: raise ValueError('Upstream optimization override changed')
|
||||
processor.write_text(text)
|
||||
flags = ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_OSX_ARCHITECTURES=arm64',
|
||||
'-DCMAKE_OSX_DEPLOYMENT_TARGET=14.6', '-DBUILD_SHARED_LIBS=OFF',
|
||||
'-DCMAKE_INSTALL_PREFIX=' + str(install), '-DCMAKE_INSTALL_LIBDIR=lib',
|
||||
'-DOCIO_NAMESPACE=' + lock['namespace'], '-DOCIO_INSTALL_EXT_PACKAGES=ALL',
|
||||
'-DOCIO_BUILD_APPS=OFF', '-DOCIO_BUILD_PYTHON=OFF', '-DOCIO_BUILD_TESTS=OFF',
|
||||
'-DOCIO_BUILD_GPU_TESTS=OFF', '-DOCIO_BUILD_DOCS=OFF', '-DOCIO_BUILD_JAVA=OFF',
|
||||
'-DOCIO_BUILD_NUKE=OFF', '-DOCIO_BUILD_OPENFX=OFF']
|
||||
environment = dict(os.environ, CMAKE_BUILD_PARALLEL_LEVEL='6')
|
||||
for args in ([cmake, '-S', source, '-B', build_dir] + flags,
|
||||
[cmake, '--build', build_dir, '--parallel', '6'],
|
||||
[cmake, '--install', build_dir]):
|
||||
subprocess.run([str(x) for x in args], check=True, env=environment)
|
||||
libraries = [install / 'lib/libOpenColorIO.a'] + sorted((build_dir / 'ext/dist/lib').glob('*.a'))
|
||||
if len(libraries) != 7 or not all(p.is_file() for p in libraries):
|
||||
raise ValueError('Expected OCIO and six pinned static dependencies')
|
||||
result = dict(identity=identity, compiler=compiler, sdk=sdk, namespace=lock['namespace'],
|
||||
include=str(install / 'include'), libraries={str(p): digest(p) for p in libraries},
|
||||
builtin_config=lock['builtin_config'])
|
||||
stamp.write_text(json.dumps(result, indent=2) + '\n')
|
||||
return result
|
||||
|
||||
def build():
|
||||
CACHE.mkdir(parents=True, exist_ok=True)
|
||||
with (CACHE / 'build.lock').open('a') as guard:
|
||||
fcntl.flock(guard, fcntl.LOCK_EX)
|
||||
return _build()
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(json.dumps(build(), indent=2))
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build the pinned, ARC-isolated CMS bridge and a deterministic Xcode link file."""
|
||||
from pathlib import Path
|
||||
import hashlib, json, os, subprocess, sys, fcntl, shutil
|
||||
ROOT=Path(__file__).resolve().parent
|
||||
sys.path.insert(0,str(ROOT/'Tools'))
|
||||
from build_ocio import build
|
||||
CACHE=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/cms-runtime')
|
||||
def prepare():
|
||||
runtime=build();work=CACHE/'bridge';work.mkdir(parents=True,exist_ok=True)
|
||||
with (work/'build.lock').open('a') as guard:
|
||||
fcntl.flock(guard,fcntl.LOCK_EX)
|
||||
sources=[p for p in sorted((ROOT/'Sources').glob('*.cpp'))+sorted((ROOT/'Sources').glob('*.mm')) if not p.name.startswith('._')]
|
||||
inputs=sources+[p for p in sorted((ROOT/'Sources').glob('*.h'))+sorted((ROOT/'Core').glob('*.h*')) if not p.name.startswith('._')]+[Path(__file__)]
|
||||
key=hashlib.sha256((json.dumps(runtime,sort_keys=True)+''.join(hashlib.sha256(p.read_bytes()).hexdigest() for p in inputs)).encode()).hexdigest()
|
||||
stamp=work/'build.json';library=work/'libDayuColorManagement.a'
|
||||
if not stamp.exists() or json.loads(stamp.read_text()).get('key')!=key or not library.exists():
|
||||
objects=[]
|
||||
for src in sources:
|
||||
obj=work/(src.stem+'.o');args=['xcrun','clang++','-std=c++20','-O2','-arch','arm64','-mmacosx-version-min=14.6','-I',runtime['include'],'-c',str(src),'-o',str(obj)]
|
||||
if src.suffix=='.mm':args.insert(2,'-fobjc-arc')
|
||||
subprocess.run(args,check=True);objects.append(str(obj))
|
||||
subprocess.run(['xcrun','libtool','-static','-o',str(library),*objects],check=True)
|
||||
stamp.write_text(json.dumps(dict(key=key,librarySHA256=hashlib.sha256(library.read_bytes()).hexdigest()),indent=2)+'\n')
|
||||
frameworks=['Metal','CoreGraphics','CoreImage','ColorSync','IOKit']
|
||||
args=['-Wl,-ObjC',str(library),*runtime['libraries']]
|
||||
for name in frameworks:args+=['-framework',name]
|
||||
response=CACHE/'bridge-link.rsp';response.write_text('\n'.join('"'+s.replace('"','\\"')+'"' for s in args)+'\n')
|
||||
return str(response)
|
||||
if __name__=='__main__':
|
||||
print(prepare())
|
||||
if len(sys.argv)>1:
|
||||
destination=Path(sys.argv[1])/'ColorManagement';destination.mkdir(parents=True,exist_ok=True)
|
||||
source=ROOT/'ThirdParty/ColorManagement'
|
||||
shutil.copytree(source/'licenses',destination/'licenses',dirs_exist_ok=True,ignore=shutil.ignore_patterns('._*'))
|
||||
for name in ['dependencies.lock.json','README.md']:shutil.copy2(source/name,destination/name)
|
||||
shutil.copy2(ROOT/'PROVENANCE.json',destination/'PROVENANCE.json')
|
||||
@@ -0,0 +1,18 @@
|
||||
大鱼调色 1.8.0(55)公测版,适用于 Apple Silicon / macOS 14.6 或更高版本。
|
||||
|
||||
新增独立色彩管理方式:旧版兼容、跟随 FCP、相机编码 → ACES、输入 LUT → ACES。新版采用固定 OpenColorIO 2.5.2 / ACES 1.3 配置,一级层统一在 ACEScct/AP1 中处理,印片位于输出之前;明确区分实际宿主颜色配置与手动声明的相机编码。
|
||||
|
||||
新增一级层默认关闭额外映射,添加中性层保持画面。旧工程和 v1–v6 预设继续原有渲染,升级不会自动替换其管理方式;新版完整预设为 v7。输入 LUT 使用浮点四面体插值,并显示已选文件名。新版静态 Cube 为 65³,输出约定为 sRGB/Rec.709;HDR、空间/时间处理请保存完整预设。
|
||||
|
||||
PQ/HLG 输出或跟随 Rec.2020 宿主暂仅开放一级调色与印片;活跃 SDR 修饰工具会明确报错。旧工具尚未全部改写为 HDR/场景算法。
|
||||
|
||||
安装前保存工程并正常退出 Final Cut Pro 与 Motion。安装到唯一位置 /Library/Plug-Ins/FxPlug/大鱼调色.app,模板安装到当前用户“影片/Motion Templates/Effects/大鱼调色”。重新打开宿主后,在调色参数顶部选择管理方式。
|
||||
|
||||
验证:530 项正式原生检查、FCP 12.4 管理切换/撤销、输入 LUT 取消及错误恢复、两份预设冷重开逐字节比对、65³ Cube、1080p25 ProRes 100 帧导出通过。FCPXML 1.12 回导的三个项目与输入结构比较一致。
|
||||
|
||||
APP 与 PKG 均经 Developer ID 签名、Apple 公证 Accepted、票据粘附与验证。PKG 20 项展开验包通过;本轮未重复运行系统安装脚本,APP 已在正式路径单独安装并完成宿主验收。
|
||||
|
||||
安装包:大鱼调色-1.8.0.pkg
|
||||
字节数:42851034
|
||||
SHA-256:fd59203d387122e768090a97851daf3bd7c07193a8073b9497a10c05d5fd6c42
|
||||
实际编译源码:11a88518280f0665f3cd0f388d1d66e5446ece14
|
||||
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Preserve Dayu Color's beta flag while reusing PKG Forge's authenticated transport.
|
||||
Draft web downloads may require a normal browser session. A supplied download is
|
||||
only accepted when it is a distinct file with the exact verified size and hash.
|
||||
No release, attachment, tag or repository visibility is overwritten.
|
||||
"""
|
||||
import argparse, hashlib, json, runpy, subprocess
|
||||
from pathlib import Path
|
||||
from urllib.parse import quote
|
||||
ROOT=Path(__file__).resolve().parent.parent
|
||||
REPOSITORY='dayu/dayu-color'
|
||||
def git(*args):return subprocess.check_output(['git',*args],cwd=ROOT,text=True,stderr=subprocess.DEVNULL).strip()
|
||||
def digest(path):
|
||||
h=hashlib.sha256()
|
||||
with path.open('rb') as f:
|
||||
for block in iter(lambda:f.read(1024*1024),b''):h.update(block)
|
||||
return h.hexdigest()
|
||||
def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--tag',required=True);parser.add_argument('--notes',required=True,type=Path)
|
||||
parser.add_argument('--verified-download',type=Path)
|
||||
parser.add_argument('--pkg-forge-repo',type=Path,default=Path.home()/'Documents/dayu-git/repositories/pkg-forge')
|
||||
args=parser.parse_args();helper=runpy.run_path(str(args.pkg_forge_repo/'skills/pkg-forge/scripts/publish_release.py'),run_name='dayu_beta_transport')
|
||||
Failure=helper['Failure']
|
||||
try:
|
||||
report=json.loads((ROOT/'verification/Package.json').read_text());expected=json.loads(git('show',args.tag+':verification/Package.json'))
|
||||
assert report['pass'] and not report['testUnsigned'] and report['notarization']['status']=='Accepted'
|
||||
for key in ['sha256','bytes','appCompiledSource','appBuild']:assert report[key]==expected[key]
|
||||
package=Path(report['package']);assert package.stat().st_size==report['bytes'] and digest(package)==report['sha256']
|
||||
subprocess.run(['pkgutil','--check-signature',str(package)],check=True,capture_output=True)
|
||||
subprocess.run(['xcrun','stapler','validate',str(package)],check=True,capture_output=True)
|
||||
subprocess.run(['spctl','--assess','--type','install',str(package)],check=True,capture_output=True)
|
||||
notes=args.notes.read_text().strip();title='大鱼调色 '+report['resources'][0]['version']+'('+report['appBuild']+')'
|
||||
provider=runpy.run_path(str(Path.home()/'.local/bin/dayu-git'),run_name='dayu_beta_credentials');token,source=provider['credential']('dayu');api=helper['API'](token)
|
||||
with helper['repository_lock'](REPOSITORY):
|
||||
commit=git('rev-parse',args.tag+'^{commit}');assert git('ls-remote','origin','refs/tags/'+args.tag).split()[0]==commit
|
||||
assert api.request('GET','/user')['login']=='dayu'
|
||||
prefix='/repos/'+REPOSITORY;repo=api.request('GET',prefix);assert repo['full_name']==REPOSITORY and repo['permissions']['push']
|
||||
try:release=api.request('GET',prefix+'/releases/tags/'+quote(args.tag,safe=''))
|
||||
except Failure as e:
|
||||
if e.status!=404:raise
|
||||
release=api.request('POST',prefix+'/releases',payload=dict(tag_name=args.tag,target_commitish=commit,name=title,body=notes,draft=True,prerelease=True))
|
||||
assert release['tag_name']==args.tag and release['name']==title and release['body'].strip()==notes and release['prerelease']
|
||||
path=prefix+'/releases/'+str(release['id']);assets=api.request('GET',path+'/assets');matches=[a for a in assets if a['name']==package.name];assert len(matches)<=1
|
||||
asset=matches[0] if matches else api.upload(path+'/assets',package);assert asset['name']==package.name and asset['size']==report['bytes']
|
||||
proof=None
|
||||
try:sha,size=api.downloaded_digest(asset['browser_download_url'],report['bytes'])
|
||||
except Failure as e:
|
||||
if e.status!=404 or not release['draft']:raise
|
||||
draft=dict(status='draft-download-required',releaseID=release['id'],releaseURL=release['html_url'],tag=args.tag,commit=commit,assetID=asset['id'],downloadURL=asset['browser_download_url'],bytes=report['bytes'],sha256=report['sha256'])
|
||||
(ROOT/'verification/CMSReleaseDraft.json').write_text(json.dumps(draft,ensure_ascii=False,indent=2)+'\n')
|
||||
if not args.verified_download:
|
||||
print(json.dumps(draft,ensure_ascii=False));return 2
|
||||
download=args.verified_download.expanduser().resolve();assert download!=package.resolve() and download.is_file()
|
||||
sha,size=digest(download),download.stat().st_size;proof=dict(path=str(download),sha256=sha,bytes=size,sourceURL=asset['browser_download_url'])
|
||||
assert sha==report['sha256'] and size==report['bytes']
|
||||
if release['draft']:api.request('PATCH',path,payload={'draft':False})
|
||||
final=api.request('GET',path);confirmed=api.request('GET',path+'/assets')
|
||||
assert not final['draft'] and final['prerelease'] and final['tag_name']==args.tag and final['name']==title and final['body'].strip()==notes
|
||||
assert any(a['id']==asset['id'] and a['size']==size and a['name']==package.name for a in confirmed)
|
||||
sha,size=api.downloaded_digest(asset['browser_download_url'],report['bytes']);assert sha==report['sha256'] and size==report['bytes']
|
||||
assert git('ls-remote','origin','refs/tags/'+args.tag).split()[0]==commit
|
||||
result=dict(passResult=True,repository=REPOSITORY,repositoryID=repo['id'],private=repo['private'],tag=args.tag,releaseCommit=commit,releaseID=final['id'],releaseURL=final['html_url'],prerelease=True,assetID=asset['id'],assetName=asset['name'],downloadURL=asset['browser_download_url'],bytes=size,sha256=sha,existingAssetReused=bool(matches),verification='Full draft download checked before publication; published attachment downloaded and checked again; release, tag and asset read-back verified.',credentialSource=source)
|
||||
if proof:result['draftBrowserDownload']=proof
|
||||
(ROOT/'verification/Release.json').write_text(json.dumps(result,ensure_ascii=False,indent=2)+'\n');print(json.dumps(result,ensure_ascii=False));return 0
|
||||
except Failure as e:
|
||||
print(json.dumps({'error':str(e)},ensure_ascii=False));return 1
|
||||
except (AssertionError,OSError,subprocess.CalledProcessError):
|
||||
print(json.dumps({'error':'Release validation failed. Existing files and remote assets retained; inspect state before retrying.'}));return 1
|
||||
if __name__=='__main__':raise SystemExit(main())
|
||||
@@ -1,6 +1,25 @@
|
||||
# 大鱼调色
|
||||
|
||||
原生 FxPlug 4 调色器,当前正式安装的公测版本 **1.7.4(52)**。唯一安装位置为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;Final Cut Pro 中从“效果 → 大鱼调色”添加。
|
||||
原生 FxPlug 4 调色器,当前正式安装的公测版本 **1.8.0(55)**。唯一安装位置为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;Final Cut Pro 中从“效果 → 大鱼调色”添加。
|
||||
|
||||
2026-11-03完成BASIS、Colour Space Transform和Color Finale的只读色彩管理调查,含原版GPU曝光/映射及当前一级颜色内核的有限检查。宿主边界、重复映射、工具工作域和旧工程迁移的改进方案见[研究报告与实施方案](research/cms-audit-20261103/report.md)。1.8.0(55)已按方案接入新版 CMS,530 项正式原生检查与 FCP 12.4 切换、错误恢复、保存重开及实际导出通过。详见 [宿主验收](verification/HostColorManagement1.8.0.json)。
|
||||
|
||||
|
||||
## 1.8.0 色彩管理
|
||||
|
||||
在调色参数顶部选择管理方式;色彩管理独立于可删除的调色模块。旧工程与 v1–v6 预设缺省仍走原有渲染,不自动改变原画面。新增一级层默认关闭额外色调映射,旧层明确保存的开关保留。
|
||||
|
||||
- **跟随 FCP**:按实际源/目标颜色配置转换,不重复还原相机,不加显示映射。内部一级工作空间固定为 ACEScct/AP1。
|
||||
- **相机编码 → ACES**:明确指定输入曲线/原色,再经过一次所选输出变换。此方式保留旧版 sRGB 码值载体约定,使用前须关闭上游相机还原和重复的颜色符合。
|
||||
- **输入 LUT → ACES**:明确选择输入 LUT 及其输出编码,使用浮点四面体插值后进入同一工作链,避免低阶 LUT 的硬件插值精度误差。
|
||||
|
||||
引擎固定 OpenColorIO 2.5.2 / ACES 1.3 studio-config v2.2.0,源码、依赖源包、摘要与许可证保存在 ColorManagement/,不依赖兄弟 APP 的安装。宿主颜色配置用实际 CGColorSpace 描述及指纹分别缓存;只有已知 RGB Linear / Rec.709 或 Rec.2020 才允许缺失配置的回退。
|
||||
|
||||
新版处理顺序固定:所有一级层 → 所有印片(ACEScct)→ 一次输出变换 → SDR 修饰工具 → 实际宿主目标。一级混合、蒙版及印片强度在 AP1 线性域混合。核心图像传输、OCIO 与配置转换采用 float32;沿用的 BASIS 入口及活跃旧工具仍有 half 精度。SDR 修饰域明确为 Rec.709 线性/sRGB,物理色域转换后接入;新版减色用有界效果差量延伸保留超范围残差,旧版限幅保持。
|
||||
|
||||
PQ/HLG 输出或跟随 Rec.2020 宿主暂只接受一级与印片;存在活跃 SDR 修饰时返回明确错误,不静默进入有界 LUT。此版本没有把全部旧工具改写成场景/HDR 算法。
|
||||
|
||||
完整预设为 v7,包含独立 CMS 状态,兼容 v1–v6。新版 Cube 为 65³,输入为声明的相机/LUT 码值,跟随宿主方式导出时输入约定为 sRGB;输出固定为 sRGB/Rec.709 编码。它不保存工程的宿主上下文。HDR、蒙版、空间/时间处理和画面分析应保存完整预设。旧兼容方式维持原有 33³ 导出。
|
||||
|
||||
交接与恢复入口:[大鱼调色FxPlug4交接.md](大鱼调色FxPlug4交接.md)。
|
||||
|
||||
@@ -30,7 +49,7 @@
|
||||
|
||||
349项原生检查、四种尺寸184项原版组件对照通过。FCP12.4验证旧234参数、LUT路径、蜘蛛盘和全部287键蒙版载荷不变;新增层默认值、蒙版数量、折叠、删除撤销/重做、冷重开通过。1920×1080正式导出验证“两帧保持”,组合预设8987字节及颗粒预设8420字节重开前后逐字节一致。见[研究与边界](research/ColorFinaleFilmMixer.md)、[组件对照](verification/FilmMixerReference.json)、[宿主验收](verification/HostFilmMixer1.5.0.json)。
|
||||
|
||||
FCP新实例、全部还原及新加一级层的自动色调映射默认开启;旧独立一级层的缺省关闭保持;FCP沿用模板默认值的旧主效果会跟随为开启,新版中手动关闭后可独立保存并在冷重开后保留。在主标题区增加可点击的“更多插件访问 https://dayu.media”。
|
||||
历史 1.6–1.7 的 FCP 新实例、全部还原及新加一级层的自动色调映射默认开启;旧独立一级层的缺省关闭保持;FCP沿用模板默认值的旧主效果会跟随为开启,新版中手动关闭后可独立保存并在冷重开后保留。在主标题区增加可点击的“更多插件访问 https://dayu.media”。
|
||||
|
||||
## 1.6.0 八种印片与简洁模板
|
||||
|
||||
|
||||
+17
-1
@@ -1,6 +1,18 @@
|
||||
# 大鱼调色恢复说明
|
||||
|
||||
## 当前1.7.4(52):删除模块和图层
|
||||
## 当前1.8.0(55):版本化 ACES 色彩管理
|
||||
|
||||
远程 `https://dayu.media/git/dayu/dayu-color.git`,main;发行标签 `v1.8.0-cms-20261103`。实际编译源码 `11a88518280f0665f3cd0f388d1d66e5446ece14`,可先以该完整 SHA 恢复程序,标签与安装包的最终远程核验见 `verification/Release.json`。无 LFS 或子模块。固定 OCIO 2.5.2 / ACES 1.3 配置与全部必要依赖源码包、SHA-256 和许可证已放入 `ColorManagement/`,不依赖兄弟应用或其工作副本。
|
||||
|
||||
使用 Xcode 27.1、FxPlug SDK 4.3.5、Metal Toolchain、CMake 3.24 以上(当前 4.4.4)。`python3 ColorManagement/build_runtime.py` 在固定 `com.dayu.color/cms-runtime` 缓存中校验源包、离线编译私有静态运行时及 ARC 桥;Xcode 的 Release 阶段自动调用。`python3 tools/build_template.py --refresh-model --overwrite` 和 `python3 tools/verify_template.py` 校验原生参数与模板;正式流程为 `python3 tools/deliver.py`。证书、私钥和钥匙串公证凭据须独立恢复,不在 Git。
|
||||
|
||||
旧工程与 v1–v6 预设没有 CMS 状态时继续旧渲染;新完整预设 v7。新版统一 ACEScct/AP1 的一级与印片顺序,实际宿主源/目标颜色配置分别解释。跟随宿主不添加显示映射;相机/LUT 模式只使用一次所选输出变换。PQ/HLG 及跟随 Rec.2020 暂拒绝活跃的未验证 SDR 修饰。低阶输入 LUT 用浮点四面体插值;NSError 跨渲染池保活,选择输入 LUT 前置,取消不改变模式。
|
||||
|
||||
唯一安装 `/Library/Plug-Ins/FxPlug/大鱼调色.app`。APP 公证 `ab2b40ea-886f-49fa-8735-aa392e65f036`、PKG 公证 `2d32b77f-b825-4119-afcf-372588ad03c1` 均 Accepted。530 项正式安装版原生检查、FCP 12.4 下三种新路径、撤销、缺失资源报错/恢复、两份预设冷重开逐字节一致、最终 65³ Cube 与 1080p25 ProRes 100 帧导出通过;FCPXML 三项目回导比较一致。见 `HostColorManagement1.8.0.json`、`CMSContract1.8.0.json` 及 `InstalledSelfTest.json`。HDR 显示器/交付链和其他 FCP 版本未实机覆盖。
|
||||
|
||||
包 `../发行包/大鱼调色-1.8.0.pkg`,42851034 字节,SHA-256 `fd59203d387122e768090a97851daf3bd7c07193a8073b9497a10c05d5fd6c42`。签名、票据、Gatekeeper 和 20 项展开验包通过。本轮仅生成并验包,未再次运行 PKG 安装脚本;正式 APP 已有独立安装和宿主验证。源码、版本标签和 Release 的恢复证明另见 `CMSRecovery1.8.0.json`。本任务不改网站文章或自动更新后端。
|
||||
|
||||
## 历史1.7.4(52):删除模块和图层
|
||||
|
||||
远程`https://dayu.media/git/dayu/dayu-color.git`,main;实际编译源码`06a00371dfba6d9857dc75f48121232fb0ea01b8`。通过`git switch --detach 06a00371dfba6d9857dc75f48121232fb0ea01b8`恢复,Xcode27.1 / FxPlugSDK4.3.5;无LFS或子模块。新机器签名证书、私钥、公证凭据仍需独立恢复。构建与交付使用`tools/deliver.py`,436项正式安装版原生检查通过。模块删除实现、真实宿主边界见`research/ToolDeletion1.7.4.md`、`verification/HostToolDeletion1.7.4.json`。
|
||||
|
||||
@@ -9,6 +21,10 @@
|
||||
|
||||
当前交接:[大鱼调色FxPlug4交接.md](大鱼调色FxPlug4交接.md)。
|
||||
|
||||
正式[1.7.4 Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.7.4-tool-deletion-20261103) / Release380 / 附件24已发布并保留公测标记。标签`v1.7.4-tool-deletion-20261103`指向`468d530bf002a34e407bd5e182cb6b90d6df1eb4`;草稿浏览器下载及发布后完整下载均校验40918925字节、SHA-256`bab2cb14229de151f73782e4a9bd54ca34ef47b9dd15ef3590dd1cd95d04fce5`一致。标签从远端独立恢复并逐文件比对,程序源码与实际编译节点相同;见`ToolDeletionRecovery1.7.4.json`、`ToolDeletionReleaseDraft1.7.4.json`及`Release.json`。临时恢复clone与浏览器下载副本已清理。
|
||||
|
||||
文章 https://dayu.media/15792/ 已更新1.7.4(52),主下载媒体15805完整下载与同一正式包一致。售价50元、会员免费、封面、分类、作者和原FCPX隐藏设置保持,正文、SEO、安装说明及普通/新请求页面通过。见`publication/ArticleUpdate1.7.4.json`和`ArticleUpdateVerification1.7.4.json`。本轮没有修改网站自动更新清单。
|
||||
|
||||
## 历史1.7.3(49):更多空间的内容原点
|
||||
|
||||
远程 `https://dayu.media/git/dayu/dayu-color.git`,main;发行标签 `v1.7.3-browser-origin-20261102`,实际编译源码 `2688b22f99b5118153b94a43f6c184a204d4ce7e`。版本标签完整SHA与Release/附件下载校验以 `verification/Release.json` 为准;可用 `git switch --detach v1.7.3-browser-origin-20261102` 或完整编译SHA恢复。Xcode27.1 / FxPlugSDK4.3.5,无LFS、子模块或新增必要外部资源;签名私钥与公证凭据需独立恢复。
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"status": "updated-and-verified",
|
||||
"postID": 15792,
|
||||
"articleURL": "https://dayu.media/15792/",
|
||||
"baselineCommit": "468d530bf002a34e407bd5e182cb6b90d6df1eb4",
|
||||
"baselineContentMatchesGit": true,
|
||||
"beforeTitle": "大鱼调色 1.7.3 公测版:Final Cut Pro 原生调色插件",
|
||||
"beforeResource": {
|
||||
"cao_status": "1",
|
||||
"cao_close_novip_pay": "",
|
||||
"cao_is_boosvip": "",
|
||||
"cao_video": "",
|
||||
"cao_is_video_free": "",
|
||||
"cao_price": "50",
|
||||
"cao_vip_rate": "0",
|
||||
"cao_ref_bonus_rate": "0.25",
|
||||
"cao_expire_day": "0",
|
||||
"cao_downurl": "https://dayu.media/wp-content/uploads/2026/11/1793631185-7b18844539fd4c4.pkg",
|
||||
"cao_downurl_bak": "",
|
||||
"cao_demourl": "",
|
||||
"video_url": "",
|
||||
"video_poster_url": "",
|
||||
"cao_pwd": "",
|
||||
"cao_original_filename": "1793631185-7b18844539fd4c4.pkg",
|
||||
"post_style": "sidebar",
|
||||
"cao_info": ""
|
||||
},
|
||||
"beforeSEO": {
|
||||
"title": {
|
||||
"enabled": true,
|
||||
"value": "大鱼调色1.7.3公测版:Final Cut Pro原生调色插件,会员免费"
|
||||
},
|
||||
"description": {
|
||||
"enabled": true,
|
||||
"value": "大鱼调色1.7.3公测版,适用于Apple Silicon与macOS14.6及以上。提供CST色彩管理、LUT预览、胶片模拟、局部蒙版与跟踪,修正“更多空间”等显示缩放下LUT浏览库偏移、灰色空白与裁切。保留Cube文字行兼容,完整PKG已签名公证,售价50元,站内会员免费。"
|
||||
},
|
||||
"keywords": {
|
||||
"enabled": true,
|
||||
"value": "大鱼调色,Final Cut Pro,调色插件,FxPlug4,CST色彩管理,LUT,胶片模拟,局部蒙版,会员免费"
|
||||
}
|
||||
},
|
||||
"beforeFeaturedMedia": 15795,
|
||||
"beforeCategories": [
|
||||
13,
|
||||
4
|
||||
],
|
||||
"beforeTags": [],
|
||||
"requestID": "dayu-color-1.7.4-6366328076ed4e63b49f5c76f44a08c5",
|
||||
"payloadSHA256": "3ecfab918283c191853cdee5f33a73ae7da00bdb5ff3a456eca285a4b5d9111a",
|
||||
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.7.4.pkg",
|
||||
"packageBytes": 40918925,
|
||||
"packageSHA256": "bab2cb14229de151f73782e4a9bd54ca34ef47b9dd15ef3590dd1cd95d04fce5",
|
||||
"newDownload": {
|
||||
"mediaID": 15805,
|
||||
"url": "https://dayu.media/wp-content/uploads/2026/11/1793635244-411a5cac31e43fc.pkg",
|
||||
"bytes": 40918925,
|
||||
"sha256": "bab2cb14229de151f73782e4a9bd54ca34ef47b9dd15ef3590dd1cd95d04fce5",
|
||||
"fullDownloadVerified": true
|
||||
},
|
||||
"savedContentSHA256": "6189070a792713ff4a702917b51aeb705d8177c4662c2270349a4c1d1a2028b3",
|
||||
"businessSettingsPreserved": true,
|
||||
"authorCategoriesTagsCoverAndFCPXSettingsPreserved": true,
|
||||
"checkedAt": "2026-11-02T16:03:57.423149+00:00"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"passed": true,
|
||||
"postID": 15792,
|
||||
"url": "https://dayu.media/15792/",
|
||||
"version": "1.7.4",
|
||||
"build": "52",
|
||||
"checkedAt": "2026-11-02T16:03:57.423149+00:00",
|
||||
"mainDownload": {
|
||||
"mediaID": 15805,
|
||||
"url": "https://dayu.media/wp-content/uploads/2026/11/1793635244-411a5cac31e43fc.pkg",
|
||||
"bytes": 40918925,
|
||||
"sha256": "bab2cb14229de151f73782e4a9bd54ca34ef47b9dd15ef3590dd1cd95d04fce5",
|
||||
"fullDownloadVerified": true
|
||||
},
|
||||
"frontend": [
|
||||
{
|
||||
"request": "normal",
|
||||
"seoTitleDescriptionKeywordsExact": true,
|
||||
"versionAndChangelog": true,
|
||||
"guestPrice50AndVIPFree": true,
|
||||
"inlineImageAndNativeInstallGuidePreserved": true,
|
||||
"paidDownloadNotInPublicBody": true
|
||||
},
|
||||
{
|
||||
"request": "fresh",
|
||||
"seoTitleDescriptionKeywordsExact": true,
|
||||
"versionAndChangelog": true,
|
||||
"guestPrice50AndVIPFree": true,
|
||||
"inlineImageAndNativeInstallGuidePreserved": true,
|
||||
"paidDownloadNotInPublicBody": true
|
||||
}
|
||||
],
|
||||
"businessSettingsPreserved": true,
|
||||
"authorCategoriesTagsCoverAndFCPXSettingsPreserved": true,
|
||||
"readBackContentMatchesAfterHTMLWhitespaceNormalization": true,
|
||||
"frontendScreenshotLocalOnly": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/tool-deletion-qa/article-1.7.4.png"
|
||||
}
|
||||
@@ -2,63 +2,14 @@
|
||||
"passed": true,
|
||||
"postID": 15792,
|
||||
"url": "https://dayu.media/15792/",
|
||||
"status": "publish",
|
||||
"actualTitle": "大鱼调色 1.7.3 公测版:Final Cut Pro 原生调色插件",
|
||||
"price": 50,
|
||||
"vipRate": 0,
|
||||
"ordinaryPurchaseAllowed": true,
|
||||
"featuredMedia": 15795,
|
||||
"media": [
|
||||
{
|
||||
"id": 15795,
|
||||
"url": "https://dayu.media/wp-content/uploads/2026/11/1793613870-285eac993228898.png",
|
||||
"bytes": 1850952,
|
||||
"sha256": "7f80bab9def7caa679550d6425f07b8a8fce7b1ec088451151ca625a5f4e6a57",
|
||||
"alt": "大鱼调色1.7.0公测版介绍封面,展示蓝色插件界面和CST、LUT、胶片模拟、局部蒙版功能",
|
||||
"width": 1672,
|
||||
"height": 941
|
||||
},
|
||||
{
|
||||
"id": 15796,
|
||||
"url": "https://dayu.media/wp-content/uploads/2026/11/1793613872-21b2d1772c5ccac.png",
|
||||
"bytes": 1707253,
|
||||
"sha256": "e2c17dc759fb43d1ff0e6539e010cfa14ffb1d4e088e6a1ee88ab67d0e01b621",
|
||||
"alt": "大鱼调色蓝色调色面板与CST色彩管理、LUT、胶片模拟和局部蒙版功能介绍",
|
||||
"width": 1122,
|
||||
"height": 1402
|
||||
}
|
||||
],
|
||||
"seo": {
|
||||
"title": {
|
||||
"enabled": true,
|
||||
"value": "大鱼调色1.7.3公测版:Final Cut Pro原生调色插件,会员免费",
|
||||
"frontendExact": true
|
||||
},
|
||||
"description": {
|
||||
"enabled": true,
|
||||
"value": "大鱼调色1.7.3公测版,适用于Apple Silicon与macOS14.6及以上。提供CST色彩管理、LUT预览、胶片模拟、局部蒙版与跟踪,修正“更多空间”等显示缩放下LUT浏览库偏移、灰色空白与裁切。保留Cube文字行兼容,完整PKG已签名公证,售价50元,站内会员免费。",
|
||||
"frontendExact": true
|
||||
},
|
||||
"keywords": {
|
||||
"enabled": true,
|
||||
"value": "大鱼调色,Final Cut Pro,调色插件,FxPlug4,CST色彩管理,LUT,胶片模拟,局部蒙版,会员免费",
|
||||
"frontendExact": true
|
||||
}
|
||||
},
|
||||
"frontendGuestPriceSnippet": "路人用户购买价格 : 50元 鱼粉会员购买价格 : 0元 登录后购买鱼粉年会员开通全站会员全站资源免费下载(极个别开发工具除外)专属临时高速网盘系统(接收方免登录)专属在线审阅系统(内测中……) 登录后开通会员权益以站点设置为准 抖音、B站ID:大鱼先森Media,闲鱼ID:成都大鱼先森文化传媒 蜀ICP备2024",
|
||||
"frontendInlineImage": true,
|
||||
"installGuideNativeCodeBlock": true,
|
||||
"paidURLOnlyInResource": true,
|
||||
"publishedBy": "user",
|
||||
"readBackVia": "dayu-publish-article read 15792",
|
||||
"checkedAt": "2026-11-02T14:55:48.259573+00:00",
|
||||
"version": "1.7.3",
|
||||
"build": "49",
|
||||
"version": "1.7.4",
|
||||
"build": "52",
|
||||
"checkedAt": "2026-11-02T16:03:57.423149+00:00",
|
||||
"mainDownload": {
|
||||
"mediaID": 15803,
|
||||
"url": "https://dayu.media/wp-content/uploads/2026/11/1793631185-7b18844539fd4c4.pkg",
|
||||
"bytes": 40908193,
|
||||
"sha256": "f7a6a5dbd38139c2d401a85aa83abd36efab076481c73a0c822e220f2c212324",
|
||||
"mediaID": 15805,
|
||||
"url": "https://dayu.media/wp-content/uploads/2026/11/1793635244-411a5cac31e43fc.pkg",
|
||||
"bytes": 40918925,
|
||||
"sha256": "bab2cb14229de151f73782e4a9bd54ca34ef47b9dd15ef3590dd1cd95d04fce5",
|
||||
"fullDownloadVerified": true
|
||||
},
|
||||
"frontend": [
|
||||
@@ -79,8 +30,8 @@
|
||||
"paidDownloadNotInPublicBody": true
|
||||
}
|
||||
],
|
||||
"updatedBy": "dayu-publish-article write --post-id 15792",
|
||||
"businessSettingsPreserved": true,
|
||||
"authorCategoriesTagsCoverAndFCPXSettingsPreserved": true,
|
||||
"readBackContentMatchesAfterHTMLWhitespaceNormalization": true
|
||||
"readBackContentMatchesAfterHTMLWhitespaceNormalization": true,
|
||||
"frontendScreenshotLocalOnly": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/tool-deletion-qa/article-1.7.4.png"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"title": "大鱼调色 1.7.3 公测版:Final Cut Pro 原生调色插件",
|
||||
"title": "大鱼调色 1.7.4 公测版:Final Cut Pro 原生调色插件",
|
||||
"slug": "dayu-color-1-7-0-beta",
|
||||
"excerpt": "",
|
||||
"categories": [
|
||||
@@ -10,11 +10,11 @@
|
||||
"seo": {
|
||||
"title": {
|
||||
"enabled": true,
|
||||
"value": "大鱼调色1.7.3公测版:Final Cut Pro原生调色插件,会员免费"
|
||||
"value": "大鱼调色1.7.4公测版:Final Cut Pro原生调色插件,会员免费"
|
||||
},
|
||||
"description": {
|
||||
"enabled": true,
|
||||
"value": "大鱼调色1.7.3公测版,适用于Apple Silicon与macOS14.6及以上。提供CST色彩管理、LUT预览、胶片模拟、局部蒙版与跟踪,修正“更多空间”等显示缩放下LUT浏览库偏移、灰色空白与裁切。保留Cube文字行兼容,完整PKG已签名公证,售价50元,站内会员免费。"
|
||||
"value": "大鱼调色1.7.4公测版,适用于Apple Silicon与macOS14.6及以上。支持CST色彩管理、LUT预览、胶片模拟、局部蒙版与跟踪;新增模块和图层删除,删除时还原参数,重新添加从初始值开始。保留“更多空间”窗口修正,完整PKG已签名公证,售价50元,站内会员免费。"
|
||||
},
|
||||
"keywords": {
|
||||
"enabled": true,
|
||||
@@ -31,17 +31,17 @@
|
||||
"cao_vip_rate": "0",
|
||||
"cao_ref_bonus_rate": "0.25",
|
||||
"cao_expire_day": "0",
|
||||
"cao_downurl": "https://dayu.media/wp-content/uploads/2026/11/1793631185-7b18844539fd4c4.pkg",
|
||||
"cao_downurl": "https://dayu.media/wp-content/uploads/2026/11/1793635244-411a5cac31e43fc.pkg",
|
||||
"cao_downurl_bak": "",
|
||||
"cao_demourl": "",
|
||||
"video_url": "",
|
||||
"video_poster_url": "",
|
||||
"cao_pwd": "",
|
||||
"cao_original_filename": "1793631185-7b18844539fd4c4.pkg",
|
||||
"cao_original_filename": "1793635244-411a5cac31e43fc.pkg",
|
||||
"post_style": "sidebar",
|
||||
"cao_info": ""
|
||||
},
|
||||
"packageSHA256": "f7a6a5dbd38139c2d401a85aa83abd36efab076481c73a0c822e220f2c212324",
|
||||
"packageSHA256": "bab2cb14229de151f73782e4a9bd54ca34ef47b9dd15ef3590dd1cd95d04fce5",
|
||||
"skill": {
|
||||
"installed": "/Users/mac/.codex/skills/dayu-publish-article",
|
||||
"remote": "https://dayu.media/git/dayu/dayu-publish-article-skill.git",
|
||||
@@ -57,13 +57,13 @@
|
||||
"articleURL": "https://dayu.media/15792/",
|
||||
"actualSlug": "%e5%a4%a7%e9%b1%bc%e8%b0%83%e8%89%b2-1-7-0-%e5%85%ac%e6%b5%8b%e7%89%88%ef%bc%9afinal-cut-pro-%e5%8e%9f%e7%94%9f%e8%b0%83%e8%89%b2%e6%8f%92%e4%bb%b6%ef%bc%8c%e4%bc%9a%e5%91%98%e5%85%8d%e8%b4%b9",
|
||||
"featuredMedia": 15795,
|
||||
"actualTitle": "大鱼调色 1.7.3 公测版:Final Cut Pro 原生调色插件",
|
||||
"actualTitle": "大鱼调色 1.7.4 公测版:Final Cut Pro 原生调色插件",
|
||||
"userPublished": true,
|
||||
"actualTags": [],
|
||||
"actualExcerpt": "",
|
||||
"packageBytes": 40908193,
|
||||
"packageMediaID": 15803,
|
||||
"updatedBy": "dayu-publish-article command",
|
||||
"version": "1.7.3",
|
||||
"build": "49"
|
||||
"packageBytes": 40918925,
|
||||
"packageMediaID": 15805,
|
||||
"updatedBy": "dayu-publish-article",
|
||||
"version": "1.7.4",
|
||||
"build": "52"
|
||||
}
|
||||
+14
-2
@@ -1,9 +1,9 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>大鱼调色 1.7.3 公测版是一款适用于 Final Cut Pro 与 Motion 的原生 FxPlug 4 调色插件。从素材色彩还原、基础调整,到 LUT 风格、胶片质感和局部蒙版,可直接在剪辑时间线里完成。</p>
|
||||
<p>大鱼调色 1.7.4 公测版是一款适用于 Final Cut Pro 与 Motion 的原生 FxPlug 4 调色插件。从素材色彩还原、基础调整,到 LUT 风格、胶片质感和局部蒙版,可直接在剪辑时间线里完成。</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>本篇下载售价为50元,站内有效会员免费。提供已签名、公证的完整 PKG 安装包,版本1.7.3,构建49。</p>
|
||||
<p>本篇下载售价为50元,站内有效会员免费。提供已签名、公证的完整 PKG 安装包,版本1.7.4,构建52。</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:image {"sizeSlug":"full","linkDestination":"none"} -->
|
||||
@@ -30,6 +30,18 @@
|
||||
<p><strong>局部蒙版与工具叠层</strong>:可针对单独工具添加蒙版、建立相邻叠层,并使用关键帧与跟踪处理局部区域,方便细调画面的不同部分。</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">1.7.4 更新:删除模块与图层</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>每个模块和新增图层的标题增加减号按钮,可删除不需要的层并让它从界面消失。删除时一并还原该模块的参数、清除关键帧及所属 LUT、蒙版等设置,避免隐藏后仍影响画面;其他模块保持原设置。误删可通过 Final Cut Pro 的一次撤销恢复。</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>顶部“添加模块”菜单可重新添加任意模块,新层从初始参数开始,不继承已删除层的设置。原有“再加一层”继续保留,删除状态随工程和完整预设保存。本机已验证删除、撤销、重做、重新添加与退出重开;本版继续保留此前的 Cube 兼容与“更多空间”窗口修正。</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">1.7.3 更新:显示缩放下的 LUT 窗口</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
+9
-3
@@ -1,8 +1,8 @@
|
||||
# 大鱼调色 1.7.3 公测版:Final Cut Pro 原生调色插件
|
||||
# 大鱼调色 1.7.4 公测版:Final Cut Pro 原生调色插件
|
||||
|
||||
大鱼调色 1.7.3 公测版是一款适用于 Final Cut Pro 与 Motion 的原生 FxPlug 4 调色插件。从素材色彩还原、基础调整,到 LUT 风格、胶片质感和局部蒙版,可直接在剪辑时间线里完成。
|
||||
大鱼调色 1.7.4 公测版是一款适用于 Final Cut Pro 与 Motion 的原生 FxPlug 4 调色插件。从素材色彩还原、基础调整,到 LUT 风格、胶片质感和局部蒙版,可直接在剪辑时间线里完成。
|
||||
|
||||
本篇下载售价为50元,站内有效会员免费。提供已签名、公证的完整 PKG 安装包,版本1.7.3,构建49。
|
||||
本篇下载售价为50元,站内有效会员免费。提供已签名、公证的完整 PKG 安装包,版本1.7.4,构建52。
|
||||
|
||||
## 在时间线里完成调色
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
|
||||
**局部蒙版与工具叠层**:可针对单独工具添加蒙版、建立相邻叠层,并使用关键帧与跟踪处理局部区域,方便细调画面的不同部分。
|
||||
|
||||
## 1.7.4 更新:删除模块与图层
|
||||
|
||||
每个模块和新增图层的标题增加减号按钮,可删除不需要的层并让它从界面消失。删除时一并还原该模块的参数、清除关键帧及所属 LUT、蒙版等设置,避免隐藏后仍影响画面;其他模块保持原设置。误删可通过 Final Cut Pro 的一次撤销恢复。
|
||||
|
||||
顶部“添加模块”菜单可重新添加任意模块,新层从初始参数开始,不继承已删除层的设置。原有“再加一层”继续保留,删除状态随工程和完整预设保存。本机已验证删除、撤销、重做、重新添加与退出重开;本版继续保留此前的 Cube 兼容与“更多空间”窗口修正。
|
||||
|
||||
## 1.7.3 更新:显示缩放下的 LUT 窗口
|
||||
|
||||
修正部分显示器选择“更多空间”后,LUT 缩略图浏览库出现大片灰色、内容偏移和裁切的问题。首次打开即可完整显示搜索、文件夹、预览和底部控件,无需点击窗口绿色按钮恢复;原有窗口缩放、网格/列表与缩略图设置继续保留。本机已在相同显示设置下验证首次打开和重新启动 Final Cut Pro 后打开正常。
|
||||
|
||||
文件差异过大,未显示。
加载差异
@@ -0,0 +1,240 @@
|
||||
{
|
||||
"authority" : "controlled shader execution; original installed Metal libraries",
|
||||
"basisDIExposurePlusOneStop" : [
|
||||
{
|
||||
"absoluteCodeError" : 1.52587890625e-05,
|
||||
"actualCode" : [
|
||||
0.0208740234375,
|
||||
0.0208740234375,
|
||||
0.0208740234375
|
||||
],
|
||||
"expectedCodeDouble" : 0.0208892822265625,
|
||||
"halfULPAgainstRoundedReference" : 1,
|
||||
"inputCode" : 0.010444268584251404,
|
||||
"shaderInputHalf" : 0.01044464111328125
|
||||
},
|
||||
{
|
||||
"absoluteCodeError" : 8.2587538793865711e-07,
|
||||
"actualCode" : [
|
||||
0.133056640625,
|
||||
0.133056640625,
|
||||
0.133056640625
|
||||
],
|
||||
"expectedCodeDouble" : 0.13305581474961206,
|
||||
"halfULPAgainstRoundedReference" : 0,
|
||||
"inputCode" : 0.085275709629058838,
|
||||
"shaderInputHalf" : 0.08526611328125
|
||||
},
|
||||
{
|
||||
"absoluteCodeError" : 0.00010919044650758991,
|
||||
"actualCode" : [
|
||||
0.406982421875,
|
||||
0.406982421875,
|
||||
0.406982421875
|
||||
],
|
||||
"expectedCodeDouble" : 0.40709161232150759,
|
||||
"halfULPAgainstRoundedReference" : 0,
|
||||
"inputCode" : 0.33604326844215393,
|
||||
"shaderInputHalf" : 0.3359375
|
||||
},
|
||||
{
|
||||
"absoluteCodeError" : 0.0001436520877062808,
|
||||
"actualCode" : [
|
||||
0.58642578125,
|
||||
0.58642578125,
|
||||
0.58642578125
|
||||
],
|
||||
"expectedCodeDouble" : 0.58656943333770628,
|
||||
"halfULPAgainstRoundedReference" : 0,
|
||||
"inputCode" : 0.51383745670318604,
|
||||
"shaderInputHalf" : 0.513671875
|
||||
},
|
||||
{
|
||||
"absoluteCodeError" : 4.8850578683645729e-05,
|
||||
"actualCode" : [
|
||||
0.73291015625,
|
||||
0.73291015625,
|
||||
0.73291015625
|
||||
],
|
||||
"expectedCodeDouble" : 0.73286130567131635,
|
||||
"halfULPAgainstRoundedReference" : 0,
|
||||
"inputCode" : 0.65983039140701294,
|
||||
"shaderInputHalf" : 0.65966796875
|
||||
}
|
||||
],
|
||||
"basisExposureMaximumHalfULP" : 1,
|
||||
"basisSHA256" : "e164080db3a6d553a0e75d377ac3c5bd28455bddd8a97640d9de6c74e0d105f3",
|
||||
"cstForwardThenReverse" : [
|
||||
{
|
||||
"displayGamma24" : [
|
||||
0.0169219970703125,
|
||||
0.0169219970703125,
|
||||
0.0169219970703125
|
||||
],
|
||||
"reverseToLinear709" : [
|
||||
5.2571296691894531e-05,
|
||||
5.2571296691894531e-05,
|
||||
5.2571296691894531e-05
|
||||
],
|
||||
"sourceLinear709" : 0
|
||||
},
|
||||
{
|
||||
"displayGamma24" : [
|
||||
0.0222320556640625,
|
||||
0.0222320556640625,
|
||||
0.0222320556640625
|
||||
],
|
||||
"reverseToLinear709" : [
|
||||
0.00010114908218383789,
|
||||
0.00010114908218383789,
|
||||
0.00010114908218383789
|
||||
],
|
||||
"sourceLinear709" : 0.0010000000474974513
|
||||
},
|
||||
{
|
||||
"displayGamma24" : [
|
||||
0.0640869140625,
|
||||
0.0640869140625,
|
||||
0.0640869140625
|
||||
],
|
||||
"reverseToLinear709" : [
|
||||
0.0012845993041992188,
|
||||
0.0012845993041992188,
|
||||
0.0012845993041992188
|
||||
],
|
||||
"sourceLinear709" : 0.0099999997764825821
|
||||
},
|
||||
{
|
||||
"displayGamma24" : [
|
||||
0.40234375,
|
||||
0.40234375,
|
||||
0.40234375
|
||||
],
|
||||
"reverseToLinear709" : [
|
||||
0.1143798828125,
|
||||
0.1143798828125,
|
||||
0.1143798828125
|
||||
],
|
||||
"sourceLinear709" : 0.18000000715255737
|
||||
},
|
||||
{
|
||||
"displayGamma24" : [
|
||||
0.763671875,
|
||||
0.763671875,
|
||||
0.763671875
|
||||
],
|
||||
"reverseToLinear709" : [
|
||||
0.76708984375,
|
||||
0.76708984375,
|
||||
0.76708984375
|
||||
],
|
||||
"sourceLinear709" : 1
|
||||
},
|
||||
{
|
||||
"displayGamma24" : [
|
||||
0.86328125,
|
||||
0.86328125,
|
||||
0.86328125
|
||||
],
|
||||
"reverseToLinear709" : [
|
||||
1.275390625,
|
||||
1.275390625,
|
||||
1.275390625
|
||||
],
|
||||
"sourceLinear709" : 2
|
||||
},
|
||||
{
|
||||
"displayGamma24" : [
|
||||
0.927734375,
|
||||
0.927734375,
|
||||
0.927734375
|
||||
],
|
||||
"reverseToLinear709" : [
|
||||
1.83984375,
|
||||
1.83984375,
|
||||
1.83984375
|
||||
],
|
||||
"sourceLinear709" : 4
|
||||
},
|
||||
{
|
||||
"displayGamma24" : [
|
||||
0.9853515625,
|
||||
0.9853515625,
|
||||
0.9853515625
|
||||
],
|
||||
"reverseToLinear709" : [
|
||||
2.689453125,
|
||||
2.689453125,
|
||||
2.689453125
|
||||
],
|
||||
"sourceLinear709" : 16
|
||||
},
|
||||
{
|
||||
"displayGamma24" : [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"reverseToLinear709" : [
|
||||
3,
|
||||
3,
|
||||
3
|
||||
],
|
||||
"sourceLinear709" : 64
|
||||
}
|
||||
],
|
||||
"cstSHA256" : "b38165dd86bb6e038f7835373dadb51a54a0ad266c67672ff8fcd9548641c2d3",
|
||||
"date" : "2026-11-03",
|
||||
"dayuNewPrimaryDefaultMapping" : [
|
||||
{
|
||||
"hostLinearInput" : 0.01000213623046875,
|
||||
"newPrimaryDefaultMappingOutput" : [
|
||||
0.0027828216552734375,
|
||||
0.0027828216552734375,
|
||||
0.0027828216552734375
|
||||
]
|
||||
},
|
||||
{
|
||||
"hostLinearInput" : 0.1800537109375,
|
||||
"newPrimaryDefaultMappingOutput" : [
|
||||
0.12066650390625,
|
||||
0.12066650390625,
|
||||
0.12066650390625
|
||||
]
|
||||
},
|
||||
{
|
||||
"hostLinearInput" : 0.5,
|
||||
"newPrimaryDefaultMappingOutput" : [
|
||||
0.43310546875,
|
||||
0.43310546875,
|
||||
0.43310546875
|
||||
]
|
||||
},
|
||||
{
|
||||
"hostLinearInput" : 1,
|
||||
"newPrimaryDefaultMappingOutput" : [
|
||||
0.796875,
|
||||
0.796875,
|
||||
0.796875
|
||||
]
|
||||
},
|
||||
{
|
||||
"hostLinearInput" : 2,
|
||||
"newPrimaryDefaultMappingOutput" : [
|
||||
0.796875,
|
||||
0.796875,
|
||||
0.796875
|
||||
]
|
||||
}
|
||||
],
|
||||
"dayuSHA256" : "6ec98b85aeb841f9988a4b66e3e5fba9e34d5ab3d7542c9205b0480c77f9ac6d",
|
||||
"device" : "Apple M4",
|
||||
"limitations" : [
|
||||
"Not a Final Cut Pro render, camera import test or whole-application CMS certification.",
|
||||
"RGBA32Float transport; target shaders can quantize samples\/results internally to half.",
|
||||
"CST inverse display mapping is not assumed to be an inverse of the forward DRT.",
|
||||
"DI formula follows Blackmagic public specification; finite samples and exposure-isolation bypasses only.",
|
||||
"Dayu primary rows test the actual installed color kernel with source-derived new-layer parameters, not the whole scheduler\/UI."
|
||||
],
|
||||
"schema" : 1
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
// Bounded, headless observations of the user-selected installed shaders.
|
||||
// No vendor source, shader code, LUT data, app launch or host document is copied.
|
||||
// Build instructions and interpretation limits are in report.md.
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Metal/Metal.h>
|
||||
#include <simd/simd.h>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <CommonCrypto/CommonDigest.h>
|
||||
|
||||
struct CSTParams { int inputGamut,inputTransfer,outputGamut,outputTransfer,toneMapping; };
|
||||
struct BasisParams {
|
||||
int colorspace;
|
||||
float exposure,balanceTarget,balanceStrength,contrast,pivot,highlights,midtones,shadows;
|
||||
float trimLow,trimHigh,trimToeStrength,trimShoulderStrength,shadowContrast,shadowPivot,hiContrast,hiPivot,chromaMix;
|
||||
unsigned char bypassBalance,bypassTone,bypassExposure,bypassContrast;
|
||||
float saturation;
|
||||
};
|
||||
struct DayuRenderParams { CSTParams input,output;BasisParams basis;int stages,sourceLinear,destinationLinear,reserved;CSTParams basisInput,basisOutput; };
|
||||
static_assert(sizeof(CSTParams)==20 && sizeof(BasisParams)==80);
|
||||
static_assert(sizeof(DayuRenderParams)==176);
|
||||
struct Vertex { simd_float2 position,uv; };
|
||||
static void need(bool value,NSString *reason) {
|
||||
if(!value) @throw [NSException exceptionWithName:@"CMSAudit" reason:reason userInfo:nil];
|
||||
}
|
||||
static NSString *digest(NSString *path) {
|
||||
NSData *data=[NSData dataWithContentsOfFile:path];need(data!=nil,path);
|
||||
unsigned char hash[CC_SHA256_DIGEST_LENGTH];CC_SHA256(data.bytes,(CC_LONG)data.length,hash);
|
||||
NSMutableString *s=[NSMutableString string];for(auto v:hash)[s appendFormat:@"%02x",v];return s;
|
||||
}
|
||||
static double encodeDI(double v) {
|
||||
return v<=.00262409?v*10.44426855:(std::log2(v+.0075)+7)*.07329248;
|
||||
}
|
||||
static double decodeDI(double v) {
|
||||
return v<=.02740668?v/10.44426855:std::exp2(v/.07329248-7)-.0075;
|
||||
}
|
||||
static std::vector<float> render(id<MTLDevice>device,id<MTLCommandQueue>queue,
|
||||
id<MTLRenderPipelineState>pipeline,const std::vector<float>&input,const void *params,NSUInteger length) {
|
||||
NSUInteger width=input.size()/4;need(width>0 && input.size()%4==0,@"invalid input");
|
||||
auto desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA32Float width:width height:1 mipmapped:NO];
|
||||
desc.storageMode=MTLStorageModeShared;desc.usage=MTLTextureUsageShaderRead|MTLTextureUsageRenderTarget;
|
||||
id<MTLTexture>source=[device newTextureWithDescriptor:desc],output=[device newTextureWithDescriptor:desc];
|
||||
need(source && output,@"texture allocation");
|
||||
[source replaceRegion:MTLRegionMake2D(0,0,width,1) mipmapLevel:0 withBytes:input.data() bytesPerRow:width*16];
|
||||
float w=width,h=1;Vertex vertices[]={{{-w/2,-h/2},{0,1}},{{w/2,-h/2},{1,1}},{{-w/2,h/2},{0,0}},{{w/2,h/2},{1,0}}};
|
||||
simd_uint2 dims={(unsigned)width,1};
|
||||
auto pass=[MTLRenderPassDescriptor renderPassDescriptor];pass.colorAttachments[0].texture=output;
|
||||
pass.colorAttachments[0].loadAction=MTLLoadActionDontCare;pass.colorAttachments[0].storeAction=MTLStoreActionStore;
|
||||
auto cb=[queue commandBuffer];auto enc=[cb renderCommandEncoderWithDescriptor:pass];
|
||||
[enc setRenderPipelineState:pipeline];[enc setVertexBytes:vertices length:sizeof(vertices) atIndex:0];
|
||||
[enc setVertexBytes:&dims length:sizeof(dims) atIndex:1];[enc setFragmentTexture:source atIndex:0];
|
||||
[enc setFragmentBytes:params length:length atIndex:0];[enc drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];
|
||||
[enc endEncoding];[cb commit];[cb waitUntilCompleted];need(cb.status==MTLCommandBufferStatusCompleted,cb.error.description?:@"GPU failure");
|
||||
std::vector<float>result(input.size());[output getBytes:result.data() bytesPerRow:width*16 fromRegion:MTLRegionMake2D(0,0,width,1) mipmapLevel:0];return result;
|
||||
}
|
||||
static id<MTLRenderPipelineState> pipeline(id<MTLDevice>device,id<MTLLibrary>library) {
|
||||
auto d=[MTLRenderPipelineDescriptor new];d.vertexFunction=[library newFunctionWithName:@"vertexShader"];
|
||||
d.fragmentFunction=[library newFunctionWithName:@"fragmentShader"];d.colorAttachments[0].pixelFormat=MTLPixelFormatRGBA32Float;
|
||||
NSError *error=nil;auto result=[device newRenderPipelineStateWithDescriptor:d error:&error];need(result!=nil,error.description);return result;
|
||||
}
|
||||
static NSArray *rgb(const std::vector<float>&v,NSUInteger pixel) {
|
||||
NSMutableArray *a=[NSMutableArray array];for(int c=0;c<3;c++){
|
||||
float x=v[pixel*4+c];[a addObject:std::isfinite(x)?(id)@(x):(id)[NSString stringWithFormat:@"%g",x]];
|
||||
}return a;
|
||||
}
|
||||
int main(int argc,const char *argv[]) { @autoreleasepool { @try {
|
||||
need(argc==2,@"usage: probe /absolute/report.json");
|
||||
NSString *cstPath=@"/Library/Plug-Ins/FxPlug/Colour Space Transform.app/Contents/PlugIns/Colour Space Transform XPC Service.pluginkit/Contents/Resources/default.metallib";
|
||||
NSString *basisPath=@"/Library/Plug-Ins/FxPlug/BASIS.app/Contents/PlugIns/Basis XPC Service.pluginkit/Contents/Resources/default.metallib";
|
||||
need([digest(cstPath)isEqual:@"b38165dd86bb6e038f7835373dadb51a54a0ad266c67672ff8fcd9548641c2d3"],@"CST identity changed; re-inspect before probing");
|
||||
need([digest(basisPath)isEqual:@"e164080db3a6d553a0e75d377ac3c5bd28455bddd8a97640d9de6c74e0d105f3"],@"BASIS identity changed; re-inspect before probing");
|
||||
auto device=MTLCreateSystemDefaultDevice();need(device!=nil,@"Metal device unavailable");auto queue=[device newCommandQueue];
|
||||
NSError *error=nil;auto cst=[device newLibraryWithURL:[NSURL fileURLWithPath:cstPath] error:&error];need(cst!=nil,error.description);
|
||||
auto basis=[device newLibraryWithURL:[NSURL fileURLWithPath:basisPath] error:&error];need(basis!=nil,error.description);
|
||||
auto cp=pipeline(device,cst),bp=pipeline(device,basis);
|
||||
const float levels[]={0,.001f,.01f,.18f,1,2,4,16,64};std::vector<float>gray;
|
||||
for(auto v:levels)gray.insert(gray.end(),{v,v,v,1});
|
||||
CSTParams forward={22,20,22,1002,1},reverse={22,1002,22,20,2};
|
||||
auto mapped=render(device,queue,cp,gray,&forward,sizeof(forward));
|
||||
auto restored=render(device,queue,cp,mapped,&reverse,sizeof(reverse));
|
||||
NSMutableArray *mapping=[NSMutableArray array];for(NSUInteger i=0;i<sizeof(levels)/sizeof(float);i++)
|
||||
[mapping addObject:@{@"sourceLinear709":@(levels[i]),@"displayGamma24":rgb(mapped,i),@"reverseToLinear709":rgb(restored,i)}];
|
||||
std::vector<float>codes;for(double v:{.001,.01,.18,1.0,4.0}){float c=(float)encodeDI(v);codes.insert(codes.end(),{c,c,c,1});}
|
||||
BasisParams b={};b.colorspace=10;b.exposure=2;b.contrast=b.pivot=b.trimLow=b.trimHigh=b.shadowPivot=b.hiPivot=b.saturation=1;
|
||||
b.trimToeStrength=8.5;b.trimShoulderStrength=4.5;b.chromaMix=.5;
|
||||
// Isolate the exposure operation rather than asserting a whole tone stack is neutral.
|
||||
b.bypassBalance=b.bypassTone=b.bypassContrast=1;
|
||||
auto exposed=render(device,queue,bp,codes,&b,sizeof(b));NSMutableArray *exposure=[NSMutableArray array];unsigned maximumHalfULP=0;
|
||||
for(NSUInteger i=0;i<codes.size()/4;i++){
|
||||
float inputHalf=(float)(__fp16)codes[i*4];double expected=encodeDI(decodeDI(inputHalf)*2);
|
||||
__fp16 reference=(__fp16)expected,actual=(__fp16)exposed[i*4];uint16_t referenceBits,actualBits;
|
||||
std::memcpy(&referenceBits,&reference,2);std::memcpy(&actualBits,&actual,2);
|
||||
unsigned halfULP=unsigned(std::abs(int(referenceBits)-int(actualBits)));maximumHalfULP=std::max(maximumHalfULP,halfULP);
|
||||
[exposure addObject:@{@"inputCode":@(codes[i*4]),@"shaderInputHalf":@(inputHalf),@"expectedCodeDouble":@(expected),@"actualCode":rgb(exposed,i),@"absoluteCodeError":@(std::fabs(expected-exposed[i*4])),@"halfULPAgainstRoundedReference":@(halfULP)}];
|
||||
}
|
||||
NSString *dayuPath=@"/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit/Contents/Resources/default.metallib";
|
||||
need([digest(dayuPath)isEqual:@"6ec98b85aeb841f9988a4b66e3e5fba9e34d5ab3d7542c9205b0480c77f9ac6d"],@"Dayu identity changed; re-inspect before probing");
|
||||
auto dayu=[device newLibraryWithURL:[NSURL fileURLWithPath:dayuPath] error:&error];need(dayu!=nil,error.description);
|
||||
auto dp=[device newComputePipelineStateWithFunction:[dayu newFunctionWithName:@"dyColorManagement"] error:&error];need(dp!=nil,error.description);
|
||||
// Matches DYToolUniforms(new primary) + DYCMRender at the audited source revision.
|
||||
// It does not simulate the tool scheduler, masks, or the full host render.
|
||||
DayuRenderParams p={};p.input={22,1002,16,10,2};p.output={16,10,22,1002,1};p.basis=b;
|
||||
p.basis.exposure=1;p.basis.bypassBalance=p.basis.bypassTone=p.basis.bypassContrast=0;p.stages=7;
|
||||
const float hostLevels[]={.01f,.18f,.5f,1,2};std::vector<float>host;
|
||||
for(float level:hostLevels)host.insert(host.end(),{(float)(__fp16)level,(float)(__fp16)level,(float)(__fp16)level,1});
|
||||
auto td=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA32Float width:5 height:1 mipmapped:NO];td.storageMode=MTLStorageModeShared;td.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;
|
||||
auto source=[device newTextureWithDescriptor:td],dest=[device newTextureWithDescriptor:td];
|
||||
[source replaceRegion:MTLRegionMake2D(0,0,5,1) mipmapLevel:0 withBytes:host.data() bytesPerRow:80];
|
||||
auto cb=[queue commandBuffer];auto e=[cb computeCommandEncoder];[e setComputePipelineState:dp];[e setTexture:source atIndex:0];[e setTexture:dest atIndex:1];
|
||||
[e setBytes:&p length:sizeof(p) atIndex:0];float amount=1;[e setBytes:&amount length:sizeof(amount) atIndex:1];
|
||||
[e dispatchThreads:MTLSizeMake(5,1,1) threadsPerThreadgroup:MTLSizeMake(5,1,1)];[e endEncoding];[cb commit];[cb waitUntilCompleted];need(cb.status==MTLCommandBufferStatusCompleted,cb.error.description?:@"Dayu GPU failure");
|
||||
std::vector<float>dayuResult(20);[dest getBytes:dayuResult.data() bytesPerRow:80 fromRegion:MTLRegionMake2D(0,0,5,1) mipmapLevel:0];
|
||||
NSMutableArray *dayuRows=[NSMutableArray array];for(NSUInteger i=0;i<5;i++)[dayuRows addObject:@{@"hostLinearInput":@(host[i*4]),@"newPrimaryDefaultMappingOutput":rgb(dayuResult,i)}];
|
||||
NSDictionary *report=@{@"schema":@1,@"date":@"2026-11-03",@"device":device.name,
|
||||
@"authority":@"controlled shader execution; original installed Metal libraries",
|
||||
@"cstSHA256":digest(cstPath),@"basisSHA256":digest(basisPath),
|
||||
@"cstForwardThenReverse":mapping,@"basisDIExposurePlusOneStop":exposure,@"basisExposureMaximumHalfULP":@(maximumHalfULP),
|
||||
@"dayuSHA256":digest(dayuPath),@"dayuNewPrimaryDefaultMapping":dayuRows,
|
||||
@"limitations":@[@"Not a Final Cut Pro render, camera import test or whole-application CMS certification.",@"RGBA32Float transport; target shaders can quantize samples/results internally to half.",@"CST inverse display mapping is not assumed to be an inverse of the forward DRT.",@"DI formula follows Blackmagic public specification; finite samples and exposure-isolation bypasses only.",@"Dayu primary rows test the actual installed color kernel with source-derived new-layer parameters, not the whole scheduler/UI."]};
|
||||
NSData *json=[NSJSONSerialization dataWithJSONObject:report options:NSJSONWritingPrettyPrinted|NSJSONWritingSortedKeys error:&error];need(json!=nil,error.description);
|
||||
need([json writeToFile:[NSString stringWithUTF8String:argv[1]] options:NSDataWritingAtomic error:&error],error.description);
|
||||
puts([[NSString alloc]initWithData:json encoding:NSUTF8StringEncoding].UTF8String);return 0;
|
||||
} @catch(NSException *e) {fputs(e.reason.UTF8String,stderr);return 1;} }}
|
||||
@@ -0,0 +1,156 @@
|
||||
# 三个目标插件的色彩管理分析与大鱼调色改进方案
|
||||
|
||||
日期:2026年11月3日,Asia/Shanghai。大鱼调色源码基线 `d0b4e9d2ba1cd27b8677cfb723f540deb9027cbe`,正式安装版1.7.4(52);本次仅增加研究、探针和方案记录,没有修改产品渲染、模板或安装。
|
||||
|
||||
建议保留现有算法作为有版本的兼容管线,建立独立的新版根级色彩管理:明确宿主实际空间与用户声明输入、让各调色工具在适合的空间工作、统一印片与输出顺序,并限制每条场景输入链的显示渲染次数。优先修复新增一级层的默认映射行为,再接入已有的公开OCIO与ICC基础设施。
|
||||
|
||||
需要修正上一轮评估的措辞:固定sRGB编解码桥本身可以构成可逆的码值载体,不能单凭该公式推断全部FCP画面有错。风险在于载体是否匹配宿主交付的实际数值、上游是否已经进行相机或显示变换,以及返回像素是否符合宿主契约。还需区分“跟随宿主”与“场景参考”:宿主已管理的像素可能已经过显示渲染,转换为宽色域不能恢复已丢失的场景信息。
|
||||
|
||||
**1.目标身份与调查边界**
|
||||
|
||||
| 目标 | 安装版本 | 核心职责 | 本轮证据 |
|
||||
| --- | --- | --- | --- |
|
||||
| BASIS.app | 1.0(8) | 在指定编码下进行一级调色 | 当前arm64反编译、同SHA既有AIR研究、原版GPU曝光探针 |
|
||||
| Colour Space Transform.app | 2.0(8) | 输入/输出曲线与色域变换,附显示映射 | 匹配快照与当前发行字节复核、原版GPU正反映射探针 |
|
||||
| ColorFinale.app | 2.16.2(625) | 根CMS、工具工作域、LUT、胶片与输出管理 | 同SHA既有CMS证据、新补宿主入口/CIContext/回写静态调用链、官方文档 |
|
||||
|
||||
完整文件与arm64切片摘要见 [target-identities.json](target-identities.json)。研究只读用户明确指定的安装目标;派生切片和完整反编译证据留在本机缓存,未将原版二进制、私有着色器或LUT资源加入仓库。静态调用证据、历史运行证据和本轮GPU探针分开记录;没有把静态可达性写成实机执行。
|
||||
|
||||
**2.BASIS的色彩逻辑**
|
||||
|
||||
BASIS向宿主请求 `DesiredProcessingColorInfo=2`,本机FxPlug SDK对应 `RGB_GAMMA_VIDEO`,说明为视频Gamma 2.2。它不是独立识别摄像机或负责最终显示输出的完整CMS;其“Color Space”主要决定怎样解释送入的编码值。菜单有22个模式,其中KOLOR Default与DaVinci Intermediate是不同模式。
|
||||
|
||||
已恢复并与原版有限样本对照的运算顺序是:所选曲线解码 → 线性曝光乘法与RGB色彩平衡 → 编码与饱和度处理 → 影调、对比、趾部/肩部等曲线 → 色度混合 → 输出。它针对不同操作切换运算域,支持“曝光按档位乘以2”的合理模型。色彩平衡色轮是一种RGB增益调整,不能仅因名称相似就当作带明确照明体、白点与色适应定义的摄影白平衡。
|
||||
|
||||
本轮直接调用正式原版着色器,在DaVinci Intermediate模式、曝光+1EV且旁路其他影调/对比操作的五个中性灰样本上,与Blackmagic公开公式的差异最大为1个half ULP。说明这组曝光行为有数值基础;不能外推为所有模式、颜色和参数的独立标准认证。原版着色器会经过half精度边界,使用32位输出纹理不等于内核全程32位。
|
||||
|
||||
证据:`ev_50cd56935bf6cf1f094ab18a87ec4fb4232745b438b362bd1ee5c377151ae152`(属性);`ev_e641b255869e8e1115bb281a6efb7b332cc2bc43edbaef769d1465c062de2292`(常量2);`ev_02df5b28e8027cb62692d5192ef9cfad1210fe271f8cb36131b2a98423c9b016`(UI到GPU参数);本轮 [gpu-observations.json](gpu-observations.json)。公式依据:[Blackmagic DWG与DI规范](https://documents.blackmagicdesign.com/InformationNotes/DaVinci_Resolve_17_Wide_Gamut_Intermediate.pdf)。
|
||||
|
||||
**3.Colour Space Transform的色彩逻辑**
|
||||
|
||||
CST也请求视频Gamma编码RGB(数值2)。CPU冻结输入色域、输入曲线、输出色域、输出曲线和映射标志,GPU完成解码、色域矩阵/相关分支、可选显示映射、再编码。曲线和色域独立选择;它是明确指定输入的转换工具,当前检查路径没有摄像机自动识别步骤。
|
||||
|
||||
原版按曲线ID分类:大于1000的Gamma 2.2/2.4/2.6视为显示曲线,其他曲线视为场景侧。自动标志由“输入是否显示、输出是否显示”组成。场景→显示会调用自定义DRT;显示→场景会调用另一个逆向形状函数。这套规则体现作者的渲染选择,不等同于Academy ACES输出,也不代表任意正反组合可逆。
|
||||
|
||||
本轮原版GPU实测,线性Rec.709经其DRT转Gamma2.4,再使用其显示→场景映射返回线性Rec.709:
|
||||
|
||||
| 初始线性灰 | 显示编码结果 | 逆向映射后线性灰 |
|
||||
| --- | --- | --- |
|
||||
| 0.18 | 0.402344 | 0.114380 |
|
||||
| 1 | 0.763672 | 0.767090 |
|
||||
| 4 | 0.927734 | 1.839844 |
|
||||
| 16 | 0.985352 | 2.689453 |
|
||||
| 64 | 1 | 3 |
|
||||
|
||||
两个方向不能用作无损的技术往返。这不否定单向显示渲染的创作价值;它直接影响“新增一个默认一级层应保持画面”及反复进入/退出工作空间的设计。DRT末端存在0–1限制,逆向函数也有有限范围,已被压缩或剪掉的信息不能通过逆变换恢复。
|
||||
|
||||
证据:`ev_bbe42e9acd5c1e0470681d56d3b4dfcd2e26b3fe1556fac4c23c999751feed84`(属性);`ev_db7337a59c2f40d85a22ecad704ea295ed7f46e65626b9e919b5641ef1bc861b`(常量2);`ev_c8e5be75668f4e69851ffc9d23901083bac7c356252b89287b9d891837bec5e5`(映射标志);[本轮GPU数据](gpu-observations.json)。原着色器SHA与既有AIR研究完全一致,见证据索引。
|
||||
|
||||
**4.Color Finale的色彩管理架构**
|
||||
|
||||
Color Finale把根级输入管理、工具工作空间与最后输出分开。当前正常入口有四种:
|
||||
|
||||
| 模式 | 已观察行为 | 使用边界 |
|
||||
| --- | --- | --- |
|
||||
| Assume Video | 新建默认;按宿主视频空间解释已经匹配的输入 | 已经由上游相机LUT还原的素材可走此入口 |
|
||||
| Assume Log | 固定一般校正后进入视频路径 | 属于通用估计,静态路径没有相机识别或逐片分析 |
|
||||
| ACES | 相机IDT → ACES → 选定工作编码,末端单独输出 | 新建工作空间ACEScct;旧归档缺字段回退ACEScc |
|
||||
| Input LUT | 应用输入LUT并保存其输出空间声明 | 支持声明709 Gamma、2020 Gamma、PQ、HLG等输出语义 |
|
||||
|
||||
Generic输入分支实际使用所选ODT的逆变换,不能将它宣传为任意未知相机Log的准确解码。产品内部100/200/210等修订值也不能直接命名为Academy ACES 1.0/2.0/2.1。
|
||||
|
||||
正常ACES主链是:输入CMS → 基础校正/色卡匹配(有历史版本顺序差异)→ 图层树 → 胶片处理 → 印片LMT → ODT。基础校正主动转入线性域,Log Wheels/Telecine等使用stack空间;并非所有工具全程使用同一种Log编码。LUT也可以先适配到其期望空间,处理后返回工作空间。印片位置在RRT/ODT之前,与大鱼当前显示链后接入印片的方式不同。[官方CMS说明](https://docs.colorfinale.com/docs/inspector/cms/)、[官方印片说明](https://docs.colorfinale.com/docs/inspector/film-emulation/)。
|
||||
|
||||
当前产物保存有9种ODT、8种印片外观及具体摄像机输入表。菜单覆盖和“原版组件一致”只能支持各自已检查范围,不能代替整条CMS、所有输入和半透明图像的准确性验证。Color Finale的旧归档还显式保留Legacy ODT路径,升级时不会简单把所有历史输出替换为新算法。
|
||||
|
||||
新补的正常宿主衔接证据表明:
|
||||
|
||||
1. 属性字典请求视频Gamma RGB(2)。`FTProAPIAccessing`读取宿主 `colorPrimaries`,区分709/2020,再提供相应逻辑空间;当前实现通过API manager的KVC取值,不应照搬为大鱼对所有宿主的稳定公开API保证。
|
||||
2. `FTCIRenderer`保存destination tile的实际CGColorSpace,用它包装输入图像。`CIImage`入口带有这个颜色空间标签;标签本身不表示已执行摄像机IDT。
|
||||
3. 内部CIContext把自动工作空间和输出空间设为NSNull,处理空间和变换由自身CMS明确执行。
|
||||
4. 最终写宿主纹理时Core Image的colorSpace参数为NULL,避免再自动叠加一轮输出转换。
|
||||
|
||||
因此可借鉴的是颜色语义、入口标签和变换责任的分离。仅把CIContext打开自动色彩管理,也不会自动得到相机IDT、完整ACES显示渲染和正确印片。
|
||||
|
||||
关键证据:`ev_e4aea5e08f51d466349c9b197ce4b2cd24677316f0593a69a4238b8575afda6d`及常量字典读数;`ev_50235366fb24a6970669d43fdbc342e4a7ecc82d3699576b3d63b2d5f1910846`(709/2020);`ev_77ac74cf117fa08eed62cb602525c2f17419ae65c561524f7a45bbbd81ecd186`(正常渲染);`ev_1144f3b54e28a3a29e13899b36fb6688d74086a75f89eb0b7d9adffbe90d91aa`(入图标签);`ev_394c260352b0906c3854e955f30582295f6c2029a2832aaa4379a3c067aaca82`(CIContext);`ev_59dc53561198edfe1effb986550de215d55316f734fa5235ffd6b4d2793ee9bd`(回写NULL)。主CMS与LMT/ODT顺序见 [evidence-index.json](evidence-index.json)。
|
||||
|
||||
**5.大鱼调色当前最具体的问题**
|
||||
|
||||
| 优先级 | 当前实现 | 影响及处理 |
|
||||
| --- | --- | --- |
|
||||
| P0 | 请求linear RGB,固定sRGB运输桥,未读src/dst colorSpace或宿主primaries | 与三个目标的宿主接入策略不同。先测真实数值契约,再决定新模式适配;旧模式保留 |
|
||||
| P0 | 新独立一级层显式开启自动映射,input=output仍进工作空间并返回 | 逆DRT与正DRT不能相消,新层默认不具备严格中性;新版一级层应gradeOnly |
|
||||
| P0 | 根级输出先完成,后段与印片继续按sRGB/709假设处理 | 选择2020/P3不能保证后续模块仍正确;每个算子必须声明并适配输入域 |
|
||||
| P0 | CST mix直接混合输入代码值与另一输出编码值 | 属于旧创意混合语义;新版应在共同工作/宿主线性域混合 |
|
||||
| P1 | 活跃减色夹断0–1,部分HSL/白平衡/色轮来自RGB8 17³表 | 适合有明确限制的传统SDR风格路径,不能当作全扩展范围场景算法 |
|
||||
| P1 | 输出菜单、渲染算法、目标峰值和宿主线性回写没有统一描述 | PQ/HLG编码不能直接写进请求linear的目标纹理;需明确显示渲染责任和物理边界 |
|
||||
| P1 | 静态Cube依赖伪造sRGB载体网格走生产链 | 应使用明确颜色描述评估;补非格点误差、33/65及有限域/shaper合同 |
|
||||
|
||||
独立一级层的事实来源是 `DYNewTool`、`DYToolUniforms`和`DYToolIsNeutral`。它不会默认再次按Sony S-Log3解码:新层input/output默认同为709/Gamma2.4,但显式toneMapping=1使其走逆向与正向映射。不能把问题描述成“每层重复Sony还原”。
|
||||
|
||||
本轮用正式安装的 `dyColorManagement`,配置为上述新层默认参数,在alpha=1、无蒙版的直接内核检查中,得到线性中性灰0.180054→0.120667、1→0.796875、2→0.796875。参数与当前源代码生成结果对应;这项检查隔离了颜色内核,没有冒充完整FCP/UI或调度器验收。它足以要求新增一级层的中性行为成为优先修复和真实宿主复测项。
|
||||
|
||||
源码位置:`DYPlugIn.mm:25,30–36`;`DYGrade.metal:294–313`;`DYRenderer.mm:45–49,163–177,199–211`;`DYToolState.mm:65,120–126`;`DYFilmMath.h:16–21,34–40`;`DYColorTables.mm:104–147`。本轮直接内核结果见 [gpu-observations.json](gpu-observations.json)。
|
||||
|
||||
**6.分阶段实施方案**
|
||||
|
||||
第一阶段先补诊断并锁定旧画面。新增 `DYColorContext`,在合适的宿主回调冻结项目primaries,在render中核对源/目标 `FxImageTile.colorSpace`,记录空间名称/ICC摘要、线性/非线性、alpha与纹理精度。API或元数据不足时显示未知并保留兼容行为,不静默当作709。缓存键包含这份颜色上下文,避免同一XPC内多个项目互相污染。此阶段不全局改写旧sRGB桥。
|
||||
|
||||
第二阶段建立独立版本的根CMS,提供三种明确入口:跟随宿主、专家相机编码、输入LUT。跟随宿主按实际空间接入,不再无条件套默认Sony解码;已渲染输入保留其显示参考语义。相机编码路径要求通过对应FCP设置和数值夹具验证,关闭某个LUT开关本身不能证明拿到了原始代码值。输入LUT附内容hash、输入/输出空间与scene/display语义。上游转换状态无法可靠读取时,保留用户声明与“未知”状态,不能伪装自动检测。
|
||||
|
||||
第三阶段拆开根输入、调色工具、显示渲染和宿主输出。多个一级层仅调整统一工作空间中的画面;相机输入和显示映射由根CMS统一负责。印片作为具有AP1/ACEScct合同的look阶段接入匹配的渲染变换之前。传统709 LUT和曲线保留明确的显示域修饰区域;HDR模式下未完成扩展范围适配的工具须明确限制,不能默默夹断。新版强度和蒙版在共同域混合,恒等/关闭/mix=0直接旁路,避免多余编解码及U/P往返。
|
||||
|
||||
推荐新版语义主链:
|
||||
|
||||
```text
|
||||
实际宿主像素与颜色描述
|
||||
→ 输入边界与输入解释
|
||||
→ 统一工作空间
|
||||
→ 一级与局部调色(按工具声明适配线性/Log域)
|
||||
→ 场景外观与印片
|
||||
→ 一次明确的显示渲染(仅在插件负责时)
|
||||
→ 明确的显示域修饰
|
||||
→ 转回宿主要求的颜色空间与alpha合同
|
||||
```
|
||||
|
||||
“一次”指根级场景→显示渲染的责任,不代表所有曲线、艺术映射或系统显示管理只能出现一次。宿主已完成显示渲染的路径不应再默认执行一轮DRT;最终显示器呈现仍由宿主及系统负责。
|
||||
|
||||
第四阶段复用兄弟工程现成的公开CMS基础。`大鱼调色盘`固定节点 `f8950384e514685c8809fe8e8ee2dd5f16ad0bd7` 已有OpenColorIO 2.5.2、`studio-config-v2.2.0_aces-v1.3_ocio-v2.4`、ICC边界、CPU/Metal、依赖锁与许可证。可提炼 `DYColorManagement.cpp`、`DYColorManagementGPU.mm`、`DYColorManagementState.mm`、`DYColorProfile.mm`、`DYColorBoundary.mm` 及必要Core声明,构建缓存改用本产品com.dayu.color,不链接兄弟APP或依赖研究缓存。
|
||||
|
||||
现成模块的工作空间只允许ACEScg/cc/cct,DI目前只是输入选项。最短的标准参考路径是新模式采用ACEScct并适配现有BASIS;现有DWG/DI继续保留在兼容路径。若新版也提供DWG/DI工作空间,需要扩展工作空间合同、白点/色域适配并进入同样的验收矩阵,不能仅解锁菜单。OCIO 2.5.2、config修订和ACES 1.3是三个不同版本号;不能误写成ACES 2.5.2,也不能借用原版内部210命名。
|
||||
|
||||
第五阶段补齐输出目标与高级能力。将tone mapping、目标色域压缩、显示编码分开保存;固定公开输出变换及其版本,按所选算法声明参考白、黑位、峰值与显示原色。提供明确的709 SDR、P3和2020 PQ/HLG目标,但写回前仍适配宿主空间。再逐步增加有定义的场景白平衡、剪切/超色域诊断、参考帧与镜头匹配。是否全程32位由压力测试和误差预算决定,不能把half直接等同不专业,也不能把float纹理等同全程高精度。
|
||||
|
||||
**7.兼容与数据模型**
|
||||
|
||||
保留当前1312字节uniforms ABI、原参数ID和预设v1–v6读取。新版颜色状态独立归档,包含 `pipelineVersion`、输入模式/声明来源、实际host描述、工作空间、scene/display语义、渲染责任、输出目标/算法版本、LUT空间与内容hash、兼容修订。GPU新常量使用独立buffer,不继续把所有元数据塞进冻结的还原核前缀。
|
||||
|
||||
旧工程和旧预设固定走legacyV1;新模式单独分配schema与预设版本。不能依赖“新参数缺省值”识别旧工程:本项目已有FCP省略默认值、模板更新影响旧实例的实际记录。显式迁移操作应可撤销,并保留迁移前状态;不承诺自动迁移后与旧艺术外观逐像素一致。
|
||||
|
||||
alpha需逐算子约定。当前产品对非正alpha清零,兄弟工程支持隐藏RGB及区间外alpha,并对极小alpha采用1e-5分母下限;这两种语义不能直接互换。既有Color Finale印片探针也显示原版组件在半透明时直接拼链与alpha=1颜色函数不同。因此先定义新版straight/premultiplied合同,再验证所有转换、空间效果和蒙版;旧工程保留旧行为。
|
||||
|
||||
**8.验收与退出条件**
|
||||
|
||||
| 组别 | 必须覆盖 | 判断依据 |
|
||||
| --- | --- | --- |
|
||||
| 宿主边界 | FCP标准/宽色域库、709/2020、src/dst空间、摄像机LUT/Color Conform组合 | 实际记录tile空间、已知代码值夹具和正式导出;不能只看菜单 |
|
||||
| 基础科学 | 官方相机曲线、矩阵/跨白点、18%灰、曝光档位、中性轴 | 独立double公式/官方golden vectors,避免仅以同源核为oracle |
|
||||
| 范围与连续性 | 近黑、负值、超白、灰阶渐变、强饱和LED | 有限值、连续性、单调性、色相及目标色域;HDR用相对/ULP等合适误差预算 |
|
||||
| 顺序 | 多一级层、空层、印片前后、scene/display工具 | 空层保持像素;输入和DRT执行次数符合计划 |
|
||||
| alpha与空间 | 0/极小/0.5/1及约定支持的扩展alpha、蒙版、边界/原点 | 隐藏RGB与U/P合同、无意外彩边、预览/导出一致 |
|
||||
| 兼容 | 真实旧FCP工程、v1–v6预设、撤销/重做/冷重开 | 默认升级保持旧像素;显式迁移可回退 |
|
||||
| LUT | 33/65、非格点随机样本、有限域或shaper | 给出误差范围;空间/时间效果不能伪装静态Cube |
|
||||
| 工程交付 | Release构建、签名、公证、正式路径启动/宿主导出 | 按全局交付约定完成;本次研究不代表新版已经实现或发布 |
|
||||
|
||||
本轮完成了目标身份、主要管理架构、宿主包装策略、原版有限GPU行为及按文件可实施的改造方案。真实FCP摄像机入口、宽色域/HDR导出、显示器EDR和跨素材精度仍属于实施阶段的必需验收,不能由本轮离线探针替代。
|
||||
|
||||
**9.复现与恢复**
|
||||
|
||||
探针仅执行本机目标Metal函数,不启动目标GUI或FCP。需macOS、Apple Metal与Xcode命令行工具,原版库SHA改变时探针会停止。源码 [probe.mm](probe.mm),输出 [gpu-observations.json](gpu-observations.json),完整证据位置与摘要 [evidence-index.json](evidence-index.json)。
|
||||
|
||||
```sh
|
||||
xcrun clang++ -std=c++17 -fobjc-arc -framework Foundation -framework Metal research/cms-audit-20261103/probe.mm -o /tmp/dayu-cms-probe
|
||||
/tmp/dayu-cms-probe /tmp/dayu-cms-observations.json
|
||||
```
|
||||
|
||||
仓库为 `https://dayu.media/git/dayu/dayu-color.git`,分支main。探针与身份检查点 `a1e49e2eb55d1175e1ea52dfcf0f7aaa48eaab7b` 已推送并核对远端;本报告的最终提交可由 `git log -- research/cms-audit-20261103` 定位。本研究无LFS、子模块或新增二进制依赖。远端保存包含本文、探针、数值结果、目标身份和精简取证记录;完整REA缓存和第三方APP不属于远程恢复承诺,未来重跑需重新安装对应版本目标。
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"schema": 1,
|
||||
"date": "2026-11-03",
|
||||
"timezone": "Asia/Shanghai",
|
||||
"productSourceCommit": "d0b4e9d2ba1cd27b8677cfb723f540deb9027cbe",
|
||||
"targets": [
|
||||
{
|
||||
"name": "BASIS",
|
||||
"version": "1.0 (8)",
|
||||
"path": "/Library/Plug-Ins/FxPlug/BASIS.app/Contents/PlugIns/Basis XPC Service.pluginkit/Contents/MacOS/Basis XPC Service",
|
||||
"bytes": 305520,
|
||||
"sha256": "4dcf7bc7d0efd97b6aa733049fe55d4cbeebf15f4490ffd490875ea8fc0b5929",
|
||||
"arm64": {
|
||||
"offset": 163840,
|
||||
"bytes": 141680,
|
||||
"sha256": "55be57c9f17a94f6fc36beaf6d260a0d2ea8fe8a65f7898fff8f9b66e0b02f3f"
|
||||
},
|
||||
"metal": {
|
||||
"path": "/Library/Plug-Ins/FxPlug/BASIS.app/Contents/PlugIns/Basis XPC Service.pluginkit/Contents/Resources/default.metallib",
|
||||
"bytes": 26992,
|
||||
"sha256": "e164080db3a6d553a0e75d377ac3c5bd28455bddd8a97640d9de6c74e0d105f3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Colour Space Transform",
|
||||
"version": "2.0 (8)",
|
||||
"path": "/Library/Plug-Ins/FxPlug/Colour Space Transform.app/Contents/PlugIns/Colour Space Transform XPC Service.pluginkit/Contents/MacOS/Colour Space Transform XPC Service",
|
||||
"bytes": 272672,
|
||||
"sha256": "48b4aa2bc6a79679386096234bf2124d4cd4d1ad75db46d080dd19f75a61bbf5",
|
||||
"arm64": {
|
||||
"offset": 131072,
|
||||
"bytes": 141600,
|
||||
"sha256": "409c1406668ef855bc55325a106cac13f7ef7527cff21d627cadd8308c91e444"
|
||||
},
|
||||
"metal": {
|
||||
"path": "/Library/Plug-Ins/FxPlug/Colour Space Transform.app/Contents/PlugIns/Colour Space Transform XPC Service.pluginkit/Contents/Resources/default.metallib",
|
||||
"bytes": 39288,
|
||||
"sha256": "b38165dd86bb6e038f7835373dadb51a54a0ad266c67672ff8fcd9548641c2d3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ColorFinale",
|
||||
"version": "2.16.2 (625)",
|
||||
"path": "/Applications/ColorFinale.app/Contents/PlugIns/ColorFinale.pluginkit/Contents/MacOS/ColorFinale",
|
||||
"bytes": 4098720,
|
||||
"sha256": "49121a6f5487060d322a59e7658166ab772e8a56f7dc1bcfa9d433a89436b30f",
|
||||
"arm64": {
|
||||
"offset": 16384,
|
||||
"bytes": 4082336,
|
||||
"sha256": "748f0119cf3a77e0d53e4c3f2b48dfa6fe7227dd44cbd75a28b070e7b962adc4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GradeKit",
|
||||
"path": "/Applications/ColorFinale.app/Contents/PlugIns/ColorFinale.pluginkit/Contents/Frameworks/GradeKit.framework/Versions/A/GradeKit",
|
||||
"bytes": 1462656,
|
||||
"sha256": "e868a8c6df64bf03b7c24af5657c5ac7a2259a1943dfe06e01dbb7881df018a3"
|
||||
},
|
||||
{
|
||||
"name": "RenderingEngine",
|
||||
"path": "/Applications/ColorFinale.app/Contents/PlugIns/ColorFinale.pluginkit/Contents/Frameworks/RenderingEngine.framework/Versions/A/RenderingEngine",
|
||||
"bytes": 1072736,
|
||||
"sha256": "32dca93459347e5ad363cb145d0ccf84b933b2045eee2c9535676a01744b84e3"
|
||||
}
|
||||
],
|
||||
"scope": "Read-only inspection of explicit installed targets; derived slices remain local cache; no vendor binary or LUT resource added to repository."
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"archivesBase64": {
|
||||
"9000": "AAAAAAAAAisqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEBa2JwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAaULDBMZH1UkbnVsbNMNDg8QERJVZm9sZHNWc2NoZW1hViRjbGFzc4ACEAKABNMUFQ8WFxhXTlMua2V5c1pOUy5vYmplY3RzoKCAA9IaGxwdWiRjbGFzc25hbWVYJGNsYXNzZXNcTlNEaWN0aW9uYXJ5ohweWE5TT2JqZWN00hobICFfEBBEWUluc3BlY3RvclRva2VuoiIeXxAQRFlJbnNwZWN0b3JUb2tlbgAIABEAGgAkACkAMgA3AEkATABYAFoAYABmAG0AcwB6AIEAgwCFAIcAjgCWAKEAogCjAKUAqgC1AL4AywDOANcA3ADvAPIAAAAAAAACAQAAAAAAAAAjAAAAAAAAAAAAAAAAAAABBQgACAARABoAJAApADIANwBJAE4AWwBtAG8AcQB1AHsB6gAAAAAAAAIBAAAAAAAAABAAAAAAAAAAAAAAAAAAAAHrAA==",
|
||||
"9001": "AAAAAAAAAjcqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEBd2JwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAaULDBUbIVUkbnVsbNQNDg8QERITFFVwYXRoc1YkY2xhc3Ncc3BpZGVyTGlua2VkWnNwaWRlck1lc2iAAoAECYAA0xYXDhgZGldOUy5rZXlzWk5TLm9iamVjdHOgoIAD0hwdHh9aJGNsYXNzbmFtZVgkY2xhc3Nlc1xOU0RpY3Rpb25hcnmiHiBYTlNPYmplY3TSHB0iI1xEWUFzc2V0U3RhdGWiJCBcRFlBc3NldFN0YXRlAAgAEQAaACQAKQAyADcASQBMAFgAWgBgAGYAbwB1AHwAiQCUAJYAmACZAJsAogCqALUAtgC3ALkAvgDJANIA3wDiAOsA8AD9AQAAAAAAAAACAQAAAAAAAAAlAAAAAAAAAAAAAAAAAAABDQgACAARABoAJAApADIANwBJAE4AWwBtAG8AcQB1AHsB9gAAAAAAAAIBAAAAAAAAABAAAAAAAAAAAAAAAAAAAAH3AA==",
|
||||
"9001": "AAAAAAAAAlEqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEBkWJwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAaULDBcdI1UkbnVsbNUNDg8QERITFBUVVXBhdGhzViRjbGFzc1xzcGlkZXJMaW5rZWRfEA9jb2xvck1hbmFnZW1lbnRac3BpZGVyTWVzaIACgAQJgACAANMYGQ4aGxxXTlMua2V5c1pOUy5vYmplY3RzoKCAA9IeHyAhWiRjbGFzc25hbWVYJGNsYXNzZXNcTlNEaWN0aW9uYXJ5oiAiWE5TT2JqZWN00h4fJCVcRFlBc3NldFN0YXRloiYiXERZQXNzZXRTdGF0ZQAIABEAGgAkACkAMgA3AEkATABYAFoAYABmAHEAdwB+AIsAnQCoAKoArACtAK8AsQC4AMAAywDMAM0AzwDUAN8A6AD1APgBAQEGARMBFgAAAAAAAAIBAAAAAAAAACcAAAAAAAAAAAAAAAAAAAEjCAAIABEAGgAkACkAMgA3AEkATgBbAG0AbwBxAHUAewIQAAAAAAAAAgEAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAhEA",
|
||||
"9002": "AAAAAAAAApUqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEB1WJwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAawLDBEdHh8gJCotMDFVJG51bGzSDQ4PEFhkb2N1bWVudFYkY2xhc3OAAoAL0xITDhQYHFdOUy5rZXlzWk5TLm9iamVjdHOjFRYXgAOABIAFoxkaG4AGgAiACoAHWWJhc2VNYXNrc1ZsYXllcnNWc2NoZW1h0xITDiEiHKCggAfSJSYnKFokY2xhc3NuYW1lWCRjbGFzc2VzXE5TRGljdGlvbmFyeaInKVhOU09iamVjdNITDissoIAJ0iUmLi9XTlNBcnJheaIuKRAB0iUmMjNeRFlUb29sRG9jdW1lbnSiNCleRFlUb29sRG9jdW1lbnQACAARABoAJAApADIANwBJAEwAWABaAGcAbQByAHsAggCEAIYAjQCVAKAApACmAKgAqgCuALAAsgC0ALYAwADHAM4A1QDWANcA2QDeAOkA8gD/AQIBCwEQAREBEwEYASABIwElASoBOQE8AAAAAAAAAgEAAAAAAAAANQAAAAAAAAAAAAAAAAAAAUsIAAgAEQAaACQAKQAyADcASQBOAFsAbQBvAHEAdQB7AlQAAAAAAAACAQAAAAAAAAAQAAAAAAAAAAAAAAAAAAACVQA="
|
||||
},
|
||||
"parameters": [
|
||||
@@ -3638,11 +3638,13 @@
|
||||
"大鱼调色/Plugin/DYColorManagement.h": "b0a4cd1b8c45dbce90a7b4f30f72ebf95ecd382895e74e3bfeda0f7cdb185157",
|
||||
"大鱼调色/Plugin/DYFilmMath.h": "945b7036c6aa6d27941a3bf96c4d70dec65a14b1747fba618e650738fa7108f0",
|
||||
"大鱼调色/Plugin/DYFilmTypes.h": "c35a43b5b93988e8517e5db8f281da0dfd1e02f5b0e7bfb62e7345cec444a36d",
|
||||
"大鱼调色/Plugin/DYModel.h": "80e88add97deeac7a9dc47d12f68b0245905786297de2e6553b3da15c729da6e",
|
||||
"大鱼调色/Plugin/DYModel.mm": "bde987e48f79e5cf8e2e6bccc49cac27d420979d27e0e6859a27e98d0bd7bad7",
|
||||
"大鱼调色/Plugin/DYManagedColor.h": "616c7919bf0889f767ebb68d4b37b775183451b213b8d2d979eeb293be69010c",
|
||||
"大鱼调色/Plugin/DYManagedColor.mm": "8c9276003ea75c21c8e631122fe9a910bac26b12db69c76e626ec2100a6cbfd1",
|
||||
"大鱼调色/Plugin/DYModel.h": "a28652bd53aa9e1d085af1108c344b5d673c5e1b3731531e1bb2982efeb8708c",
|
||||
"大鱼调色/Plugin/DYModel.mm": "29fea6064d3131119933401f554cc04e48cadf07d0c62f25b8d66795201396f8",
|
||||
"大鱼调色/Plugin/DYSpiderState.h": "0c80747e41e8fc97762e301b011bd08c18865a825eaafde086ed79ace37b22f9",
|
||||
"大鱼调色/Plugin/DYToolState.h": "28088ec819307a60f2e52334fd807a514c3ff8a550bc0efbe7069b68a6242320",
|
||||
"大鱼调色/Plugin/DYToolState.mm": "7b113450ae43e0e5d478d8f0e4212b7d25e47d3cc8bc0d4d868ab58c98d3c56c",
|
||||
"大鱼调色/Plugin/DYToolState.h": "0a83109d2c02626d6b9e7340b74be6e6a74f366f31f9d7622b4a88000d5ad7b9",
|
||||
"大鱼调色/Plugin/DYToolState.mm": "3be23fd6e50f1137a2d5f2c087fd5724d0c41ca0aabb8e3b43dbb0ed7ec6b578",
|
||||
"大鱼调色/Plugin/DYUniforms.h": "207d36b5b53ab084fa8eb3813ccbbeb5193178e3468a37e9dc692ab196ffbb6a",
|
||||
"大鱼调色/Plugin/MaskCore/DYMask.h": "5b9aa44390d4a1fca1baf5e34cb9eefc8483c939a65cc2a0412b7b41fc85bc16",
|
||||
"大鱼调色/Plugin/MaskCore/DYMaskOperator.h": "43fa701ad574f38ce0ab4f4d3900bb034edaaa1adc09821d2f4443ee2b687ba2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"passed": true,
|
||||
"sha256": "fe6b9ed9a59e1e00de7bcad4526bc98fa2d5fde5cab490fd65ec999835ab2250",
|
||||
"sha256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
|
||||
"version": "5.11",
|
||||
"displayversion": "5.4.5",
|
||||
"nativeReference": {
|
||||
@@ -18,7 +18,7 @@
|
||||
},
|
||||
"staticContract": {
|
||||
"passed": true,
|
||||
"sha256": "fe6b9ed9a59e1e00de7bcad4526bc98fa2d5fde5cab490fd65ec999835ab2250",
|
||||
"sha256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
|
||||
"version": "5.11",
|
||||
"displayversion": "5.4.5",
|
||||
"filterCount": 1,
|
||||
@@ -55,7 +55,7 @@
|
||||
},
|
||||
"savedSelection": {
|
||||
"passed": true,
|
||||
"sha256": "fe6b9ed9a59e1e00de7bcad4526bc98fa2d5fde5cab490fd65ec999835ab2250",
|
||||
"sha256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
|
||||
"version": "5.11",
|
||||
"selectionMask": "0x10000001",
|
||||
"projectID": "10000",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"passed": true,
|
||||
"sha256": "fe6b9ed9a59e1e00de7bcad4526bc98fa2d5fde5cab490fd65ec999835ab2250",
|
||||
"sha256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
|
||||
"version": "5.11",
|
||||
"selectionMask": "0x10000001",
|
||||
"projectID": "10000",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"passed": true,
|
||||
"sha256": "fe6b9ed9a59e1e00de7bcad4526bc98fa2d5fde5cab490fd65ec999835ab2250",
|
||||
"sha256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
|
||||
"version": "5.11",
|
||||
"displayversion": "5.4.5",
|
||||
"filterCount": 1,
|
||||
|
||||
+2
-2
@@ -227,8 +227,8 @@
|
||||
</parameter>
|
||||
<parameter name="LUT 文件" id="9001" flags="12889161776">
|
||||
<numberOfKeypoints>0</numberOfKeypoints>
|
||||
<defaultVal>*********XQeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-Rq7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-IP6JIYPbJgPBEB1UwE2F6H33JkMLFcQpMYMqlVQrBQQr-dN4JmH4ZiOqJYKbBkOKFZQYpZQqW**c*20M**olML1VUN4ZRCImtfNLZnKYtH9axWOaJXR5CUc6*1oVkR5VxO74BgMLBnPa3hNJUYMqlVQrBZQplCIoFdMrFdPqtVQbaW5W-MHZBDMadZMrHG5-oW6pl2KI3nQqJoIrFVR4KW70-QF3Z-QrBZR3BoMLFZ**U*2E*O*0E*8E*m*1Q*GE-A*3U*KU-U*4M*Pk-p*5k*WE0I*7M*a*0N*7g*cU0e*9I*hU0r*9Y*jU17*B6*rk1W*Cg*w*1x*E*********0*E*********Z*******************-1EU*0**F*-c*7**d*16*Bk-7*2s*Kk-h*4w*QE-p*5g-xU********6-*********-********************5r**</defaultVal>
|
||||
<dataValue>*********XQeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-Rq7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-IP6JIYPbJgPBEB1UwE2F6H33JkMLFcQpMYMqlVQrBQQr-dN4JmH4ZiOqJYKbBkOKFZQYpZQqW**c*20M**olML1VUN4ZRCImtfNLZnKYtH9axWOaJXR5CUc6*1oVkR5VxO74BgMLBnPa3hNJUYMqlVQrBZQplCIoFdMrFdPqtVQbaW5W-MHZBDMadZMrHG5-oW6pl2KI3nQqJoIrFVR4KW70-QF3Z-QrBZR3BoMLFZ**U*2E*O*0E*8E*m*1Q*GE-A*3U*KU-U*4M*Pk-p*5k*WE0I*7M*a*0N*7g*cU0e*9I*hU0r*9Y*jU17*B6*rk1W*Cg*w*1x*E*********0*E*********Z*******************-1EU*0**F*-c*7**d*16*Bk-7*2s*Kk-h*4w*QE-p*5g-xU********6-*********-********************5r**</dataValue>
|
||||
<defaultVal>*********Z2eMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-YK7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-QR6pIYPbJgPBIB1UwE2F6H3-IJJL-VR4VnJWFXP43nQplnQ4ZYNL7AOKtfNKFT2*xXPqljQYpVPa3bNKpZPbFOQr-dN4JmHKJnO6*0U*E7U*0**BAM4EsO4llLHZAiOqJtQpdCImtjMadZMrFnc80**x6S5m*VKWFXP43nQqtVPKJM74BgMLBnNLBQHZB2OKBoOKxiML7tcW*WK2tHHq7eNKBooVsT70JQF3Z-QrBZR3BoMLFZcWMWL2FNELBnNLFHR43oNE*6*-2*4U*Y*0Y*AU*r*2Y*H*-M*3c*M*-a*52*Rk-y*6g*bE0c*8c*f*0h*8w*gE0s*A**mk1A*Ao*nk1I*Bw*u*1p*DU-*E24*FA-3U********6-*********0Q*******************2X0**6*-2*4U*Y*0Y*AU*r*2Y*HU-P*4o*Pk-l*5I*Sk6E*********U2*********2********************V2*</defaultVal>
|
||||
<dataValue>*********Z2eMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-YK7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-QR6pIYPbJgPBIB1UwE2F6H3-IJJL-VR4VnJWFXP43nQplnQ4ZYNL7AOKtfNKFT2*xXPqljQYpVPa3bNKpZPbFOQr-dN4JmHKJnO6*0U*E7U*0**BAM4EsO4llLHZAiOqJtQpdCImtjMadZMrFnc80**x6S5m*VKWFXP43nQqtVPKJM74BgMLBnNLBQHZB2OKBoOKxiML7tcW*WK2tHHq7eNKBooVsT70JQF3Z-QrBZR3BoMLFZcWMWL2FNELBnNLFHR43oNE*6*-2*4U*Y*0Y*AU*r*2Y*H*-M*3c*M*-a*52*Rk-y*6g*bE0c*8c*f*0h*8w*gE0s*A**mk1A*Ao*nk1I*Bw*u*1p*DU-*E24*FA-3U********6-*********0Q*******************2X0**6*-2*4U*Y*0Y*AU*r*2Y*HU-P*4o*Pk-l*5I*Sk6E*********U2*********2********************V2*</dataValue>
|
||||
</parameter>
|
||||
<parameter name="工具与蒙版" id="9002" flags="12889161776">
|
||||
<numberOfKeypoints>0</numberOfKeypoints>
|
||||
|
||||
+3
-2
@@ -22,14 +22,15 @@ CONTENT_TAGS={'scenenode','layer','group','filter','behavior','mask'}
|
||||
def sha(data):return hashlib.sha256(data).hexdigest()
|
||||
|
||||
def model_identity():
|
||||
files=['大鱼调色/Plugin/DYModel.h','大鱼调色/Plugin/DYModel.mm','大鱼调色/Plugin/DYUniforms.h','大鱼调色/Plugin/DYColorManagement.h','大鱼调色/Plugin/DYCSTTypes.h','大鱼调色/Plugin/DYSpiderState.h','大鱼调色/Plugin/SpiderCore/DYColorMath.h','大鱼调色/Plugin/SpiderCore/DYSpiderMesh.hpp','template/tools/dump_model.mm','大鱼调色/Plugin/DYFilmTypes.h','大鱼调色/Plugin/DYFilmMath.h','大鱼调色/Plugin/DYToolState.h','大鱼调色/Plugin/DYToolState.mm','大鱼调色/Plugin/MaskCore/DYMaskOperator.h','大鱼调色/Plugin/MaskCore/DYMask.h']
|
||||
files=['大鱼调色/Plugin/DYModel.h','大鱼调色/Plugin/DYManagedColor.h','大鱼调色/Plugin/DYManagedColor.mm','大鱼调色/Plugin/DYModel.mm','大鱼调色/Plugin/DYUniforms.h','大鱼调色/Plugin/DYColorManagement.h','大鱼调色/Plugin/DYCSTTypes.h','大鱼调色/Plugin/DYSpiderState.h','大鱼调色/Plugin/SpiderCore/DYColorMath.h','大鱼调色/Plugin/SpiderCore/DYSpiderMesh.hpp','template/tools/dump_model.mm','大鱼调色/Plugin/DYFilmTypes.h','大鱼调色/Plugin/DYFilmMath.h','大鱼调色/Plugin/DYToolState.h','大鱼调色/Plugin/DYToolState.mm','大鱼调色/Plugin/MaskCore/DYMaskOperator.h','大鱼调色/Plugin/MaskCore/DYMask.h']
|
||||
return {name:sha((ROOT/name).read_bytes()) for name in files}
|
||||
|
||||
def refresh_metadata():
|
||||
cache=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/template-model')
|
||||
cache.mkdir(parents=True,exist_ok=True)
|
||||
executable=cache/'dump_model'
|
||||
command=['xcrun','clang++','-std=c++17','-fno-objc-arc','-fblocks','-F','/Library/Developer/SDKs/FxPlug.sdk/Library/Frameworks','-F','/Library/Developer/Frameworks','-framework','Foundation','-framework','AppKit','-framework','FxPlug','-framework','CoreMedia','-Wl,-rpath,/Library/Developer/Frameworks','-I',str(ROOT/'大鱼调色/Plugin'),str(TEMPLATE/'tools/dump_model.mm'),str(ROOT/'大鱼调色/Plugin/DYModel.mm'),str(ROOT/'大鱼调色/Plugin/DYToolState.mm'),'-o',str(executable)]
|
||||
subprocess.run(['/usr/bin/python3',str(ROOT/'ColorManagement/build_runtime.py')],check=True)
|
||||
command=['xcrun','clang++','-std=c++20','-fno-objc-arc','-fblocks','-F','/Library/Developer/SDKs/FxPlug.sdk/Library/Frameworks','-F','/Library/Developer/Frameworks','-framework','Foundation','-framework','AppKit','-framework','FxPlug','-framework','CoreMedia','-Wl,-rpath,/Library/Developer/Frameworks','-I',str(ROOT/'大鱼调色/Plugin'),str(TEMPLATE/'tools/dump_model.mm'),str(ROOT/'大鱼调色/Plugin/DYModel.mm'),str(ROOT/'大鱼调色/Plugin/DYManagedColor.mm'),str(ROOT/'大鱼调色/Plugin/DYToolState.mm'),'@/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/cms-runtime/bridge-link.rsp','-o',str(executable)]
|
||||
subprocess.run(command,check=True)
|
||||
result=json.loads(subprocess.check_output([str(executable)],text=True))
|
||||
result['sourceSHA256']=model_identity()
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Create isolated synthetic timelines for CMS migration; no library edits."""
|
||||
from pathlib import Path
|
||||
import uuid
|
||||
import xml.etree.ElementTree as E
|
||||
|
||||
qa = Path.home() / 'Library/Caches/CodexBuilds/com.dayu.color/fcp-qa'
|
||||
chart = qa / '大鱼调色验收图.png'
|
||||
assert chart.is_file(), 'Generate the existing synthetic chart fixture first.'
|
||||
root = E.Element('fcpxml', version='1.12')
|
||||
resources = E.SubElement(root, 'resources')
|
||||
E.SubElement(resources, 'format', id='f1', width='1920', height='1080',
|
||||
frameDuration='1/25s', colorSpace='1-1-1 (Rec. 709)')
|
||||
E.SubElement(resources, 'format', id='f2', width='1920', height='1080',
|
||||
name='FFVideoFormatRateUndefined')
|
||||
asset = E.SubElement(resources, 'asset', id='a1', name='色彩管理验收图', start='0s',
|
||||
duration='0s', format='f2', hasVideo='1', videoSources='1')
|
||||
E.SubElement(asset, 'media-rep', kind='original-media', src=chart.as_uri())
|
||||
template = Path.home() / 'Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef'
|
||||
E.SubElement(resources, 'effect', id='fx', name='大鱼调色',
|
||||
uid='~/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef', src=template.as_uri())
|
||||
event = E.SubElement(E.SubElement(root, 'library'), 'event',
|
||||
name='大鱼调色_1.8_新版CMS验收', uid=str(uuid.uuid4()).upper())
|
||||
for title in ['大鱼调色_1.8_旧版兼容', '大鱼调色_1.8_跟随FCP', '大鱼调色_1.8_相机ACES']:
|
||||
project = E.SubElement(event, 'project', name=title, uid=str(uuid.uuid4()).upper())
|
||||
sequence = E.SubElement(project, 'sequence', format='f1', duration='4s',
|
||||
tcStart='0s', tcFormat='NDF', audioLayout='stereo', audioRate='48k')
|
||||
clip = E.SubElement(E.SubElement(sequence, 'spine'), 'video', ref='a1',
|
||||
name=title, offset='0s', start='0s', duration='4s')
|
||||
E.SubElement(clip, 'filter-video', ref='fx', name='大鱼调色', enabled='1')
|
||||
E.indent(root)
|
||||
output = qa / '大鱼调色_1.8_新版CMS验收.fcpxml'
|
||||
output.write_text('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE fcpxml>\n'
|
||||
+ E.tostring(root, encoding='unicode') + '\n')
|
||||
print(output)
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"status": "installed-awaiting-host-verification",
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.8.0",
|
||||
"build": "53",
|
||||
"team": "B3W25FX5H5",
|
||||
"notaryID": "9cedbb19-531c-4379-aa3a-401a4302c76a",
|
||||
"notaryStatus": "Accepted",
|
||||
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
|
||||
"sourceCommit": "54e68b4810238e2d1476a2ff38e257b4243937eb",
|
||||
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
|
||||
"templateSHA256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
|
||||
"shaderSHA256": "836fcd4775f01d8fba7e46612ed0d8ba2992e30baf3c0f938304e8b2550f6900",
|
||||
"previousInstallBackup": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-16cc761c5f7f49d09e8c375975e8121b.app",
|
||||
"phaseNote": "Candidate 53 signed/notarized/installed and initial FCP modes/undo/grade/layer tests passed; final LUT filename UI and mode3 regression added in build 54."
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"status": "installed-awaiting-host-verification",
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.8.0",
|
||||
"build": "54",
|
||||
"team": "B3W25FX5H5",
|
||||
"notaryID": "311f25cf-dfbc-410f-8b18-33c544c1e7dc",
|
||||
"notaryStatus": "Accepted",
|
||||
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
|
||||
"sourceCommit": "8bd2ba91fae43cf831ab1efc776da34c54fa2f87",
|
||||
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
|
||||
"templateSHA256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
|
||||
"shaderSHA256": "52a9630ed3f887a0b5f3678da4330254891b15e88f637204473796736a8b7be1",
|
||||
"previousInstallBackup": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-8f63e2e207d6454a9eb31015e5f8732b.app",
|
||||
"phaseNote": "Build 54 passed 530 tests, cold reopen and Cube/MOV export; missing-input-LUT error exposed an MRC NSError autorelease lifetime crash, fixed in build 55."
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"removedEarlierCandidateBackups": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-16cc761c5f7f49d09e8c375975e8121b.app",
|
||||
"version": "1.7.4",
|
||||
"build": "52"
|
||||
},
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-8f63e2e207d6454a9eb31015e5f8732b.app",
|
||||
"version": "1.8.0",
|
||||
"build": "53"
|
||||
}
|
||||
],
|
||||
"formalInstall": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"scope": "Only generated backups created by this CMS task; source, media, historical installers and other apps retained"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"version": "1.8.0",
|
||||
"build": "55",
|
||||
"CMSStateVersion": 2,
|
||||
"presetVersion": 7,
|
||||
"workingSpace": "ACEScct/AP1",
|
||||
"engine": "OpenColorIO 2.5.2",
|
||||
"config": "studio-config-v2.2.0_aces-v1.3_ocio-v2.4",
|
||||
"legacyState": "Absent CMS state renders v1 unchanged; old explicit toneMapping values remain stored",
|
||||
"pipeline": [
|
||||
"actual source profile or explicit code carrier/LUT",
|
||||
"declared input to ACEScct",
|
||||
"all primary layers",
|
||||
"all print looks",
|
||||
"one optional display/output transform",
|
||||
"explicit SDR linear709/sRGB finishing branch",
|
||||
"actual destination profile"
|
||||
],
|
||||
"HDRBoundary": "PQ/HLG and host-follow Rec2020 reject active unvalidated SDR finishing tools",
|
||||
"inputLUTInterpolation": "float32 tetrahedral; hardware trilinear precision defect found by identity 2cube test and fixed",
|
||||
"coreStorage": "RGBA32Float; BASIS entry and old active finishing keep existing half precision",
|
||||
"cube": {
|
||||
"v2Side": 65,
|
||||
"legacySide": 33,
|
||||
"input": "declared camera/LUT code values, sRGB for host-profile mode",
|
||||
"output": "sRGB/Rec.709",
|
||||
"cannotEncode": [
|
||||
"PQ/HLG delivery",
|
||||
"spatial masks/tracking",
|
||||
"temporal/spatial film",
|
||||
"texture/clarity/dehaze and frame-dependent operations"
|
||||
]
|
||||
},
|
||||
"sourceVersion": "11a88518280f0665f3cd0f388d1d66e5446ece14",
|
||||
"errorContract": "NSError is retained across nested render autorelease pools and returned in caller pool; invalid LUT/HDR combinations fail without dangling error objects",
|
||||
"inputLUTSelection": "File is selected and parsed before mode 3 is committed; cancel retains prior state"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"affectedCandidateBuild": "54",
|
||||
"observedIn": "Final Cut Pro 12.4 / formally installed notarized build",
|
||||
"trigger": "Select input LUT mode before assigning a LUT",
|
||||
"exception": "EXC_BAD_ACCESS in objc_msgSend(domain), DYPlugIn.mm renderDestinationImage error logging",
|
||||
"rootCause": "NSError autoreleased inside nested renderer pool did not survive until the FxPlug caller used its out-parameter",
|
||||
"fix": "Preserve error across each pool boundary, including segmented tool rendering; select and prepare LUT before enabling required-resource mode",
|
||||
"validation": "Regression now reads domain and localizedDescription after renderer returns; final live-host verification recorded separately"
|
||||
}
|
||||
@@ -2,14 +2,15 @@
|
||||
"status": "verified",
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.7.4",
|
||||
"build": "52",
|
||||
"version": "1.8.0",
|
||||
"build": "55",
|
||||
"team": "B3W25FX5H5",
|
||||
"notaryID": "673758ed-55f7-418d-8094-d05cf4932111",
|
||||
"notaryID": "ab2b40ea-886f-49fa-8735-aa392e65f036",
|
||||
"notaryStatus": "Accepted",
|
||||
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
|
||||
"sourceCommit": "06a00371dfba6d9857dc75f48121232fb0ea01b8",
|
||||
"sourceCommit": "11a88518280f0665f3cd0f388d1d66e5446ece14",
|
||||
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
|
||||
"templateSHA256": "fe6b9ed9a59e1e00de7bcad4526bc98fa2d5fde5cab490fd65ec999835ab2250",
|
||||
"shaderSHA256": "6ec98b85aeb841f9988a4b66e3e5fba9e34d5ab3d7542c9205b0480c77f9ac6d"
|
||||
"templateSHA256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
|
||||
"shaderSHA256": "52a9630ed3f887a0b5f3678da4330254891b15e88f637204473796736a8b7be1",
|
||||
"hostVerification": "verification/HostColorManagement1.8.0.json"
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"date": "2026-11-03T05:16:05.530977+00:00",
|
||||
"version": "1.8.0",
|
||||
"build": "55",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"system": "27.0.1",
|
||||
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"compiledSource": "11a88518280f0665f3cd0f388d1d66e5446ece14",
|
||||
"nativeChecks": 530,
|
||||
"maximumCPUParityError": 0.001953125,
|
||||
"hostChecks": [
|
||||
"New mode controls and actual linear709 source/destination context",
|
||||
"Legacy mode retained on new and existing state without opt-in",
|
||||
"Mode change undo/redo",
|
||||
"Working exposure and neutral independent primary layer",
|
||||
"Global CMS remains accessible when base primary removed; undo from timeline restores grade",
|
||||
"Camera/ACES with Display P3 output",
|
||||
"LUT mode chooses file before activation; cancel preserves prior camera/P3 state",
|
||||
"Loaded mode3 preset with no LUT: NSError consumed by real FxPlug host; inspector stayed usable",
|
||||
"Same process PID 34001 before and after missing-resource error; no new crash report",
|
||||
"Choosing valid LUT recovers same inspector and renderer",
|
||||
"Mode1 and mode3 presets cold-reopen with identical bytes"
|
||||
],
|
||||
"presetComparisons": [
|
||||
{
|
||||
"before": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/cms-authored-v2-before.json",
|
||||
"bytes": 8896,
|
||||
"sha256": "8794af8534c6e3da25715b423c9ac2d44763951c00ad7e5fe0891e2b94abc565"
|
||||
},
|
||||
"after": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/cms-authored-v2-after.json",
|
||||
"bytes": 8896,
|
||||
"sha256": "8794af8534c6e3da25715b423c9ac2d44763951c00ad7e5fe0891e2b94abc565"
|
||||
},
|
||||
"byteIdentical": true
|
||||
},
|
||||
{
|
||||
"before": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/cms-lut-recovered-before.json",
|
||||
"bytes": 9003,
|
||||
"sha256": "9a0eac72e3c41b26c1553c0a47b3d67acc85e1f63fd2ec4f1c0591805b77a214"
|
||||
},
|
||||
"after": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/cms-lut-recovered-after.json",
|
||||
"bytes": 9003,
|
||||
"sha256": "9a0eac72e3c41b26c1553c0a47b3d67acc85e1f63fd2ec4f1c0591805b77a214"
|
||||
},
|
||||
"byteIdentical": true
|
||||
}
|
||||
],
|
||||
"cube": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/cms-host-export55.cube",
|
||||
"bytes": 9067763,
|
||||
"sha256": "d22fb74c107748d60c35afedbc8597958154b2b4fb1173a04e89efce2402057d",
|
||||
"side": 65,
|
||||
"rows": 274625,
|
||||
"finite": true,
|
||||
"identicalToBuild54": true,
|
||||
"input": "sRGB in host-profile mode",
|
||||
"output": "sRGB/Rec.709"
|
||||
},
|
||||
"render": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/cms-host-render55.mov",
|
||||
"bytes": 16462804,
|
||||
"sha256": "d156b30f69da68e39acca365450a55c7f0872368005bbfb16776b13f8e7992dc",
|
||||
"probe": {
|
||||
"programs": [],
|
||||
"stream_groups": [
|
||||
{
|
||||
"streams": [
|
||||
{
|
||||
"codec_name": "prores",
|
||||
"width": 1920,
|
||||
"height": 1080,
|
||||
"color_space": "bt709",
|
||||
"color_transfer": "bt709",
|
||||
"color_primaries": "bt709",
|
||||
"r_frame_rate": "25/1",
|
||||
"nb_read_frames": "100"
|
||||
},
|
||||
{
|
||||
"r_frame_rate": "0/0"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"streams": [
|
||||
{
|
||||
"codec_name": "prores",
|
||||
"width": 1920,
|
||||
"height": 1080,
|
||||
"color_space": "bt709",
|
||||
"color_transfer": "bt709",
|
||||
"color_primaries": "bt709",
|
||||
"r_frame_rate": "25/1",
|
||||
"nb_read_frames": "100"
|
||||
},
|
||||
{
|
||||
"r_frame_rate": "0/0"
|
||||
}
|
||||
],
|
||||
"format": {
|
||||
"duration": "4.000000",
|
||||
"size": "16462804"
|
||||
}
|
||||
},
|
||||
"decodedFrames": 100,
|
||||
"uniqueDecodedFrameHashes": 1,
|
||||
"identicalDecodedFramesToBuild54": true
|
||||
},
|
||||
"FCPXML": {
|
||||
"inputVersion": "1.12",
|
||||
"roundtripVersion": "1.12",
|
||||
"DTD": true,
|
||||
"projects": 3,
|
||||
"comparison": {
|
||||
"expected_projects": 3,
|
||||
"actual_projects": 3,
|
||||
"status": "compared_fields_match",
|
||||
"differences": [],
|
||||
"scope": "project format/timecode, story timing/identity, static transforms (1e-4 absolute tolerance), title/caption text+role, linear time-map samples, effect references, opaque payload hashes, audio component/volume attributes",
|
||||
"not_covered": "rendered picture/sound, plugin parameter semantics, smooth interpolation, all crop/keyframe/metadata attributes, media/resources not reachable directly inside projects"
|
||||
}
|
||||
},
|
||||
"processObservation": [
|
||||
"34109 /Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit/Contents/MacOS/大鱼调色 XPC Service"
|
||||
],
|
||||
"limitations": [
|
||||
"SDR synthetic chart host acceptance; HDR numerical CPU/GPU tests do not certify an HDR monitor or delivery setup",
|
||||
"FCP 12.4 on this Mac; other host versions not directly exercised",
|
||||
"PKG installation script not rerun; source APP installed and verified independently"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"bundlePath": "/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit",
|
||||
"checks": 436,
|
||||
"checks": 530,
|
||||
"gpu": "Apple M4",
|
||||
"limitations": [
|
||||
"Finite states and a 64x48 frame; live FCP discovery, inspector interaction, timeline persistence and real host export require separate acceptance.",
|
||||
@@ -12,7 +12,7 @@
|
||||
"error": "未提供错误信息",
|
||||
"name": "runtime-directory",
|
||||
"pass": true,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/430B635C-D18D-4437-B92A-D957A1DC73C1"
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/FBA3B728-B160-450E-9D50-3F2DCA624ECA"
|
||||
},
|
||||
{
|
||||
"descriptors": 278,
|
||||
@@ -55,7 +55,7 @@
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"archiveBytes": 659,
|
||||
"archiveBytes": 685,
|
||||
"error": "未提供错误信息",
|
||||
"name": "secure-asset-archive-roundtrip",
|
||||
"pass": true
|
||||
@@ -202,7 +202,7 @@
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "complete-version-six-preset-includes-mesh",
|
||||
"name": "complete-version-seven-preset-includes-mesh",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
@@ -890,7 +890,7 @@
|
||||
"error": "未提供错误信息",
|
||||
"name": "renderer-export-33cube",
|
||||
"pass": true,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/430B635C-D18D-4437-B92A-D957A1DC73C1/diagnostic-export.cube"
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/FBA3B728-B160-450E-9D50-3F2DCA624ECA/diagnostic-export.cube"
|
||||
},
|
||||
{
|
||||
"bytes": 1186074,
|
||||
@@ -910,7 +910,7 @@
|
||||
},
|
||||
{
|
||||
"heartbeats": 0,
|
||||
"maximumGapMS": 89.39395833294839,
|
||||
"maximumGapMS": 77.1040416584583,
|
||||
"name": "external-activation-main-loop-responsive",
|
||||
"pass": true
|
||||
},
|
||||
@@ -994,7 +994,7 @@
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "new-primary-layer-auto-mapping-on-old-omitted-default-stays-off",
|
||||
"name": "new-primary-layer-neutral-old-explicit-mapping-preserved",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
@@ -2242,8 +2242,572 @@
|
||||
{
|
||||
"name": "pen-drawing-actions-visible-only-for-bezier-mask",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-versioned-state-valid",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-secure-archive-independent-opt-in",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-rejects-unknown-output",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "",
|
||||
"name": "cms-v1-reference",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-v1-absent-state",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-v1-absent-state-bit-exact",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-host-profile-neutral-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 4608,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-host-mode-preserves-grey-negative-superwhite-alpha",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 10240,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-four-neutral-primary-layers",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-neutral-primary-layers-do-not-remap",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-709-source-2020-destination",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 3072,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-physical-profile-matrix-and-context-key",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 10240,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-working-exposure",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-one-stop-working-grade-changes-pixels-preserves-alpha",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-zero-mask",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-zero-primary-mask-preserves-input",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-opposite-origin",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-source-destination-origin-contract",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-output-1-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2253,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-output-1-single-ODT-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11250,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-output-2-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2323,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-output-2-single-ODT-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11517,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-output-3-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2367,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-output-3-single-ODT-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11517,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-output-4-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2547,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-output-4-single-ODT-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11236,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-output-5-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2898,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-output-5-single-ODT-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11517,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-output-6-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2587,
|
||||
"maxAbsoluteError": 0.001953125,
|
||||
"name": "cms-output-6-single-ODT-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11775,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-output-7-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2841,
|
||||
"maxAbsoluteError": 0.001953125,
|
||||
"name": "cms-output-7-single-ODT-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11775,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-output-8-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2774,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-output-8-single-ODT-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11517,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-output-9-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 3309,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-output-9-single-ODT-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11517,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-output-10-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2746,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-output-10-single-ODT-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11517,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-1-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 4816,
|
||||
"maxAbsoluteError": 0.00048828125,
|
||||
"name": "cms-input-1-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 12104,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-2-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 5103,
|
||||
"maxAbsoluteError": 0.00048828125,
|
||||
"name": "cms-input-2-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 12174,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-3-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 3000,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-3-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11864,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-4-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 3014,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-4-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11334,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-10-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 5043,
|
||||
"maxAbsoluteError": 0.00048828125,
|
||||
"name": "cms-input-10-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 12288,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-11-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 3505,
|
||||
"maxAbsoluteError": 0.000244140625,
|
||||
"name": "cms-input-11-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11905,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-12-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2533,
|
||||
"maxAbsoluteError": 0.000244140625,
|
||||
"name": "cms-input-12-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 12160,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-13-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 4874,
|
||||
"maxAbsoluteError": 0.00048828125,
|
||||
"name": "cms-input-13-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 12174,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-100-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2870,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-100-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 10613,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-101-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 3310,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-101-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11320,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-102-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2252,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-102-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11418,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-103-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2549,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-103-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11362,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-104-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2887,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-104-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11207,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-105-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 3761,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-105-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 10924,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-106-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2672,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-106-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 10952,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-107-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2955,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-107-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11334,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-108-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2238,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-108-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11221,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-109-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2253,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-109-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11250,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-110-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2211,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-110-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11221,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-111-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2195,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-111-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11221,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-input-112-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 3788,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-input-112-cpu-parity",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 12091,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-camera-identity-LUT-reference",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 0,
|
||||
"maxAbsoluteError": 0,
|
||||
"name": "cms-input-LUT-same-single-input-and-ODT-chain",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11250,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-input-LUT-missing-resource-fails-explicitly",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-print-baseline-p3",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-print-before-p3-output",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-independent-print-before-output",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-root-and-extra-print-same-pre-output-result",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"changedComponents": 2842,
|
||||
"maxAbsoluteError": 0.0009765625,
|
||||
"name": "cms-print-cpu-reference-before-ODT-linear-mix",
|
||||
"nonfiniteComponents": 0,
|
||||
"nonzeroComponents": 11517,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-hdr-refuses-unvalidated-bounded-finishing",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-v2-cube-65-declared-output-contract",
|
||||
"pass": true,
|
||||
"size": 65
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "cms-cube-off-grid-direct-reference",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"maxCodeValueError": 0.004936873912811279,
|
||||
"name": "cms-cube-off-grid-production-error",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"linearGrey": 0.360107421875,
|
||||
"name": "cms-one-stop-grey-photometric-check",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cms-preview-still-available",
|
||||
"pass": true
|
||||
}
|
||||
],
|
||||
"runtimePath": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/430B635C-D18D-4437-B92A-D957A1DC73C1",
|
||||
"runtimePath": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/FBA3B728-B160-450E-9D50-3F2DCA624ECA",
|
||||
"scope": "Native model and renderer integration with real Metal/IOSurface textures and fake FxPlug host selectors; no GUI or live host document."
|
||||
}
|
||||
+16
-16
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.7.4.pkg",
|
||||
"sha256": "bab2cb14229de151f73782e4a9bd54ca34ef47b9dd15ef3590dd1cd95d04fce5",
|
||||
"bytes": 40918925,
|
||||
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.8.0.pkg",
|
||||
"sha256": "fd59203d387122e768090a97851daf3bd7c07193a8073b9497a10c05d5fd6c42",
|
||||
"bytes": 42851034,
|
||||
"testUnsigned": false,
|
||||
"installationExecuted": false,
|
||||
"checks": [
|
||||
@@ -31,34 +31,34 @@
|
||||
"source": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"payload": "Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.7.4",
|
||||
"build": "52"
|
||||
"version": "1.8.0",
|
||||
"build": "55"
|
||||
},
|
||||
{
|
||||
"source": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/pkg-inputs/大鱼调色",
|
||||
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.b633084d-1d48-4173-a03a-c364f66a4ba9/37AE54E5-F282-467A-A036-E2AE0F918129/大鱼调色"
|
||||
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.746989a4-8119-4b88-af02-e861254bd9d2/EF8CD85E-8B1E-47BF-8034-51E5439EF770/大鱼调色"
|
||||
}
|
||||
],
|
||||
"signature": "Package \"大鱼调色-1.7.4.pkg\":\n Status: signed by a developer certificate issued by Apple for distribution\n Notarization: trusted by the Apple notary service\n Signed with a trusted timestamp on: 2026-11-02 15:59:42 +0000\n Certificate Chain:\n 1. Developer ID Installer: zhong luo (B3W25FX5H5)\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n C0 19 01 3C 67 88 8F 34 65 56 C5 91 3C E5 B6 12 4C 5D A6 DA F9 D8 \n DA 00 37 52 DF F0 F3 E6 00 B4\n ------------------------------------------------------------------------\n 2. Developer ID Certification Authority\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n 7A FC 9D 01 A6 2F 03 A2 DE 96 37 93 6D 4A FE 68 09 0D 2D E1 8D 03 \n F2 9C 88 CF B0 B1 BA 63 58 7F\n ------------------------------------------------------------------------\n 3. Apple Root CA\n Expires: 2035-02-09 21:40:36 +0000\n SHA256 Fingerprint:\n B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C \n 68 C5 BE 91 B5 A1 10 01 F0 24",
|
||||
"gatekeeper": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.7.4.pkg: accepted\nsource=Notarized Developer ID",
|
||||
"signature": "Package \"大鱼调色-1.8.0.pkg\":\n Status: signed by a developer certificate issued by Apple for distribution\n Notarization: trusted by the Apple notary service\n Signed with a trusted timestamp on: 2026-11-03 05:16:45 +0000\n Certificate Chain:\n 1. Developer ID Installer: zhong luo (B3W25FX5H5)\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n C0 19 01 3C 67 88 8F 34 65 56 C5 91 3C E5 B6 12 4C 5D A6 DA F9 D8 \n DA 00 37 52 DF F0 F3 E6 00 B4\n ------------------------------------------------------------------------\n 2. Developer ID Certification Authority\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n 7A FC 9D 01 A6 2F 03 A2 DE 96 37 93 6D 4A FE 68 09 0D 2D E1 8D 03 \n F2 9C 88 CF B0 B1 BA 63 58 7F\n ------------------------------------------------------------------------\n 3. Apple Root CA\n Expires: 2035-02-09 21:40:36 +0000\n SHA256 Fingerprint:\n B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C \n 68 C5 BE 91 B5 A1 10 01 F0 24",
|
||||
"gatekeeper": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.8.0.pkg: accepted\nsource=Notarized Developer ID",
|
||||
"pass": true,
|
||||
"scope": "Expanded package structural and payload verification only; no installer scripts executed and no host quit or registration performed.",
|
||||
"notarization": {
|
||||
"createdDate": "2026-11-02T15:59:43.960Z",
|
||||
"status": "Accepted",
|
||||
"name": "大鱼调色-1.8.0.pkg",
|
||||
"message": "Successfully received submission info",
|
||||
"id": "102e93fc-2214-4dbf-8d67-68412464a5c2",
|
||||
"name": "大鱼调色-1.7.4.pkg"
|
||||
"id": "2d32b77f-b825-4119-afcf-372588ad03c1",
|
||||
"status": "Accepted",
|
||||
"createdDate": "2026-11-03T05:16:46.953Z"
|
||||
},
|
||||
"appCompiledSource": "06a00371dfba6d9857dc75f48121232fb0ea01b8",
|
||||
"appBuild": "52",
|
||||
"appCompiledSource": "11a88518280f0665f3cd0f388d1d66e5446ece14",
|
||||
"appBuild": "55",
|
||||
"packageBuilderRemote": "https://dayu.media/git/dayu/pkg-forge.git",
|
||||
"packageBuilderCommit": "eb53707c0e67d8ddeab8c1270bb079f1050cfafe",
|
||||
"templateSHA256": {
|
||||
"大鱼调色.moef": "fe6b9ed9a59e1e00de7bcad4526bc98fa2d5fde5cab490fd65ec999835ab2250",
|
||||
"大鱼调色.moef": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
|
||||
"large.png": "ab12611e8801cff86332ccc505a4cffa0c1120541c2efb9bb9908be2c9fe631a",
|
||||
"small.png": "41fec3138aee904fc39d6982e6fde809243ffec55298dbfe966f4f48d89caf8a"
|
||||
},
|
||||
"installedAppHostAcceptance": "verification/HostLUTLoading.json",
|
||||
"installedAppHostAcceptance": "verification/HostColorManagement1.8.0.json",
|
||||
"installScope": "本轮仅生成并验包,未再次执行系统安装;正式 APP 已有独立宿主验收。"
|
||||
}
|
||||
@@ -3,16 +3,16 @@
|
||||
"repository": "dayu/dayu-color",
|
||||
"repositoryID": 52,
|
||||
"private": false,
|
||||
"tag": "v1.7.3-browser-origin-20261102",
|
||||
"releaseCommit": "f2038f12ebf24ec5c298ba67212e7f7f29afa60c",
|
||||
"releaseID": 379,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.7.3-browser-origin-20261102",
|
||||
"tag": "v1.7.4-tool-deletion-20261103",
|
||||
"releaseCommit": "468d530bf002a34e407bd5e182cb6b90d6df1eb4",
|
||||
"releaseID": 380,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.7.4-tool-deletion-20261103",
|
||||
"prerelease": true,
|
||||
"assetID": 23,
|
||||
"assetName": "大鱼调色-1.7.3.pkg",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.7.3-browser-origin-20261102/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.7.3.pkg",
|
||||
"bytes": 40908193,
|
||||
"sha256": "f7a6a5dbd38139c2d401a85aa83abd36efab076481c73a0c822e220f2c212324",
|
||||
"assetID": 24,
|
||||
"assetName": "大鱼调色-1.7.4.pkg",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.7.4-tool-deletion-20261103/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.7.4.pkg",
|
||||
"bytes": 40918925,
|
||||
"sha256": "bab2cb14229de151f73782e4a9bd54ca34ef47b9dd15ef3590dd1cd95d04fce5",
|
||||
"existingAssetReused": true,
|
||||
"verification": "Authenticated full download SHA-256 and byte count, then beta release/asset read-back; original prerelease metadata preserved.",
|
||||
"credentialSource": "macOS Keychain: dayu-git-api"
|
||||
|
||||
@@ -17,5 +17,8 @@
|
||||
"historicalPackagesPreserved": true,
|
||||
"privateQAFixturesPreserved": true,
|
||||
"buildAppAndNotaryZipCleanedByDelivery": true,
|
||||
"pkgTemporaryPayloadCleanedByPackaging": true
|
||||
"pkgTemporaryPayloadCleanedByPackaging": true,
|
||||
"recoveryCloneRemoved": true,
|
||||
"verifiedBrowserDownloadRemoved": "/Volumes/备份/大鱼调色-1.7.4.pkg",
|
||||
"finalPackagePreserved": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.7.4.pkg"
|
||||
}
|
||||
@@ -6,5 +6,11 @@
|
||||
"fsck": "full strict passed",
|
||||
"lfs": false,
|
||||
"submodules": false,
|
||||
"recoveryClone": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/tool-deletion-recovery"
|
||||
"releaseTag": "v1.7.4-tool-deletion-20261103",
|
||||
"releaseCommit": "468d530bf002a34e407bd5e182cb6b90d6df1eb4",
|
||||
"releaseTagFiles": 384,
|
||||
"releaseTagByteIdentical": true,
|
||||
"compiledProgramSourcesIdentical": true,
|
||||
"releaseTagFsck": "full strict passed",
|
||||
"recoveryCloneCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"tag": "v1.7.4-tool-deletion-20261103",
|
||||
"releaseCommit": "468d530bf002a34e407bd5e182cb6b90d6df1eb4",
|
||||
"releaseID": 380,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.7.4-tool-deletion-20261103",
|
||||
"assetID": 24,
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.7.4-tool-deletion-20261103/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.7.4.pkg",
|
||||
"assetName": "大鱼调色-1.7.4.pkg",
|
||||
"bytes": 40918925,
|
||||
"sha256": "bab2cb14229de151f73782e4a9bd54ca34ef47b9dd15ef3590dd1cd95d04fce5",
|
||||
"draft": true,
|
||||
"prerelease": true,
|
||||
"apiDraftVerified": false,
|
||||
"draftDownloadRequiresNormalBrowserSession": true,
|
||||
"browserFullDownloadVerified": true,
|
||||
"browserDownloadBytes": 40918925,
|
||||
"browserDownloadSHA256": "bab2cb14229de151f73782e4a9bd54ca34ef47b9dd15ef3590dd1cd95d04fce5"
|
||||
}
|
||||
@@ -62,6 +62,8 @@
|
||||
Plugin/DYInspector.mm,
|
||||
Plugin/DYLUTBrowser.mm,
|
||||
Plugin/DYLUTLibrary.mm,
|
||||
Plugin/DYManagedColor.mm,
|
||||
Plugin/DYManagedColorPanel.mm,
|
||||
Plugin/DYModel.mm,
|
||||
Plugin/DYPlugIn.mm,
|
||||
Plugin/DYRenderer.mm,
|
||||
@@ -323,6 +325,7 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = (
|
||||
"set -eu",
|
||||
"/usr/bin/python3 \"$SRCROOT/ColorManagement/build_runtime.py\" \"$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH\"",
|
||||
"/usr/bin/python3 \"$SRCROOT/tools/build_kernels.py\" --output \"$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/default.metallib\" --intermediates \"$DERIVED_FILE_DIR/DayuKernels\"",
|
||||
"/usr/bin/python3 - \"$SRCROOT/大鱼调色/Plugin/Resources\" \"$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH\" <<'PYBUILD'",
|
||||
"import pathlib,shutil,sys",
|
||||
@@ -375,6 +378,7 @@
|
||||
MACH_O_TYPE = mh_execute;
|
||||
MACOSX_DEPLOYMENT_TARGET = 14.6;
|
||||
OTHER_LDFLAGS = (
|
||||
"@/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/cms-runtime/bridge-link.rsp",
|
||||
"$(inherited)",
|
||||
"-framework",
|
||||
Metal,
|
||||
@@ -408,6 +412,7 @@
|
||||
MACH_O_TYPE = mh_execute;
|
||||
MACOSX_DEPLOYMENT_TARGET = 14.6;
|
||||
OTHER_LDFLAGS = (
|
||||
"@/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/cms-runtime/bridge-link.rsp",
|
||||
"$(inherited)",
|
||||
"-framework",
|
||||
Metal,
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#import "DYDiagnostics.h"
|
||||
#import "DYModel.h"
|
||||
#import "DYRenderer.h"
|
||||
#import "DYManagedColor.h"
|
||||
#import "../../ColorManagement/Sources/DYColorProfile.h"
|
||||
#import "DYAutoGrade.h"
|
||||
#import "DYLUTLibrary.h"
|
||||
#import "DYLUTBrowser.h"
|
||||
@@ -93,9 +95,11 @@
|
||||
FxRect _bounds;
|
||||
uint64_t _registry;
|
||||
FxImageOrigin _diagnosticOrigin;
|
||||
CGColorSpaceRef _diagnosticSpace;
|
||||
}
|
||||
- (instancetype)initWithDevice:(id<MTLDevice>)device width:(NSUInteger)width height:(NSUInteger)height;
|
||||
- (void)setDiagnosticImageOrigin:(FxImageOrigin)origin;
|
||||
- (void)setDiagnosticColorSpace:(CGColorSpaceRef)space;
|
||||
@end
|
||||
@implementation DYDiagnosticTile
|
||||
- (instancetype)initWithDevice:(id<MTLDevice>)device width:(NSUInteger)width height:(NSUInteger)height {
|
||||
@@ -111,12 +115,14 @@
|
||||
if(!_surface||!_texture){[self release];return nil;}
|
||||
}return self;
|
||||
}
|
||||
- (void)dealloc {[_texture release];if(_surface)CFRelease(_surface);[super dealloc];}
|
||||
- (void)dealloc {if(_diagnosticSpace)CGColorSpaceRelease(_diagnosticSpace);[_texture release];if(_surface)CFRelease(_surface);[super dealloc];}
|
||||
- (id<MTLTexture>)metalTextureForDevice:(id<MTLDevice>)device {return device.registryID==_registry?_texture:nil;}
|
||||
- (IOSurface *)ioSurface {return (IOSurface *)_surface;}
|
||||
- (FxRect)tilePixelBounds {return _bounds;}
|
||||
- (FxRect)imagePixelBounds {return _bounds;}
|
||||
- (uint64_t)deviceRegistryID {return _registry;}
|
||||
- (CGColorSpaceRef)colorSpace{return _diagnosticSpace;}
|
||||
- (void)setDiagnosticColorSpace:(CGColorSpaceRef)s{if(_diagnosticSpace)CGColorSpaceRelease(_diagnosticSpace);_diagnosticSpace=s?CGColorSpaceRetain(s):nil;}
|
||||
- (FxImageOrigin)imageOrigin {return _diagnosticOrigin;}
|
||||
- (double)pixelAspect{return 1;}
|
||||
- (void)setDiagnosticImageOrigin:(FxImageOrigin)origin {_diagnosticOrigin=origin;}
|
||||
@@ -282,7 +288,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
run.record(@"spider-single-drag-spoke-following-and-pin",dragged.x[0]>initialMesh.x[0]&&dragged.x[1]>initialMesh.x[1]&&dragged.x[3]>initialMesh.x[3]&&dragged.x[4]==initialMesh.x[4]&&dragged.x[5]==initialMesh.x[5]&&dragged.pins[2]);
|
||||
run.record(@"spider-drag-one-host-undo-group",uiHost->_undoStarts==starts+1&&uiHost->_undoEnds==ends+1&&!uiHost->_undoActive);
|
||||
error=nil;NSData *spiderArchive=[NSKeyedArchiver archivedDataWithRootObject:spiderSaved requiringSecureCoding:YES error:&error];DYAssetState *decodedSpider=[NSKeyedUnarchiver unarchivedObjectOfClass:DYAssetState.class fromData:spiderArchive error:&error];run.record(@"spider-archive-retains-mesh-pins-and-lut-paths",decodedSpider&&[decodedSpider isEqual:spiderSaved],@{@"error":reason(error)});
|
||||
NSDictionary *snapshot=[inspector performSelector:@selector(presetSnapshot)];NSData *presetJSON=[NSJSONSerialization dataWithJSONObject:snapshot options:0 error:&error];NSDictionary *decodedPreset=[NSJSONSerialization JSONObjectWithData:presetJSON options:0 error:&error];run.record(@"complete-version-six-preset-includes-mesh",[decodedPreset[@"version"]isEqual:@6]&&[DYSpiderFromJSON(decodedPreset[@"spider"])isEqual:spiderSaved.spiderMesh]);
|
||||
NSDictionary *snapshot=[inspector performSelector:@selector(presetSnapshot)];NSData *presetJSON=[NSJSONSerialization dataWithJSONObject:snapshot options:0 error:&error];NSDictionary *decodedPreset=[NSJSONSerialization JSONObjectWithData:presetJSON options:0 error:&error];run.record(@"complete-version-seven-preset-includes-mesh",[decodedPreset[@"version"]isEqual:@7]&&[DYSpiderFromJSON(decodedPreset[@"spider"])isEqual:spiderSaved.spiderMesh]);
|
||||
NSDictionary *portable=DYSpiderJSON(spiderSaved.spiderMesh,spiderSaved.spiderLinked);NSData *decodedPortable=DYSpiderFromJSON(portable);run.record(@"spider-json-preset-exact-roundtrip",[decodedPortable isEqual:spiderSaved.spiderMesh]);
|
||||
NSMutableDictionary *badJSON=[[portable mutableCopy]autorelease];badJSON[@"hues"]=@7;run.record(@"spider-json-rejects-unsupported-topology",!DYSpiderFromJSON(badJSON));auto corrupt=dragged;corrupt.x[0]=NAN;run.record(@"spider-archive-rejects-nonfinite-coordinates",!DYSpiderMeshIsValid([NSData dataWithBytes:&corrupt length:sizeof(corrupt)]));
|
||||
[disc changeHueCount:12 saturationCount:8];spiderSaved=DYReadAssets(uiHost,kCMTimeZero);auto dense=DYSpiderMesh(spiderSaved.spiderMesh);run.record(@"spider-independent-resolution-and-resample",dense.hues==12&&dense.rings==7&&fabs(dy::meshDelta(dense,0,.6).x)>0);
|
||||
@@ -493,6 +499,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
#include "DYToolCanvasDiagnostics.inc.h"
|
||||
#include "DYToolPenDiagnostics.inc.h"
|
||||
#include "DYMaskPanelDiagnostics.inc.h"
|
||||
#include "DYManagedDiagnostics.inc.h"
|
||||
[gpu release];
|
||||
} @catch(NSException *exception) {
|
||||
run.record(@"diagnostic-exception",false,@{@"exception":exception.name?:@"unknown",@"message":exception.reason?:@"unknown"});
|
||||
|
||||
@@ -6,7 +6,7 @@ kernel void dyFilmPoint(texture2d<float,access::read> source [[texture(0)]],text
|
||||
float4 pixel=source.read(pos);if(!(pixel.a>0)){output.write(pixel,pos);return;}
|
||||
float3 c=pixel.rgb/pixel.a,result=c;DYFilmSettings film=uniforms.film;
|
||||
if(pass.operation==0)result=dyDecode(dyFilmMixer(dyEncode(c),uniforms));
|
||||
else if(pass.operation==1)result=dyDecode(dyFilmSubtractive(dyEncode(c),film));
|
||||
else if(pass.operation==1){float3 code=dyEncode(c);float3 bounded=clamp(code,0.f,1.f);result=dyDecode(dyFilmSubtractive(code,film)+(pass.reserved?code-bounded:float3(0)));}
|
||||
else if(pass.operation==2){float3 b=auxiliary.read(pos).rgb;float3 w=float3(film.boost,film.dyeTransmission/500.f,0);result=(c+b*w)/(1+w);}
|
||||
else if(pass.operation==3)result=c+auxiliary.read(pos).rgb;
|
||||
else if(pass.operation==4)result=dyDecode(dyFilmGrain(dyEncode(c),auxiliary.read(pos).rgb,film));
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
id<MTLComputeCommandEncoder>ce=[commands computeCommandEncoder];[ce setComputePipelineState:entry[name]];[ce setTexture:a atIndex:0];if(b)[ce setTexture:b atIndex:1];[ce setTexture:out atIndex:b?2:1];if(data)[ce setBytes:data length:length atIndex:0];[ce dispatchThreads:MTLSizeMake(out.width,out.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];
|
||||
};
|
||||
id<MTLTexture>current=before;
|
||||
auto point=[&](int operation,id<MTLTexture>aux){id<MTLTexture>out=texture(current==slots[0]?1:0);if(!out)return NO;struct {int operation;float radius;unsigned frameKey,reserved;}pass={operation,0,u.filmFrameKey,0};id<MTLComputeCommandEncoder>ce=[commands computeCommandEncoder];[ce setComputePipelineState:entry[@"dyFilmPoint"]];[ce setTexture:current atIndex:0];[ce setTexture:aux?:current atIndex:1];[ce setTexture:out atIndex:2];[ce setBytes:&u length:sizeof(u) atIndex:0];[ce setBytes:&pass length:sizeof(pass) atIndex:1];[ce dispatchThreads:MTLSizeMake(out.width,out.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];current=out;return YES;};
|
||||
auto point=[&](int operation,id<MTLTexture>aux){id<MTLTexture>out=texture(current==slots[0]?1:0);if(!out)return NO;struct {int operation;float radius;unsigned frameKey,reserved;}pass={operation,0,u.filmFrameKey,_managedFinishing?1u:0u};id<MTLComputeCommandEncoder>ce=[commands computeCommandEncoder];[ce setComputePipelineState:entry[@"dyFilmPoint"]];[ce setTexture:current atIndex:0];[ce setTexture:aux?:current atIndex:1];[ce setTexture:out atIndex:2];[ce setBytes:&u length:sizeof(u) atIndex:0];[ce setBytes:&pass length:sizeof(pass) atIndex:1];[ce dispatchThreads:MTLSizeMake(out.width,out.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];current=out;return YES;};
|
||||
@try{
|
||||
if(mixer){if(!point(0,nil))return fail(error,@"无法分配通道混合缓冲区");}
|
||||
else {
|
||||
|
||||
@@ -325,3 +325,4 @@ kernel void dyToolSkin(texture2d<float,access::read> before [[texture(0)]],textu
|
||||
fragment half4 dyToolCopyFragment(DYRaster in [[stage_in]],texture2d<half> source [[texture(0)]]){constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);return source.sample(f,in.uv);}
|
||||
|
||||
#include "DYFilmKernels.inc.h"
|
||||
#include "DYManagedKernels.inc.h"
|
||||
+19
-10
@@ -1,3 +1,5 @@
|
||||
#import "DYManagedColorPanel.h"
|
||||
#import "DYManagedColor.h"
|
||||
#import "DYInspector.h"
|
||||
#import "../Shared/DYBetaDiagnostics.h"
|
||||
#import "DYModel.h"
|
||||
@@ -415,6 +417,7 @@ static NSImage *DYWheelImage(void) {
|
||||
id<PROAPIAccessing> _manager;
|
||||
NSScrollView *_scroll;
|
||||
DYFlippedView *_document;
|
||||
DYManagedColorPanel *_managedPanel;
|
||||
NSTextField *_brand;
|
||||
NSTextField *_subtitle;
|
||||
NSButton *_resetAll, *_save, *_load, *_export, *_websiteLink;
|
||||
@@ -488,6 +491,7 @@ static NSImage *DYWheelImage(void) {
|
||||
_document=[[DYFlippedView alloc] initWithFrame:NSMakeRect(0,0,360,1000)];
|
||||
_document.accessibilityLabel=@"调色参数";
|
||||
_scroll.documentView=_document; [self addSubview:_scroll];
|
||||
if(!_embedded){_managedPanel=[[DYManagedColorPanel alloc]initWithManager:_manager renderer:_renderer assetTarget:self];[_document addSubview:_managedPanel];}
|
||||
[self buildCards];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(modelChanged:) name:@"DYModelChanged" object:_manager];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(themeChanged:) name:DYThemeDidChange object:nil];
|
||||
@@ -505,7 +509,7 @@ static NSImage *DYWheelImage(void) {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
if(_embedded)[(id)_manager release];[_stackViews release];[_stackOrder release];[_stackRoots release];
|
||||
[_brand release]; [_subtitle release]; [_websiteLink release]; [_resetAll release]; [_save release]; [_load release]; [_export release];[_addModule release];
|
||||
[_scroll release]; [_document release]; [_sections release]; [_cards release]; [_controls release]; [_assetButtons release]; [_graphics release]; [_sampler release];
|
||||
[_managedPanel release];[_scroll release]; [_document release]; [_sections release]; [_cards release]; [_controls release]; [_assetButtons release]; [_graphics release]; [_sampler release];
|
||||
[_browser close];[_browser release];[_renderer release];[_library release];[_themeButtons release];[_tabs release];
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -544,7 +548,7 @@ static NSImage *DYWheelImage(void) {
|
||||
[self setNeedsLayout:YES];NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);
|
||||
}
|
||||
- (void)addLook:(id)sender {_visibleLooks=MIN(5,_visibleLooks+1);[self setNeedsLayout:YES];}
|
||||
- (void)previewChanged:(NSNotification *)note {if(_browser.visible)[_browser updatePreview:[_renderer lookLUTPreview]];}
|
||||
- (void)previewChanged:(NSNotification *)note {[_managedPanel refreshContext];if(_browser.visible)[_browser updatePreview:[_renderer lookLUTPreview]];}
|
||||
- (void)buildCards {
|
||||
NSInteger index=0;
|
||||
for(NSDictionary *section in _sections) {
|
||||
@@ -687,7 +691,8 @@ static NSImage *DYWheelImage(void) {
|
||||
if([row.identifier isEqual:@"toolMasks"])return [(DYToolMaskPanel*)row contentHeight]>0;
|
||||
NSString *key=row.identifier?:@"";NSInteger tab=[_tabs[section]integerValue];
|
||||
if(!_embedded&&[section isEqual:@"base"]&&[key isEqual:@"skinEnabled"])for(NSDictionary *card in _cards)if([card[@"section"][@"key"]isEqual:@"skin"])return ![card[@"removed"]boolValue];
|
||||
if([key isEqual:@"legacyInput"])return [_tabs[@"legacyInput"]boolValue];
|
||||
if([key isEqual:@"legacyInput"])return ![_tabs[@"managedColor"]boolValue]&&[_tabs[@"legacyInput"]boolValue];
|
||||
if([section isEqual:@"primary"]&&[_tabs[@"managedColor"]boolValue]){if([@[@"heading:input",@"heading:output"]containsObject:key])return NO;if([key isEqual:@"cmmix"])return YES;for(NSDictionary*d in DYDescriptors())if([d[@"key"]isEqual:key]&&d[@"cmTab"]&&[d[@"cmTab"]integerValue]!=1)return NO;}
|
||||
if([section isEqual:@"curve"] && ![key isEqual:@"curveGraph"])return NO;
|
||||
if([section isEqual:@"hsl"]) {
|
||||
int axis=0,color=0;if(sscanf(key.UTF8String,"hsl%d_%d",&axis,&color)==2)return color==tab;
|
||||
@@ -700,7 +705,7 @@ static NSImage *DYWheelImage(void) {
|
||||
if([section isEqual:@"look"]){int slot=0;if(sscanf(key.UTF8String,"asset:look%d",&slot)==1)return slot<_visibleLooks;if([key isEqual:@"postLUTStrength"])return YES;int number=0;if(sscanf(key.UTF8String,"look%dStrength",&number)==1)return number-1<_visibleLooks;return NO;}
|
||||
return YES;
|
||||
}
|
||||
- (CGFloat)heightForRow:(NSView *)row {if([row isKindOfClass:DYToolMaskPanel.class])return [(DYToolMaskPanel*)row contentHeight];if([row.identifier isEqual:@"spiderGraph"])return 444;if([row.identifier isEqual:@"primaryBalance"])return 232;if([row.identifier hasPrefix:@"heading:"])return 27;return [row.identifier isEqual:@"curveGraph"]?240:[row.identifier isEqual:@"gradingWheels"]?292:32;}
|
||||
- (CGFloat)heightForRow:(NSView *)row {if([row isKindOfClass:DYManagedColorPanel.class])return [(DYManagedColorPanel*)row contentHeight];if([row isKindOfClass:DYToolMaskPanel.class])return [(DYToolMaskPanel*)row contentHeight];if([row.identifier isEqual:@"spiderGraph"])return 444;if([row.identifier isEqual:@"primaryBalance"])return 232;if([row.identifier hasPrefix:@"heading:"])return 27;return [row.identifier isEqual:@"curveGraph"]?240:[row.identifier isEqual:@"gradingWheels"]?292:32;}
|
||||
- (void)layout {
|
||||
[super layout];
|
||||
CGFloat w=MAX(280,self.bounds.size.width),h=self.bounds.size.height;
|
||||
@@ -713,6 +718,7 @@ static NSImage *DYWheelImage(void) {
|
||||
_addModule.frame=NSMakeRect(16,108,w-32,27);
|
||||
_scroll.frame=_embedded?NSMakeRect(0,0,w,h):NSMakeRect(0,144,w,MAX(80,h-144));
|
||||
CGFloat cw=MAX(244,_scroll.contentSize.width-32),y=8;
|
||||
if(_managedPanel){_managedPanel.frame=NSMakeRect(28,y,cw-24,_managedPanel.contentHeight);y+=_managedPanel.contentHeight+12;}
|
||||
for(NSMutableDictionary *c in _cards) {
|
||||
DYCard *card=c[@"view"];BOOL collapsed=[c[@"collapsed"]boolValue];NSString *key=c[@"section"][@"key"];
|
||||
card.hidden=[c[@"removed"]boolValue];if(card.hidden){y=[self layoutRepeatedToolsAfter:[@"base:" stringByAppendingString:key] y:y width:w];continue;}
|
||||
@@ -804,7 +810,9 @@ static NSImage *DYWheelImage(void) {
|
||||
[(DYMaskCountBadge*)card[@"maskBadge"]setCount:count];NSString *hint=count?[NSString stringWithFormat:@"已有 %lu 个蒙版;点击添加独立蒙版",(unsigned long)count]:@"添加本工具的独立蒙版";
|
||||
[card[@"maskButton"]setToolTip:hint];[card[@"maskButton"]setAccessibilityHelp:hint];
|
||||
}
|
||||
DYAssetState *assets=DYReadAssets(_manager,t);[_spiderPanel setMesh:assets.spiderMesh linked:assets.spiderLinked];
|
||||
DYAssetState *assets=DYReadAssets(_manager,t);_tabs[@"managedColor"]=@((_embedded?DYReadAssets([(DYToolManager*)_manager host],t).colorManagement:assets.colorManagement).count>0);[_managedPanel refreshWithState:assets.colorManagement context:[_renderer colorContext]];[_managedPanel setInputLUTPath:assets.paths[@"input"]];for(NSDictionary *r in _controls.allValues)if([r[@"descriptor"][@"key"]isEqual:@"cmmix"])[r[@"label"]setStringValue:[_tabs[@"managedColor"]boolValue]?@"调色混合":@"CST 混合"];
|
||||
if([_tabs[@"managedColor"]boolValue])for(NSDictionary *c in _cards)if([c[@"section"][@"key"]isEqual:@"primary"]){[c[@"enabled"]setToolTip:@"启停此层一级调色;全局色彩管理保持当前方式"];[c[@"enabled"]setAccessibilityHelp:[c[@"enabled"]toolTip]];}
|
||||
[_spiderPanel setMesh:assets.spiderMesh linked:assets.spiderLinked];
|
||||
double profile=0,configured=0;[get getFloatValue:&profile fromParameter:2013 atTime:t];[get getFloatValue:&configured fromParameter:2236 atTime:t];
|
||||
DYInspectorToken *oldToken=nil;[get getCustomParameterValue:&oldToken fromParameter:DYInspectorParameterID atTime:t];
|
||||
_tabs[@"legacyInput"]=@(configured<.5&&(configured<0||profile>.5||[assets.paths[@"input"]length]||oldToken.schema<2));
|
||||
@@ -1082,15 +1090,15 @@ static NSImage *DYWheelImage(void) {
|
||||
}
|
||||
- (NSDictionary *)presetSnapshot {
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action)return nil;
|
||||
NSMutableDictionary *values=[NSMutableDictionary dictionary];NSDictionary *paths=@{},*spider=nil;NSString *tools=nil;
|
||||
NSMutableDictionary *values=[NSMutableDictionary dictionary];NSDictionary *paths=@{},*spider=nil,*cms=nil;NSString *tools=nil;
|
||||
[action startAction:self];
|
||||
@try {
|
||||
CMTime t=action.currentTime;id<FxParameterRetrievalAPI_v6> get=[_manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];
|
||||
for(NSDictionary *d in DYDescriptors()) {double v=[d[@"default"] doubleValue];[get getFloatValue:&v fromParameter:[d[@"pid"] unsignedIntValue] atTime:t];if(std::isfinite(v))values[d[@"key"]]=@(v);}
|
||||
DYUniforms effective;DYReadUniforms(_manager,t,&effective);values[@"cmConfigured"]=@(effective.cm.configured);values[@"blackWhiteMix"]=@(effective.cm.blackWhiteMix);
|
||||
DYAssetState *state=DYReadAssets(_manager,t);paths=[[state.paths copy]autorelease]?:@{};spider=DYSpiderJSON(state.spiderMesh,state.spiderLinked);NSData *toolData=[NSPropertyListSerialization dataWithPropertyList:DYReadTools(_manager,t).document format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];tools=[toolData base64EncodedStringWithOptions:0];
|
||||
DYAssetState *state=DYReadAssets(_manager,t);paths=[[state.paths copy]autorelease]?:@{};cms=[[state.colorManagement copy]autorelease];spider=DYSpiderJSON(state.spiderMesh,state.spiderLinked);NSData *toolData=[NSPropertyListSerialization dataWithPropertyList:DYReadTools(_manager,t).document format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];tools=[toolData base64EncodedStringWithOptions:0];
|
||||
} @finally {[action endAction:self];}
|
||||
return @{@"format":@"com.dayu.color.preset",@"version":@6,@"values":values,@"paths":paths,@"spider":spider,@"tools":tools?:@""};
|
||||
return @{@"format":@"com.dayu.color.preset",@"version":@7,@"colorManagement":cms?:@{},@"values":values,@"paths":paths,@"spider":spider,@"tools":tools?:@""};
|
||||
}
|
||||
- (void)savePreset:(id)sender {
|
||||
NSDictionary *snapshot=[self presetSnapshot];if(!snapshot)return;
|
||||
@@ -1105,7 +1113,8 @@ static NSImage *DYWheelImage(void) {
|
||||
NSError *error=nil;NSData *data=[NSData dataWithContentsOfURL:panel.URL options:0 error:&error];
|
||||
if(!data||data.length>32*1024*1024){[self showError:error.localizedDescription?:@"预设文件过大"];return;}
|
||||
id json=[NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
|
||||
if(![json isKindOfClass:NSDictionary.class]||![json[@"format"] isEqual:@"com.dayu.color.preset"]||![@[@1,@2,@3,@4,@5,@6]containsObject:json[@"version"]]||![json[@"values"] isKindOfClass:NSDictionary.class]||![json[@"paths"] isKindOfClass:NSDictionary.class]){[self showError:@"这不是有效的大鱼调色预设。"];return;}
|
||||
if(![json isKindOfClass:NSDictionary.class]||![json[@"format"] isEqual:@"com.dayu.color.preset"]||![@[@1,@2,@3,@4,@5,@6,@7]containsObject:json[@"version"]]||![json[@"values"] isKindOfClass:NSDictionary.class]||![json[@"paths"] isKindOfClass:NSDictionary.class]){[self showError:@"这不是有效的大鱼调色预设。"];return;}
|
||||
NSDictionary *newCMS=[json[@"version"]integerValue]>=7?json[@"colorManagement"]:nil;if(newCMS&&(![newCMS isKindOfClass:NSDictionary.class]||([newCMS count]&&!DYManagedColorValid(newCMS,nil)))){[self showError:@"预设色彩管理设置无效,当前调色未修改。"];return;}
|
||||
NSDictionary *values=json[@"values"],*paths=json[@"paths"];NSData *mesh=[json[@"version"]integerValue]>=3?DYSpiderFromJSON(json[@"spider"]):nil;if([json[@"version"]integerValue]>=3&&!mesh){[self showError:@"预设包含无效蜘蛛盘,当前调色未修改。"];return;}
|
||||
NSDictionary *tools=[[[DYToolDocument alloc]init]autorelease].document;if([json[@"version"]integerValue]>=4){id encoded=json[@"tools"];NSData *binary=[encoded isKindOfClass:NSString.class]?[[[NSData alloc]initWithBase64EncodedString:encoded options:0]autorelease]:nil;tools=binary?[NSPropertyListSerialization propertyListWithData:binary options:NSPropertyListImmutable format:NULL error:nil]:nil;if(!DYValidToolDocument(tools)){[self showError:@"预设包含无效工具或蒙版,当前调色未修改。"];return;}}
|
||||
for(NSDictionary *d in DYDescriptors()) {
|
||||
@@ -1126,7 +1135,7 @@ static NSImage *DYWheelImage(void) {
|
||||
CMTime t=action.currentTime;id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];
|
||||
for(NSDictionary *d in DYDescriptors()){id value=values[d[@"key"]];if(!value&&[d[@"offset"]integerValue]>=1104)value=d[@"default"];if(value)[set setFloatValue:[value doubleValue] toParameter:[d[@"pid"]unsignedIntValue] atTime:t];}
|
||||
if([json[@"version"]isEqual:@1]&&!values[@"cmConfigured"]){[set setFloatValue:-1 toParameter:2236 atTime:t];[set setFloatValue:1 toParameter:2270 atTime:t];}
|
||||
DYAssetState *assets=[[[DYAssetState alloc] init] autorelease];assets.paths=validPaths;assets.spiderMesh=mesh;assets.spiderLinked=mesh?[json[@"spider"][@"linked"]boolValue]:YES;DYWriteAssets(_manager,assets,t);DYWriteTools(_manager,tools,t);
|
||||
DYAssetState *assets=[[[DYAssetState alloc] init] autorelease];assets.paths=validPaths;assets.colorManagement=newCMS.count?newCMS:nil;assets.spiderMesh=mesh;assets.spiderLinked=mesh?[json[@"spider"][@"linked"]boolValue]:YES;DYWriteAssets(_manager,assets,t);DYWriteTools(_manager,tools,t);
|
||||
} @finally {[action endAction:self];}
|
||||
[self postChanged];
|
||||
if(missing.count)[self showError:[@"调色参数已恢复,以下 LUT 文件需要重新选择:\n" stringByAppendingString:[missing componentsJoinedByString:@"\n"]]];
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <FxPlug/FxPlugSDK.h>
|
||||
// Separate authoring state; absent state always selects the unchanged v1 renderer.
|
||||
FOUNDATION_EXPORT NSDictionary *DYManagedColorDefaults(void);
|
||||
FOUNDATION_EXPORT BOOL DYManagedColorValid(id state,NSError **error);
|
||||
FOUNDATION_EXPORT NSArray<NSDictionary*> *DYManagedInputSpaces(void);
|
||||
FOUNDATION_EXPORT NSArray<NSDictionary*> *DYManagedOutputSpaces(void);
|
||||
FOUNDATION_EXPORT NSDictionary *DYHostColorContext(FxImageTile *source,FxImageTile *destination,NSInteger primaries);
|
||||
FOUNDATION_EXPORT CGColorSpaceRef DYManagedTileSpace(FxImageTile *tile,NSInteger primaries) CF_RETURNS_RETAINED;
|
||||
@@ -0,0 +1,29 @@
|
||||
#import "DYManagedColor.h"
|
||||
#include "../../ColorManagement/Core/DYColorManagement.hpp"
|
||||
#include <CommonCrypto/CommonDigest.h>
|
||||
#include <cmath>
|
||||
NSDictionary *DYManagedColorDefaults(void){return @{@"version":@2,@"mode":@1,@"input":@109,@"output":@1,@"gamutCompression":@YES,@"engine":@"OpenColorIO-2.5.2",@"config":@"studio-config-v2.2.0_aces-v1.3_ocio-v2.4"};}
|
||||
NSArray<NSDictionary*> *DYManagedInputSpaces(void){NSMutableArray *a=[NSMutableArray array];for(const auto&s:dycm::spaces())[a addObject:@{@"id":@(unsigned(s.id)),@"name":@(s.label)}];return a;}
|
||||
NSArray<NSDictionary*> *DYManagedOutputSpaces(void){NSMutableArray *a=[NSMutableArray array];for(const auto&s:dycm::outputs())[a addObject:@{@"id":@(unsigned(s.id)),@"name":@(s.label)}];return a;}
|
||||
BOOL DYManagedColorValid(id state,NSError **error){
|
||||
BOOL valid=[state isKindOfClass:NSDictionary.class]&&[state count]==7&&[state[@"version"]isEqual:@2]&&[state[@"engine"]isEqual:@"OpenColorIO-2.5.2"]&&[state[@"config"]isEqual:@"studio-config-v2.2.0_aces-v1.3_ocio-v2.4"];
|
||||
for(NSString *key in @[@"mode",@"input",@"output",@"gamutCompression"]){id v=[state isKindOfClass:NSDictionary.class]?state[key]:nil;double n=[v isKindOfClass:NSNumber.class]?[v doubleValue]:NAN;valid&=std::isfinite(n)&&n==floor(n);}
|
||||
if(valid){valid=[@[@1,@2,@3]containsObject:state[@"mode"]]&&[@[@0,@1]containsObject:state[@"gamutCompression"]];BOOL input=NO,output=NO;for(NSDictionary *s in DYManagedInputSpaces())input|=[s[@"id"]isEqual:state[@"input"]];for(NSDictionary *s in DYManagedOutputSpaces())output|=[s[@"id"]isEqual:state[@"output"]];valid&=input&&output;}
|
||||
if(!valid&&error)*error=[NSError errorWithDomain:@"com.dayu.color.cms" code:1 userInfo:@{NSLocalizedDescriptionKey:@"色彩管理设置无效或组件版本不匹配,未修改工程。"}];return valid;
|
||||
}
|
||||
CGColorSpaceRef DYManagedTileSpace(FxImageTile *tile,NSInteger primaries){
|
||||
CGColorSpaceRef space=nil;@try{space=tile.colorSpace;}@catch(NSException *exception){}
|
||||
if(space&&CGColorSpaceGetModel(space)==kCGColorSpaceModelRGB){CGColorSpaceRef device=CGColorSpaceCreateDeviceRGB();BOOL unspecified=CFEqual(space,device);CGColorSpaceRelease(device);if(!unspecified)return CGColorSpaceRetain(space);}
|
||||
if(primaries==kFxColorPrimaries_Rec709)return CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);
|
||||
if(primaries==kFxColorPrimaries_Rec2020)return CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearITUR_2020);
|
||||
return nil;
|
||||
}
|
||||
static NSString *profileLabel(CGColorSpaceRef space){
|
||||
if(!space)return @"未知空间";NSString *name=[(id)CGColorSpaceCopyName(space)autorelease];
|
||||
if([name containsString:@"LinearSRGB"])return @"线性 Rec.709";
|
||||
if([name containsString:@"LinearITUR_2020"])return @"线性 Rec.2020";
|
||||
if([name containsString:@"ACESCGLinear"])return @"线性 ACEScg";
|
||||
return name.length?[name stringByReplacingOccurrencesOfString:@"kCGColorSpace" withString:@""]:@"自定义 RGB 配置";
|
||||
}
|
||||
static NSString *profileKey(CGColorSpaceRef space){if(!space)return @"unknown";CFPropertyListRef p=CGColorSpaceCopyPropertyList(space);NSData *d=p?[NSPropertyListSerialization dataWithPropertyList:(id)p format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil]:nil;if(p)CFRelease(p);if(!d)return @"unknown";unsigned char hash[CC_SHA256_DIGEST_LENGTH];CC_SHA256(d.bytes,(CC_LONG)d.length,hash);NSMutableString*s=[NSMutableString string];for(auto c:hash)[s appendFormat:@"%02x",c];return s;}
|
||||
NSDictionary *DYHostColorContext(FxImageTile *source,FxImageTile *destination,NSInteger primaries){CGColorSpaceRef a=DYManagedTileSpace(source,primaries),b=DYManagedTileSpace(destination,primaries);NSString *an=profileLabel(a),*bn=profileLabel(b);NSDictionary *d=@{@"primaries":@(primaries),@"source":an?:(a?@"自定义 RGB 配置":@"未知空间"),@"destination":bn?:(b?@"自定义 RGB 配置":@"未知空间"),@"sourceKey":profileKey(a),@"destinationKey":profileKey(b),@"processing":@"RGB Linear",@"alpha":@"premultiplied"};if(a)CGColorSpaceRelease(a);if(b)CGColorSpaceRelease(b);return d;}
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <FxPlug/FxPlugSDK.h>
|
||||
@class DYRenderer;
|
||||
@interface DYManagedColorPanel : NSView
|
||||
- (instancetype)initWithManager:(id<PROAPIAccessing>)manager renderer:(DYRenderer*)renderer assetTarget:(id)target;
|
||||
- (void)refreshContext;
|
||||
- (void)setInputLUTPath:(NSString*)path;
|
||||
- (void)refreshWithState:(NSDictionary*)state context:(NSDictionary*)context;
|
||||
- (CGFloat)contentHeight;
|
||||
@end
|
||||
@@ -0,0 +1,51 @@
|
||||
#import "DYManagedColorPanel.h"
|
||||
#import "DYManagedColor.h"
|
||||
#import "DYModel.h"
|
||||
#import "DYRenderer.h"
|
||||
#import "DYTheme.h"
|
||||
@protocol DYManagedAssetTarget <NSObject>
|
||||
- (NSProgress*)setAssetPath:(NSString*)path forKey:(NSString*)key completion:(void(^)(NSError*))completion;
|
||||
@end
|
||||
@implementation DYManagedColorPanel {
|
||||
id<PROAPIAccessing> _manager;id _assetTarget;DYRenderer *_renderer;
|
||||
NSPopUpButton *_mode,*_input,*_output;NSButton *_gamut,*_lut;NSTextField *_inputLabel,*_outputLabel,*_help,*_context;
|
||||
NSDictionary *_state;NSString *_inputLUTPath;NSUInteger _selectionGeneration;BOOL _refreshing;
|
||||
}
|
||||
- (BOOL)isFlipped{return YES;}
|
||||
- (CGFloat)contentHeight{NSInteger m=[_state[@"mode"]integerValue];return m==0?112:m==1?190:302;}
|
||||
static NSTextField *cmsLabel(NSString*s){NSTextField*l=[NSTextField wrappingLabelWithString:s];l.font=[NSFont systemFontOfSize:11];l.textColor=DYThemeColor(@"text");return l;}
|
||||
- (instancetype)initWithManager:(id<PROAPIAccessing>)m renderer:(DYRenderer*)r assetTarget:(id)target {
|
||||
if((self=[super initWithFrame:NSZeroRect])){_manager=m;_renderer=[r retain];_assetTarget=target;self.identifier=@"managedColor";
|
||||
_mode=[[NSPopUpButton alloc]initWithFrame:NSZeroRect];[_mode addItemsWithTitles:@[@"色彩管理 · 旧版兼容",@"色彩管理 · 跟随 FCP",@"相机编码 → ACES",@"输入 LUT → ACES"]];_mode.target=self;_mode.action=@selector(modeChanged:);_mode.accessibilityLabel=@"色彩管理方式";
|
||||
_inputLabel=[cmsLabel(@"输入空间")retain];_outputLabel=[cmsLabel(@"输出目标")retain];
|
||||
_input=[[NSPopUpButton alloc]initWithFrame:NSZeroRect];for(NSDictionary*s in DYManagedInputSpaces()){[_input addItemWithTitle:s[@"name"]];_input.lastItem.representedObject=s[@"id"];} _input.target=self;_input.action=@selector(settingsChanged:);_input.accessibilityLabel=@"新版输入空间";
|
||||
_output=[[NSPopUpButton alloc]initWithFrame:NSZeroRect];for(NSDictionary*s in DYManagedOutputSpaces()){[_output addItemWithTitle:s[@"name"]];_output.lastItem.representedObject=s[@"id"];} _output.target=self;_output.action=@selector(settingsChanged:);_output.accessibilityLabel=@"新版输出目标";
|
||||
_gamut=[[NSButton checkboxWithTitle:@"ACES 参考色域压缩" target:self action:@selector(settingsChanged:)]retain];_gamut.font=[NSFont systemFontOfSize:11];
|
||||
_lut=[[NSButton buttonWithTitle:@"选择输入 LUT…" target:self action:@selector(chooseLUT:)]retain];_lut.bezelStyle=NSBezelStyleRounded;
|
||||
_help=[cmsLabel(@"")retain];_help.textColor=DYThemeColor(@"secondary");_context=[cmsLabel(@"宿主颜色信息将在渲染后显示。")retain];_context.textColor=DYThemeColor(@"secondary");_context.accessibilityLabel=@"当前颜色链路";
|
||||
for(NSView*v in @[_mode,_inputLabel,_input,_outputLabel,_output,_gamut,_lut,_help,_context])[self addSubview:v];[self refreshWithState:nil context:nil];
|
||||
}return self;
|
||||
}
|
||||
- (void)dealloc{[_renderer release];[_state release];[_inputLUTPath release];for(id v in @[_mode,_input,_output,_gamut,_lut,_inputLabel,_outputLabel,_help,_context])[v release];[super dealloc];}
|
||||
- (void)layout{[super layout];CGFloat w=self.bounds.size.width;_mode.frame=NSMakeRect(0,3,w,26);_inputLabel.frame=NSMakeRect(2,36,70,22);_input.frame=NSMakeRect(72,32,w-72,26);_outputLabel.frame=NSMakeRect(2,67,70,22);_output.frame=NSMakeRect(72,63,w-72,26);_gamut.frame=NSMakeRect(0,94,w,22);_lut.frame=NSMakeRect(0,120,w,25);_help.frame=NSMakeRect(2,152,w-4,96);_context.frame=NSMakeRect(2,252,w-4,47);if([_state[@"mode"]integerValue]<2){_help.frame=NSMakeRect(2,36,w-4,90);_context.frame=NSMakeRect(2,132,w-4,54);}}
|
||||
- (void)refreshWithState:(NSDictionary*)s context:(NSDictionary*)context {
|
||||
_refreshing=YES;NSDictionary *saved=[s copy];[_state release];_state=saved;NSInteger mode=s.count?[s[@"mode"]integerValue]:0;[_mode selectItemAtIndex:mode];
|
||||
NSDictionary *values=s.count?s:DYManagedColorDefaults();for(NSMenuItem*i in _input.itemArray)if([i.representedObject isEqual:values[@"input"]])[_input selectItem:i];for(NSMenuItem*i in _output.itemArray)if([i.representedObject isEqual:values[@"output"]])[_output selectItem:i];
|
||||
_input.hidden=_inputLabel.hidden=_output.hidden=_outputLabel.hidden=_gamut.hidden=mode<2;_context.hidden=mode==0;_input.enabled=mode==2||mode==3;_output.enabled=mode==2||mode==3;_gamut.enabled=mode==2||mode==3;_gamut.state=[values[@"gamutCompression"]boolValue];_lut.hidden=mode!=3;_inputLabel.stringValue=mode==3?@"LUT 输出":@"输入空间";_outputLabel.stringValue=mode==1?@"跟随宿主":@"输出目标";
|
||||
_help.stringValue=mode==0?@"保留当前工程的原有颜色。选择新版后,一级层在 ACEScct 中调色,印片位于输出之前;可撤销或切回兼容方式。":mode==1?@"按宿主实际空间处理,不重复还原或映射。顺序:一级层 → 印片 → SDR 修饰。Rec.2020 宿主暂限一级与印片。":mode==2?@"按所选相机编码解释兼容码值。请确认上游未还原、未自动符合;选择准确输入与输出目标。PQ/HLG 仅支持一级与印片,其他工具用于 SDR。":@"使用输入 LUT,并按“LUT 输出”解释其结果;再进入 ACEScct 和所选输出变换。";
|
||||
_context.stringValue=context.count?[NSString stringWithFormat:@"%@ → ACEScct → %@",context[@"source"]?:@"未知",context[@"destination"]?:@"未知"]:@"宿主颜色信息将在渲染后显示。";_refreshing=NO;[self setNeedsLayout:YES];
|
||||
}
|
||||
- (void)setInputLUTPath:(NSString*)path{NSString *saved=[path copy];[_inputLUTPath release];_inputLUTPath=saved;_lut.title=path.length?path.lastPathComponent:@"选择输入 LUT…";_lut.toolTip=path.length?path:@"选择 LUT,并准确指定其输出编码";_lut.accessibilityLabel=path.length?[@"输入 LUT:" stringByAppendingString:path.lastPathComponent]:@"选择输入 LUT";}
|
||||
- (void)refreshContext{[self refreshWithState:_state context:[_renderer colorContext]];}
|
||||
- (void)writeState:(NSDictionary*)state {
|
||||
if(state&&!DYManagedColorValid(state,nil))return;id<FxCustomParameterActionAPI_v4>a=[_manager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{id<FxUndoAPI>undo=[_manager apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"更改色彩管理方式"];DYAssetState*assets=[[DYReadAssets(_manager,a.currentTime)copy]autorelease];assets.colorManagement=state;DYWriteAssets(_manager,assets,a.currentTime);[undo endUndoGroup];}@finally{[a endAction:self];}[_renderer invalidatePreview];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_manager];
|
||||
}
|
||||
- (void)modeChanged:(id)sender {if(_refreshing)return;NSInteger mode=_mode.indexOfSelectedItem;_selectionGeneration++;if(mode==3&&(!_inputLUTPath.length||![NSFileManager.defaultManager fileExistsAtPath:_inputLUTPath])){[self refreshWithState:_state context:[_renderer colorContext]];[self selectInputLUTAndEnable:YES];return;}if(!mode){[self writeState:nil];return;}NSMutableDictionary *s=[[_state?:DYManagedColorDefaults() mutableCopy]autorelease];s[@"mode"]=@(mode);[self writeState:s];}
|
||||
- (void)settingsChanged:(id)sender {if(_refreshing||!_state)return;NSMutableDictionary*s=[[_state mutableCopy]autorelease];s[@"input"]=_input.selectedItem.representedObject;s[@"output"]=_output.selectedItem.representedObject;s[@"gamutCompression"]=@(_gamut.state==NSControlStateValueOn);[self writeState:s];}
|
||||
- (void)selectInputLUTAndEnable:(BOOL)enable {
|
||||
NSUInteger generation=_selectionGeneration;NSOpenPanel *panel=[NSOpenPanel openPanel];panel.allowedFileTypes=@[@"cube"];panel.allowsMultipleSelection=NO;panel.canChooseDirectories=NO;panel.message=@"选择输入 LUT,再指定 LUT 的输出编码";
|
||||
if([panel runModal]!=NSModalResponseOK||!self.window)return;
|
||||
[(id<DYManagedAssetTarget>)_assetTarget setAssetPath:panel.URL.path forKey:@"input" completion:^(NSError *error){if(error||!enable||!self.window||generation!=_selectionGeneration)return;NSMutableDictionary *s=[[(_state?:DYManagedColorDefaults())mutableCopy]autorelease];s[@"mode"]=@3;[self writeState:s];}];
|
||||
}
|
||||
- (void)chooseLUT:(id)sender {[self selectInputLUTAndEnable:NO];}
|
||||
@end
|
||||
@@ -0,0 +1,54 @@
|
||||
// Actual production entry points and independent CPU/profile reference vectors.
|
||||
{
|
||||
DYRenderer *cmsRenderer=[[[DYRenderer alloc]init]autorelease];DYToolDocument *empty=[[[DYToolDocument alloc]init]autorelease];
|
||||
NSMutableDictionary *state=[[DYManagedColorDefaults()mutableCopy]autorelease];
|
||||
run.need(@"cms-versioned-state-valid",DYManagedColorValid(state,nil)&&!DYManagedColorValid(@"bad",nil));
|
||||
DYAssetState *saved=[[[DYAssetState alloc]init]autorelease];saved.colorManagement=state;NSData *archive=[NSKeyedArchiver archivedDataWithRootObject:saved requiringSecureCoding:YES error:&error];DYAssetState *restored=[NSKeyedUnarchiver unarchivedObjectOfClass:DYAssetState.class fromData:archive error:&error];
|
||||
run.record(@"cms-secure-archive-independent-opt-in",[saved isEqual:restored]&&[restored.colorManagement isEqual:state]&&![[[DYAssetState alloc]init]autorelease].colorManagement);
|
||||
NSMutableDictionary *invalid=[[state mutableCopy]autorelease];invalid[@"output"]=@999;run.record(@"cms-rejects-unknown-output",!DYManagedColorValid(invalid,nil));
|
||||
DYUniforms u=defaults;u.skinProtection.x=0; // No grade is applied by default in the new working domain.
|
||||
Pixels probe(width*height*4);float vectors[][4]={{.18,.18,.18,1},{2,1.2,.3,1},{-.03,.1,.2,1},{.03,.01,.005,.1},{0,0,0,0},{.7,.2,.05,1}};
|
||||
for(size_t i=0;i<width*height;i++)for(int c=0;c<4;c++)probe[i*4+c]=vectors[i%6][c];
|
||||
auto upload=[&](const Pixels&p){[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:p.data() bytesPerRow:width*8];};upload(probe);
|
||||
auto managed=[&](NSDictionary *s,DYUniforms v,NSDictionary *doc,NSString *name){NSError *e=nil;BOOL ok=[cmsRenderer renderSource:source destination:destination uniforms:v paths:@{} spider:nil tools:doc colorManagement:s hostPrimaries:kFxColorPrimaries_Rec709 error:&e];run.need(name,ok,@{@"error":reason(e)});return read(destination,gpu);};
|
||||
Pixels old=render(run,cmsRenderer,source,destination,gpu,u,@{},@"cms-v1-reference");Pixels compatibility=managed(nil,u,empty.document,@"cms-v1-absent-state");run.record(@"cms-v1-absent-state-bit-exact",difference(old,compatibility).maximum==0);
|
||||
Pixels host=managed(state,u,empty.document,@"cms-host-profile-neutral-render");run.record(@"cms-host-mode-preserves-grey-negative-superwhite-alpha",difference(probe,host).maximum<.004&&difference(probe,host).nonfinite==0,measure(difference(probe,host)));
|
||||
NSMutableDictionary *layers=DYMutablePlist(empty.document);for(int i=0;i<4;i++)DYInsertTool(layers,@"primary",@"base:primary");Pixels repeated=managed(state,u,layers,@"cms-four-neutral-primary-layers");run.record(@"cms-neutral-primary-layers-do-not-remap",difference(host,repeated).maximum==0);
|
||||
// All real physical profiles are interpreted, and src/dst keys cannot alias.
|
||||
CGColorSpaceRef a=CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB),b=CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearITUR_2020);[source setDiagnosticColorSpace:a];[destination setDiagnosticColorSpace:b];Pixels physical=managed(state,u,empty.document,@"cms-709-source-2020-destination");
|
||||
DYColorProfile *p=[[[DYColorProfile alloc]initWithSource:a target:b error:&error]autorelease];std::vector<DYCompositeRGBA>reference(width*height);for(size_t i=0;i<reference.size();i++)reference[i]={(float)probe[i*4],(float)probe[i*4+1],(float)probe[i*4+2],(float)probe[i*4+3]};auto converted=[p convertPixels:reference alpha:dycm::Alpha::Premultiplied budget:64*1024*1024 cancelled:nullptr error:&error];Pixels expected(probe.size());if(converted)for(size_t i=0;i<reference.size();i++){auto c=(*converted)[i];expected[i*4]=c.r;expected[i*4+1]=c.g;expected[i*4+2]=c.b;expected[i*4+3]=c.a;}
|
||||
NSDictionary *context=[cmsRenderer colorContext];run.record(@"cms-physical-profile-matrix-and-context-key",converted&&difference(physical,expected).maximum<.004&&![context[@"sourceKey"]isEqual:context[@"destinationKey"]],measure(difference(physical,expected)));[source setDiagnosticColorSpace:nil];[destination setDiagnosticColorSpace:nil];CGColorSpaceRelease(a);CGColorSpaceRelease(b);
|
||||
// Working grade has one exposure operation; a zero mask is an exact bypass.
|
||||
DYUniforms grade=u;grade.cm.exposure=1;Pixels exposed=managed(state,grade,empty.document,@"cms-working-exposure");run.record(@"cms-one-stop-working-grade-changes-pixels-preserves-alpha",difference(host,exposed).different>20&&difference(exposed,exposed).nonfinite==0&&exposed[3]==host[3]);
|
||||
NSMutableDictionary *mask=DYMutablePlist(DYNewMask(DYMaskRectangle));DYMaskParameters mp=DYMaskAtTime(mask,kCMTimeZero);mp.strength=0;mask[@"parameters"]=[NSData dataWithBytes:&mp length:sizeof(mp)];NSMutableDictionary *masked=DYMutablePlist(empty.document);masked[@"baseMasks"][@"primary"]=@[mask];Pixels zero=managed(state,grade,masked,@"cms-zero-mask");run.record(@"cms-zero-primary-mask-preserves-input",difference(zero,host).maximum==0);
|
||||
// Frame orientation is normalized at the actual host destination boundary.
|
||||
[destination setDiagnosticImageOrigin:kFxImageOrigin_BOTTOM_LEFT];Pixels flipped=managed(state,u,empty.document,@"cms-opposite-origin");BOOL orientation=YES;for(NSUInteger y=0;y<height;y++)for(NSUInteger x=0;x<width*4;x++)orientation&=fabs((float)flipped[y*width*4+x]-(float)host[(height-1-y)*width*4+x])<.004;run.record(@"cms-source-destination-origin-contract",orientation);[destination setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];
|
||||
// Declared code values -> OCIO input -> exactly one ODT -> physical host output.
|
||||
// CPU reference omits all renderer code; this catches repeated display mapping.
|
||||
Pixels codes(width*height*4);for(size_t i=0;i<width*height;i++){float v=.04f+.8f*float(i%31)/30;for(int c=0;c<3;c++){float channel=i%7?v:(.05f+.7f*float((i*(3+c*4)+c*7)%31)/30);codes[i*4+c]=powf((channel+.055f)/1.055f,2.4f);}codes[i*4+3]=i%7?.5:1;for(int c=0;c<3;c++)codes[i*4+c]*=codes[i*4+3];}upload(codes);state[@"mode"]=@2;
|
||||
auto cpuInput=[&](){std::vector<DYCompositeRGBA>r(width*height);for(size_t i=0;i<r.size();i++){float alpha=codes[i*4+3],c[3];for(int k=0;k<3;k++){float v=(float)codes[i*4+k]/alpha;c[k]=v<=.0031308f?v*12.92f:1.055f*powf(v,1/2.4f)-.055f;}r[i]={c[0]*alpha,c[1]*alpha,c[2]*alpha,alpha};}dycm::Transform::convert(dycm::Space([state[@"input"]unsignedIntValue]),dycm::Space::ACEScct).apply(r,dycm::Alpha::Premultiplied);return r;};
|
||||
auto cpuOutput=[&](std::vector<DYCompositeRGBA>r,int output){dycm::Transform::display(dycm::Space::ACEScct,dycm::Output(output),true).apply(r,dycm::Alpha::Premultiplied);CGColorSpaceRef target=CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);DYColorProfile *profile=[[[DYColorProfile alloc]initWithDisplayOutput:dycm::Output(output) target:target error:&error]autorelease];CGColorSpaceRelease(target);auto out=[profile convertPixels:r alpha:dycm::Alpha::Premultiplied budget:64*1024*1024 cancelled:nullptr error:&error];Pixels result(codes.size());if(out)for(size_t i=0;i<r.size();i++){auto c=(*out)[i];result[i*4]=c.r;result[i*4+1]=c.g;result[i*4+2]=c.b;result[i*4+3]=c.a;}return result;};
|
||||
for(int output=1;output<=10;output++){@autoreleasepool{state[@"output"]=@(output);Pixels gpuFrame=managed(state,u,empty.document,[NSString stringWithFormat:@"cms-output-%d-render",output]);Pixels ref=cpuOutput(cpuInput(),output);Difference d=difference(ref,gpuFrame);run.record([NSString stringWithFormat:@"cms-output-%d-single-ODT-cpu-parity",output],d.maximum<.02&&d.nonfinite==0,measure(d));}}
|
||||
state[@"output"]=@1;
|
||||
for(NSDictionary *inputSpace in DYManagedInputSpaces()){@autoreleasepool{state[@"input"]=inputSpace[@"id"];Pixels gpuFrame=managed(state,u,empty.document,[NSString stringWithFormat:@"cms-input-%@-render",inputSpace[@"id"]]);Difference delta=difference(gpuFrame,cpuOutput(cpuInput(),1));run.record([NSString stringWithFormat:@"cms-input-%@-cpu-parity",inputSpace[@"id"]],delta.nonfinite==0&&delta.maximum<.01,measure(delta));}}state[@"input"]=@109;
|
||||
// Identity input LUT must be the same declared-input path, not an extra DRT.
|
||||
NSString *identityPath=[runtime stringByAppendingPathComponent:@"cms-identity-input.cube"];NSMutableString *identity=[NSMutableString stringWithString:@"LUT_3D_SIZE 2\n"];for(int z=0;z<2;z++)for(int y=0;y<2;y++)for(int x=0;x<2;x++)[identity appendFormat:@"%d %d %d\n",x,y,z];[identity writeToFile:identityPath atomically:YES encoding:NSUTF8StringEncoding error:&error];
|
||||
state[@"output"]=@1;Pixels camera=managed(state,u,empty.document,@"cms-camera-identity-LUT-reference");state[@"mode"]=@3;error=nil;BOOL lutOK=[cmsRenderer renderSource:source destination:destination uniforms:u paths:@{@"input":identityPath} spider:nil tools:empty.document colorManagement:state hostPrimaries:kFxColorPrimaries_Rec709 error:&error];Difference lutDelta=difference(camera,read(destination,gpu));run.record(@"cms-input-LUT-same-single-input-and-ODT-chain",lutOK&&lutDelta.maximum<.001&&lutDelta.nonfinite==0,measure(lutDelta));error=nil;BOOL missingLUT=[cmsRenderer renderSource:source destination:destination uniforms:u paths:@{} spider:nil tools:empty.document colorManagement:state hostPrimaries:kFxColorPrimaries_Rec709 error:&error];run.record(@"cms-input-LUT-missing-resource-fails-explicitly",!missingLUT&&[error.domain isEqual:@"com.dayu.color"]&&error.localizedDescription.length>0);state[@"mode"]=@2;
|
||||
state[@"output"]=@3;DYUniforms print=u;print.filmPrint.x=1;print.filmPrint.y=.6;print.film.mix=.8;Pixels base=managed(state,u,empty.document,@"cms-print-baseline-p3"),printed=managed(state,print,empty.document,@"cms-print-before-p3-output");
|
||||
NSMutableDictionary *printDoc=DYMutablePlist(empty.document),*printNode=(id)DYInsertTool(printDoc,@"film",@"base:film");printNode[@"values"][@"filmPrintLook"]=@1;printNode[@"values"][@"filmPrintStrength"]=@.6;printNode[@"values"][@"filmMix"]=@.8;Pixels extraPrint=managed(state,u,printDoc,@"cms-independent-print-before-output");run.record(@"cms-root-and-extra-print-same-pre-output-result",difference(printed,extraPrint).maximum==0&&difference(printed,base).different>20);
|
||||
// A CPU tetrahedral lookup in AP1/ACEScct, mixed in AP1 linear, then ODT.
|
||||
std::vector<float>look;NSUInteger lookSide=0;NSString *lookPath=[[NSBundle bundleForClass:renderer.class]pathForResource:@"kodak_2383" ofType:@"dylut" inDirectory:@"PrintLooks"];
|
||||
BOOL readLook=DYLUTReadCube(lookPath,look,lookSide,&error);auto scene=cpuInput();
|
||||
if(readLook)for(auto &pixel:scene){if(!(pixel.a>0))continue;float c[3]={pixel.r/pixel.a,pixel.g/pixel.a,pixel.b/pixel.a},f[3];int cell[3],axis[3]={0,1,2};for(int k=0;k<3;k++){float x=fmaxf(0,fminf(1,c[k]))*(lookSide-1);cell[k]=MIN((int)floorf(x),(int)lookSide-2);f[k]=x-cell[k];}std::sort(axis,axis+3,[&](int x,int y){return f[x]>f[y];});
|
||||
float weights[4]={1-f[axis[0]],f[axis[0]]-f[axis[1]],f[axis[1]]-f[axis[2]],f[axis[2]]},value[3]={};for(int j=0;j<4;j++){size_t offset=((cell[2]*lookSide+cell[1])*lookSide+cell[0])*4;for(int k=0;k<3;k++)value[k]+=look[offset+k]*weights[j];if(j<3)cell[axis[j]]++;}float out[3];for(int k=0;k<3;k++)out[k]=dyPrintCCTEncode(dyPrintCCTDecode(c[k])*.52f+dyPrintCCTDecode(value[k])*.48f)*pixel.a;pixel.r=out[0];pixel.g=out[1];pixel.b=out[2];}
|
||||
Difference printDelta=difference(printed,cpuOutput(scene,3));run.record(@"cms-print-cpu-reference-before-ODT-linear-mix",readLook&&printDelta.maximum<.01&&printDelta.nonfinite==0,measure(printDelta));
|
||||
state[@"output"]=@6;DYUniforms bounded=u;bounded.hslHueA.x=20;NSError *blocked=nil;BOOL hdr=[cmsRenderer renderSource:source destination:destination uniforms:bounded paths:@{} spider:nil tools:empty.document colorManagement:state hostPrimaries:kFxColorPrimaries_Rec709 error:&blocked];run.record(@"cms-hdr-refuses-unvalidated-bounded-finishing",!hdr&&[blocked.domain isEqual:@"com.dayu.color"]&&blocked.localizedDescription.length>0);
|
||||
state[@"output"]=@1;NSURL *cube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"cms-v2.cube"]];error=nil;BOOL exportOK=[cmsRenderer exportLUT:cube uniforms:u paths:@{} spider:nil tools:empty.document colorManagement:state error:&error];std::vector<float>table;NSUInteger size=0;BOOL parse=exportOK&&DYLUTReadCube(cube.path,table,size,&error);run.record(@"cms-v2-cube-65-declared-output-contract",parse&&size==65,@{@"error":reason(error),@"size":@(size)});
|
||||
// Static Cube interpolation at off-grid values must match the complete path.
|
||||
Pixels direct=managed(state,u,empty.document,@"cms-cube-off-grid-direct-reference");double cubeError=0;
|
||||
if(parse)for(size_t i=0;i<width*height;i++){float alpha=codes[i*4+3];float coord[3],f[3];int cell[3];for(int k=0;k<3;k++){float linear=(float)codes[i*4+k]/alpha;coord[k]=linear<=.0031308f?linear*12.92f:1.055f*powf(linear,1/2.4f)-.055f;float x=coord[k]*(size-1);cell[k]=MIN((int)floorf(x),(int)size-2);f[k]=x-cell[k];}for(int k=0;k<3;k++){float value=0;for(int z=0;z<2;z++)for(int y=0;y<2;y++)for(int x=0;x<2;x++){float weight=(x?f[0]:1-f[0])*(y?f[1]:1-f[1])*(z?f[2]:1-f[2]);value+=table[(((cell[2]+z)*size+cell[1]+y)*size+cell[0]+x)*4+k]*weight;}float linear=(float)direct[i*4+k]/alpha;float expected=linear<=.0031308f?linear*12.92f:1.055f*powf(linear,1/2.4f)-.055f;cubeError=MAX(cubeError,fabs(value-expected));}}
|
||||
run.record(@"cms-cube-off-grid-production-error",parse&&cubeError<.015,@{@"maxCodeValueError":@(cubeError)});
|
||||
run.record(@"cms-one-stop-grey-photometric-check",fabs((float)exposed[0]-.36f)<.005,@{@"linearGrey":@((float)exposed[0])});
|
||||
run.record(@"cms-preview-still-available",cmsRenderer.preview.length==320*180*16);
|
||||
upload(input);[source setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];[destination setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// V2 working images store premultiplied ACEScct/AP1 code values in float32.
|
||||
inline float3 dyManagedDecode(float3 c){return float3(dyPrintCCTDecode(c.r),dyPrintCCTDecode(c.g),dyPrintCCTDecode(c.b));}
|
||||
inline float3 dyManagedEncode(float3 c){return float3(dyPrintCCTEncode(c.r),dyPrintCCTEncode(c.g),dyPrintCCTEncode(c.b));}
|
||||
kernel void dyManagedCopy(texture2d<float,access::read> a [[texture(0)]],texture2d<float,access::write> b [[texture(1)]],uint2 p [[thread_position_in_grid]]){if(any(p>=uint2(b.get_width(),b.get_height())))return;b.write(a.read(p),p);}
|
||||
kernel void dyManagedBasis(texture2d<float,access::read> a [[texture(0)]],texture2d<float,access::write> b [[texture(1)]],constant BasisParams& settings [[buffer(0)]],constant float& amount [[buffer(1)]],uint2 p [[thread_position_in_grid]]){
|
||||
if(any(p>=uint2(b.get_width(),b.get_height())))return;float4 c=a.read(p);if(!(c.a>0)||amount<=0){b.write(c,p);return;}
|
||||
float3 raw=c.rgb/c.a,result=basis_air(half4(half3(raw),1.h),settings).rgb;
|
||||
float3 mixed=amount>=1?result:dyManagedEncode(mix(dyManagedDecode(raw),dyManagedDecode(result),amount));b.write(float4(mixed*c.a,c.a),p);
|
||||
}
|
||||
kernel void dyManagedPrint(texture2d<float,access::read> a [[texture(0)]],texture3d<float,access::read> cube [[texture(1)]],texture2d<float,access::write> b [[texture(2)]],constant float& amount [[buffer(0)]],uint2 p [[thread_position_in_grid]]){
|
||||
if(any(p>=uint2(b.get_width(),b.get_height())))return;float4 c=a.read(p);if(!(c.a>0)||amount<=0){b.write(c,p);return;}float3 raw=c.rgb/c.a,result=dyPrintTetra(cube,raw);
|
||||
b.write(float4(dyManagedEncode(mix(dyManagedDecode(raw),dyManagedDecode(result),amount))*c.a,c.a),p);
|
||||
}
|
||||
kernel void dyManagedBlend(texture2d<float,access::read> before [[texture(0)]],texture2d<float,access::read> after [[texture(1)]],texture2d<float,access::write> output [[texture(2)]],device const DYToolMaskEntry* masks [[buffer(0)]],constant DYToolMaskHeader& h [[buffer(1)]],uint2 p [[thread_position_in_grid]]){
|
||||
if(any(p>=uint2(output.get_width(),output.get_height())))return;float4 a=before.read(p),b=after.read(p);if(!(a.a>0)||!(b.a>0)){output.write(a,p);return;}
|
||||
float3 ac=dyManagedDecode(a.rgb/a.a),bc=dyManagedDecode(b.rgb/b.a);float2 uv=(float2(p)+.5f)/float2(output.get_width(),output.get_height());
|
||||
float w=dyToolCoverage(uv,dyToolEncode(dyPrintFromAP1(ac)),masks,h,h.section);if(w<=0){output.write(a,p);return;}if(w>=1){output.write(b,p);return;}
|
||||
output.write(float4(dyManagedEncode(mix(ac,bc,w))*a.a,a.a),p);
|
||||
}
|
||||
// Explicit code-value carrier for expert camera/LUT input. Host-profile mode
|
||||
// never uses this reinterpretation; it converts the actual source ICC instead.
|
||||
kernel void dyManagedCarrier(texture2d<float,access::read> a [[texture(0)]],texture2d<float,access::write> b [[texture(1)]],texture3d<float,access::read> cube [[texture(2)]],constant uint& useLUT [[buffer(0)]],uint2 p [[thread_position_in_grid]]){
|
||||
if(any(p>=uint2(b.get_width(),b.get_height())))return;float4 c=a.read(p);if(c.a>0){float3 v=dyEncode(c.rgb/c.a);if(useLUT)v=dyPrintTetra(cube,v);c.rgb=v*c.a;}b.write(c,p);
|
||||
}
|
||||
|
||||
fragment float4 dyManagedCopyFragment(DYRaster in [[stage_in]],texture2d<float> source [[texture(0)]]){constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);return source.sample(f,in.uv);}
|
||||
|
||||
kernel void dyManagedPreview(texture2d<float> a [[texture(0)]],device float4* out [[buffer(0)]],uint2 p [[thread_position_in_grid]]){if(any(p>=uint2(320,180)))return;constexpr sampler s(coord::normalized,address::clamp_to_edge,filter::linear);float4 c=a.sample(s,(float2(p)+.5f)/float2(320,180));out[p.y*320+p.x]=float4(c.a>0?dyEncode(c.rgb/c.a):float3(0),c.a);}
|
||||
@@ -0,0 +1,70 @@
|
||||
- (void)managedPreview:(id<MTLTexture>)texture origin:(FxImageOrigin)origin entry:(NSMutableDictionary*)entry {
|
||||
@synchronized(_previewLock){if(_exporting||CACurrentMediaTime()-_lastPreview<=.5)return;}
|
||||
id<MTLComputePipelineState>p=[self managedKernel:@"dyManagedPreview" entry:entry error:nil];if(!p)return;
|
||||
id<MTLBuffer>b=[entry[@"device"]newBufferWithLength:320*180*16 options:MTLResourceStorageModeShared];if(!b)return;
|
||||
id<MTLCommandBuffer>cb=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:p];[ce setTexture:texture atIndex:0];[ce setBuffer:b offset:0 atIndex:0];[ce dispatchThreads:MTLSizeMake(320,180,1) threadsPerThreadgroup:MTLSizeMake(8,8,1)];[ce endEncoding];[cb commit];[cb waitUntilCompleted];
|
||||
if(cb.status==MTLCommandBufferStatusCompleted){@synchronized(_previewLock){[_preview release];_preview=[[NSData alloc]initWithBytes:b.contents length:b.length];[_lookLUTPreview release];if(origin==kFxImageOrigin_BOTTOM_LEFT){NSMutableData *flipped=[NSMutableData dataWithLength:b.length];for(NSUInteger y=0;y<180;y++)memcpy((uint8_t*)flipped.mutableBytes+y*320*16,(uint8_t*)b.contents+(179-y)*320*16,320*16);_lookLUTPreview=[flipped copy];}else _lookLUTPreview=[_preview retain];_lastPreview=CACurrentMediaTime();}dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYPreviewDidChange" object:self];});}[b release];
|
||||
}
|
||||
// Included in DYRenderer. V1 callers and their ABI remain on renderSource:...tools:error:.
|
||||
- (NSDictionary*)colorContext {@synchronized(_previewLock){return [[_colorContext copy]autorelease];}}
|
||||
- (id<MTLComputePipelineState>)managedKernel:(NSString*)name entry:(NSMutableDictionary*)entry error:(NSError**)error {
|
||||
NSMutableDictionary *cache=entry[@"managedKernels"];if(!cache){cache=[NSMutableDictionary dictionary];entry[@"managedKernels"]=cache;}
|
||||
id<MTLComputePipelineState>pipeline=cache[name];if(!pipeline){id<MTLFunction>f=[entry[@"library"]newFunctionWithName:name];if(!f){fail(error,[@"色彩管理内核缺失:" stringByAppendingString:name]);return nil;}pipeline=[entry[@"device"]newComputePipelineStateWithFunction:f error:error];[f release];if(!pipeline)return nil;cache[name]=pipeline;[pipeline release];}return pipeline;
|
||||
}
|
||||
- (BOOL)managedDispatch:(NSString*)name textures:(NSArray*)textures data:(const void*)data length:(NSUInteger)length extra:(const void*)extra extraLength:(NSUInteger)extraLength entry:(NSMutableDictionary*)entry error:(NSError**)error {
|
||||
id<MTLComputePipelineState>pipeline=[self managedKernel:name entry:entry error:error];if(!pipeline)return NO;
|
||||
id<MTLCommandBuffer>cb=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:pipeline];for(NSUInteger i=0;i<textures.count;i++)[ce setTexture:textures[i] atIndex:i];if(data)[ce setBytes:data length:length atIndex:0];if(extra)[ce setBytes:extra length:extraLength atIndex:1];id<MTLTexture>t=textures[0];[ce dispatchThreads:MTLSizeMake(t.width,t.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];[cb commit];[cb waitUntilCompleted];return cb.status==MTLCommandBufferStatusCompleted?YES:fail(error,cb.error.localizedDescription);
|
||||
}
|
||||
- (BOOL)managedConvert:(dycm::Space)from to:(dycm::Space)to display:(NSInteger)display gamut:(BOOL)gamut input:(id<MTLTexture>)input output:(id<MTLTexture>)output entry:(NSMutableDictionary*)entry error:(NSError**)error {
|
||||
static std::mutex guard;static std::map<std::string,dycm::Transform>plans;
|
||||
std::string key=std::to_string(unsigned(from))+":"+std::to_string(unsigned(to))+":"+std::to_string(display)+":"+std::to_string(gamut);
|
||||
dycm::Transform transform=[&]{std::lock_guard<std::mutex>lock(guard);auto i=plans.find(key);if(i!=plans.end())return i->second;auto t=display?dycm::Transform::display(from,dycm::Output(display),gamut):dycm::Transform::convert(from,to);if(plans.size()>=48)plans.clear();plans.emplace(key,t);return t;}();
|
||||
DYColorManagementGPU*p=[[DYColorManagementGPUCache sharedCache]pipelineWithDevice:entry[@"device"] transform:transform resourceBudget:128*1024*1024 error:error];if(!p)return NO;id<MTLCommandBuffer>cb=[entry[@"queue"]commandBuffer];if(![p encodeInput:input output:output alpha:dycm::Alpha::Premultiplied commandBuffer:cb workspaceBudget:2ull*1024*1024*1024 error:error])return NO;[cb commit];[cb waitUntilCompleted];return cb.status==MTLCommandBufferStatusCompleted?YES:fail(error,cb.error.localizedDescription);
|
||||
}
|
||||
- (BOOL)managedProfile:(DYColorProfile*)profile input:(id<MTLTexture>)input output:(id<MTLTexture>)output entry:(NSMutableDictionary*)entry error:(NSError**)error {
|
||||
if(!profile)return NO;NSMutableDictionary*cache=entry[@"managedProfiles"];if(!cache){cache=[NSMutableDictionary dictionary];entry[@"managedProfiles"]=cache;}DYColorProfileGPU*p=cache[profile.key];if(!p){p=[[[DYColorProfileGPU alloc]initWithDevice:entry[@"device"] profile:profile error:error]autorelease];if(!p)return NO;if(cache.count>=16)[cache removeAllObjects];cache[profile.key]=p;}return [p renderInput:input output:output alpha:dycm::Alpha::Premultiplied workspaceBudget:2ull*1024*1024*1024 cancelled:nullptr error:error];
|
||||
}
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools colorManagement:(NSDictionary*)state hostPrimaries:(NSInteger)primaries error:(NSError**)error {@synchronized(self){return DYRenderWithPool(error,[&]()->BOOL{
|
||||
if(state&&![state isKindOfClass:NSDictionary.class])return fail(error,@"色彩管理状态无效。");
|
||||
NSDictionary*context=DYHostColorContext(src,dst,primaries);@synchronized(_previewLock){[_colorContext release];_colorContext=[context copy];}
|
||||
if(!state.count)return [self renderSource:src destination:dst uniforms:u paths:paths spider:spider tools:tools error:error];
|
||||
if(!DYManagedColorValid(state,error))return NO;if(!tools)tools=@{@"schema":@2,@"layers":@[],@"baseMasks":@{}};if(!DYValidToolDocument(tools))return fail(error,@"调色层或蒙版数据无效。");
|
||||
NSMutableDictionary*entry=[self device:dst.deviceRegistryID error:error];if(!entry)return NO;id<MTLDevice>d=entry[@"device"];id<MTLTexture>source=[src metalTextureForDevice:d];if(!source)return fail(error,@"色彩管理输入纹理不可用。");
|
||||
uint64_t pixels=uint64_t(source.width)*source.height;if(!pixels||pixels>64ull*1024*1024||pixels*16*8>MAX(768ull*1024*1024,MIN(2ull*1024*1024*1024,d.recommendedMaxWorkingSetSize/2)))return fail(error,@"当前画面超过色彩管理内存预算。");
|
||||
CGColorSpaceRef srcSpace=DYManagedTileSpace(src,primaries),dstSpace=DYManagedTileSpace(dst,primaries),aces=CGColorSpaceCreateWithName(kCGColorSpaceACESCGLinear),linear709=CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);
|
||||
NSMutableArray*pool=[NSMutableArray array];id<MTLTexture>current=nil;
|
||||
auto next=[&](id<MTLTexture>exclude=nil)->id<MTLTexture>{for(id<MTLTexture>t in pool)if(t!=current&&t!=exclude)return t;MTLTextureDescriptor*td=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA32Float width:source.width height:source.height mipmapped:NO];td.storageMode=MTLStorageModePrivate;td.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite|MTLTextureUsageRenderTarget;id<MTLTexture>t=[d newTextureWithDescriptor:td];if(t){[pool addObject:t];[t release];}return t;};
|
||||
auto copy=[&](id<MTLTexture>input,id<MTLTexture>output){return input&&output&&[self managedDispatch:@"dyManagedCopy" textures:@[input,output] data:nullptr length:0 extra:nullptr extraLength:0 entry:entry error:error];};
|
||||
auto convert=[&](dycm::Space a,dycm::Space b,NSInteger display=0,BOOL gamut=NO){id<MTLTexture>out=next();if(!out)return fail(error,@"无法分配色彩管理缓冲区。");BOOL ok=[self managedConvert:a to:b display:display gamut:gamut input:current output:out entry:entry error:error];if(ok)current=out;return ok;};
|
||||
auto profile=[&](DYColorProfile*p){id<MTLTexture>out=next();if(!out)return fail(error,@"无法分配颜色配置缓冲区。");BOOL ok=[self managedProfile:p input:current output:out entry:entry error:error];if(ok)current=out;return ok;};
|
||||
auto tile=[&](id<MTLTexture>texture){DYExportTile*t=[[[DYExportTile alloc]initWithTexture:texture registry:d.registryID]autorelease];[t setBounds:src.tilePixelBounds origin:src.imageOrigin];[t setPixelAspect:src.pixelAspect];return t;};
|
||||
auto blend=[&](id<MTLTexture>before,NSArray*masks,NSString*type){if(!masks.count)return YES;id<MTLTexture>out=next(before);if(!out)return fail(error,@"无法分配工作空间蒙版缓冲区。");DYToolMaskHeader h{};id<MTLBuffer>mb=[self maskBuffer:@{type:masks} tile:src device:d header:&h];h.section=(int)[DYToolTypes()indexOfObject:type];id<MTLComputePipelineState>p=[self managedKernel:@"dyManagedBlend" entry:entry error:error];if(!mb||!p)return NO;id<MTLCommandBuffer>cb=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:p];[ce setTexture:before atIndex:0];[ce setTexture:current atIndex:1];[ce setTexture:out atIndex:2];[ce setBuffer:mb offset:0 atIndex:0];[ce setBytes:&h length:sizeof(h) atIndex:1];[ce dispatchThreads:MTLSizeMake(source.width,source.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];[cb commit];[cb waitUntilCompleted];if(cb.status!=MTLCommandBufferStatusCompleted)return fail(error,cb.error.localizedDescription);current=out;return YES;};
|
||||
auto basis=[&](DYUniforms values,NSArray*masks){values.cm.inputTransfer=values.cm.workingTransfer=values.cm.outputTransfer=1;values.cm.inputGamut=values.cm.workingGamut=values.cm.outputGamut=2;values.cm.toneMapping=0;values.inputSectionEnabled=values.cm.outputEnabled=0;if(values.primarySectionEnabled<.5||values.cm.basisEnabled<.5||identityCM(values)||values.cm.mix<=0)return YES;id<MTLTexture>before=current,out=next();BasisParams p=DYCMRender(values.cm).basis;float amount=values.cm.mix;if(!out||![self managedDispatch:@"dyManagedBasis" textures:@[current,out] data:&p length:sizeof(p) extra:&amount extraLength:4 entry:entry error:error])return NO;current=out;return blend(before,masks,@"primary");};
|
||||
auto print=[&](DYUniforms values,NSArray*masks){if(!DYFilmPrintActive(values))return YES;NSArray*names=@[@"",@"kodak_2383",@"kodak_2393",@"kodak_2302_bw",@"fuji_3510",@"fuji_3513",@"fuji_3519",@"fuji_3521",@"agfa_cp30"];NSString*path=[[NSBundle bundleForClass:self.class]pathForResource:names[(int)values.filmPrint.x] ofType:@"dylut" inDirectory:@"PrintLooks"];id<MTLTexture>cube=path?[self lut:path entry:entry error:error]:nil;if(!cube)return fail(error,@"印片资源不可用。");id<MTLTexture>before=current,out=next();float amount=values.filmPrint.y*values.film.mix;if(!out||![self managedDispatch:@"dyManagedPrint" textures:@[current,cube,out] data:&amount length:4 extra:nullptr extraLength:0 entry:entry error:error])return NO;current=out;return blend(before,masks,@"film");};
|
||||
@try{try{
|
||||
if(!dstSpace||(!srcSpace&&[state[@"mode"]integerValue]==1))return fail(error,@"宿主未提供明确颜色空间,无法使用新版管理。可切回旧版兼容。");
|
||||
id<MTLTexture>first=next();if(!copy(source,first))return NO;current=first;
|
||||
NSInteger mode=[state[@"mode"]integerValue],output=[state[@"output"]integerValue];
|
||||
if(mode==1){DYColorProfile*p=[[[DYColorProfile alloc]initWithSource:srcSpace target:aces error:error]autorelease];if(!profile(p)||!convert(dycm::Space::ACEScg,dycm::Space::ACEScct))return NO;}
|
||||
else {id<MTLTexture>out=next(),cube=entry[@"identity"];uint32_t useLUT=mode==3;if(useLUT){if(![paths[@"input"]length])return fail(error,@"请选择输入 LUT,并指定 LUT 输出空间。");cube=[self lut:paths[@"input"] entry:entry error:error];if(!cube)return NO;}if(!out||![self managedDispatch:@"dyManagedCarrier" textures:@[current,out,cube] data:&useLUT length:4 extra:nullptr extraLength:0 entry:entry error:error])return NO;current=out;if(!convert(dycm::Space([state[@"input"]unsignedIntValue]),dycm::Space::ACEScct))return NO;}
|
||||
DYApplyRemovedBaseTools(&u,tools);if(!basis(u,tools[@"baseMasks"][@"primary"]))return NO;
|
||||
NSMutableDictionary*finishing=DYMutablePlist(tools);NSMutableSet*sceneLayers=[NSMutableSet set];
|
||||
for(NSString*ID in DYToolDisplayOrder(tools)){NSDictionary*node=DYToolWithID(tools,ID);if([node[@"type"]isEqual:@"primary"]){if(!basis(DYToolUniforms(node),node[@"masks"]))return NO;[sceneLayers addObject:ID];}}
|
||||
if(!print(u,tools[@"baseMasks"][@"film"]))return NO;for(NSString*ID in DYToolDisplayOrder(tools)){NSDictionary*node=DYToolWithID(tools,ID);if([node[@"type"]isEqual:@"film"]&&!print(DYToolUniforms(node),node[@"masks"]))return NO;}
|
||||
for(NSString*ID in sceneLayers)DYRemoveTool(finishing,ID);for(NSMutableDictionary*node in finishing[@"layers"])if([node[@"type"]isEqual:@"film"])node[@"values"][@"filmPrintLook"]=@0;
|
||||
u.primarySectionEnabled=0;u.cm.configured=-1;u.inputProfile=u.preLUTStrength=0;u.filmPrint.x=0;
|
||||
if(mode==1){if(!convert(dycm::Space::ACEScct,dycm::Space::Linear709))return NO;}
|
||||
else {if(!convert(dycm::Space::ACEScct,dycm::Space::ACEScct,output,[state[@"gamutCompression"]boolValue]))return NO;DYColorProfile*p=[[[DYColorProfile alloc]initWithDisplayOutput:dycm::Output(output) target:linear709 error:error]autorelease];if(!profile(p))return NO;}
|
||||
// Bounded display tools are an explicit SDR finishing branch. HDR delivery
|
||||
// uses the float32 primary / print / single-ODT core until these tools have
|
||||
// measured HDR implementations; never silently clip them through old LUTs.
|
||||
NSDictionary *finishPaths=DYVisibleBaseToolPaths(paths,finishing);
|
||||
NSArray *activeFinish=DYManagedActiveFinishing(u,finishPaths,spider,finishing);
|
||||
if(((mode!=1&&(output==6||output==7))||(mode==1&&primaries==kFxColorPrimaries_Rec2020))&&activeFinish.count)return fail(error,@"HDR 输出或跟随 Rec.2020 宿主时,目前支持一级调色与印片。请关闭 SDR 修饰工具;需要这些工具时,请明确选择 SDR 输出。");
|
||||
[self managedPreview:current origin:src.imageOrigin entry:entry];
|
||||
if(activeFinish.count){id<MTLTexture>out=next();if(!out)return fail(error,@"无法分配显示域修饰缓冲区。");_managedFinishing=YES;BOOL ok=NO;@try{ok=[self renderSource:tile(current) destination:tile(out) uniforms:u paths:finishPaths spider:spider tools:finishing error:error];}@finally{_managedFinishing=NO;}if(!ok)return NO;current=out;}
|
||||
DYColorProfile*returnProfile=[[[DYColorProfile alloc]initWithSource:linear709 target:dstSpace error:error]autorelease];if(!profile(returnProfile))return NO;
|
||||
_managedFinishing=YES;@try{return [self copyTile:tile(current) to:dst entry:entry error:error];}@finally{_managedFinishing=NO;}
|
||||
}catch(const std::exception&e){return fail(error,@(e.what()));}}@finally{if(srcSpace)CGColorSpaceRelease(srcSpace);if(dstSpace)CGColorSpaceRelease(dstSpace);if(aces)CGColorSpaceRelease(aces);if(linear709)CGColorSpaceRelease(linear709);}
|
||||
});}}
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools colorManagement:(NSDictionary*)state error:(NSError**)error {@synchronized(self){if(state&&![state isKindOfClass:NSDictionary.class])return fail(error,@"色彩管理状态无效。");if(state.count&&!DYManagedColorValid(state,error))return NO;if(state.count&&[state[@"mode"]integerValue]!=1&&[@[@6,@7]containsObject:state[@"output"]])return fail(error,@"PQ/HLG 交付需要明确的亮度与范围,请保存完整预设;当前静态 Cube 输出为 sRGB。");if(state.count){auto spatial=[](DYUniforms v){return v.baseSectionEnabled>.5&&((v.textureEnabled>.5&&v.texture!=0)||(v.clarityEnabled>.5&&v.clarity!=0)||(v.dehazeEnabled>.5&&v.dehaze!=0));};BOOL unsupported=spatial(u);for(NSDictionary *node in tools[@"layers"])unsupported|=spatial(DYToolUniforms(node));if(unsupported)return fail(error,@"纹理、清晰度或去朦胧依赖画面内容,不能完整保存到 Cube;请保存完整预设。");}_exportManagedState=state.count?state:nil;@try{return [self exportLUT:url uniforms:u paths:paths spider:spider tools:tools error:error];}@finally{_exportManagedState=nil;}}}
|
||||
@@ -14,6 +14,7 @@ FOUNDATION_EXPORT void DYReadUniforms(id<PROAPIAccessing> manager,CMTime time,DY
|
||||
@property(copy) NSDictionary *paths;
|
||||
@property(nonatomic,copy) NSData *spiderMesh;
|
||||
@property BOOL spiderLinked;
|
||||
@property(nonatomic,copy) NSDictionary *colorManagement;
|
||||
@end
|
||||
@interface DYInspectorToken : NSObject<NSSecureCoding,NSCopying,FxCustomParameterInterpolation_v2>
|
||||
@property(copy) NSDictionary *folds;
|
||||
|
||||
+7
-6
@@ -1,3 +1,4 @@
|
||||
#import "DYManagedColor.h"
|
||||
#import "DYModel.h"
|
||||
#import "DYToolState.h"
|
||||
#include <cmath>
|
||||
@@ -206,14 +207,14 @@ BOOL DYCreateParameters(id<PROAPIAccessing>m,NSError**error){id<FxParameterCreat
|
||||
@implementation DYAssetState
|
||||
+ (BOOL)supportsSecureCoding{return YES;}
|
||||
- (instancetype)init{if((self=[super init])){_paths=[@{}copy];_spiderLinked=YES;}return self;}
|
||||
- (void)dealloc{[_spiderMesh release];[_paths release];[super dealloc];}
|
||||
- (void)encodeWithCoder:(NSCoder*)c{[c encodeObject:_paths forKey:@"paths"];[c encodeObject:_spiderMesh forKey:@"spiderMesh"];[c encodeBool:_spiderLinked forKey:@"spiderLinked"];}
|
||||
- (instancetype)initWithCoder:(NSCoder*)c{if((self=[self init])){NSSet*s=[NSSet setWithObjects:NSDictionary.class,NSString.class,nil];NSDictionary*d=[c decodeObjectOfClasses:s forKey:@"paths"];if(d)self.paths=d;if([c containsValueForKey:@"spiderMesh"])self.spiderMesh=[c decodeObjectOfClass:NSData.class forKey:@"spiderMesh"];_spiderLinked=[c containsValueForKey:@"spiderLinked"]?[c decodeBoolForKey:@"spiderLinked"]:YES;}return self;}
|
||||
- (id)copyWithZone:(NSZone*)z{DYAssetState*v=[[[self class]allocWithZone:z]init];v.paths=_paths;v.spiderMesh=_spiderMesh;v.spiderLinked=_spiderLinked;return v;}
|
||||
- (void)dealloc{[_colorManagement release];[_spiderMesh release];[_paths release];[super dealloc];}
|
||||
- (void)encodeWithCoder:(NSCoder*)c{[c encodeObject:_colorManagement forKey:@"colorManagement"];[c encodeObject:_paths forKey:@"paths"];[c encodeObject:_spiderMesh forKey:@"spiderMesh"];[c encodeBool:_spiderLinked forKey:@"spiderLinked"];}
|
||||
- (instancetype)initWithCoder:(NSCoder*)c{if((self=[self init])){NSSet*s=[NSSet setWithObjects:NSDictionary.class,NSString.class,nil];NSDictionary*d=[c decodeObjectOfClasses:s forKey:@"paths"];if(d)self.paths=d;if([c containsValueForKey:@"colorManagement"]){NSDictionary *cms=[c decodeObjectOfClasses:[NSSet setWithObjects:NSDictionary.class,NSString.class,NSNumber.class,nil] forKey:@"colorManagement"];if(cms&&!DYManagedColorValid(cms,nil)){[c failWithError:[NSError errorWithDomain:@"com.dayu.color.cms" code:1 userInfo:nil]];[self release];return nil;}self.colorManagement=cms;}if([c containsValueForKey:@"spiderMesh"])self.spiderMesh=[c decodeObjectOfClass:NSData.class forKey:@"spiderMesh"];_spiderLinked=[c containsValueForKey:@"spiderLinked"]?[c decodeBoolForKey:@"spiderLinked"]:YES;}return self;}
|
||||
- (id)copyWithZone:(NSZone*)z{DYAssetState*v=[[[self class]allocWithZone:z]init];v.paths=_paths;v.colorManagement=_colorManagement;v.spiderMesh=_spiderMesh;v.spiderLinked=_spiderLinked;return v;}
|
||||
- (id)interpolateBetween:(id)r withWeight:(float)w{return w<.5?[[self copy]autorelease]:[[r copy]autorelease];}
|
||||
- (BOOL)isEqual:(id)o{return [o isKindOfClass:self.class]&&[_paths isEqual:[o paths]]&&[_spiderMesh?:[NSData data] isEqual:[o spiderMesh]?:[NSData data]]&&_spiderLinked==[o spiderLinked];}
|
||||
- (BOOL)isEqual:(id)o{return [o isKindOfClass:self.class]&&[_paths isEqual:[o paths]]&&[_spiderMesh?:[NSData data] isEqual:[o spiderMesh]?:[NSData data]]&&_spiderLinked==[o spiderLinked]&&[_colorManagement?:@{} isEqual:[o colorManagement]?:@{}];}
|
||||
- (void)setSpiderMesh:(NSData *)data{if(data.length&&!DYSpiderMeshIsValid(data))return;if(_spiderMesh!=data){[_spiderMesh release];_spiderMesh=[data copy];}}
|
||||
- (NSUInteger)hash{return _paths.hash^_spiderMesh.hash^_spiderLinked;}
|
||||
- (NSUInteger)hash{return _paths.hash^_spiderMesh.hash^_spiderLinked^_colorManagement.hash;}
|
||||
@end
|
||||
@implementation DYInspectorToken
|
||||
+ (BOOL)supportsSecureCoding{return YES;}
|
||||
|
||||
+4
-3
@@ -1,3 +1,4 @@
|
||||
#import "DYManagedColor.h"
|
||||
#import "DYPlugIn.h"
|
||||
#import "../Shared/DYBetaDiagnostics.h"
|
||||
#import "DYModel.h"
|
||||
@@ -28,16 +29,16 @@
|
||||
- (NSView*)createViewForParameterID:(UInt32)pid{[self scheduleToolCanvasRegistration];return pid==DYInspectorParameterID?[[DYInspector alloc]initWithAPIManager:_apiManager renderer:_renderer]:[[NSView alloc]initWithFrame:NSZeroRect];}
|
||||
- (BOOL)parameterChanged:(UInt32)pid atTime:(CMTime)t error:(NSError**)e{if(pid==DYToolsParameterID)[self adoptToolCanvasDocument:DYReadTools(_apiManager,t).document];if(pid==DYToolsParameterID||pid==2013||pid==2014||(pid>=2236&&pid<2400)||pid==DYAssetsParameterID)[_renderer invalidatePreview];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self.apiManager];});return YES;}
|
||||
- (BOOL)pluginState:(NSData**)state atTime:(CMTime)t quality:(FxQuality)q error:(NSError**)e{
|
||||
DYUniforms u;DYReadUniforms(_apiManager,t,&u);CMTime frameDuration=kCMTimeInvalid,origin=kCMTimeZero;id<FxTimingAPI_v4>timing=[_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];if([timing respondsToSelector:@selector(frameDuration:)])[timing frameDuration:&frameDuration];if([timing respondsToSelector:@selector(startTimeForEffect:)])[timing startTimeForEffect:&origin];int64_t frame=DYFilmFrameIndex(t,frameDuration,origin);u.filmFrameKey=DYFilmFrameKey(frame,u.film.grainHold,u.film.grainSeed);DYAssetState*a=DYReadAssets(_apiManager,t);DYToolDocument *tools=DYReadTools(_apiManager,t);[self adoptToolCanvasDocument:tools.document];double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:©Auto fromParameter:8800 atTime:t];NSMutableDictionary *snapshot=DYMutablePlist(DYToolRenderSnapshot(tools.document,t));for(NSMutableDictionary *node in snapshot[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"])node[@"filmFrameKey"]=@(DYFilmFrameKey(frame,layer.film.grainHold,layer.film.grainSeed));}NSDictionary*s=@{@"schema":@2,@"tools":snapshot,@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{},@"spider":a.spiderMesh?:[NSData data]};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil;
|
||||
DYUniforms u;DYReadUniforms(_apiManager,t,&u);CMTime frameDuration=kCMTimeInvalid,origin=kCMTimeZero;id<FxTimingAPI_v4>timing=[_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];if([timing respondsToSelector:@selector(frameDuration:)])[timing frameDuration:&frameDuration];if([timing respondsToSelector:@selector(startTimeForEffect:)])[timing startTimeForEffect:&origin];int64_t frame=DYFilmFrameIndex(t,frameDuration,origin);u.filmFrameKey=DYFilmFrameKey(frame,u.film.grainHold,u.film.grainSeed);DYAssetState*a=DYReadAssets(_apiManager,t);DYToolDocument *tools=DYReadTools(_apiManager,t);[self adoptToolCanvasDocument:tools.document];double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:©Auto fromParameter:8800 atTime:t];NSMutableDictionary *snapshot=DYMutablePlist(DYToolRenderSnapshot(tools.document,t));for(NSMutableDictionary *node in snapshot[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"])node[@"filmFrameKey"]=@(DYFilmFrameKey(frame,layer.film.grainHold,layer.film.grainSeed));}NSInteger primaries=-1;id<FxColorGamutAPI_v2>gamut=[_apiManager apiForProtocol:@protocol(FxColorGamutAPI_v2)];if([gamut respondsToSelector:@selector(colorPrimaries)])primaries=gamut.colorPrimaries;NSDictionary*s=@{@"colorManagement":a.colorManagement?:@{},@"hostPrimaries":@(primaries),@"schema":@2,@"tools":snapshot,@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{},@"spider":a.spiderMesh?:[NSData data]};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil;
|
||||
}
|
||||
- (BOOL)destinationImageRect:(FxRect*)rect sourceImages:(NSArray<FxImageTile*>*)src destinationImage:(FxImageTile*)dst pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{if(!src.count)return NO;*rect=src[0].imagePixelBounds;return YES;}
|
||||
- (BOOL)sourceTileRect:(FxRect*)rect sourceImageIndex:(NSUInteger)i sourceImages:(NSArray<FxImageTile*>*)src destinationTileRect:(FxRect)dstRect destinationImage:(FxImageTile*)dst pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{if(i>=src.count)return NO;*rect=src[i].imagePixelBounds;return YES;}
|
||||
- (BOOL)renderDestinationImage:(FxImageTile*)dst sourceImages:(NSArray<FxImageTile*>*)src pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{
|
||||
if(!src.count||!src[0].ioSurface||!dst.ioSurface||!s.length)return NO;NSDictionary*p=[NSPropertyListSerialization propertyListWithData:s options:NSPropertyListImmutable format:NULL error:e];if(![p isKindOfClass:NSDictionary.class])return NO;NSData*b=p[@"uniforms"];if(![@[@1,@2]containsObject:p[@"schema"]]||![b isKindOfClass:NSData.class]||b.length!=sizeof(DYUniforms)||![p[@"paths"]isKindOfClass:NSDictionary.class])return NO;DYUniforms u;[b getBytes:&u length:sizeof(u)];uint64_t beta=!_betaFirstRenderStarted.exchange(true)?DYBetaSpanBegin(@"first_render",nil):0;BOOL ok=[_renderer renderSource:src[0] destination:dst uniforms:u paths:p[@"paths"] spider:p[@"spider"] tools:p[@"tools"] error:e];DYBetaSpanEnd(beta,@{@"status":ok?@"passed":@"failed"});if(!ok)DYBetaEvent(@"render_error",@{@"error_domain":(e&&*e)?(*e).domain:@"unknown",@"error_code":@((e&&*e)?(*e).code:0)});if(ok){if(_toolCaptureEnabled&&!_trackingActive.load()){dy::GrayFrame frame=[self toolGrayFrame:src[0] error:nil];if(frame.valid()){@synchronized(self){_toolSourceFrame=std::move(frame);_toolSourceTime=t;}}}BOOL analyze=NO;@synchronized(self){if(![p[@"copyAuto"]boolValue])_copyAnalyzed=NO;else if(!_copyAnalyzed){_copyAnalyzed=YES;analyze=YES;}}if(analyze){NSDictionary*values=DYAutoGrade([_renderer preview]);if(values)dispatch_async(dispatch_get_main_queue(),^{[self applyValues:values];});}}return ok;
|
||||
if(!src.count||!src[0].ioSurface||!dst.ioSurface||!s.length)return NO;NSDictionary*p=[NSPropertyListSerialization propertyListWithData:s options:NSPropertyListImmutable format:NULL error:e];if(![p isKindOfClass:NSDictionary.class])return NO;NSData*b=p[@"uniforms"];if(![@[@1,@2]containsObject:p[@"schema"]]||![b isKindOfClass:NSData.class]||b.length!=sizeof(DYUniforms)||![p[@"paths"]isKindOfClass:NSDictionary.class])return NO;DYUniforms u;[b getBytes:&u length:sizeof(u)];uint64_t beta=!_betaFirstRenderStarted.exchange(true)?DYBetaSpanBegin(@"first_render",nil):0;BOOL ok=[_renderer renderSource:src[0] destination:dst uniforms:u paths:p[@"paths"] spider:p[@"spider"] tools:p[@"tools"] colorManagement:p[@"colorManagement"] hostPrimaries:p[@"hostPrimaries"]?[p[@"hostPrimaries"]integerValue]:-1 error:e];DYBetaSpanEnd(beta,@{@"status":ok?@"passed":@"failed"});if(!ok)DYBetaEvent(@"render_error",@{@"error_domain":(e&&*e)?(*e).domain:@"unknown",@"error_code":@((e&&*e)?(*e).code:0)});if(ok){if(_toolCaptureEnabled&&!_trackingActive.load()){dy::GrayFrame frame=[self toolGrayFrame:src[0] error:nil];if(frame.valid()){@synchronized(self){_toolSourceFrame=std::move(frame);_toolSourceTime=t;}}}BOOL analyze=NO;@synchronized(self){if(![p[@"copyAuto"]boolValue])_copyAnalyzed=NO;else if(!_copyAnalyzed){_copyAnalyzed=YES;analyze=YES;}}if(analyze){NSDictionary*values=DYAutoGrade([_renderer preview]);if(values)dispatch_async(dispatch_get_main_queue(),^{[self applyValues:values];});}}return ok;
|
||||
}
|
||||
- (void)alert:(NSString*)message{dispatch_async(dispatch_get_main_queue(),^{NSAlert*a=[NSAlert new];a.messageText=@"大鱼调色";a.informativeText=message?:@"操作未完成";[a runModal];[a release];});}
|
||||
- (void)exportRequested:(NSNotification*)n{
|
||||
NSURL*url=n.userInfo[@"url"];if(![url isKindOfClass:NSURL.class])return;id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];[a startAction:self];DYUniforms u;DYReadUniforms(_apiManager,a.currentTime,&u);DYAssetState *assets=DYReadAssets(_apiManager,a.currentTime);NSDictionary*paths=[assets.paths copy];NSData *mesh=[assets.spiderMesh copy];NSDictionary *tools=[DYReadTools(_apiManager,a.currentTime).document copy];[a endAction:self];NSError*e=nil;BOOL ok=[_renderer exportLUT:url uniforms:u paths:paths spider:mesh tools:tools error:&e];[tools release];[mesh release];[paths release];if(!ok)[self alert:e.localizedDescription];
|
||||
NSURL*url=n.userInfo[@"url"];if(![url isKindOfClass:NSURL.class])return;id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];[a startAction:self];DYUniforms u;DYReadUniforms(_apiManager,a.currentTime,&u);DYAssetState *assets=DYReadAssets(_apiManager,a.currentTime);NSDictionary*paths=[assets.paths copy];NSDictionary *cms=[assets.colorManagement copy];NSData *mesh=[assets.spiderMesh copy];NSDictionary *tools=[DYReadTools(_apiManager,a.currentTime).document copy];[a endAction:self];NSError*e=nil;BOOL ok=[_renderer exportLUT:url uniforms:u paths:paths spider:mesh tools:tools colorManagement:cms error:&e];[cms release];[tools release];[mesh release];[paths release];if(!ok)[self alert:e.localizedDescription];
|
||||
}
|
||||
- (void)applyValues:(NSDictionary*)values{if(!values){[self alert:@"尚未拿到当前片段画面,请移动播放头后重试。"];return;}id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];[a startAction:self];@try{id<FxParameterSettingAPI_v6>s=[_apiManager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];for(NSDictionary*r in DYDescriptors()){NSNumber*v=values[r[@"key"]];if(v)[s setFloatValue:v.doubleValue toParameter:[r[@"pid"]unsignedIntValue] atTime:a.currentTime];}}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_apiManager];}
|
||||
- (void)autoRequested:(NSNotification*)n{NSData*frame=[_renderer preview];[self applyValues:[n.name isEqual:@"DYAutoGrade"]?DYAutoGrade(frame):DYAutoWhiteBalance(frame)];}
|
||||
|
||||
@@ -18,4 +18,7 @@
|
||||
/// Analysis preview retains the host texture's original row order separately.
|
||||
- (NSData*)lookLUTPreview;
|
||||
- (void)invalidatePreview;
|
||||
- (NSDictionary*)colorContext;
|
||||
- (BOOL)renderSource:(FxImageTile*)source destination:(FxImageTile*)destination uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools colorManagement:(NSDictionary*)state hostPrimaries:(NSInteger)primaries error:(NSError**)error;
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools colorManagement:(NSDictionary*)state error:(NSError**)error;
|
||||
@end
|
||||
+41
-11
@@ -1,3 +1,8 @@
|
||||
#import "DYManagedColor.h"
|
||||
#import "../../ColorManagement/Sources/DYColorManagementGPU.h"
|
||||
#import "../../ColorManagement/Sources/DYColorProfile.h"
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#import "DYRenderer.h"
|
||||
#import "../Shared/DYBetaDiagnostics.h"
|
||||
#import "DYModel.h"
|
||||
@@ -13,6 +18,13 @@
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
static BOOL fail(NSError**e,NSString*m){if(e)*e=[NSError errorWithDomain:@"com.dayu.color" code:1 userInfo:@{NSLocalizedDescriptionKey:m?:@"Metal 调色失败"}];return NO;}
|
||||
// MRC NSError out-parameters must outlive every nested render pool. Preserve
|
||||
// the same pointer across nested closures, then autorelease in the caller pool.
|
||||
template<class F> static BOOL DYRenderWithPool(NSError **error,F body){
|
||||
if(error)*error=nil;NSError *held=nil;BOOL ok=NO;
|
||||
@autoreleasepool{@try{ok=body();}@catch(NSException *exception){ok=fail(error,exception.reason?:@"渲染异常");}if(!ok&&error)held=[*error retain];}
|
||||
if(error)*error=[held autorelease];return ok;
|
||||
}
|
||||
static NSArray *inputFiles(){return @[@"",@"apple_log_to_rec709",@"arri_logc3_to_rec709",@"arri_logc4_to_rec709",@"blackmagic_film_gen5_to_rec709",@"canon_clog_bt709_to_rec709",@"canon_clog2_cinema_gamut_to_rec709",@"canon_clog3_cinema_gamut_to_rec709",@"dji_dlog_to_rec709",@"dji_dlog_m_to_rec709",@"fujifilm_flog_to_rec709",@"fujifilm_flog2_to_rec709",@"nikon_nlog_to_rec709",@"panasonic_vlog_vgamut_to_rec709",@"red_log3g10_rwg_to_rec709",@"sony_slog2_sgamut_to_rec709",@"sony_slog3_sgamut3cine_to_rec709",@"sony_hlg_bt2020_to_rec709"];}
|
||||
static id<MTLTexture> texture3D(id<MTLDevice>d,const float*values,NSUInteger n){MTLTextureDescriptor*t=[MTLTextureDescriptor new];t.textureType=MTLTextureType3D;t.pixelFormat=MTLPixelFormatRGBA32Float;t.width=n;t.height=n;t.depth=n;t.storageMode=MTLStorageModeShared;t.usage=MTLTextureUsageShaderRead;id<MTLTexture>x=[d newTextureWithDescriptor:t];[t release];if(x)[x replaceRegion:MTLRegionMake3D(0,0,0,n,n,n) mipmapLevel:0 slice:0 withBytes:values bytesPerRow:n*16 bytesPerImage:n*n*16];return [x autorelease];}
|
||||
// A synthetic texture lattice uses exactly the production render path for Cube export.
|
||||
@@ -26,6 +38,7 @@ static id<MTLTexture> texture3D(id<MTLDevice>d,const float*values,NSUInteger n){
|
||||
- (void)dealloc{[_tex release];[super dealloc];}
|
||||
- (id<MTLTexture>)metalTextureForDevice:(id<MTLDevice>)d{return d.registryID==_registry?_tex:nil;}
|
||||
- (void)setBounds:(FxRect)bounds origin:(FxImageOrigin)origin{_bounds=bounds;_origin=origin;}
|
||||
- (CGColorSpaceRef)colorSpace{static CGColorSpaceRef s;static dispatch_once_t once;dispatch_once(&once,^{s=CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);});return s;}
|
||||
- (FxRect)tilePixelBounds{return _bounds;}
|
||||
- (FxRect)imagePixelBounds{return self.tilePixelBounds;}
|
||||
- (uint64_t)deviceRegistryID{return _registry;}
|
||||
@@ -56,6 +69,20 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
for(int i=0;i<13;i++){BOOL group=(i>=6&&i<=9)?u->colorSectionEnabled>.5:u->baseSectionEnabled>.5;if(group&&enabled[i]>.5&&values[i]!=0)return;}
|
||||
u->skinProtection.x=0;
|
||||
}
|
||||
// Admission and identity bypass for the explicitly bounded finishing domain.
|
||||
static NSArray *DYManagedActiveFinishing(DYUniforms u,NSDictionary *paths,NSData *spider,NSDictionary *tools){
|
||||
bypassNeutralTools(&u);bypassIdleSkin(&u);if(u.cm.blackWhiteMix<=0)u.blackWhiteSectionEnabled=0;
|
||||
NSMutableArray *active=[NSMutableArray array];
|
||||
for(NSString *type in DYToolTypes()){
|
||||
if([type isEqual:@"primary"])continue;
|
||||
NSMutableDictionary *values=[NSMutableDictionary dictionary],*localPaths=[NSMutableDictionary dictionary];
|
||||
for(NSDictionary *d in DYBaseToolDescriptors(type))if([d[@"offset"]integerValue]>=0)values[d[@"key"]]=@(*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue]));
|
||||
if([type isEqual:@"look"]&&u.lookSectionEnabled>.5)for(NSString *key in paths)if([key hasPrefix:@"look"])localPaths[key]=paths[key];
|
||||
NSMutableDictionary *node=[NSMutableDictionary dictionaryWithDictionary:@{@"type":type,@"values":values,@"paths":localPaths}];if([type isEqual:@"spider"]&&spider)node[@"spider"]=spider;
|
||||
if(!DYToolIsNeutral(node))[active addObject:type];
|
||||
}
|
||||
for(NSDictionary *node in tools[@"layers"])if(!DYToolIsNeutral(node))[active addObject:node[@"type"]];return active;
|
||||
}
|
||||
@interface DYRenderer(){
|
||||
NSMutableDictionary *_devices,*_luts,*_preparedLUTs;
|
||||
NSSet *_activeLUTPaths;
|
||||
@@ -65,14 +92,16 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
NSData *_preview,*_lookLUTPreview;
|
||||
CFTimeInterval _lastPreview;
|
||||
BOOL _exporting;
|
||||
NSDictionary *_toolDocument;
|
||||
NSDictionary *_toolDocument,*_colorContext,*_exportManagedState;
|
||||
BOOL _managedFinishing;
|
||||
}
|
||||
@end
|
||||
@implementation DYRenderer
|
||||
#include "DYFilmRender.inc.h"
|
||||
#include "DYManagedRender.inc.h"
|
||||
#include "DYToolRender.inc.h"
|
||||
- (instancetype)init{if((self=[super init])){_previewLock=[NSObject new];_devices=[NSMutableDictionary new];_luts=[NSMutableDictionary new];_preparedLUTs=[NSMutableDictionary new];_activeLUTPaths=[NSSet new];_lutPreparationQueue=dispatch_queue_create("com.dayu.color.lut-upload",DISPATCH_QUEUE_SERIAL);dispatch_set_target_queue(_lutPreparationQueue,dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0));_tables=[DYColorTables new];}return self;}
|
||||
- (void)dealloc{[_devices release];[_luts release];[_preparedLUTs release];[_activeLUTPaths release];dispatch_release(_lutPreparationQueue);[_tables release];[_preview release];[_lookLUTPreview release];[_previewLock release];[super dealloc];}
|
||||
- (void)dealloc{[_devices release];[_luts release];[_preparedLUTs release];[_activeLUTPaths release];dispatch_release(_lutPreparationQueue);[_tables release];[_preview release];[_lookLUTPreview release];[_colorContext release];[_previewLock release];[super dealloc];}
|
||||
- (void)trimPreparedLUTsKeeping:(NSString *)path {
|
||||
if(_preparedLUTs.count<=12)return;
|
||||
for(NSString *key in _preparedLUTs.allKeys)if(![_activeLUTPaths containsObject:key]&&![key isEqualToString:path])[_preparedLUTs removeObjectForKey:key];
|
||||
@@ -138,7 +167,7 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths error:(NSError**)err{return [self renderSource:src destination:dst uniforms:u paths:paths spider:nil error:err];}
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider error:(NSError**)err{return [self renderSource:src destination:dst uniforms:u paths:paths spider:spider tools:nil error:err];}
|
||||
- (BOOL)renderLegacy:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider masks:(NSDictionary*)masks error:(NSError**)err{return [self renderLegacy:src destination:dst uniforms:u paths:paths spider:spider masks:masks stageFirst:-1 stageLast:-1 skinReference:nil originalReference:nil captureOriginal:nullptr suppressBlackWhite:NO error:err];}
|
||||
- (BOOL)renderLegacy:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider masks:(NSDictionary*)masks stageFirst:(NSInteger)stageFirst stageLast:(NSInteger)stageLast skinReference:(FxImageTile*)skinReference originalReference:(FxImageTile*)originalReference captureOriginal:(DYExportTile**)captureOriginal suppressBlackWhite:(BOOL)suppressBlackWhite error:(NSError**)err{@synchronized(self){@autoreleasepool{
|
||||
- (BOOL)renderLegacy:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider masks:(NSDictionary*)masks stageFirst:(NSInteger)stageFirst stageLast:(NSInteger)stageLast skinReference:(FxImageTile*)skinReference originalReference:(FxImageTile*)originalReference captureOriginal:(DYExportTile**)captureOriginal suppressBlackWhite:(BOOL)suppressBlackWhite error:(NSError**)err{@synchronized(self){return DYRenderWithPool(err,[&]()->BOOL{
|
||||
BOOL segmented=stageFirst>=0;if(segmented&&(stageFirst>stageLast||stageLast>11))return fail(err,@"原生工具分段范围无效");
|
||||
if(spider.length&&!DYSpiderMeshIsValid(spider))return fail(err,@"蜘蛛盘数据无效");
|
||||
if(u.primarySectionEnabled<.5){u.inputSectionEnabled=0;u.cm.basisEnabled=0;u.cm.outputEnabled=0;}
|
||||
@@ -194,21 +223,22 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
_lastPreview=CACurrentMediaTime();dispatch_async(dispatch_get_main_queue(),^{[[NSNotificationCenter defaultCenter]postNotificationName:@"DYPreviewDidChange" object:self];});
|
||||
}}
|
||||
if(!ok)fail(err,cb.error.localizedDescription);[pb release];[straight release];[scene release];return ok;
|
||||
}}}
|
||||
});}}
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths error:(NSError**)err{return [self exportLUT:url uniforms:u paths:paths spider:nil error:err];}
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider error:(NSError**)err{@synchronized(self){
|
||||
if(DYFilmToolActive(u)&&DYFilmSpatialActive(u.film))return fail(err,@"胶片空间和颗粒处理不能保存到静态 Cube,请保存完整预设。");
|
||||
NSMutableDictionary *e=[self device:0 error:err];if(!e)return NO;id<MTLDevice>d=e[@"device"];const NSUInteger n=33,count=n*n*n,width=n*n,height=n;
|
||||
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:width height:height mipmapped:NO];desc.storageMode=MTLStorageModeShared;desc.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite|MTLTextureUsageRenderTarget;
|
||||
NSMutableDictionary *e=[self device:0 error:err];if(!e)return NO;id<MTLDevice>d=e[@"device"];const NSUInteger n=_exportManagedState?65:33,count=n*n*n,width=n*n,height=n;
|
||||
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:(_exportManagedState?MTLPixelFormatRGBA32Float:MTLPixelFormatRGBA16Float) width:width height:height mipmapped:NO];desc.storageMode=MTLStorageModeShared;desc.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite|MTLTextureUsageRenderTarget;
|
||||
id<MTLTexture>input=[d newTextureWithDescriptor:desc],output=[d newTextureWithDescriptor:desc];if(!input||!output){[input release];[output release];return fail(err,@"无法分配 LUT 色格");}
|
||||
std::vector<__fp16>values(count*4);for(NSUInteger i=0;i<count;i++){float v[3]={(float)(i%n)/(n-1),(float)((i/n)%n)/(n-1),(float)(i/(n*n))/(n-1)};for(int c=0;c<3;c++)values[i*4+c]=v[c]<=.04045f?v[c]/12.92f:powf((v[c]+.055f)/1.055f,2.4f);values[i*4+3]=1;}
|
||||
[input replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:values.data() bytesPerRow:width*8];
|
||||
std::vector<__fp16>values(count*4);std::vector<float>precise(_exportManagedState?count*4:0);for(NSUInteger i=0;i<count;i++){float v[3]={(float)(i%n)/(n-1),(float)((i/n)%n)/(n-1),(float)(i/(n*n))/(n-1)};for(int c=0;c<3;c++)values[i*4+c]=v[c]<=.04045f?v[c]/12.92f:powf((v[c]+.055f)/1.055f,2.4f);values[i*4+3]=1;if(_exportManagedState){for(int c=0;c<3;c++)precise[i*4+c]=v[c]<=.04045f?v[c]/12.92f:powf((v[c]+.055f)/1.055f,2.4f);precise[i*4+3]=1;}}
|
||||
[input replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:_exportManagedState?(const void*)precise.data():(const void*)values.data() bytesPerRow:width*(_exportManagedState?16:8)];
|
||||
DYExportTile *source=[[[DYExportTile alloc]initWithTexture:input registry:d.registryID]autorelease],*dest=[[[DYExportTile alloc]initWithTexture:output registry:d.registryID]autorelease];
|
||||
u.textureEnabled=0;u.clarityEnabled=0;u.dehazeEnabled=0;BOOL ok=NO;_exporting=YES;
|
||||
@try{ok=[self renderSource:source destination:dest uniforms:u paths:paths spider:spider tools:_toolDocument error:err];}@finally{_exporting=NO;}
|
||||
if(ok)[output getBytes:values.data() bytesPerRow:width*8 fromRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0];[input release];[output release];if(!ok)return NO;
|
||||
@try{ok=[self renderSource:source destination:dest uniforms:u paths:paths spider:spider tools:_toolDocument colorManagement:_exportManagedState hostPrimaries:kFxColorPrimaries_Rec709 error:err];}@finally{_exporting=NO;}
|
||||
if(ok)[output getBytes:_exportManagedState?(void*)precise.data():(void*)values.data() bytesPerRow:width*(_exportManagedState?16:8) fromRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0];[input release];[output release];if(!ok)return NO;
|
||||
NSMutableString *text=[NSMutableString stringWithString:@"TITLE \"大鱼调色\"\n# 包含 CST 与逐像素颜色;不包含纹理、清晰度和逐画面分析。\nLUT_3D_SIZE 33\nDOMAIN_MIN 0 0 0\nDOMAIN_MAX 1 1 1\n"];
|
||||
for(NSUInteger i=0;i<count;i++){float rgb[3];for(int c=0;c<3;c++){float v=values[i*4+c];rgb[c]=v<=.0031308f?v*12.92f:1.055f*powf(v,1/2.4f)-.055f;if(!std::isfinite(rgb[c]))return fail(err,@"LUT 输出含无效值");}[text appendFormat:@"%.8f %.8f %.8f\n",rgb[0],rgb[1],rgb[2]];}
|
||||
for(NSUInteger i=0;i<count;i++){float rgb[3];for(int c=0;c<3;c++){float v=_exportManagedState?precise[i*4+c]:(float)values[i*4+c];rgb[c]=v<=.0031308f?v*12.92f:1.055f*powf(v,1/2.4f)-.055f;if(!std::isfinite(rgb[c]))return fail(err,@"LUT 输出含无效值");}[text appendFormat:@"%.8f %.8f %.8f\n",rgb[0],rgb[1],rgb[2]];}
|
||||
if(_exportManagedState){NSData *metadata=[NSJSONSerialization dataWithJSONObject:_exportManagedState options:NSJSONWritingSortedKeys error:nil];if(metadata)[text insertString:[NSString stringWithFormat:@"# DAYU_CMS_STATE %@\n",[[[NSString alloc]initWithData:metadata encoding:NSUTF8StringEncoding]autorelease]] atIndex:0];[text replaceOccurrencesOfString:@"LUT_3D_SIZE 33" withString:@"LUT_3D_SIZE 65" options:0 range:NSMakeRange(0,text.length)];[text insertString:@"# V2 input: declared camera/LUT code values, or sRGB in host mode. Output: sRGB / Rec.709.\n" atIndex:0];}
|
||||
return [text writeToURL:url atomically:YES encoding:NSUTF8StringEncoding error:err];
|
||||
}}
|
||||
@end
|
||||
@@ -19,7 +19,7 @@
|
||||
[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:input.data() bytesPerRow:width*8];
|
||||
Pixels baseline=renderTools(empty.document,defaults,nil,@"empty-tool-document-render");run.record(@"empty-tool-document-preserves-legacy-pixels-exactly",difference(baseline,neutral).maximum==0);
|
||||
DYUniforms newPrimary=DYToolUniforms(DYNewTool(@"primary")),oldPrimary=DYToolUniforms(@{@"type":@"primary",@"values":@{}});
|
||||
run.record(@"new-primary-layer-auto-mapping-on-old-omitted-default-stays-off",newPrimary.cm.toneMapping==1&&oldPrimary.cm.toneMapping==0&&!DYToolIsNeutral(DYNewTool(@"primary"))&&DYToolIsNeutral(@{@"type":@"primary",@"values":@{}}));
|
||||
run.record(@"new-primary-layer-neutral-old-explicit-mapping-preserved",newPrimary.cm.toneMapping==0&&oldPrimary.cm.toneMapping==0&&DYToolIsNeutral(DYNewTool(@"primary"))&&DYToolUniforms(@{@"type":@"primary",@"values":@{@"cmtoneMapping":@1}}).cm.toneMapping==1&&DYToolIsNeutral(@{@"type":@"primary",@"values":@{}}));
|
||||
doc=DYMutablePlist(empty.document);for(NSString *type in DYToolTypes()){NSMutableDictionary *n=DYMutablePlist(DYNewTool(type));if([type isEqual:@"primary"])n[@"values"][@"cmtoneMapping"]=@0;[doc[@"layers"]addObject:n];}Pixels initialized=renderTools(doc,defaults,nil,@"all-initialized-tool-types-with-legacy-primary-mapping-render");run.record(@"legacy-neutral-repeated-tools-preserve-pixels",difference(initialized,neutral).maximum==0);
|
||||
// Reference is two explicit isolated native operations, which catches shared
|
||||
// uniform or lookup caches, ordering, repeated CST and accidental base replay.
|
||||
|
||||
+11
-11
@@ -14,8 +14,8 @@
|
||||
}
|
||||
- (BOOL)copyTile:(FxImageTile*)source to:(FxImageTile*)dest entry:(NSMutableDictionary*)e error:(NSError**)error {
|
||||
id<MTLDevice>device=e[@"device"];id<MTLTexture>a=[source metalTextureForDevice:device],b=[dest metalTextureForDevice:device];
|
||||
NSMutableDictionary *pipelines=e[@"pipelines"];NSString *key=[NSString stringWithFormat:@"copy-%lu",(unsigned long)b.pixelFormat];id<MTLRenderPipelineState>pipeline=pipelines[key];
|
||||
if(!pipeline){MTLRenderPipelineDescriptor *desc=[MTLRenderPipelineDescriptor new];desc.vertexFunction=[e[@"library"]newFunctionWithName:@"dyVertex"];desc.fragmentFunction=[e[@"library"]newFunctionWithName:@"dyToolCopyFragment"];desc.colorAttachments[0].pixelFormat=b.pixelFormat;pipeline=[device newRenderPipelineStateWithDescriptor:desc error:error];[desc.vertexFunction release];[desc.fragmentFunction release];[desc release];if(!pipeline)return NO;pipelines[key]=pipeline;[pipeline release];}
|
||||
NSMutableDictionary *pipelines=e[@"pipelines"];NSString *key=[NSString stringWithFormat:@"copy-%d-%lu",_managedFinishing,(unsigned long)b.pixelFormat];id<MTLRenderPipelineState>pipeline=pipelines[key];
|
||||
if(!pipeline){MTLRenderPipelineDescriptor *desc=[MTLRenderPipelineDescriptor new];desc.vertexFunction=[e[@"library"]newFunctionWithName:@"dyVertex"];desc.fragmentFunction=[e[@"library"]newFunctionWithName:_managedFinishing?@"dyManagedCopyFragment":@"dyToolCopyFragment"];desc.colorAttachments[0].pixelFormat=b.pixelFormat;pipeline=[device newRenderPipelineStateWithDescriptor:desc error:error];[desc.vertexFunction release];[desc.fragmentFunction release];[desc release];if(!pipeline)return NO;pipelines[key]=pipeline;[pipeline release];}
|
||||
FxRect s=source.tilePixelBounds,t=dest.tilePixelBounds;float width=s.right-s.left,height=s.top-s.bottom,l=(t.left-s.left)/width,r=(t.right-s.left)/width,top=(s.top-t.top)/height,bottom=(s.top-t.bottom)/height;
|
||||
if(source.imageOrigin==kFxImageOrigin_BOTTOM_LEFT){top=1-top;bottom=1-bottom;}
|
||||
float w=b.width,h=b.height;DYVertex2D v[]={{{w/2,-h/2},{r,bottom}},{{-w/2,-h/2},{l,bottom}},{{w/2,h/2},{r,top}},{{-w/2,h/2},{l,top}}};if(dest.imageOrigin==kFxImageOrigin_BOTTOM_LEFT)for(auto &vertex:v)vertex.position.y=-vertex.position.y;
|
||||
@@ -40,7 +40,7 @@
|
||||
DYToolMaskHeader h{};h.section=3;id<MTLBuffer>buffer=[self maskBuffer:@{type:node[@"masks"]} tile:source device:d header:&h];cb=[entry[@"queue"]commandBuffer];[self encodeBlend:before after:after output:blend masks:buffer header:h entry:entry commands:cb];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
|
||||
DYExportTile *blended=[[DYExportTile alloc]initWithTexture:blend registry:d.registryID];[blended setBounds:source.tilePixelBounds origin:source.imageOrigin];[blended setPixelAspect:source.pixelAspect];[blend release];if(ok)ok=[self copyTile:blended to:destination entry:entry error:error];else fail(error,cb.error.localizedDescription);[blended release];return ok;
|
||||
}
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){@autoreleasepool{
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){return DYRenderWithPool(error,[&]()->BOOL{
|
||||
if(!tools)tools=@{@"schema":@1,@"layers":@[],@"baseMasks":@{}};if(!DYValidToolDocument(tools))return fail(error,@"工具或蒙版数据损坏,未更改原工程");
|
||||
DYApplyRemovedBaseTools(&u,tools);paths=DYVisibleBaseToolPaths(paths,tools);if(DYBaseToolRemoved(tools,@"spider"))spider=nil;
|
||||
NSArray *layers=tools[@"layers"];BOOL active=NO,anchored=NO;for(NSDictionary *node in layers)if(!DYToolIsNeutral(node)){active=YES;anchored|=![DYToolRootAnchor(tools,node[@"id"])isEqual:@"tail"];}
|
||||
@@ -51,7 +51,7 @@
|
||||
DYExportTile *tile=nil,*skinReference=nil,*originalReference=nil;NSArray *order=DYToolDisplayOrder(tools);NSMutableDictionary *groups=[NSMutableDictionary dictionary];for(NSString *ID in order){NSDictionary *node=DYToolWithID(tools,ID);if(!node||DYToolIsNeutral(node))continue;NSString *root=DYToolRootAnchor(tools,ID);if(!groups[root])groups[root]=[NSMutableArray array];[groups[root]addObject:node];}
|
||||
auto makeTile=[&](){id<MTLTexture>texture=[d newTextureWithDescriptor:desc];if(!texture)return (DYExportTile*)nil;DYExportTile *result=[[DYExportTile alloc]initWithTexture:texture registry:d.registryID];[result setBounds:src.tilePixelBounds origin:src.imageOrigin];[result setPixelAspect:src.pixelAspect];[texture release];return result;};
|
||||
auto replace=[&](DYExportTile *next){[tile release];tile=next;};
|
||||
auto apply=[&](NSString *anchor){for(NSDictionary *node in groups[anchor]){@autoreleasepool{DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配新增工具缓冲区");BOOL ok=[self renderExtraTool:node source:tile original:src destination:next entry:entry error:error];if(!ok){[next release];return NO;}replace(next);}}return YES;};
|
||||
auto apply=[&](NSString *anchor){for(NSDictionary *node in groups[anchor]){if(!DYRenderWithPool(error,[&]()->BOOL{DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配新增工具缓冲区");BOOL ok=[self renderExtraTool:node source:tile original:src destination:next entry:entry error:error];if(!ok){[next release];return NO;}replace(next);return YES;}))return NO;}return YES;};
|
||||
@try{
|
||||
if(!anchored){DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配工具图层缓冲区");BOOL ok=[self renderLegacy:src destination:next uniforms:u paths:paths spider:spider masks:tools[@"baseMasks"] error:error];if(!ok){[next release];return NO;}replace(next);}
|
||||
else {
|
||||
@@ -61,13 +61,13 @@
|
||||
NSArray *anchors=@[@"base:primary",@"base:primaries",@"",@"base:curve",@"base:levels",@"base:balance",@"base:hsl",@"base:grading",@"base:base",@"base:blackwhite",@"base:look",@"base:skin"];
|
||||
float bwMix=fmaxf(0,fminf(1,u.cm.blackWhiteMix));BOOL splitBW=u.blackWhiteSectionEnabled>.5&&bwMix>0&&bwMix<1&&([groups[@"base:blackwhite"]count]||[groups[@"base:look"]count]);
|
||||
NSInteger first=0;
|
||||
for(NSInteger last=0;last<(splitBW?9:12);last++)if(last==5||last==(splitBW?8:11)||[groups[anchors[last]]count]){@autoreleasepool{
|
||||
for(NSInteger last=0;last<(splitBW?9:12);last++)if(last==5||last==(splitBW?8:11)||[groups[anchors[last]]count]){if(!DYRenderWithPool(error,[&]()->BOOL{
|
||||
DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配原生工具分段缓冲区");DYUniforms segment=u;
|
||||
BOOL ok=[self renderLegacy:tile?:src destination:next uniforms:segment paths:paths spider:nil masks:tools[@"baseMasks"] stageFirst:first stageLast:last skinReference:skinReference originalReference:originalReference captureOriginal:first==0?&originalReference:nullptr suppressBlackWhite:NO error:error];if(!ok){[next release];return NO;}replace(next);
|
||||
if(!apply(anchors[last]))return NO;
|
||||
// Skin protects the native pre-HSL result, including tools inserted before it.
|
||||
if(last==5){[skinReference release];skinReference=[tile retain];}first=last+1;
|
||||
}}
|
||||
if(last==5){[skinReference release];skinReference=[tile retain];}first=last+1;return YES;
|
||||
}))return NO;}
|
||||
if(splitBW){
|
||||
// Native partial B&W mixes two complete color branches after native skin,
|
||||
// before Spider. Keep that fork if a B&W/Look insertion splits stages 9-11.
|
||||
@@ -76,9 +76,9 @@
|
||||
@try{
|
||||
for(int branch=0;branch<2;branch++){
|
||||
if(branch==1)replace([prefix retain]);DYUniforms branchUniforms=u;branchUniforms.cm.blackWhiteMix=1;NSInteger begin=9;
|
||||
for(NSInteger end=9;end<12;end++)if(end==11||[groups[anchors[end]]count]){@autoreleasepool{
|
||||
DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配黑白混合分支缓冲区");BOOL ok=[self renderLegacy:tile destination:next uniforms:branchUniforms paths:paths spider:nil masks:tools[@"baseMasks"] stageFirst:begin stageLast:end skinReference:skinReference originalReference:originalReference captureOriginal:nullptr suppressBlackWhite:branch==1 error:error];if(!ok){[next release];return NO;}replace(next);if(end<11&&!apply(anchors[end]))return NO;begin=end+1;
|
||||
}}
|
||||
for(NSInteger end=9;end<12;end++)if(end==11||[groups[anchors[end]]count]){if(!DYRenderWithPool(error,[&]()->BOOL{
|
||||
DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配黑白混合分支缓冲区");BOOL ok=[self renderLegacy:tile destination:next uniforms:branchUniforms paths:paths spider:nil masks:tools[@"baseMasks"] stageFirst:begin stageLast:end skinReference:skinReference originalReference:originalReference captureOriginal:nullptr suppressBlackWhite:branch==1 error:error];if(!ok){[next release];return NO;}replace(next);if(end<11&&!apply(anchors[end]))return NO;begin=end+1;return YES;
|
||||
}))return NO;}
|
||||
if(branch==0)bwTile=[tile retain];
|
||||
}
|
||||
DYExportTile *mixed=makeTile();if(!mixed)return fail(error,@"无法分配黑白混合缓冲区");DYToolMaskEntry constant{};constant.section=0;constant.combine=0;constant.mask.parameters=dyDefaultMaskParameters();constant.mask.parameters.kind=DYMaskRectangle;constant.mask.parameters.width=constant.mask.parameters.height=4000;constant.mask.parameters.feather=0;constant.mask.parameters.outputBlack=constant.mask.parameters.outputWhite=1;constant.mask.parameters.strength=bwMix;
|
||||
@@ -96,7 +96,7 @@
|
||||
// their old end-of-chain order. Saving does not silently migrate old looks.
|
||||
if(!apply(@"tail"))return NO;return [self copyTile:tile to:dst entry:entry error:error];
|
||||
}@finally{[originalReference release];[skinReference release];[tile release];}
|
||||
}}}
|
||||
});}}
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){
|
||||
if(tools&&!DYValidToolDocument(tools))return fail(error,@"工具或蒙版数据损坏,未更改原工程");DYApplyRemovedBaseTools(&u,tools);paths=DYVisibleBaseToolPaths(paths,tools);if(DYBaseToolRemoved(tools,@"spider"))spider=nil;
|
||||
if(DYFilmToolActive(u)&&DYFilmSpatialActive(u.film))return fail(error,@"当前胶片含晕光、辉光、颗粒或暗角,无法完整保存到静态 Cube。请保存完整预设,或关闭这些处理后再导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"]&&DYFilmToolActive(layer)&&DYFilmSpatialActive(layer.film))return fail(error,@"新增胶片层含空间或时间处理,无法完整保存到静态 Cube。请保存完整预设。");}
|
||||
|
||||
@@ -62,7 +62,7 @@ static NSData *parameterData(DYMaskParameters p){return [NSData dataWithBytes:&p
|
||||
static BOOL readParameters(id data,DYMaskParameters *p){if(![data isKindOfClass:NSData.class]||[data length]!=sizeof(*p))return NO;[data getBytes:p length:sizeof(*p)];return dyValidMaskParameters(*p);}
|
||||
static CMTime keyTime(NSDictionary *key){return CMTimeMakeWithEpoch([key[@"value"]longLongValue],[key[@"scale"]intValue],[key[@"epoch"]longLongValue]);}
|
||||
NSDictionary *DYNewMask(NSInteger kind){if(kind<0||kind>5)return nil;DYMaskParameters p=dyDefaultMaskParameters();p.kind=(DYMaskKind)kind;p.width=.5;p.height=.5;p.sourceStage=DYMaskSourceOriginal;if(kind==DYMaskHSLKey)p.flags=DYMaskHueEnabled;NSData *nodes=[NSData data];if(kind==DYMaskBezier){DYBezierNode n[4]={};float x[4]={-.5,.5,.5,-.5},y[4]={-.5,-.5,.5,.5};for(int i=0;i<4;i++)n[i]={x[i],y[i],x[i],y[i],x[i],y[i]};nodes=[NSData dataWithBytes:n length:sizeof(n)];}return @{@"id":NSUUID.UUID.UUIDString,@"enabled":@YES,@"combine":@0,@"parameters":parameterData(p),@"nodes":nodes,@"keys":@[]};}
|
||||
NSDictionary *DYNewTool(NSString *type){if(![DYToolTypes()containsObject:type])return nil;return @{@"id":NSUUID.UUID.UUIDString,@"type":type,@"values":[type isEqual:@"skin"]?@{@"skinStrength":@0}:[type isEqual:@"primary"]?@{@"cmtoneMapping":@1}:@{},@"paths":@{},@"spiderLinked":@YES,@"masks":@[]};}
|
||||
NSDictionary *DYNewTool(NSString *type){if(![DYToolTypes()containsObject:type])return nil;return @{@"id":NSUUID.UUID.UUIDString,@"type":type,@"values":[type isEqual:@"skin"]?@{@"skinStrength":@0}:[type isEqual:@"primary"]?@{@"cmtoneMapping":@0}:@{},@"paths":@{},@"spiderLinked":@YES,@"masks":@[]};}
|
||||
BOOL DYValidToolMask(NSDictionary *mask){
|
||||
if(![mask isKindOfClass:NSDictionary.class]||!validID(mask[@"id"])||!finiteNumber(mask[@"enabled"])||!finiteNumber(mask[@"combine"])||[mask[@"combine"]integerValue]<0||[mask[@"combine"]integerValue]>2)return NO;
|
||||
DYMaskParameters p;if(!readParameters(mask[@"parameters"],&p))return NO;NSData *nodes=mask[@"nodes"];if(![nodes isKindOfClass:NSData.class]||nodes.length%sizeof(DYBezierNode)||nodes.length>32*sizeof(DYBezierNode))return NO;
|
||||
@@ -120,10 +120,10 @@ NSDictionary *DYToolRenderSnapshot(NSDictionary *doc,CMTime t){
|
||||
DYUniforms DYToolUniforms(NSDictionary *node){DYUniforms u;DYDefaultUniforms(&u);NSString *type=node[@"type"];for(NSDictionary *s in DYSections())for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:s[@"enabled"]])*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=0;u.primarySectionEnabled=0;u.cm.configured=-1;u.inputProfile=u.preLUTStrength=0;u.skinProtection.x=0;
|
||||
NSArray *parts=[type isEqual:@"primary"]?@[@"input",@"primary",@"output"]:[type isEqual:@"base"]?@[@"base",@"color"]:@[type];for(NSString *part in parts){NSDictionary *s=DYToolSection(part);for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:s[@"enabled"]])*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=1;}
|
||||
// Old independent layers omitted the former zero default. Keep their image;
|
||||
// new layers explicitly store the user's new automatic-mapping default.
|
||||
// new layers explicitly disable mapping so adding a neutral layer is identity.
|
||||
if([type isEqual:@"primary"]){u.primarySectionEnabled=1;u.cm.configured=1;u.cm.inputTransfer=u.cm.outputTransfer;u.cm.inputGamut=u.cm.outputGamut;u.cm.toneMapping=0;}
|
||||
for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if(v&&[d[@"offset"]integerValue]>=0)*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=v.floatValue;}return u;}
|
||||
BOOL DYToolIsNeutral(NSDictionary *node){NSString *type=node[@"type"];DYUniforms u=DYToolUniforms(node);NSDictionary *section=DYToolSection(type);BOOL enabled=YES;if([type isEqual:@"primary"])enabled=u.primarySectionEnabled>.5;else if([type isEqual:@"base"])enabled=u.baseSectionEnabled>.5||u.colorSectionEnabled>.5;else for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:section[@"enabled"]])enabled=*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])>.5;if(!enabled)return YES;if([type isEqual:@"primary"]&&u.cm.toneMapping>.5)return NO;if([type isEqual:@"mixer"])return !DYChannelMixerActive(u);if([type isEqual:@"film"])return !DYFilmToolActive(u);if([type isEqual:@"skin"])return u.skinProtection.y==0;if([node[@"type"]isEqual:@"spider"]&&[node[@"spider"]length]){auto mesh=DYSpiderMesh(node[@"spider"]);for(float v:dy::meshSamples(mesh))if(v!=0)return NO;}if([node[@"paths"]count])return NO;for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if(v&&v.floatValue!=[d[@"default"]floatValue])return NO;}return YES;}
|
||||
BOOL DYToolIsNeutral(NSDictionary *node){NSString *type=node[@"type"];DYUniforms u=DYToolUniforms(node);NSDictionary *section=DYToolSection(type);BOOL enabled=YES;if([type isEqual:@"primary"])enabled=u.primarySectionEnabled>.5;else if([type isEqual:@"base"])enabled=u.baseSectionEnabled>.5||u.colorSectionEnabled>.5;else for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:section[@"enabled"]])enabled=*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])>.5;if(!enabled)return YES;if([type isEqual:@"primary"]&&u.cm.toneMapping>.5)return NO;if([type isEqual:@"mixer"])return !DYChannelMixerActive(u);if([type isEqual:@"film"])return !DYFilmToolActive(u);if([type isEqual:@"skin"])return u.skinProtection.y==0;if([node[@"type"]isEqual:@"spider"]&&[node[@"spider"]length]){auto mesh=DYSpiderMesh(node[@"spider"]);for(float v:dy::meshSamples(mesh))if(v!=0)return NO;}if([node[@"paths"]count])return NO;for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if([type isEqual:@"primary"]&&[d[@"key"]isEqual:@"cmtoneMapping"]&&v.floatValue==0)continue;if(v&&v.floatValue!=[d[@"default"]floatValue])return NO;}return YES;}
|
||||
|
||||
@implementation DYToolManager {
|
||||
id<PROAPIAccessing> _host;NSString *_nodeID,*_type;NSInteger _depth;CMTime _time;NSMutableDictionary *_pending;DYInspectorToken *_token;
|
||||
|
||||
+3
-3
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.7.4</string>
|
||||
<string>1.8.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>52</string>
|
||||
<string>55</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>PlugInKit</key>
|
||||
@@ -71,7 +71,7 @@
|
||||
<key>uuid</key>
|
||||
<string>1C17B73B-F229-4C09-A434-EAF6DFF5F22A</string>
|
||||
<key>version</key>
|
||||
<string>1.7.4</string>
|
||||
<string>1.8.0</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>className</key>
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.7.4</string>
|
||||
<string>1.8.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>52</string>
|
||||
<string>55</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
在新工单中引用
屏蔽一个用户