让 Metal 直写 Vision 追踪输入并加入 LUT 高清分屏预览
这个提交包含在:
1 父节点
ef0e62419a
当前提交
63c49b0135
22 个文件已更改
+496
-86
没有与搜索条件相匹配的文件
+19
-5
@@ -60,14 +60,28 @@ kernel void dyToolCapture(texture2d<float> source [[texture(0)]],device uchar* p
|
||||
}
|
||||
|
||||
// Reuse the analysis source texture for the lightweight color preview.
|
||||
inline uchar4 dyTrackingPreviewPixel(texture2d<float> source,uint2 pos,uint3 info){
|
||||
constexpr sampler filter(coord::normalized,address::clamp_to_edge,filter::linear);
|
||||
float2 uv=(float2(pos)+.5f)/float2(info.xy);
|
||||
if(info.z)uv.y=1-uv.y;
|
||||
return uchar4(uchar3(rint(saturate(source.sample(filter,uv).rgb)*255)),255);
|
||||
}
|
||||
kernel void dyToolTrackingPreview(texture2d<float> source [[texture(0)]],
|
||||
device uchar4 *pixels [[buffer(0)]],
|
||||
constant uint3 &info [[buffer(1)]],
|
||||
uint2 pos [[thread_position_in_grid]]){
|
||||
if(any(pos>=info.xy))return;
|
||||
constexpr sampler filter(coord::normalized,address::clamp_to_edge,filter::linear);
|
||||
float2 uv=(float2(pos)+.5f)/float2(info.xy);
|
||||
if(info.z)uv.y=1-uv.y;
|
||||
float3 rgb=source.sample(filter,uv).rgb;
|
||||
pixels[pos.y*info.x+pos.x]=uchar4(uchar3(rint(saturate(rgb)*255)),255);
|
||||
pixels[pos.y*info.x+pos.x]=dyTrackingPreviewPixel(source,pos,info);
|
||||
}
|
||||
|
||||
kernel void dyToolVisionPreview(texture2d<float> source [[texture(0)]],
|
||||
texture2d<float,access::write> image [[texture(1)]],
|
||||
constant uint3 &info [[buffer(0)]],
|
||||
constant uint &reverseRows [[buffer(1)]],
|
||||
uint2 pos [[thread_position_in_grid]]){
|
||||
if(any(pos>=info.xy))return;
|
||||
// Reverse the same discrete row as the CPU packer, keeping sampling and
|
||||
// quantization identical for both image origins and odd sizes.
|
||||
uint2 sample=uint2(pos.x,reverseRows?info.y-1-pos.y:pos.y);
|
||||
image.write(float4(dyTrackingPreviewPixel(source,sample,info))/255.f,pos);
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户