Normalize motion sampling with low-pass capture; 285 native and 19 independent checks pass

这个提交包含在:
mac 于 2026-11-02 00:37:48 +08:00 提交
1 父节点 3b57e36eb1
当前提交 c771a9274a
7 个文件已更改
+275 -4

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

+6 -3
查看文件
@@ -50,8 +50,11 @@ kernel void dyTrackFlow(device const float*prev[[buffer(0)]],device const float*
if(lane==0)results[idx]=float4(q,error,ok?1.f:0.f);
}
// Full host frame -> top-first display luma. Analysis and reference use the
// same sampler, alpha convention and transfer; no 320x180 inspector preview.
// Full host frame -> top-first display luma. Low-pass the source footprint
// before decimation so 4K fabric detail cannot alias into inconsistent motion.
// This analysis-only image never changes the full-resolution color render.
kernel void dyToolCapture(texture2d<float> source [[texture(0)]],device float* pixels [[buffer(0)]],constant uint3& info [[buffer(1)]],uint2 pos [[thread_position_in_grid]]){
if(pos.x>=info.x||pos.y>=info.y)return;constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);float2 uv=(float2(pos)+.5f)/float2(info.xy);if(info.z)uv.y=1-uv.y;float4 sample=source.sample(f,uv);float3 linear=sample.a>0?sample.rgb/sample.a:float3(0);float3 encoded=select(1.055f*pow(max(linear,float3(0)),float3(1.f/2.4f))-.055f,linear*12.92f,linear<=.0031308f);pixels[pos.y*info.x+pos.x]=dot(clamp(encoded,0.f,1.f),float3(.2126f,.7152f,.0722f));
if(pos.x>=info.x||pos.y>=info.y)return;constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);uint2 taps=clamp(uint2(ceil(float2(source.get_width(),source.get_height())/float2(info.xy))),uint2(1),uint2(8));float sum=0;
for(uint y=0;y<taps.y;y++)for(uint x=0;x<taps.x;x++){float2 uv=(float2(pos)+(float2(x,y)+.5f)/float2(taps))/float2(info.xy);if(info.z)uv.y=1-uv.y;float4 sample=source.sample(f,uv);float3 linear=sample.a>0?sample.rgb/sample.a:float3(0);float3 encoded=select(1.055f*pow(max(linear,float3(0)),float3(1.f/2.4f))-.055f,linear*12.92f,linear<=.0031308f);sum+=dot(clamp(encoded,0.f,1.f),float3(.2126f,.7152f,.0722f));}
pixels[pos.y*info.x+pos.x]=sum/float(taps.x*taps.y);
}