From 7f2917393c89cdc8935b494106e09b2851378ec5 Mon Sep 17 00:00:00 2001 From: mac Date: Sun, 8 Nov 2026 20:32:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Rec.709=20=E6=9B=B2?= =?UTF-8?q?=E7=BA=BF=E7=9B=B4=E6=96=B9=E5=9B=BE=E7=9A=84=E7=BA=BF=E6=80=A7?= =?UTF-8?q?=E7=94=B5=E5=B9=B3=E5=81=8F=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 大鱼调色/Plugin/DYCompactUIDiagnostics.inc.h | 10 ++++++++++ 大鱼调色/Plugin/DYHistogram.h | 15 ++++++++++----- 大鱼调色/Plugin/DYInspector.mm | 12 ++++++++++-- 大鱼调色/Plugin/DYScopeSample.h | 2 +- 大鱼调色/Plugin/DYScopeSample.mm | 6 +++++- 大鱼调色/Plugin/Info.plist | 4 ++-- 大鱼调色/Wrapper Application/Info.plist | 4 ++-- 开发交接.md | 6 ++++++ 8 files changed, 46 insertions(+), 13 deletions(-) diff --git a/大鱼调色/Plugin/DYCompactUIDiagnostics.inc.h b/大鱼调色/Plugin/DYCompactUIDiagnostics.inc.h index 1298932..bee5f8d 100644 --- a/大鱼调色/Plugin/DYCompactUIDiagnostics.inc.h +++ b/大鱼调色/Plugin/DYCompactUIDiagnostics.inc.h @@ -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.systemUptimerec709VideoLevels&&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); diff --git a/大鱼调色/Plugin/DYHistogram.h b/大鱼调色/Plugin/DYHistogram.h index 2ce7dcd..cc1ab6c 100644 --- a/大鱼调色/Plugin/DYHistogram.h +++ b/大鱼调色/Plugin/DYHistogram.h @@ -3,22 +3,27 @@ #include #include -// 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;isamples?[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));} diff --git a/大鱼调色/Plugin/DYScopeSample.h b/大鱼调色/Plugin/DYScopeSample.h index 721b4f2..06ee54c 100644 --- a/大鱼调色/Plugin/DYScopeSample.h +++ b/大鱼调色/Plugin/DYScopeSample.h @@ -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)displayReferenceWithProfile:(DYColorProfile *)profile; diff --git a/大鱼调色/Plugin/DYScopeSample.mm b/大鱼调色/Plugin/DYScopeSample.mm index 16cd05e..fa43436 100644 --- a/大鱼调色/Plugin/DYScopeSample.mm +++ b/大鱼调色/Plugin/DYScopeSample.mm @@ -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]; } } diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index 139b16d..f5fb47c 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.21.3 + 1.21.4 CFBundleVersion - 120 + 121 NSHumanReadableCopyright PlugInKit diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index 6ccb31b..bff48f4 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.21.3 + 1.21.4 CFBundleVersion - 120 + 121 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright diff --git a/开发交接.md b/开发交接.md index ceef846..b936c3d 100644 --- a/开发交接.md +++ b/开发交接.md @@ -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)