fix: align spider vectorscope with CbCr scope and separate trace from controls
这个提交包含在:
1 父节点
01efcc8a29
当前提交
b16a6326a4
17 个文件已更改
+411
-114
没有与搜索条件相匹配的文件
+32
-4
@@ -1,8 +1,11 @@
|
||||
#import "DYScopeSample.h"
|
||||
#import "DYHistogram.h"
|
||||
#include "DYScopeMath.hpp"
|
||||
#import "../../ColorManagement/Sources/DYColorProfile.h"
|
||||
#include <mutex>
|
||||
@implementation DYScopeSample {
|
||||
NSData *_canvasHistogram,*_spiderScope;
|
||||
std::shared_ptr<const DYScopeReference> _reference;
|
||||
std::mutex _referenceMutex;
|
||||
}
|
||||
- (NSData *)canvasHistogram{
|
||||
@synchronized(self){
|
||||
@@ -10,10 +13,35 @@
|
||||
return [[_canvasHistogram retain]autorelease];
|
||||
}
|
||||
}
|
||||
- (NSData *)spiderScope {
|
||||
- (std::shared_ptr<const DYScopeReference>)displayReferenceWithProfile:(DYColorProfile *)profile {
|
||||
std::lock_guard<std::mutex> lock(_referenceMutex);
|
||||
if(_reference)return _reference;
|
||||
const auto *raw=(const dyscope::RGBA *)_pixels.bytes;
|
||||
auto reference=std::make_shared<DYScopeReference>();
|
||||
reference->pixels.resize(_pixels.length/sizeof(*raw));
|
||||
for(size_t i=0;i<reference->pixels.size();i++){
|
||||
const auto &p=raw[i];
|
||||
if(!std::isfinite(p.r)||!std::isfinite(p.g)||!std::isfinite(p.b)||!std::isfinite(p.a)){
|
||||
reference->invalid++;
|
||||
continue;
|
||||
}
|
||||
if(p.a<=1e-6f)continue;
|
||||
dyscope::RGBA straight={p.r/p.a,p.g/p.a,p.b/p.a,p.a};
|
||||
if(dyscope::visible(straight))reference->pixels[i]=straight;
|
||||
else reference->invalid++;
|
||||
}
|
||||
if(profile){
|
||||
auto result=[profile convertPixels:reference->pixels alpha:dycm::Alpha::Straight
|
||||
budget:32ull*1024*1024 cancelled:nullptr error:nil];
|
||||
if(result){reference->pixels=std::move(*result);reference->converted=true;}
|
||||
}
|
||||
_reference=reference;
|
||||
return _reference;
|
||||
}
|
||||
- (NSData *)spiderScopeWithProfile:(DYColorProfile *)profile {
|
||||
@synchronized(self){if(_spiderScope)return [[_spiderScope retain]autorelease];}
|
||||
const auto *pixels=(const dyscope::RGBA *)_pixels.bytes;
|
||||
auto raster=dyscope::spiderVectorImage({pixels,_pixels.length/sizeof(*pixels)});
|
||||
auto reference=[self displayReferenceWithProfile:profile];
|
||||
auto raster=dyscope::spiderVectorImage(reference->pixels);
|
||||
NSData *data=[NSData dataWithBytes:raster.data() length:raster.size()];
|
||||
@synchronized(self){
|
||||
if(!_spiderScope)_spiderScope=[data retain];
|
||||
|
||||
在新工单中引用
屏蔽一个用户