feat: complete FxPlug integration, input-aware auto grade and FCP wrapper

这个提交包含在:
mac 于 2026-10-31 01:24:07 +08:00 提交
1 父节点 2f11e8bd0f
当前提交 2330eb737e
36 个文件已更改
+4320 -131

没有与搜索条件相匹配的文件

+32
查看文件
@@ -78,3 +78,35 @@ kernel void dyPreview(texture2d<half> source [[texture(0)]],
float3 encoded = select(power, linear * 12.92f, linear <= 0.0031308f);
outRGBA[pixel.y * 64 + pixel.x] = float4(encoded, float(sample.a));
}
// Analysis resolution matches the reference auto-grade sample dimensions.
kernel void dyAnalysis(texture2d<half> source [[texture(0)]],
device float4* outRGBA [[buffer(0)]],
uint2 pixel [[thread_position_in_grid]]) {
if (pixel.x >= 320 || pixel.y >= 180) return;
constexpr sampler sampleFilter(coord::normalized, address::clamp_to_edge, filter::linear);
half4 sample = source.sample(sampleFilter, (float2(pixel) + 0.5f) / float2(320.0f, 180.0f));
float3 linear = float3(sample.rgb);
float3 power = 1.055f * pow(max(linear, float3(0.0f)), float3(1.0f / 2.4f)) - 0.055f;
float3 encoded = select(power, linear * 12.92f, linear <= 0.0031308f);
outRGBA[pixel.y * 320 + pixel.x] = float4(encoded, float(sample.a));
}
// Native auto-grade statistics consume the input-converted RGB8 preview.
// Quantization before and after the LUT mirrors the reference NSImage path.
kernel void dyInputAnalysis(texture2d<half> source [[texture(0)]],
texture3d<float> inputLUT [[texture(1)]],
device float4* outRGBA [[buffer(0)]],
constant float& inputStrength [[buffer(1)]],
uint2 pixel [[thread_position_in_grid]]) {
if (pixel.x >= 320 || pixel.y >= 180) return;
constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);
half4 sample=source.sample(f,(float2(pixel)+.5f)/float2(320,180));
float3 linear=float3(sample.rgb);
float3 power=1.055f*pow(max(linear,float3(0)),float3(1.0f/2.4f))-.055f;
float3 encoded=round(clamp(select(power,linear*12.92f,linear<=.0031308f),0.0f,1.0f)*255.0f)/255.0f;
float strength=clamp(inputStrength,0.0f,1.0f);
if(strength>0.0f){float n=float(inputLUT.get_width());float3 coord=encoded*((n-1.0f)/n)+.5f/n;encoded=mix(encoded,inputLUT.sample(f,coord).rgb,strength);}
encoded=round(clamp(encoded,0.0f,1.0f)*255.0f)/255.0f;
outRGBA[pixel.y*320+pixel.x]=float4(encoded,float(sample.a));
}