namespace XFEEDToolBox.Core.Notifications;
/// Rejects empty/transition/HUD-only captures. Scene identity is checked separately.
public static class StarFrameCandidate
{
public static bool HasStar(int width,int height,ReadOnlySpan bgra)
{
if(width<64||height<64||bgra.Length!=(long)width*height*4)return false;
const int step=4;var columns=width/step;var rows=height/step;var visited=new bool[columns*rows];
var queue=new Queue();
for(var y=rows/12;ycell-1,1=>cell+1,2=>cell-columns,_=>cell+columns};
var nx=next%columns;var ny=next/columns;
if(next<0||next>=visited.Length||nx=columns*7/8||ny=rows*7/10||visited[next]||Math.Abs(nx-cx)+Math.Abs(ny-cy)!=1)continue;
visited[next]=true;if(Bright(bgra,(ny*step*width+nx*step)*4))queue.Enqueue(next);
}
}
var w=maxX-minX+1;var h=maxY-minY+1;
if(count>=20&&w>=5&&h>=5&&w/(double)h is >=.5 and <=2&&count/(double)(w*h)>.42&&count pixels,int at)=>Math.Max(pixels[at],Math.Max(pixels[at+1],pixels[at+2]))>180
&&pixels[at]+pixels[at+1]+pixels[at+2]>300;
}