fix: bound vector-scope coordinates before rounding extreme samples

这个提交包含在:
mac 于 2026-11-05 09:57:59 +08:00 提交
1 父节点 ded1f22be8
当前提交 0ef847f6bb
2 个文件已更改
+2 -1

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

+1 -1
查看文件
@@ -21,7 +21,7 @@ struct Result {
inline unsigned bin(float v){if(!(v>Low))return 0;if(v>=High)return Bins-1;return unsigned(std::clamp(std::lround((v-Low)/(High-Low)*(Bins-1)),0l,long(Bins-1)));}
// BT.709 colour-difference coordinates on the same encoded display-reference
// RGB used by the existing scopes (ITU-R BT.709-6 section 3.3). Not an IRE meter.
inline unsigned chromaBin(float v){return unsigned(std::clamp(std::lround((v+.6f)/1.2f*(Bins-1)),0l,long(Bins-1)));}
inline unsigned chromaBin(float v){if(!(v>-.6f))return 0;if(v>=.6f)return Bins-1;return unsigned(std::clamp(std::lround((v+.6f)/1.2f*(Bins-1)),0l,long(Bins-1)));}
inline Result measure(std::span<const RGBA> pixels,unsigned width=Width,unsigned height=Height){
Result r;if(!width||!height||pixels.size()!=size_t(width)*height)return r;bool first=true;
for(unsigned y=0;y<height;y++)for(unsigned x=0;x<width;x++){