Implement adaptive inspector and responsive canvas controls for 1.12.1
这个提交包含在:
1 父节点
91b66eb2d8
当前提交
585c83c8a1
21 个文件已更改
+316
-68
没有与搜索条件相匹配的文件
@@ -3,21 +3,22 @@
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
|
||||
// Immutable renderer-owned snapshot. Channel 0 is Rec.709 luma of the existing
|
||||
// display-encoded analysis samples, not scene-linear luminance or an HDR scope.
|
||||
// Immutable renderer-owned snapshot. Channel 0 uses Rec.709 weights in the
|
||||
// supplied RGB domain.
|
||||
struct DYHistogram {
|
||||
uint32_t bins[4][256]{};
|
||||
uint32_t samples=0;
|
||||
};
|
||||
static inline NSData *DYHistogramFromRGBA(NSData *rgba) {
|
||||
static inline NSData *DYHistogramFromRGBA(NSData *rgba, bool premultiplied=false) {
|
||||
DYHistogram h;
|
||||
if(rgba.length%sizeof(float[4]))return nil;
|
||||
const float *p=(const float *)rgba.bytes;
|
||||
auto bin=[](double v){return (int)std::lround(std::fmax(0.,std::fmin(1.,v))*255.);};
|
||||
for(NSUInteger i=0;i<rgba.length/sizeof(float[4]);i++,p+=4){
|
||||
if(!std::isfinite(p[0])||!std::isfinite(p[1])||!std::isfinite(p[2])||!std::isfinite(p[3])||p[3]<=0)continue;
|
||||
h.bins[0][bin(.2126*p[0]+.7152*p[1]+.0722*p[2])]++;
|
||||
for(int c=0;c<3;c++)h.bins[c+1][bin(p[c])]++;
|
||||
if(!std::isfinite(p[0])||!std::isfinite(p[1])||!std::isfinite(p[2])||!std::isfinite(p[3])||p[3]<=(premultiplied?1e-6f:0))continue;
|
||||
double alpha=premultiplied?p[3]:1.;
|
||||
h.bins[0][bin((.2126*p[0]+.7152*p[1]+.0722*p[2])/alpha)]++;
|
||||
for(int c=0;c<3;c++)h.bins[c+1][bin(p[c]/alpha)]++;
|
||||
h.samples++;
|
||||
}
|
||||
return [NSData dataWithBytes:&h length:sizeof(h)];
|
||||
|
||||
在新工单中引用
屏蔽一个用户