Keep stable OpenCV flow with compact Metal capture and pyramid reuse
这个提交包含在:
1 父节点
48ac192d4b
当前提交
1cc7f8edb2
15 个文件已更改
+184
-29
没有与搜索条件相匹配的文件
@@ -54,9 +54,9 @@ kernel void dyToolEncodeGamma22(texture2d<float,access::read> source [[texture(0
|
||||
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;float4 pixel=source.read(pos);float alpha=max(pixel.a,0.f);float3 straight=alpha>0?pixel.rgb/alpha:float3(0);output.write(float4(pow(max(straight,float3(0)),float3(1.f/2.2f))*alpha,alpha),pos);
|
||||
}
|
||||
// Lanczos RGBA8 -> top-first OpenCV Gray8. Analysis never changes color output.
|
||||
kernel void dyToolCapture(texture2d<float> source [[texture(0)]],device float* pixels [[buffer(0)]],constant uint3& info [[buffer(1)]],uint2 pos [[thread_position_in_grid]]){
|
||||
kernel void dyToolCapture(texture2d<float> source [[texture(0)]],device uchar* pixels [[buffer(0)]],constant uint3& info [[buffer(1)]],uint2 pos [[thread_position_in_grid]]){
|
||||
if(pos.x>=info.x||pos.y>=info.y)return;uint2 point=uint2(pos.x,info.z?info.y-1-pos.y:pos.y);uint3 rgb=uint3(rint(source.read(point).rgb*255.f));
|
||||
pixels[pos.y*info.x+pos.x]=float((rgb.r*9798u+rgb.g*19235u+rgb.b*3735u+16384u)>>15)/255.f;
|
||||
pixels[pos.y*info.x+pos.x]=uchar((rgb.r*9798u+rgb.g*19235u+rgb.b*3735u+16384u)>>15);
|
||||
}
|
||||
|
||||
// Reuse the analysis source texture for the lightweight color preview.
|
||||
|
||||
在新工单中引用
屏蔽一个用户