修复 Rec.709 曲线直方图的线性电平偏移
这个提交包含在:
1 父节点
d91f1b176b
当前提交
7f2917393c
8 个文件已更改
+46
-13
没有与搜索条件相匹配的文件
@@ -70,6 +70,11 @@
|
||||
BOOL totals=YES;for(int c=0;c<4;c++){uint32_t total=0;for(int b=0;b<256;b++)total+=h->bins[c][b];totals&=total==6;}
|
||||
run.record(@"histogram-each-channel-conserves-valid-samples",totals);
|
||||
run.record(@"histogram-malformed-and-empty-safe",!DYHistogramFromRGBA([NSData dataWithBytes:pixels length:3])&&((const DYHistogram*)DYHistogramFromRGBA([NSData data]).bytes)->samples==0);
|
||||
const float premultipliedGrey[]={.09f,.09f,.09f,.5f};
|
||||
NSData *grey=[NSData dataWithBytes:premultipliedGrey length:sizeof(premultipliedGrey)];
|
||||
NSData *greyLevels=DYHistogramFromRGBA(grey,true,true);
|
||||
const auto *video=(const DYHistogram*)greyLevels.bytes;
|
||||
run.record(@"histogram-encodes-straight-linear-grey-as-rec709-signal",video->rec709VideoLevels&&video->samples==1&&video->bins[0][104]==1&&video->bins[1][104]==1);
|
||||
DYDiagnosticManager *host=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(host,nil);DYRenderer *renderer=[[[DYRenderer alloc]init]autorelease];
|
||||
DYScopeSample *sample=[[[DYScopeSample alloc]init]autorelease];sample.pixels=input;[renderer setValue:sample forKey:@"scopeLatest"];
|
||||
DYInspector *view=[[[DYInspector alloc]initWithAPIManager:host renderer:renderer]autorelease];[view refresh];NSDictionary *before=[view presetSnapshot];
|
||||
@@ -90,6 +95,9 @@
|
||||
[renderer invalidatePreview];
|
||||
run.record(@"histogram-keeps-final-output-while-a-new-render-is-pending",[[graph valueForKey:@"histogram"]isEqual:data]);
|
||||
DYDiagnosticTile *updated=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:2 height:2]autorelease];
|
||||
CGColorSpaceRef linear709=CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);
|
||||
[updated setDiagnosticColorSpace:linear709];
|
||||
CGColorSpaceRelease(linear709);
|
||||
const __fp16 colors[16]={.25f,.4f,.6f,1,.25f,.4f,.6f,1,.25f,.4f,.6f,1,.25f,.4f,.6f,1};
|
||||
[[updated metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,2,2)mipmapLevel:0 withBytes:colors bytesPerRow:16];
|
||||
[renderer captureScopeTile:updated atTime:kCMTimeZero];
|
||||
@@ -97,6 +105,8 @@
|
||||
while([[graph valueForKey:@"histogram"]isEqual:data]&&NSProcessInfo.processInfo.systemUptime<until)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];
|
||||
NSData *latest=[graph valueForKey:@"histogram"];
|
||||
run.record(@"histogram-open-inspector-refreshes-after-a-new-output-at-the-same-time",latest.length==sizeof(DYHistogram)&&![latest isEqual:data]&&[latest isEqual:[renderer canvasHistogramAtTime:kCMTimeZero]]);
|
||||
const auto *latestBins=latest.length==sizeof(DYHistogram)?(const DYHistogram*)latest.bytes:nullptr;
|
||||
run.record(@"histogram-inspector-and-canvas-use-rec709-video-bins-for-linear-output",latestBins&&latestBins->rec709VideoLevels&&latestBins->samples==57600&&latestBins->bins[1][125]==57600&&latestBins->bins[2][160]==57600&&latestBins->bins[3][197]==57600);
|
||||
NSInteger previous=DYThemeIndex();DYSetThemeIndex(8);
|
||||
run.record(@"relief-only-two-choices-and-no-text-glow",DYThemeNames().count==2&&DYThemeTextShadow()==nil&&![DYThemePalette()[@"background"]isEqual:DYThemePalette()[@"backgroundEnd"]]);
|
||||
DYSetThemeIndex(previous);
|
||||
|
||||
+10
-5
@@ -3,22 +3,27 @@
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
|
||||
// Immutable renderer-owned snapshot. Channel 0 uses Rec.709 weights in the
|
||||
// supplied RGB domain.
|
||||
// Immutable renderer-owned snapshot. Channel 0 uses Rec.709 weights after
|
||||
// any signal encoding, as luma is weighted from R′G′B′.
|
||||
struct DYHistogram {
|
||||
uint32_t bins[4][256]{};
|
||||
uint32_t samples=0;
|
||||
uint32_t rec709VideoLevels=0;
|
||||
};
|
||||
static inline NSData *DYHistogramFromRGBA(NSData *rgba, bool premultiplied=false) {
|
||||
static inline NSData *DYHistogramFromRGBA(NSData *rgba, bool premultiplied=false, bool encodeRec709=false) {
|
||||
DYHistogram h;
|
||||
if(rgba.length%sizeof(float[4]))return nil;
|
||||
h.rec709VideoLevels=encodeRec709;
|
||||
const float *p=(const float *)rgba.bytes;
|
||||
auto bin=[](double v){return (int)std::lround(std::fmax(0.,std::fmin(1.,v))*255.);};
|
||||
auto rec709=[](double linear){return linear<.018?4.5*linear:1.099*std::pow(linear,.45)-.099;};
|
||||
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]<=(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)]++;
|
||||
double rgb[]={p[0]/alpha,p[1]/alpha,p[2]/alpha};
|
||||
if(encodeRec709)for(double &component:rgb)component=rec709(component);
|
||||
h.bins[0][bin(.2126*rgb[0]+.7152*rgb[1]+.0722*rgb[2])]++;
|
||||
for(int c=0;c<3;c++)h.bins[c+1][bin(rgb[c])]++;
|
||||
h.samples++;
|
||||
}
|
||||
return [NSData dataWithBytes:&h length:sizeof(h)];
|
||||
|
||||
+10
-2
@@ -258,7 +258,7 @@ static NSArray *DYPresentationSections(BOOL cstOnly,BOOL splitOutput) {
|
||||
_values=[@{} copy];
|
||||
_channels=[[NSSegmentedControl segmentedControlWithLabels:@[@"RGB",@"红",@"绿",@"蓝"] trackingMode:NSSegmentSwitchTrackingSelectOne target:self action:@selector(channelChanged:)] retain];
|
||||
_channels.selectedSegment=0; _channels.controlSize=NSControlSizeSmall; [self addSubview:_channels];
|
||||
_histogramToggle=[[NSButton checkboxWithTitle:@"直方图" target:self action:@selector(histogramToggled:)]retain];_histogramToggle.state=NSControlStateValueOn;_histogramToggle.font=[NSFont systemFontOfSize:10];_histogramToggle.accessibilityLabel=@"显示曲线直方图叠层";_histogramToggle.toolTip=@"亮度与 RGB,256 档、320×180 采样。来自当前效果的输出,曲线调整后随画面刷新。";[self addSubview:_histogramToggle];
|
||||
_histogramToggle=[[NSButton checkboxWithTitle:@"直方图" target:self action:@selector(histogramToggled:)]retain];_histogramToggle.state=NSControlStateValueOn;_histogramToggle.font=[NSFont systemFontOfSize:10];_histogramToggle.accessibilityLabel=@"显示曲线直方图叠层";_histogramToggle.toolTip=@"统计当前效果输出的亮度与 RGB。线性 Rec.709 按视频电平显示。256 档、320×180 采样。";[self addSubview:_histogramToggle];
|
||||
self.accessibilityLabel=@"曲线点编辑器";self.toolTip=@"点击添加点;拖动调整;双击、右键或按住 Option 点击已有点可删除";
|
||||
}
|
||||
return self;
|
||||
@@ -268,7 +268,15 @@ static NSArray *DYPresentationSections(BOOL cstOnly,BOOL splitOutput) {
|
||||
- (void)setValues:(NSDictionary *)values { [_values release];_values=[values copy];[self setNeedsDisplay:YES]; }
|
||||
- (void)layout { [super layout];_channels.frame=NSMakeRect(12,4,MAX(100,self.bounds.size.width-112),24);_histogramToggle.frame=NSMakeRect(self.bounds.size.width-88,5,80,22); }
|
||||
- (void)setFixedWorkspaceChannel:(NSInteger)channel {_fixedWorkspaceChannel=YES;_channel=channel;_channels.hidden=YES;_histogramToggle.hidden=YES;}
|
||||
- (void)setHistogram:(NSData *)histogram {if(_histogram==histogram)return;[_histogram release];_histogram=[histogram copy];const DYHistogram *h=_histogram.length==sizeof(DYHistogram)?(const DYHistogram*)_histogram.bytes:nullptr;_histogramToggle.accessibilityValueDescription=h&&h->samples?[NSString stringWithFormat:@"效果输出,%u 个有效采样",h->samples]:@"等待画面;请移动播放头";[self setNeedsDisplay:YES];}
|
||||
- (void)setHistogram:(NSData *)histogram {
|
||||
if(_histogram==histogram)return;
|
||||
[_histogram release];_histogram=[histogram copy];
|
||||
const DYHistogram *h=_histogram.length==sizeof(DYHistogram)?(const DYHistogram*)_histogram.bytes:nullptr;
|
||||
_histogramToggle.accessibilityValueDescription=h&&h->samples
|
||||
?[NSString stringWithFormat:@"%@,%u 个有效采样",h->rec709VideoLevels?@"Rec.709 视频电平":@"效果输出",h->samples]
|
||||
:@"等待画面;请移动播放头";
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
- (void)histogramToggled:(id)sender {[self setNeedsDisplay:YES];}
|
||||
- (void)channelChanged:(NSSegmentedControl *)sender { _channel=sender.selectedSegment;[self setNeedsDisplay:YES]; }
|
||||
- (NSRect)plotRect {if(_fixedWorkspaceChannel){CGFloat side=MAX(50,MIN(self.bounds.size.width-16,self.bounds.size.height-42));return NSMakeRect((self.bounds.size.width-side)/2,MAX(8,(self.bounds.size.height-side-34)/2),side,side);}return NSMakeRect(16,37,MAX(50,self.bounds.size.width-32),MAX(50,self.bounds.size.height-76));}
|
||||
|
||||
@@ -15,7 +15,7 @@ struct DYScopeReference {
|
||||
@property(nonatomic,copy) NSDictionary *metadata;
|
||||
@property(nonatomic) NSUInteger generation;
|
||||
@property(nonatomic) CGColorSpaceRef space;
|
||||
/// Final-output bins in the host RGB domain, calculated only if requested.
|
||||
/// Final-output bins, encoded as video levels for linear Rec.709 output.
|
||||
@property(nonatomic,readonly) NSData *canvasHistogram;
|
||||
/// Shared straight-alpha display samples for the workspace and spider scopes.
|
||||
- (std::shared_ptr<const DYScopeReference>)displayReferenceWithProfile:(DYColorProfile *)profile;
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
}
|
||||
- (NSData *)canvasHistogram{
|
||||
@synchronized(self){
|
||||
if(!_canvasHistogram)_canvasHistogram=[DYHistogramFromRGBA(_pixels,true) retain];
|
||||
if(!_canvasHistogram){
|
||||
CFStringRef name=_space?CGColorSpaceGetName(_space):nullptr;
|
||||
bool linear709=name&&(CFEqual(name,kCGColorSpaceExtendedLinearSRGB)||CFEqual(name,kCGColorSpaceLinearSRGB));
|
||||
_canvasHistogram=[DYHistogramFromRGBA(_pixels,true,linear709) retain];
|
||||
}
|
||||
return [[_canvasHistogram retain]autorelease];
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.21.3</string>
|
||||
<string>1.21.4</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>120</string>
|
||||
<string>121</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>PlugInKit</key>
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.21.3</string>
|
||||
<string>1.21.4</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>120</string>
|
||||
<string>121</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
更新于 2026-11-08(Asia/Shanghai)。这是新对话的接手入口。历史设计和实现细节按需查阅专项交接,复现和交付证据以对应版本的报告为准。
|
||||
|
||||
## 1.21.4(121)曲线直方图 Rec.709 电平
|
||||
|
||||
用户在 FCP 的 Rec.709 项目对照同帧 S-Log3 灰片,发现曲线背景分布偏左。本机正式 1.21.3 在同一工程的 00:00:02:24 复现。曲线背景曾直接分箱线性 RGB,约 50% 的 Rec.709 视频电平在线性域约为 0.26,旧图约 66/255。改为对已识别的线性 Rec.709 输出解除透明度预乘、逐通道进行 BT.709 编码再分箱。检查器和画布共用这份结果。其他色彩空间沿用原统计,亮度叠层、320×180 采样及 0–255 坐标保留。[统计入口](大鱼调色/Plugin/DYScopeSample.mm#L10) · [FxPlug 色彩空间](https://developer.apple.com/documentation/professional-video-applications/managing-color-space-and-gamut-in-plug-ins)
|
||||
|
||||
源码候选待 Release 构建、正式安装及 FCP 同帧峰位验收。下一步验证色彩配置识别、同帧刷新及有效采样数量,再生成发行包。
|
||||
|
||||
## 1.21.3(120)共享缓冲追踪与 LUT 对比预览
|
||||
|
||||
正式版从唯一插件路径启动,编译提交 `43364549327470291abd82ca1d0eded2becd1579`,APP 公证 `6f1e34d4-7d24-4a73-9a8b-af41e132d4ba` Accepted。1012 项原生自检、17 套模板、票据、Gatekeeper 与 PluginKit 唯一路径通过。Metal 直写 IOSurface 上的 BGRA 缓冲后交给 Vision。四组奇数宽高、不同图像原点与翻转的像素回归逐字节一致。其他普通蒙版和图章追踪仍使用各自现有输入。[安装](verification/Delivery1.21.3.json)
|
||||
|
||||
在新工单中引用
屏蔽一个用户