比较提交
4
次代码提交
13821366a5
..
v1.3.0
| 作者 | SHA1 | 提交日期 | |
|---|---|---|---|
|
|
58f09e5756 | ||
|
|
730d1755ca | ||
|
|
2f2c081980 | ||
|
|
2e79602761 |
没有与搜索条件相匹配的文件
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
正式安装路径为 `/Library/Plug-Ins/FxPlug/beatygril.app`。Motion 滤镜分类为「大鱼」,滤镜名「大鱼人像美化」。Final Cut Pro 在「效果 → 大鱼磨皮瘦脸 → 大鱼人像美化」中使用配套 Motion 效果,模板目录必须同时保留 `.moef` 与 `Drop Zone.tiff`。美化会随当前帧的人脸自动更新,不需要点击分析。界面以磨皮、美白、瘦脸三张卡片呈现,默认跟随主要人脸;多人模式对多脸变形。单项眼睛可暂时停用并保留数值,右侧箭头恢复默认;磨皮半径、饱和度、锐化和整体混合等收在「更多设置」。旧手动分析与调试参数仅保留隐藏兼容,实际输出统一使用实时自动跟随。
|
正式安装路径为 `/Library/Plug-Ins/FxPlug/beatygril.app`。Motion 滤镜分类为「大鱼」,滤镜名「大鱼人像美化」。Final Cut Pro 在「效果 → 大鱼磨皮瘦脸 → 大鱼人像美化」中使用配套 Motion 效果,模板目录必须同时保留 `.moef` 与 `Drop Zone.tiff`。美化会随当前帧的人脸自动更新,不需要点击分析。界面以磨皮、美白、瘦脸三张卡片呈现,默认跟随主要人脸;多人模式对多脸变形。单项眼睛可暂时停用并保留数值,右侧箭头恢复默认;磨皮半径、饱和度、锐化和整体混合等收在「更多设置」。旧手动分析与调试参数仅保留隐藏兼容,实际输出统一使用实时自动跟随。
|
||||||
|
|
||||||
|
1.3.0 的磨皮卡片依次提供「磨皮程度、微细锐化、五官保护、非肤色区保护」。两种保护默认 100%;降低五官保护让五官区域参与更多磨皮,降低非肤色区保护则扩大磨皮范围,均不扩大肤色提亮范围。微细锐化在局部支持区域恢复纹理;旧全局磨皮和全局锐化仍保留在更多设置,旧工程的参数与归档继续兼容。迁移证据、实现边界与验证见[新版磨皮参数迁移](docs/analysis/新版磨皮参数迁移.md)。1.3.0(15)APP 已完成签名、公证及正式安装,1636 项自动检查通过;原生宿主效果由用户实测。1.2.0 下载链接仍对应原发行包,本次未更新文章或安装包。
|
||||||
|
|
||||||
## 开发和恢复
|
## 开发和恢复
|
||||||
|
|
||||||
需要 Xcode 27.1、FxPlug SDK 4.3.4 与 PluginManager 1.7.4;最低运行系统 macOS 13。正式产物为 arm64/x86_64 通用版本。
|
需要 Xcode 27.1、FxPlug SDK 4.3.4 与 PluginManager 1.7.4;最低运行系统 macOS 13。正式产物为 arm64/x86_64 通用版本。
|
||||||
|
|||||||
+9
@@ -105,3 +105,12 @@ Motion/FCP原生验收范围及未完成项见`docs/verification/v1.1.2/native-q
|
|||||||
## GitHub 公开恢复副本
|
## GitHub 公开恢复副本
|
||||||
|
|
||||||
GitHub 远端 `https://github.com/FAMEDaYu/FCP-BeatyGril.git` 已完成完整历史与七个标签的推送,`origin` 及其 main 上游保持大鱼仓库。独立匿名克隆恢复节点为 `356683b41af702d6c0143ad7fa5f540d752d6e14`,197 文件逐字节核验、strict/full fsck 和全部标签回读通过。后续 main 补充发布说明与验证文档,产品源码保持相同。GitHub Release 的公证安装包已匿名下载核对哈希、签名和票据。详见 `docs/GitHub同步说明.md` 和 `docs/verification/github/`。
|
GitHub 远端 `https://github.com/FAMEDaYu/FCP-BeatyGril.git` 已完成完整历史与七个标签的推送,`origin` 及其 main 上游保持大鱼仓库。独立匿名克隆恢复节点为 `356683b41af702d6c0143ad7fa5f540d752d6e14`,197 文件逐字节核验、strict/full fsck 和全部标签回读通过。后续 main 补充发布说明与验证文档,产品源码保持相同。GitHub Release 的公证安装包已匿名下载核对哈希、签名和票据。详见 `docs/GitHub同步说明.md` 和 `docs/verification/github/`。
|
||||||
|
|
||||||
|
|
||||||
|
## 1.3.0 新面板参数恢复
|
||||||
|
|
||||||
|
签名源码节点 `2f2c081980dc610ac810f8daf92da8966f310802` 已推送并读回核验 origin 与 github 的 `codex/new-beauty-controls` 分支。两个远端地址沿用本文既有配置。独立远端克隆与 strict/full fsck、205 个受跟踪文件逐字节比较通过,见 `docs/verification/v1.3.0/recovery-verification.json`。无 LFS、子模块;依赖与签名凭据仍需单独恢复。
|
||||||
|
|
||||||
|
本节点增加五官保护强度、非肤色区保护和局部微细锐化,PGBeautySettings v2 兼容旧 160 字节 v1 状态,面板归档仍为 schema 1。测试命令不变,1636 项通过。恢复签名源码时克隆并切换该分支,或 `git switch --detach 2f2c081980dc610ac810f8daf92da8966f310802`。
|
||||||
|
|
||||||
|
1.3.0(15)已正式安装到 `/Library/Plug-Ins/FxPlug/beatygril.app`。签名、通用架构、公证票据、Gatekeeper 和 PluginKit 正式路径均通过,已清理本次构建、旧 APP 备份和公证 ZIP。最终回执见 `docs/verification/v1.3.0/delivery-receipt.json`、`installed-verification.json`;`prepared-release.json` 保留安装前状态。`v1.3.0` 标签包含签名源码及后续交付文档。本次没有生成新 PKG 或更新文章,1.2.0 的公开发行资料继续有效;新滑杆的原生宿主视觉仍由用户测试。
|
||||||
@@ -17,9 +17,9 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>XPC!</string>
|
<string>XPC!</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.2.0</string>
|
<string>1.3.0</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>14</string>
|
<string>15</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>PlugInKit</key>
|
<key>PlugInKit</key>
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
<key>uuid</key>
|
<key>uuid</key>
|
||||||
<string>FB14B0E6-59B2-4836-916F-CD0C559E9241</string>
|
<string>FB14B0E6-59B2-4836-916F-CD0C559E9241</string>
|
||||||
<key>version</key>
|
<key>version</key>
|
||||||
<string>1.2.0</string>
|
<string>1.3.0</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>className</key>
|
<key>className</key>
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
<key>uuid</key>
|
<key>uuid</key>
|
||||||
<string>E0E432C8-3D71-4ABA-B006-E7F519E06C87</string>
|
<string>E0E432C8-3D71-4ABA-B006-E7F519E06C87</string>
|
||||||
<key>version</key>
|
<key>version</key>
|
||||||
<string>1.2.0</string>
|
<string>1.3.0</string>
|
||||||
<key>protocolNames</key>
|
<key>protocolNames</key>
|
||||||
<array>
|
<array>
|
||||||
<string>FxOnScreenControl</string>
|
<string>FxOnScreenControl</string>
|
||||||
|
|||||||
@@ -82,6 +82,26 @@ static NSDictionary<NSString *, CIColorKernel *> *PGKernels(void) {
|
|||||||
"kernel vec4 pgMaskedMix(__sample source,__sample effect,__sample mask,float amount) {"
|
"kernel vec4 pgMaskedMix(__sample source,__sample effect,__sample mask,float amount) {"
|
||||||
"vec4 s=unpremultiply(source); vec4 e=unpremultiply(effect);"
|
"vec4 s=unpremultiply(source); vec4 e=unpremultiply(effect);"
|
||||||
"return premultiply(vec4(mix(s.rgb,e.rgb,clamp(mask.r*amount,0.0,1.0)),s.a)); }");
|
"return premultiply(vec4(mix(s.rgb,e.rgb,clamp(mask.r*amount,0.0,1.0)),s.a)); }");
|
||||||
|
// Keep smoothing support separate from the exposure/color mask. The
|
||||||
|
// two new controls independently release feature cutouts and background.
|
||||||
|
k[@"smoothingSupport"] = PGKernel(@
|
||||||
|
"kernel vec4 pgSmoothingSupport(__sample protectedMask,__sample baseMask,float featureProtection,float skinProtection) {"
|
||||||
|
"float base=clamp(baseMask.r,0.0,1.0);float protectedValue=clamp(protectedMask.r,0.0,1.0);"
|
||||||
|
"float value=mix(base,protectedValue,featureProtection);"
|
||||||
|
"if(skinProtection<1.0){float extended=1.0-skinProtection*(1.0-base);"
|
||||||
|
"float retention=base>0.00001?clamp(protectedValue/base,0.0,1.0):1.0;"
|
||||||
|
"value=extended*mix(1.0,retention,featureProtection);}"
|
||||||
|
"return vec4(value,value,value,1.0); }");
|
||||||
|
k[@"microDetail"] = PGKernel(@
|
||||||
|
"kernel vec4 pgMicroDetail(__sample processed,__sample original,__sample low,__sample coverage,float amount) {"
|
||||||
|
"vec4 outPixel=unpremultiply(processed);vec3 src=unpremultiply(original).rgb;"
|
||||||
|
"vec3 high=src-unpremultiply(low).rgb;vec3 weights=vec3(0.299,0.587,0.114);"
|
||||||
|
"float y=dot(src,weights);float detailY=dot(high,weights);float size=length(high);"
|
||||||
|
"float lightGate=smoothstep(0.07,0.22,y)*(1.0-smoothstep(0.86,0.99,y));"
|
||||||
|
"float textureGate=smoothstep(0.0015,0.010,size)*(1.0-smoothstep(0.16,0.36,size));"
|
||||||
|
"float gain=amount*clamp(coverage.r,0.0,1.0)*lightGate*textureGate*1.18;"
|
||||||
|
"vec3 detail=vec3(detailY*0.92)+(high-vec3(detailY))*0.28;"
|
||||||
|
"return premultiply(vec4(clamp(outPixel.rgb+detail*gain,0.0,1.0),outPixel.a)); }");
|
||||||
k[@"colorCoverage"] = PGKernel(@
|
k[@"colorCoverage"] = PGKernel(@
|
||||||
"kernel vec4 pgColorCoverage(__sample coverage,__sample image,float invert) {"
|
"kernel vec4 pgColorCoverage(__sample coverage,__sample image,float invert) {"
|
||||||
"vec3 c=unpremultiply(image).rgb; float y=dot(c,vec3(0.299,0.587,0.114));"
|
"vec3 c=unpremultiply(image).rgb; float y=dot(c,vec3(0.299,0.587,0.114));"
|
||||||
@@ -157,7 +177,7 @@ static NSDictionary<NSString *, CIColorKernel *> *PGKernels(void) {
|
|||||||
float mix = PGClamp(s.mix, 0, 1);
|
float mix = PGClamp(s.mix, 0, 1);
|
||||||
if (mix == 0 && !s.showMask) return image;
|
if (mix == 0 && !s.showMask) return image;
|
||||||
NSDictionary *k = PGKernels();
|
NSDictionary *k = PGKernels();
|
||||||
if (k.count != 11) {
|
if (k.count != 13) {
|
||||||
if (error) *error = [NSError errorWithDomain:@"PGBeautyRenderer" code:2
|
if (error) *error = [NSError errorWithDomain:@"PGBeautyRenderer" code:2
|
||||||
userInfo:@{NSLocalizedDescriptionKey:@"The beauty image kernels could not be compiled."}];
|
userInfo:@{NSLocalizedDescriptionKey:@"The beauty image kernels could not be compiled."}];
|
||||||
return nil;
|
return nil;
|
||||||
@@ -173,7 +193,10 @@ static NSDictionary<NSString *, CIColorKernel *> *PGKernels(void) {
|
|||||||
float sharpness = PGClamp(s.sharpness,0,2);
|
float sharpness = PGClamp(s.sharpness,0,2);
|
||||||
float teeth = PGClamp(s.teethWhitening,0,1);
|
float teeth = PGClamp(s.teethWhitening,0,1);
|
||||||
float eyes = PGClamp(s.eyeBrightening,0,1);
|
float eyes = PGClamp(s.eyeBrightening,0,1);
|
||||||
BOOL needsSkin = local*amount>0 || brightness>0 || hue!=0 || saturation!=0 || even>0 ||
|
float protection = s.featureProtection ? PGClamp(s.featureProtectionAmount,0,1) : 0;
|
||||||
|
float skinProtection = PGClamp(s.nonSkinProtection,0,1);
|
||||||
|
float micro = PGClamp(s.microDetail,0,1)*amount;
|
||||||
|
BOOL needsSkin = local*amount>0 || micro>0 || brightness>0 || hue!=0 || saturation!=0 || even>0 ||
|
||||||
(s.skinTonePreset>0 && s.skinTonePreset<=6) || (s.showMask && s.debugChannel==0);
|
(s.skinTonePreset>0 && s.skinTonePreset<=6) || (s.showMask && s.debugChannel==0);
|
||||||
CIImage *black = [[CIImage imageWithColor:[CIColor colorWithRed:0 green:0 blue:0 alpha:1]] imageByCroppingToRect:extent];
|
CIImage *black = [[CIImage imageWithColor:[CIColor colorWithRed:0 green:0 blue:0 alpha:1]] imageByCroppingToRect:extent];
|
||||||
CIImage *teethInput = teethMask ? [teethMask imageByCroppingToRect:extent] : black;
|
CIImage *teethInput = teethMask ? [teethMask imageByCroppingToRect:extent] : black;
|
||||||
@@ -200,12 +223,29 @@ static NSDictionary<NSString *, CIColorKernel *> *PGKernels(void) {
|
|||||||
float invert = s.debugChannel==1 || s.debugChannel==2 ? (s.invertMask ? 1 : 0) : 0;
|
float invert = s.debugChannel==1 || s.debugChannel==2 ? (s.invertMask ? 1 : 0) : 0;
|
||||||
return PGApply(k[@"debug"],extent,@[image,preview,@(invert)]);
|
return PGApply(k[@"debug"],extent,@[image,preview,@(invert)]);
|
||||||
}
|
}
|
||||||
|
CIImage *smoothingMask=mask;
|
||||||
|
if((local*amount>0 || micro>0) && (protection<1 || skinProtection<1)) {
|
||||||
|
CIImage *baseRaw=colorMask ? [colorMask imageByCroppingToRect:extent] : raw;
|
||||||
|
float soft=PGClamp(s.maskSoftness,0,1);
|
||||||
|
CIImage *baseMask=PGApply(k[@"mask"],extent,@[baseRaw,PGBlur(baseRaw,0.35+soft*radius*0.35,extent),
|
||||||
|
image,PGBlur(image,1.5,extent),eyeInput,teethInput,
|
||||||
|
@(PGClamp(s.maskThreshold,0,255)/255.f),@(soft),@(PGClamp(s.maskEdgeProtect,0,1)),@0,@(s.invertMask?1:0)]);
|
||||||
|
smoothingMask=PGApply(k[@"smoothingSupport"],extent,@[mask,baseMask,@(protection),@(skinProtection)]);
|
||||||
|
}
|
||||||
// Detail protection may contain small eye, brow, nose and lip cutouts.
|
// Detail protection may contain small eye, brow, nose and lip cutouts.
|
||||||
// Exposure and color must not reuse those holes or sharpen a face ellipse
|
// Exposure and color must not reuse those holes or sharpen a face ellipse
|
||||||
// with the detail threshold; that creates visible rings and islands.
|
// with the detail threshold; that creates visible rings and islands.
|
||||||
CIImage *toneMask=mask;
|
CIImage *toneMask=mask;
|
||||||
BOOL changesColor=brightness>0 || hue!=0 || saturation!=0 || even>0 ||
|
BOOL changesColor=brightness>0 || hue!=0 || saturation!=0 || even>0 ||
|
||||||
(s.skinTonePreset>0 && s.skinTonePreset<=6);
|
(s.skinTonePreset>0 && s.skinTonePreset<=6);
|
||||||
|
if(!colorMask && changesColor && s.featureProtection) {
|
||||||
|
// Standalone callers may not supply the separate uncut coverage.
|
||||||
|
// At least keep our eye/teeth cutouts out of their color adjustment.
|
||||||
|
float soft=PGClamp(s.maskSoftness,0,1);
|
||||||
|
toneMask=PGApply(k[@"mask"],extent,@[raw,PGBlur(raw,0.35+soft*radius*0.35,extent),
|
||||||
|
image,PGBlur(image,1.5,extent),eyeInput,teethInput,
|
||||||
|
@(PGClamp(s.maskThreshold,0,255)/255.f),@(soft),@(PGClamp(s.maskEdgeProtect,0,1)),@0,@(s.invertMask?1:0)]);
|
||||||
|
}
|
||||||
if(colorMask && changesColor) {
|
if(colorMask && changesColor) {
|
||||||
CGFloat feather=MAX(3,MIN(extent.size.width,extent.size.height)*0.03);
|
CGFloat feather=MAX(3,MIN(extent.size.width,extent.size.height)*0.03);
|
||||||
CIImage *support=[colorMask imageByCroppingToRect:extent];
|
CIImage *support=[colorMask imageByCroppingToRect:extent];
|
||||||
@@ -219,8 +259,12 @@ static NSDictionary<NSString *, CIColorKernel *> *PGKernels(void) {
|
|||||||
CGFloat broad = fmin(16,(2.55+0.45*local)*fine+1.1+1.3*local);
|
CGFloat broad = fmin(16,(2.55+0.45*local)*fine+1.1+1.3*local);
|
||||||
float compression = 0.12+2.4*powf(local,2.15)+1.25*local;
|
float compression = 0.12+2.4*powf(local,2.15)+1.25*local;
|
||||||
CIImage *detail = PGApply(k[@"detail"],extent,@[result,PGBlur(result,fine,extent),
|
CIImage *detail = PGApply(k[@"detail"],extent,@[result,PGBlur(result,fine,extent),
|
||||||
PGBlur(result,broad,extent),@(compression),@(s.featureProtection ? 1 : 0)]);
|
PGBlur(result,broad,extent),@(compression),@(protection)]);
|
||||||
result = PGApply(k[@"maskedMix"],extent,@[result,detail,mask,@(amount)]);
|
result = PGApply(k[@"maskedMix"],extent,@[result,detail,smoothingMask,@(amount)]);
|
||||||
|
}
|
||||||
|
if(micro>0) {
|
||||||
|
CGFloat fine=fmin(7.4,2.275+3.15*pow(local,0.72)+0.95*local);
|
||||||
|
result=PGApply(k[@"microDetail"],extent,@[result,image,PGBlur(image,fine,extent),smoothingMask,@(micro)]);
|
||||||
}
|
}
|
||||||
CIImage *color = result;
|
CIImage *color = result;
|
||||||
if (brightness>0) {
|
if (brightness>0) {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
// Persisted FxPlug render state. Append fields and bump version for migrations.
|
// Persisted FxPlug render state. Append fields and bump version for migrations.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -12,11 +14,17 @@ typedef struct {
|
|||||||
float faceJumpGuardRange, selectionX, selectionY;
|
float faceJumpGuardRange, selectionX, selectionY;
|
||||||
uint32_t featureProtection, skinTonePreset, showMask, invertMask, debugChannel;
|
uint32_t featureProtection, skinTonePreset, showMask, invertMask, debugChannel;
|
||||||
uint32_t showFaceBoxes, showTrackBox, singleFace, fastMultiFace, trackingEnabled, targetIndex;
|
uint32_t showFaceBoxes, showTrackBox, singleFace, fastMultiFace, trackingEnabled, targetIndex;
|
||||||
|
// v2 keeps the entire 160-byte v1 prefix, including legacy bool/strength IDs.
|
||||||
|
float featureProtectionAmount, nonSkinProtection, microDetail;
|
||||||
} PGBeautySettings;
|
} PGBeautySettings;
|
||||||
|
|
||||||
|
enum { PGBeautySettingsV1Size = 160, PGBeautySettingsVersion = 2 };
|
||||||
|
_Static_assert(offsetof(PGBeautySettings,featureProtectionAmount)==PGBeautySettingsV1Size,
|
||||||
|
"The v1 render-state prefix must remain stable");
|
||||||
|
|
||||||
static inline PGBeautySettings PGBeautyDefaults(void) {
|
static inline PGBeautySettings PGBeautyDefaults(void) {
|
||||||
PGBeautySettings s = {0};
|
PGBeautySettings s = {0};
|
||||||
s.version = 1;
|
s.version = PGBeautySettingsVersion;
|
||||||
s.amount = 1.0f;
|
s.amount = 1.0f;
|
||||||
s.radius = 8.0f;
|
s.radius = 8.0f;
|
||||||
s.mix = 1.0f;
|
s.mix = 1.0f;
|
||||||
@@ -24,6 +32,8 @@ static inline PGBeautySettings PGBeautyDefaults(void) {
|
|||||||
s.maskSoftness = 0.6f;
|
s.maskSoftness = 0.6f;
|
||||||
s.maskEdgeProtect = 0.4f;
|
s.maskEdgeProtect = 0.4f;
|
||||||
s.featureProtection = 1;
|
s.featureProtection = 1;
|
||||||
|
s.featureProtectionAmount = 1;
|
||||||
|
s.nonSkinProtection = 1;
|
||||||
s.faceJumpGuardRange = 1.8f;
|
s.faceJumpGuardRange = 1.8f;
|
||||||
s.selectionX = s.selectionY = 0.5f;
|
s.selectionX = s.selectionY = 0.5f;
|
||||||
return s;
|
return s;
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ NSArray<NSDictionary *> *PGInspectorControls(void) {
|
|||||||
#define ITEM(ID,NAME,FIELD,SECTION,KIND,FORMAT,MIN,MAX,BYPASS,STORAGE) \
|
#define ITEM(ID,NAME,FIELD,SECTION,KIND,FORMAT,MIN,MAX,BYPASS,STORAGE) \
|
||||||
[items addObject:@{@"id":@(ID),@"name":@NAME,@"section":@SECTION,@"kind":@KIND,@"format":@FORMAT,@"min":@(MIN),@"max":@(MAX),@"default":@(defaults.FIELD),@"bypass":@(BYPASS),@"offset":@(offsetof(PGBeautySettings,FIELD)),@"storage":@STORAGE}]
|
[items addObject:@{@"id":@(ID),@"name":@NAME,@"section":@SECTION,@"kind":@KIND,@"format":@FORMAT,@"min":@(MIN),@"max":@(MAX),@"default":@(defaults.FIELD),@"bypass":@(BYPASS),@"offset":@(offsetof(PGBeautySettings,FIELD)),@"storage":@STORAGE}]
|
||||||
ITEM(PGSmoothingEnabled,"磨皮",featureProtection,"smooth","master","integer",0,1,NO,"master");
|
ITEM(PGSmoothingEnabled,"磨皮",featureProtection,"smooth","master","integer",0,1,NO,"master");
|
||||||
ITEM(PGMidtone,"局部磨皮",midtoneDetail,"smooth","slider","percent",0,1,YES,"float");
|
ITEM(PGMidtone,"磨皮程度",midtoneDetail,"smooth","slider","percent",0,1,YES,"float");
|
||||||
ITEM(PGHighPass,"全局磨皮",highPassDetail,"smooth","slider","percent",0,1,YES,"float");
|
ITEM(PGMicroDetail,"微细锐化",microDetail,"smooth","slider","percent",0,1,YES,"float");
|
||||||
ITEM(PGFeatureProtect,"五官保护",featureProtection,"smooth","toggle","integer",0,1,NO,"uint");
|
ITEM(PGFeatureProtectionAmount,"五官保护",featureProtectionAmount,"smooth","slider","percent",0,1,YES,"float");
|
||||||
|
ITEM(PGNonSkinProtection,"非肤色区保护",nonSkinProtection,"smooth","slider","percent",0,1,YES,"float");
|
||||||
ITEM(PGColorEnabled,"美白",featureProtection,"color","master","integer",0,1,NO,"master");
|
ITEM(PGColorEnabled,"美白",featureProtection,"color","master","integer",0,1,NO,"master");
|
||||||
ITEM(PGTonePreset,"肤色",skinTonePreset,"color","preset","integer",0,6,NO,"uint");
|
ITEM(PGTonePreset,"肤色",skinTonePreset,"color","preset","integer",0,6,NO,"uint");
|
||||||
NSMutableDictionary *preset=[items.lastObject mutableCopy];
|
NSMutableDictionary *preset=[items.lastObject mutableCopy];
|
||||||
@@ -22,9 +23,10 @@ NSArray<NSDictionary *> *PGInspectorControls(void) {
|
|||||||
ITEM(PGTeeth,"白牙",teethWhitening,"color","slider","percent",0,1,YES,"float");
|
ITEM(PGTeeth,"白牙",teethWhitening,"color","slider","percent",0,1,YES,"float");
|
||||||
ITEM(PGHue,"皮肤色相",skinHue,"color","slider","degrees",-30,30,YES,"float");
|
ITEM(PGHue,"皮肤色相",skinHue,"color","slider","degrees",-30,30,YES,"float");
|
||||||
ITEM(PGShapeEnabled,"瘦脸",featureProtection,"shape","master","integer",0,1,NO,"master");
|
ITEM(PGShapeEnabled,"瘦脸",featureProtection,"shape","master","integer",0,1,NO,"master");
|
||||||
ITEM(PGTrackBoxes,"人脸框预览",showTrackBox,"shape","toggle","integer",0,1,NO,"uint");
|
ITEM(PGTrackBoxes,"检测框预览",showTrackBox,"shape","toggle","integer",0,1,NO,"uint");
|
||||||
ITEM(PGFastMulti,"多人模式",fastMultiFace,"shape","toggle","integer",0,1,NO,"uint");
|
ITEM(PGFastMulti,"多人模式",fastMultiFace,"shape","toggle","integer",0,1,NO,"uint");
|
||||||
ITEM(PGJumpGuard,"防跳脸范围",faceJumpGuardRange,"shape","slider","percent",1,4,NO,"float");
|
NSMutableDictionary *multi=[items.lastObject mutableCopy];
|
||||||
|
multi[@"tooltip"]=@"多人模式易抖动,请谨慎使用";items[items.count-1]=multi;
|
||||||
ITEM(PGThin,"瘦脸",faceThin,"shape","slider","signed",0,1,YES,"float");
|
ITEM(PGThin,"瘦脸",faceThin,"shape","slider","signed",0,1,YES,"float");
|
||||||
ITEM(PGBigEye,"大眼",faceBigEye,"shape","slider","signed",0,1,YES,"float");
|
ITEM(PGBigEye,"大眼",faceBigEye,"shape","slider","signed",0,1,YES,"float");
|
||||||
ITEM(PGShort,"短脸",faceShort,"shape","slider","signed",-1,1,YES,"float");
|
ITEM(PGShort,"短脸",faceShort,"shape","slider","signed",-1,1,YES,"float");
|
||||||
@@ -36,11 +38,13 @@ NSArray<NSDictionary *> *PGInspectorControls(void) {
|
|||||||
ITEM(PGSmallHead,"小头",faceSmallHead,"shape","slider","signed",0,1,YES,"float");
|
ITEM(PGSmallHead,"小头",faceSmallHead,"shape","slider","signed",0,1,YES,"float");
|
||||||
ITEM(PGSmallHeadRange,"小头范围",faceSmallHeadRange,"shape","slider","percent",0,1,NO,"float");
|
ITEM(PGSmallHeadRange,"小头范围",faceSmallHeadRange,"shape","slider","percent",0,1,NO,"float");
|
||||||
ITEM(PGAmount,"磨皮强度",amount,"more","slider","percent",0,1,YES,"float");
|
ITEM(PGAmount,"磨皮强度",amount,"more","slider","percent",0,1,YES,"float");
|
||||||
|
ITEM(PGHighPass,"全局磨皮",highPassDetail,"more","slider","percent",0,1,YES,"float");
|
||||||
ITEM(PGRadius,"磨皮半径",radius,"more","slider","radius",1,30,NO,"float");
|
ITEM(PGRadius,"磨皮半径",radius,"more","slider","radius",1,30,NO,"float");
|
||||||
ITEM(PGSaturation,"肤色饱和度",skinSaturation,"more","slider","percent",-100,100,YES,"float");
|
ITEM(PGSaturation,"肤色饱和度",skinSaturation,"more","slider","percent",-100,100,YES,"float");
|
||||||
ITEM(PGEvenTone,"均匀肤色",skinEvenTone,"more","slider","percent",0,1,YES,"float");
|
ITEM(PGEvenTone,"均匀肤色",skinEvenTone,"more","slider","percent",0,1,YES,"float");
|
||||||
ITEM(PGEyeBright,"眼睛提亮",eyeBrightening,"more","slider","percent",0,1,YES,"float");
|
ITEM(PGEyeBright,"眼睛提亮",eyeBrightening,"more","slider","percent",0,1,YES,"float");
|
||||||
ITEM(PGSharpness,"锐化",sharpness,"more","slider","percent",0,1,YES,"float");
|
ITEM(PGSharpness,"锐化",sharpness,"more","slider","percent",0,1,YES,"float");
|
||||||
|
ITEM(PGJumpGuard,"防跳脸范围",faceJumpGuardRange,"more","slider","percent",1,4,NO,"float");
|
||||||
ITEM(PGMix,"整体混合",mix,"more","slider","percent",0,1,NO,"float");
|
ITEM(PGMix,"整体混合",mix,"more","slider","percent",0,1,NO,"float");
|
||||||
#undef ITEM
|
#undef ITEM
|
||||||
controls=[items copy];
|
controls=[items copy];
|
||||||
@@ -62,7 +66,12 @@ static double PGControlValue(id raw,NSDictionary *d) {
|
|||||||
+ (instancetype)stateWithValues:(NSDictionary *)values disabledParameters:(NSSet *)disabled hasEdits:(BOOL)edited {
|
+ (instancetype)stateWithValues:(NSDictionary *)values disabledParameters:(NSSet *)disabled hasEdits:(BOOL)edited {
|
||||||
PGInspectorState *state=[self new]; NSMutableDictionary *safe=[NSMutableDictionary new];NSMutableSet *bypassed=[NSMutableSet new];
|
PGInspectorState *state=[self new]; NSMutableDictionary *safe=[NSMutableDictionary new];NSMutableSet *bypassed=[NSMutableSet new];
|
||||||
for(NSDictionary *d in PGInspectorControls()) {
|
for(NSDictionary *d in PGInspectorControls()) {
|
||||||
NSNumber *key=d[@"id"];safe[key]=@(PGControlValue(values[key],d));
|
NSNumber *key=d[@"id"];id raw=values[key];
|
||||||
|
// Schema 1 documents stored five-feature protection as the legacy bool.
|
||||||
|
// New numeric values win when present; old archives gain its exact 0/1.
|
||||||
|
if(key.unsignedIntValue==PGFeatureProtectionAmount && !raw && [values[@(PGFeatureProtect)] isKindOfClass:NSNumber.class])
|
||||||
|
raw=@([values[@(PGFeatureProtect)] boolValue]?1:0);
|
||||||
|
safe[key]=@(PGControlValue(raw,d));
|
||||||
if([d[@"bypass"] boolValue] && [disabled containsObject:key]) [bypassed addObject:key];
|
if([d[@"bypass"] boolValue] && [disabled containsObject:key]) [bypassed addObject:key];
|
||||||
}
|
}
|
||||||
state->_values=[safe copy];state->_disabledParameters=[bypassed copy];state->_hasEdits=edited;return state;
|
state->_values=[safe copy];state->_disabledParameters=[bypassed copy];state->_hasEdits=edited;return state;
|
||||||
@@ -115,7 +124,8 @@ PGBeautySettings PGSettingsWithInspectorState(PGBeautySettings s,PGInspectorStat
|
|||||||
if([storage isEqual:@"float"]) *(float *)((uint8_t *)&s+offset)=value;
|
if([storage isEqual:@"float"]) *(float *)((uint8_t *)&s+offset)=value;
|
||||||
else *(uint32_t *)((uint8_t *)&s+offset)=(uint32_t)value;
|
else *(uint32_t *)((uint8_t *)&s+offset)=(uint32_t)value;
|
||||||
}
|
}
|
||||||
if(![state valueForParameter:PGSmoothingEnabled])s.amount=s.midtoneDetail=s.highPassDetail=0;
|
s.featureProtection=s.featureProtectionAmount>0;
|
||||||
|
if(![state valueForParameter:PGSmoothingEnabled])s.amount=s.midtoneDetail=s.highPassDetail=s.microDetail=0;
|
||||||
if(![state valueForParameter:PGColorEnabled]) {s.skinBrightness=s.skinHue=s.skinSaturation=s.skinEvenTone=s.teethWhitening=s.eyeBrightening=0;s.skinTonePreset=0;}
|
if(![state valueForParameter:PGColorEnabled]) {s.skinBrightness=s.skinHue=s.skinSaturation=s.skinEvenTone=s.teethWhitening=s.eyeBrightening=0;s.skinTonePreset=0;}
|
||||||
if(![state valueForParameter:PGShapeEnabled]) {s.faceThin=s.faceBigEye=s.faceShort=s.faceNarrow=s.faceChin=s.faceV=s.faceJaw=s.faceCheekbone=s.faceSmallHead=0;s.showTrackBox=0;}
|
if(![state valueForParameter:PGShapeEnabled]) {s.faceThin=s.faceBigEye=s.faceShort=s.faceNarrow=s.faceChin=s.faceV=s.faceJaw=s.faceCheekbone=s.faceSmallHead=0;s.showTrackBox=0;}
|
||||||
return s;
|
return s;
|
||||||
@@ -189,6 +199,12 @@ PGBeautySettings PGSettingsWithInspectorState(PGBeautySettings s,PGInspectorStat
|
|||||||
else [api getFloatValue:&value fromParameter:key atTime:time];
|
else [api getFloatValue:&value fromParameter:key atTime:time];
|
||||||
values[@(key)]=@(value);
|
values[@(key)]=@(value);
|
||||||
}
|
}
|
||||||
|
// The old bool can still disable protection. A true value must preserve a
|
||||||
|
// numeric setting already read above; its registered default is one for
|
||||||
|
// old documents that have no independently stored numeric parameter.
|
||||||
|
BOOL legacyFeatureProtection=YES;
|
||||||
|
if([api getBoolValue:&legacyFeatureProtection fromParameter:PGFeatureProtect atTime:time] && !legacyFeatureProtection)
|
||||||
|
values[@(PGFeatureProtectionAmount)]=@0;
|
||||||
BOOL legacyDetail=YES;[api getBoolValue:&legacyDetail fromParameter:PGDetailEnabled atTime:time];
|
BOOL legacyDetail=YES;[api getBoolValue:&legacyDetail fromParameter:PGDetailEnabled atTime:time];
|
||||||
NSMutableSet *disabled=legacyDetail?[NSMutableSet set]:[NSMutableSet setWithObjects:@(PGHighPass),@(PGSharpness),nil];
|
NSMutableSet *disabled=legacyDetail?[NSMutableSet set]:[NSMutableSet setWithObjects:@(PGHighPass),@(PGSharpness),nil];
|
||||||
// Earlier versions put high-pass smoothing under a different group. Keep
|
// Earlier versions put high-pass smoothing under a different group. Keep
|
||||||
@@ -196,7 +212,7 @@ PGBeautySettings PGSettingsWithInspectorState(PGBeautySettings s,PGInspectorStat
|
|||||||
// off, rather than turning a still-active global effect off on first edit.
|
// off, rather than turning a still-active global effect off on first edit.
|
||||||
if(![values[@(PGSmoothingEnabled)] boolValue] && legacyDetail && [values[@(PGHighPass)] doubleValue]>0) {
|
if(![values[@(PGSmoothingEnabled)] boolValue] && legacyDetail && [values[@(PGHighPass)] doubleValue]>0) {
|
||||||
values[@(PGSmoothingEnabled)]=@YES;
|
values[@(PGSmoothingEnabled)]=@YES;
|
||||||
[disabled addObject:@(PGMidtone)];[disabled addObject:@(PGAmount)];
|
[disabled addObject:@(PGMidtone)];[disabled addObject:@(PGAmount)];[disabled addObject:@(PGMicroDetail)];
|
||||||
}
|
}
|
||||||
_state=[PGInspectorState stateWithValues:values disabledParameters:disabled hasEdits:NO];
|
_state=[PGInspectorState stateWithValues:values disabledParameters:disabled hasEdits:NO];
|
||||||
}
|
}
|
||||||
@@ -232,6 +248,11 @@ PGBeautySettings PGSettingsWithInspectorState(PGBeautySettings s,PGInspectorStat
|
|||||||
else if([d[@"kind"] isEqual:@"toggle"] || [d[@"kind"] isEqual:@"master"]) [api setBoolValue:value!=0 toParameter:key atTime:time];
|
else if([d[@"kind"] isEqual:@"toggle"] || [d[@"kind"] isEqual:@"master"]) [api setBoolValue:value!=0 toParameter:key atTime:time];
|
||||||
else [api setFloatValue:value toParameter:key atTime:time];
|
else [api setFloatValue:value toParameter:key atTime:time];
|
||||||
}
|
}
|
||||||
|
BOOL featureProtection=[next isParameterEnabled:PGFeatureProtectionAmount] && [next valueForParameter:PGFeatureProtectionAmount]>0;
|
||||||
|
id<FxParameterRetrievalAPI_v6> reader=[_manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];
|
||||||
|
BOOL previousProtection=!featureProtection;
|
||||||
|
if(![reader getBoolValue:&previousProtection fromParameter:PGFeatureProtect atTime:time] || previousProtection!=featureProtection)
|
||||||
|
[api setBoolValue:featureProtection toParameter:PGFeatureProtect atTime:time];
|
||||||
_state=next;_pendingUntil=NSDate.timeIntervalSinceReferenceDate+.35;_pendingTime=time;_statusMessage=@"";return YES;
|
_state=next;_pendingUntil=NSDate.timeIntervalSinceReferenceDate+.35;_pendingTime=time;_statusMessage=@"";return YES;
|
||||||
}
|
}
|
||||||
- (BOOL)setValue:(double)value forParameter:(UInt32)identifier {
|
- (BOOL)setValue:(double)value forParameter:(UInt32)identifier {
|
||||||
|
|||||||
@@ -202,6 +202,8 @@ static PGInspectorGlyphButton *PGUIButton(NSString *glyph, NSColor *accent, id t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NSString *key=[descriptor[@"id"]stringValue];
|
NSString *key=[descriptor[@"id"]stringValue];
|
||||||
|
NSString *tooltip=descriptor[@"tooltip"];
|
||||||
|
if(tooltip.length){self.toolTip=tooltip;_label.toolTip=tooltip;_toggle.toolTip=tooltip;_slider.toolTip=tooltip;_valueField.toolTip=tooltip;}
|
||||||
_slider.identifier=[@"pg.value."stringByAppendingString:key];_valueField.identifier=[@"pg.number."stringByAppendingString:key];
|
_slider.identifier=[@"pg.value."stringByAppendingString:key];_valueField.identifier=[@"pg.number."stringByAppendingString:key];
|
||||||
_toggle.identifier=[@"pg.toggle."stringByAppendingString:key];_eye.identifier=[@"pg.enable."stringByAppendingString:key];_reset.identifier=[@"pg.reset."stringByAppendingString:key];
|
_toggle.identifier=[@"pg.toggle."stringByAppendingString:key];_eye.identifier=[@"pg.enable."stringByAppendingString:key];_reset.identifier=[@"pg.reset."stringByAppendingString:key];
|
||||||
}return self;
|
}return self;
|
||||||
@@ -282,11 +284,11 @@ static PGInspectorGlyphButton *PGUIButton(NSString *glyph, NSColor *accent, id t
|
|||||||
@implementation PGInspectorCard
|
@implementation PGInspectorCard
|
||||||
- (BOOL)isFlipped { return YES; }
|
- (BOOL)isFlipped { return YES; }
|
||||||
- (CGFloat)heightForWidth:(CGFloat)width {
|
- (CGFloat)heightForWidth:(CGFloat)width {
|
||||||
if(!_expanded)return 44;CGFloat height=49;for(PGInspectorRow *row in _rows){height+=[row heightForWidth:MAX(0,width-24)];if([row.descriptor[@"id"]unsignedIntValue]==PGJumpGuard)height+=8;}return height+7;
|
if(!_expanded)return 44;CGFloat height=49;for(PGInspectorRow *row in _rows){height+=[row heightForWidth:MAX(0,width-24)];if([row.descriptor[@"id"]unsignedIntValue]==PGFastMulti)height+=8;}return height+7;
|
||||||
}
|
}
|
||||||
- (void)layout {
|
- (void)layout {
|
||||||
[super layout];CGFloat w=NSWidth(self.bounds);_titleLabel.frame=NSMakeRect(25,13,MAX(70,w-80),22);_master.frame=NSMakeRect(w-39,10,25,25);
|
[super layout];CGFloat w=NSWidth(self.bounds);_titleLabel.frame=NSMakeRect(25,13,MAX(70,w-80),22);_master.frame=NSMakeRect(w-39,10,25,25);
|
||||||
CGFloat y=49;for(PGInspectorRow *row in _rows){row.hidden=!_expanded;if(!_expanded)continue;CGFloat h=[row heightForWidth:w-24];row.frame=NSMakeRect(12,y,w-24,h);y+=h;if([row.descriptor[@"id"]unsignedIntValue]==PGJumpGuard)y+=8;}
|
CGFloat y=49;for(PGInspectorRow *row in _rows){row.hidden=!_expanded;if(!_expanded)continue;CGFloat h=[row heightForWidth:w-24];row.frame=NSMakeRect(12,y,w-24,h);y+=h;if([row.descriptor[@"id"]unsignedIntValue]==PGFastMulti)y+=8;}
|
||||||
}
|
}
|
||||||
- (void)drawRect:(NSRect)dirtyRect {
|
- (void)drawRect:(NSRect)dirtyRect {
|
||||||
(void)dirtyRect;NSBezierPath *shape=[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds,.5,.5) xRadius:13 yRadius:13];
|
(void)dirtyRect;NSBezierPath *shape=[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds,.5,.5) xRadius:13 yRadius:13];
|
||||||
@@ -294,7 +296,7 @@ static PGInspectorGlyphButton *PGUIButton(NSString *glyph, NSColor *accent, id t
|
|||||||
[[_accent colorWithAlphaComponent:.22]setStroke];shape.lineWidth=.8;[shape stroke];
|
[[_accent colorWithAlphaComponent:.22]setStroke];shape.lineWidth=.8;[shape stroke];
|
||||||
NSRect pill=NSMakeRect(12,10,MAX(53,[_heading length]*13+20),25);[[_accent colorWithAlphaComponent:.10]setFill];NSBezierPath *p=[NSBezierPath bezierPathWithRoundedRect:pill xRadius:8 yRadius:8];[p fill];[[_accent colorWithAlphaComponent:.32]setStroke];p.lineWidth=.7;[p stroke];
|
NSRect pill=NSMakeRect(12,10,MAX(53,[_heading length]*13+20),25);[[_accent colorWithAlphaComponent:.10]setFill];NSBezierPath *p=[NSBezierPath bezierPathWithRoundedRect:pill xRadius:8 yRadius:8];[p fill];[[_accent colorWithAlphaComponent:.32]setStroke];p.lineWidth=.7;[p stroke];
|
||||||
if(_expanded){[[PGUIMuted() colorWithAlphaComponent:.20]setStroke];NSBezierPath *line=[NSBezierPath bezierPath];[line moveToPoint:NSMakePoint(12,43)];[line lineToPoint:NSMakePoint(NSWidth(self.bounds)-12,43)];line.lineWidth=.5;[line stroke];
|
if(_expanded){[[PGUIMuted() colorWithAlphaComponent:.20]setStroke];NSBezierPath *line=[NSBezierPath bezierPath];[line moveToPoint:NSMakePoint(12,43)];[line lineToPoint:NSMakePoint(NSWidth(self.bounds)-12,43)];line.lineWidth=.5;[line stroke];
|
||||||
for(PGInspectorRow *row in _rows)if([row.descriptor[@"id"]unsignedIntValue]==PGJumpGuard){CGFloat y=NSMaxY(row.frame)+4;[line removeAllPoints];[line moveToPoint:NSMakePoint(12,y)];[line lineToPoint:NSMakePoint(NSWidth(self.bounds)-12,y)];[line stroke];}
|
for(PGInspectorRow *row in _rows)if([row.descriptor[@"id"]unsignedIntValue]==PGFastMulti){CGFloat y=NSMaxY(row.frame)+4;[line removeAllPoints];[line moveToPoint:NSMakePoint(12,y)];[line lineToPoint:NSMakePoint(NSWidth(self.bounds)-12,y)];[line stroke];}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -14,5 +14,6 @@ enum {
|
|||||||
PGTrackData1=60, PGTrackData2=61, PGTrackData3=62,
|
PGTrackData1=60, PGTrackData2=61, PGTrackData3=62,
|
||||||
PGSmoothingEnabled=70, PGColorEnabled=71, PGShapeEnabled=72,
|
PGSmoothingEnabled=70, PGColorEnabled=71, PGShapeEnabled=72,
|
||||||
PGDetailEnabled=73, PGHelp=74,
|
PGDetailEnabled=73, PGHelp=74,
|
||||||
|
PGFeatureProtectionAmount=75, PGNonSkinProtection=76, PGMicroDetail=77,
|
||||||
PGInspectorPanel=210
|
PGInspectorPanel=210
|
||||||
};
|
};
|
||||||
@@ -30,6 +30,9 @@ static const PGSlider PGSliders[] = {
|
|||||||
PGS(PGEyeBright,"眼睛提亮",eyeBrightening,0,1,.01,YES),
|
PGS(PGEyeBright,"眼睛提亮",eyeBrightening,0,1,.01,YES),
|
||||||
PGS(PGHighPass,"高频细节平滑",highPassDetail,0,1,.01,YES),
|
PGS(PGHighPass,"高频细节平滑",highPassDetail,0,1,.01,YES),
|
||||||
PGS(PGSharpness,"锐化",sharpness,0,1,.01,YES),
|
PGS(PGSharpness,"锐化",sharpness,0,1,.01,YES),
|
||||||
|
PGS(PGFeatureProtectionAmount,"五官保护强度",featureProtectionAmount,0,1,.01,YES),
|
||||||
|
PGS(PGNonSkinProtection,"非肤色区保护",nonSkinProtection,0,1,.01,YES),
|
||||||
|
PGS(PGMicroDetail,"微细锐化",microDetail,0,1,.01,YES),
|
||||||
PGS(PGThin,"瘦脸",faceThin,0,1,.01,YES),
|
PGS(PGThin,"瘦脸",faceThin,0,1,.01,YES),
|
||||||
PGS(PGBigEye,"大眼",faceBigEye,0,1,.01,YES),
|
PGS(PGBigEye,"大眼",faceBigEye,0,1,.01,YES),
|
||||||
PGS(PGShort,"短脸",faceShort,-1,1,.01,NO),
|
PGS(PGShort,"短脸",faceShort,-1,1,.01,NO),
|
||||||
@@ -141,6 +144,7 @@ static CIImage *PGImageFromTile(FxImageTile *tile) {
|
|||||||
void (^end)(void)=^{ok=[api endParameterSubGroup]&&ok;};
|
void (^end)(void)=^{ok=[api endParameterSubGroup]&&ok;};
|
||||||
group(@"磨皮",100); toggle(@"启用磨皮",PGSmoothingEnabled,YES);
|
group(@"磨皮",100); toggle(@"启用磨皮",PGSmoothingEnabled,YES);
|
||||||
slider(PGAmount); slider(PGMidtone); slider(PGRadius); toggle(@"保护五官",PGFeatureProtect,YES); end();
|
slider(PGAmount); slider(PGMidtone); slider(PGRadius); toggle(@"保护五官",PGFeatureProtect,YES); end();
|
||||||
|
group(@"磨皮保护与细节",106); slider(PGFeatureProtectionAmount); slider(PGNonSkinProtection); slider(PGMicroDetail); end();
|
||||||
group(@"肤色",101); toggle(@"启用肤色",PGColorEnabled,YES);
|
group(@"肤色",101); toggle(@"启用肤色",PGColorEnabled,YES);
|
||||||
ok=[api addPopupMenuWithName:@"肤色风格" parameterID:PGTonePreset defaultValue:0 menuEntries:@[@"原色",@"自然白",@"冷白",@"暖白",@"红润白",@"小麦",@"古铜"] parameterFlags:kFxParameterFlag_HIDDEN]&&ok;
|
ok=[api addPopupMenuWithName:@"肤色风格" parameterID:PGTonePreset defaultValue:0 menuEntries:@[@"原色",@"自然白",@"冷白",@"暖白",@"红润白",@"小麦",@"古铜"] parameterFlags:kFxParameterFlag_HIDDEN]&&ok;
|
||||||
slider(PGBrightness); slider(PGHue); slider(PGSaturation); slider(PGEvenTone); slider(PGTeeth); slider(PGEyeBright); end();
|
slider(PGBrightness); slider(PGHue); slider(PGSaturation); slider(PGEvenTone); slider(PGTeeth); slider(PGEyeBright); end();
|
||||||
@@ -207,7 +211,7 @@ static CIImage *PGImageFromTile(FxImageTile *tile) {
|
|||||||
double x=.5,y=.5; [api getXValue:&x YValue:&y fromParameter:PGSelection atTime:time];
|
double x=.5,y=.5; [api getXValue:&x YValue:&y fromParameter:PGSelection atTime:time];
|
||||||
s.selectionX=isfinite(x)?fmin(1,fmax(0,x)):.5; s.selectionY=isfinite(y)?fmin(1,fmax(0,y)):.5;
|
s.selectionX=isfinite(x)?fmin(1,fmax(0,x)):.5; s.selectionY=isfinite(y)?fmin(1,fmax(0,y)):.5;
|
||||||
BOOL enabled=YES;
|
BOOL enabled=YES;
|
||||||
[api getBoolValue:&enabled fromParameter:PGSmoothingEnabled atTime:time]; if(!enabled) s.amount=s.midtoneDetail=0;
|
[api getBoolValue:&enabled fromParameter:PGSmoothingEnabled atTime:time]; if(!enabled) s.amount=s.midtoneDetail=s.microDetail=0;
|
||||||
enabled=YES; [api getBoolValue:&enabled fromParameter:PGColorEnabled atTime:time];
|
enabled=YES; [api getBoolValue:&enabled fromParameter:PGColorEnabled atTime:time];
|
||||||
if(!enabled) {s.skinBrightness=s.skinHue=s.skinSaturation=s.skinEvenTone=s.teethWhitening=s.eyeBrightening=0;s.skinTonePreset=0;}
|
if(!enabled) {s.skinBrightness=s.skinHue=s.skinSaturation=s.skinEvenTone=s.teethWhitening=s.eyeBrightening=0;s.skinTonePreset=0;}
|
||||||
enabled=YES; [api getBoolValue:&enabled fromParameter:PGDetailEnabled atTime:time]; if(!enabled) s.highPassDetail=s.sharpness=0;
|
enabled=YES; [api getBoolValue:&enabled fromParameter:PGDetailEnabled atTime:time]; if(!enabled) s.highPassDetail=s.sharpness=0;
|
||||||
@@ -263,9 +267,16 @@ static CIImage *PGImageFromTile(FxImageTile *tile) {
|
|||||||
- (BOOL)renderDestinationImage:(FxImageTile *)destination sourceImages:(NSArray<FxImageTile *> *)sources pluginState:(NSData *)state atTime:(CMTime)time error:(NSError **)error {
|
- (BOOL)renderDestinationImage:(FxImageTile *)destination sourceImages:(NSArray<FxImageTile *> *)sources pluginState:(NSData *)state atTime:(CMTime)time error:(NSError **)error {
|
||||||
if(sources.count==0||!sources.firstObject.ioSurface||!destination.ioSurface||![state isKindOfClass:NSData.class]||state.length==0||state.length>320*1024*1024) return PGFail(error,@"宿主传入的画面或状态无效。");
|
if(sources.count==0||!sources.firstObject.ioSurface||!destination.ioSurface||![state isKindOfClass:NSData.class]||state.length==0||state.length>320*1024*1024) return PGFail(error,@"宿主传入的画面或状态无效。");
|
||||||
NSDictionary *plist=[NSPropertyListSerialization propertyListWithData:state options:NSPropertyListImmutable format:nil error:error];
|
NSDictionary *plist=[NSPropertyListSerialization propertyListWithData:state options:NSPropertyListImmutable format:nil error:error];
|
||||||
if(![plist isKindOfClass:NSDictionary.class]||![plist[@"settings"] isKindOfClass:NSData.class]||[plist[@"settings"] length]!=sizeof(PGBeautySettings)) return PGFail(error,@"渲染状态版本无效。");
|
if(![plist isKindOfClass:NSDictionary.class]||![plist[@"settings"] isKindOfClass:NSData.class]) return PGFail(error,@"渲染状态版本无效。");
|
||||||
PGBeautySettings s;[plist[@"settings"] getBytes:&s length:sizeof(s)];
|
NSData *encoded=plist[@"settings"]; uint32_t version=0;
|
||||||
if(s.version!=1) return PGFail(error,@"此版本不支持保存的渲染状态。");
|
if(encoded.length<sizeof(version)) return PGFail(error,@"渲染状态版本无效。");
|
||||||
|
[encoded getBytes:&version length:sizeof(version)];
|
||||||
|
PGBeautySettings s=PGBeautyDefaults();
|
||||||
|
if(version==1 && encoded.length==PGBeautySettingsV1Size) {
|
||||||
|
[encoded getBytes:&s length:PGBeautySettingsV1Size];s.version=PGBeautySettingsVersion;
|
||||||
|
} else if(version==PGBeautySettingsVersion && encoded.length==sizeof(s)) {
|
||||||
|
[encoded getBytes:&s length:sizeof(s)];
|
||||||
|
} else return PGFail(error,@"此版本不支持保存的渲染状态。");
|
||||||
s.trackingEnabled=0;s.singleFace=0;
|
s.trackingEnabled=0;s.singleFace=0;
|
||||||
CIImage *input=PGImageFromTile(sources.firstObject); if(!input) return PGFail(error,@"无法读取 IOSurface。");
|
CIImage *input=PGImageFromTile(sources.firstObject); if(!input) return PGFail(error,@"无法读取 IOSurface。");
|
||||||
@synchronized(self) {
|
@synchronized(self) {
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.2.0</string>
|
<string>1.3.0</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>14</string>
|
<string>15</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# 2.4.0 面板参数迁移
|
||||||
|
|
||||||
|
2026-10-22(Asia/Shanghai)。用户通过截图纠正原需求:迁移新版面板参数,并非新增身体瘦身。此前[瘦身目标核对](瘦身迁移目标核对.md)保留为历史调查;本次继续工作使用 `codex/new-beauty-controls`,不再等待其他目标包。
|
||||||
|
|
||||||
|
## 参考与证据
|
||||||
|
|
||||||
|
目标:`/Users/dayu/Downloads/MSE18V2.app`,2.4.0 / 20260724150000;插件通用二进制 SHA-256:`577303e0de72e07feb576c882e82382b3f056b023a7e987d990ffb37f6b16109`;arm64 切片:`afc71d0d21fd3c1ca95ca745ddafcd729e36ad95f17d8638009f2e45d9b7e8df`。分析使用 Ghidra 12.1.4 与只读 Mach-O 元数据/反汇编,原文件未改。
|
||||||
|
|
||||||
|
| 参考面板 | 目标字段/转换 | 本项目入口 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 磨皮程度 | ID12 → midtoneDetail,直接 0–100% | 保留 PGMidtone 12,调整名称 |
|
||||||
|
| 微细锐化 | ID4 → sharpness,局部细节恢复 | 新 PGMicroDetail 77;原全局锐化 4 留在更多设置 |
|
||||||
|
| 五官保护 | ID30 → featureProtectionRelease = 1 − UI;旧 bool 随 release 接近 1 而关闭 | 新 PGFeatureProtectionAmount 75,直接保护量;旧 bool 30 保留类型与读取 |
|
||||||
|
| 非肤色区保护 | ID17 → highPassDetail = 1 − UI;新主路径用于肤色蒙版扩展 | 新 PGNonSkinProtection 76;原独立全局磨皮 17 留在更多设置 |
|
||||||
|
| 白牙、检测框预览、多人及脸型 | 截图中的这些项已经存在 | 保留;检测框名称调整、多人模式增加提示 |
|
||||||
|
|
||||||
|
两个新保护量默认为 100%,微细锐化默认为 0%。内部使用直接保护量,不直接复用参考包的反向 release 数值。
|
||||||
|
|
||||||
|
`setFloatValue:parameterID:minValue:maxValue:`(`0x1000116d8`)分别反转 17/30 的输入;Evidence:`ev_1fb7d2361dabf814edd6f22d217265b63efa9af24739741772ad5f579e0c67e3`。`valuesForControlPanelValue:` 返回相应原始字段;Evidence:`ev_20da8abf4eb5101b0902627255c643a783b7a15337aa4a757820ab71616f33e7`。显示格式 `strength` 是直接乘 100,只有 `protectionInverse` 格式自身反转;17/30 在绘制与交互同步时提前反转,不能把所有 strength 控制都解释为反向。格式函数汇编 Evidence:`ev_8e2a143f81d173c7643ecee2f1dac4a02145edbf82f113c8a48271428baf747c`。
|
||||||
|
|
||||||
|
目标原生处理入口 `applySkinSmoothingToImage:…`(`0x1000358d8`)把 params+0x50 用于非肤色参与,把 params+0x48 用于五官保护释放。Evidence:`ev_34eb4fe26dbaed9fc37d664d9363db903339c1447b6cd7fdb1980dcd61e99572`。可读 CI 内核字符串建立两个关键关系:肤色蒙版向白色线性扩展;保护蒙版与未保护蒙版按 release 线性混合。细节恢复使用原画与低频图的差,并受局部蒙版和亮度/纹理门控。字符串证据:`ev_d02bfe8046953e9287bd46c5403e6585354a5aa6df782a775d6a6fd0d96f1d62`。这里只记录公式和含义,不提交目标模型、metallib 或资源。
|
||||||
|
|
||||||
|
## 实施与兼容
|
||||||
|
|
||||||
|
本项目继续使用自研 Vision 几何蒙版与 Core Image 管线。新的平滑支持蒙版通过现有未保护/已保护覆盖率恢复五官衰减比例,再对非肤色区域扩展;两个控制独立于曝光/肤色蒙版。默认 100%/100% 直接沿用原覆盖路径。微细锐化在局部支持区域恢复亮度细节与少量色彩细节,可在磨皮量为零时独立使用。
|
||||||
|
|
||||||
|
原目标的语义蒙版、特征形状、纹理处理和复杂组合尚未全链对齐,因此本次是参数含义、连续控制和对应局部处理的迁移,不表示整个新版已逐像素复刻。旧版全局磨皮/全局锐化仍可通过更多设置使用,不与新保护项偷换含义;历史工程保留原强度。
|
||||||
|
|
||||||
|
PGBeautySettings v2 尾部增加三个 float,保留 v1 的 160 字节前缀。解码只接受 v1+160 字节或 v2+新完整长度;旧状态补中性默认值。PGInspectorState 仍使用 schema 1 数值字典,旧 bool 30 迁移到缺失的 75,新数值存在时优先采用新值。面板提交先保存权威对象 210,成功后再镜像旧 bool;每次拖动步进仍使用独立宿主 action。
|
||||||
|
|
||||||
|
模板继续发布原 210 对象与两项署名。新隐藏参数由插件注册和缺省值补齐,原 `.moef` 字节未改,无须覆盖用户模板。固定 Bundle ID、滤镜 UUID、安装路径及宣传资源不变。
|
||||||
|
|
||||||
|
## 验证
|
||||||
|
|
||||||
|
最终通过 1636 项:Beauty 57、Face 116、几何 796、宿主适配 ASan 341、OSC ASan 98、Inspector ASan 228(其中 1 项为可选离屏 PNG 输出)。新增检查包含保护量 0/50/100 的像素响应、非肤色保护只改变局部磨皮支持、微细锐化区域、颜色覆盖隔离、v1 状态迁移与错误长度拒绝、新滑杆归档/插值/输入/重置/旁路/主开关、松手前中间状态发布。离屏 AppKit 面板在多种宽度检查;原生宿主视觉验收需另记实际结果。
|
||||||
|
|
||||||
|
完整 REA 证据仅在忽略的 `build/body-analysis/new-controls-evidence.json`。本文保留目标身份、入口、公式与边界,恢复构建不依赖该本地调查目录。
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# 瘦身迁移:目标版本核对
|
||||||
|
|
||||||
|
核对日期:2026-10-22(Asia/Shanghai)。开发分支:`codex/body-slimming`;源码基线:`13821366a5baee9beea40972118d7fe634b5c735`。
|
||||||
|
|
||||||
|
**后续已澄清**:用户通过截图确认记错了,实际需求是迁移新增面板参数。后续以[新版磨皮参数迁移](新版磨皮参数迁移.md)为准,下面保留纠正前的有界调查结论,不再表示当前等待其他插件包。
|
||||||
|
|
||||||
|
## 当前结果
|
||||||
|
|
||||||
|
用户指定的新目标为 `/Users/dayu/Downloads/MSE18V2.app`。已读取项目交接并检查目标包,**尚未定位到可迁移的新增“瘦身”板块**。当前只完成目标核对与接入点调查,未修改产品源码、模板或正式安装的 1.2.0 APP,未编译或执行目标程序。
|
||||||
|
|
||||||
|
接续时先请用户确认瘦身控制的具体名称、面板画面或包含该功能的目标包路径。不能把现有“瘦脸”误当作“瘦身”,也不能自行设计身体变形后称为已迁移原版算法。
|
||||||
|
|
||||||
|
## 目标身份
|
||||||
|
|
||||||
|
| 项目 | 新下载目标 | 旧安装参考 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| APP 路径 | `/Users/dayu/Downloads/MSE18V2.app` | `/Applications/MSE18V2.app` |
|
||||||
|
| 外层与插件版本 | `2.4.0` / `20260724150000` | `1.0.20260617-170517` / `20260617170517` |
|
||||||
|
| 插件 Bundle ID | `com.ms.plugins.mse18v2` | `com.ms.plugins.mse18v2` |
|
||||||
|
| 插件通用二进制 SHA-256 | `577303e0de72e07feb576c882e82382b3f056b023a7e987d990ffb37f6b16109` | `6c5d74bc844a5c5f745718b48ea10ec6635d08aa08a5b6dc6e62653980849f8a` |
|
||||||
|
|
||||||
|
新插件 arm64 切片 SHA-256:`afc71d0d21fd3c1ca95ca745ddafcd729e36ad95f17d8638009f2e45d9b7e8df`。插件二进制位于各 APP 的 `Contents/PlugIns/MSE18V2.pluginkit/Contents/MacOS/MSE18V2`。
|
||||||
|
|
||||||
|
## 已观察证据与范围
|
||||||
|
|
||||||
|
- 对新旧包的外层和插件、arm64 与 x86_64 切片,静态检查 `__ustring`、`__cstring`、`__objc_methname`、`__objc_classname`。在这些段内未发现“瘦身、瘦腰、瘦腿、身体”及对应 body/slim/waist/slender/stretch/shoushen 功能命名。可读板块仍为磨皮、美白、瘦脸;新包另有“预览设置、肤色范围、非肤色区保护”等文字。这是有界字符串检查,不能排除动态生成或其他未解释数据。
|
||||||
|
- 新插件 arm64 的 Ghidra 参数注册函数 `MSSuperSkinSmoothingPlugIn::addParametersWithError:`(`0x10001fc10`)注册面板 210、磨皮/肤色/现有脸型参数和三模块开关,所见注册列表没有身体参数。Evidence:`ev_4d3e7e7dc8aa21347adbd0f0847fab13e8b69462bd5e6adf3657cbc0c1998266`。
|
||||||
|
- 面板值类的方法包括 `faceThin`、`faceNarrow`、`faceChin`、`faceJaw`、`faceSmallHead` 等,以及 skin/tone/face 三个模块开关。过程名称搜索没有返回身体变形入口;不能由名称负结果断言所有匿名函数均不存在身体算法。Evidence:`ev_446e4a969ff46db0600fe15988d0f396f394641aaeac760d6372a0c0509bf177`、`ev_157df22ee7802216f3581c9842a9629c69ee66097db068b825695bdfd99385d1`。
|
||||||
|
- 所见几何 GPU 管线仍为 `faceThin*`;新旧 metallib 的 12 个命名函数集合相同。文件变大不能证明新增身体算法,也不能由相同函数名断言函数内容相同。
|
||||||
|
- REA 对提供者已定义字符串对象的搜索只返回无关的 `URLRequest.httpBody`。Ghidra 未在该搜索中解码中文 UTF-16 常量,因此中文检查另使用实际 Mach-O 字节,未把 REA 空结果当作整个包不含中文的证据。Evidence:`ev_015a585ce5565d874f5b55af0c363bed634f09a29088ef660d3ca1c547626c26`。
|
||||||
|
|
||||||
|
REA 使用 Ghidra 12.1.4。通用 Mach-O 不支持该提供者直接选架构,故只读提取 arm64 切片分析。会话已关闭;切片、完整证据和快照仅保存在忽略的 `build/body-analysis/`,不作为构建或远端恢复依赖,不上传原版 APP、模型或 metallib。上述地址与 Evidence ID 仅对应本次 SHA,目标改变后需重新核对。
|
||||||
|
|
||||||
|
## 已完成与待定事项
|
||||||
|
|
||||||
|
| 问题 | 状态 |
|
||||||
|
| --- | --- |
|
||||||
|
| 项目交接、Git 基线、现有正式安装身份 | 已核对,产品源码未改 |
|
||||||
|
| 新下载包身份及与旧包差异 | 已核对;确为不同内容 |
|
||||||
|
| 新增瘦身控制、默认值、范围、画布操作 | 未定位,需确认正确目标 |
|
||||||
|
| 身体算法、处理顺序、跟随与蒙版行为 | 未建立证据,未实施 |
|
||||||
|
| 产品编译、回归、签名、公证、安装 | 本次未执行 |
|
||||||
|
|
||||||
|
## 确认目标后的接入提示
|
||||||
|
|
||||||
|
现有工程只有人脸几何,新增身体效果应有独立状态与总开关,不能依赖人脸检测成功。具体控制数量、范围、算法和顺序以正确目标的证据为准。
|
||||||
|
|
||||||
|
- `PGInspectorState.m` 的描述表同时驱动面板、归档和插值。保留参数 210 及既有 ID;数值字典缺失项会补默认值。新增卡片时,`PGInspectorView.m` 需按 section 识别“更多设置”,不能继续依赖 `index==3`。
|
||||||
|
- `PGBeautySettings` 当前是 160 字节 v1 裸结构体。若追加字段,应保留旧前缀并明确接受旧版本/长度组合,补齐新默认值;同步修改宿主解码,拒绝截断、超长或未知版本。不要只更改 `sizeof` 检查。
|
||||||
|
- OSC 必须同步完整面板对象 210,单写隐藏参数会被已编辑的面板状态覆盖。OSC 回调使用宿主已建立的参数上下文,不能套用面板的 `startAction/endAction` 路径;保留原选脸 ID 和 UUID。
|
||||||
|
- 身体变形需核对与外观处理、四类蒙版及整体混合的先后关系;验证无人脸、非零 extent、原点标签、极端参数、旧归档、撤销、连续拖动与保存重开。
|
||||||
|
|
||||||
|
本次分支基线已在 `origin` 和 `github` 读回核验。两端的最新研究记录以当前分支引用为准;尚无瘦身功能交付标签。
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"date": "2026-10-22",
|
||||||
|
"timezone": "Asia/Shanghai",
|
||||||
|
"version": "1.3.0",
|
||||||
|
"build": "15",
|
||||||
|
"status": "passed",
|
||||||
|
"checks": {
|
||||||
|
"beauty": 57,
|
||||||
|
"face": 116,
|
||||||
|
"geometry": 796,
|
||||||
|
"host_adapter_asan": 341,
|
||||||
|
"osc_asan": 98,
|
||||||
|
"inspector_asan_including_optional_preview": 228
|
||||||
|
},
|
||||||
|
"total": 1636,
|
||||||
|
"commands": [
|
||||||
|
"./scripts/test.sh",
|
||||||
|
"PAINTFCP_HOST_ASAN=1 ./scripts/test-host.sh",
|
||||||
|
"PAINTFCP_OSC_ASAN=1 ./scripts/test-osc.sh",
|
||||||
|
"PAINTFCP_INSPECTOR_ASAN=1 PAINTFCP_INSPECTOR_PNG=<local-path> ./scripts/test-inspector.sh"
|
||||||
|
],
|
||||||
|
"notes": [
|
||||||
|
"OSC passed before the later standalone beauty fallback and legacy inspector numeric-read fixes; those fixes do not change OSC code.",
|
||||||
|
"Core, host adapter and inspector rerun after all source fixes.",
|
||||||
|
"Inspector includes one optional offscreen PNG write assertion.",
|
||||||
|
"No native Motion/FCP interaction test performed for this version; active user hosts are preserved.",
|
||||||
|
"Reference interpretation and implementation limitations are in docs/analysis/新版磨皮参数迁移.md."
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"status": "installed_user_qa_pending",
|
||||||
|
"bundleIdentifier": "com.dayu.beatygril",
|
||||||
|
"installationPath": "/Library/Plug-Ins/FxPlug/beatygril.app",
|
||||||
|
"options": {
|
||||||
|
"waitForHosts": true,
|
||||||
|
"userTests": true
|
||||||
|
},
|
||||||
|
"nativeEffectQA": {
|
||||||
|
"status": "pending_user",
|
||||||
|
"performedByScript": false
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"commit": "2f2c081980dc610ac810f8daf92da8966f310802",
|
||||||
|
"trackedWorktreeChanges": []
|
||||||
|
},
|
||||||
|
"updatedAt": "2026-10-22T07:15:35.383726+00:00",
|
||||||
|
"version": "1.3.0",
|
||||||
|
"build": "15",
|
||||||
|
"stagingSignature": "Executable=/private/tmp/paintfcp-build-20261021/Build/Products/Release/beatygril.app/Contents/MacOS/beatygril\nIdentifier=com.dayu.beatygril\nFormat=app bundle with Mach-O universal (x86_64 arm64)\nCodeDirectory v=20500 size=478 flags=0x10000(runtime) hashes=4+7 location=embedded\nHash type=sha256 size=32\nCandidateCDHash sha256=93e3245cafc8ced5f2c01b8a72c8e0c3933eee83\nCandidateCDHashFull sha256=93e3245cafc8ced5f2c01b8a72c8e0c3933eee837831a2d779233e4364dded7c\nHash choices=sha256\nCMSDigest=93e3245cafc8ced5f2c01b8a72c8e0c3933eee837831a2d779233e4364dded7c\nCMSDigestType=2\nCDHash=93e3245cafc8ced5f2c01b8a72c8e0c3933eee83\nSignature size=8968\nAuthority=Developer ID Application: zhong luo (B3W25FX5H5)\nAuthority=Developer ID Certification Authority\nAuthority=Apple Root CA\nTimestamp=Oct 22, 2026 at 15:07:35\nInfo.plist entries=22\nTeamIdentifier=B3W25FX5H5\nRuntime Version=27.0.0\nSealed Resources version=2 rules=13 files=5\nInternal requirements count=1 size=180\nTotal signatures=1\nChosen signature=1\n",
|
||||||
|
"notarization": {
|
||||||
|
"id": "ca96837f-bf33-44fa-8d58-799026ce5c7d",
|
||||||
|
"message": "Processing complete",
|
||||||
|
"status": "Accepted"
|
||||||
|
},
|
||||||
|
"signingVerified": true,
|
||||||
|
"stapleValidated": true,
|
||||||
|
"stagingPluginUnregistered": true,
|
||||||
|
"runningHosts": [],
|
||||||
|
"installedSignature": "Executable=/Library/Plug-Ins/FxPlug/beatygril.app/Contents/MacOS/beatygril\nIdentifier=com.dayu.beatygril\nFormat=app bundle with Mach-O universal (x86_64 arm64)\nCodeDirectory v=20500 size=478 flags=0x10000(runtime) hashes=4+7 location=embedded\nHash type=sha256 size=32\nCandidateCDHash sha256=93e3245cafc8ced5f2c01b8a72c8e0c3933eee83\nCandidateCDHashFull sha256=93e3245cafc8ced5f2c01b8a72c8e0c3933eee837831a2d779233e4364dded7c\nHash choices=sha256\nCMSDigest=93e3245cafc8ced5f2c01b8a72c8e0c3933eee837831a2d779233e4364dded7c\nCMSDigestType=2\nCDHash=93e3245cafc8ced5f2c01b8a72c8e0c3933eee83\nSignature size=8968\nAuthority=Developer ID Application: zhong luo (B3W25FX5H5)\nAuthority=Developer ID Certification Authority\nAuthority=Apple Root CA\nTimestamp=Oct 22, 2026 at 15:07:35\nNotarization Ticket=stapled\nInfo.plist entries=22\nTeamIdentifier=B3W25FX5H5\nRuntime Version=27.0.0\nSealed Resources version=2 rules=13 files=5\nInternal requirements count=1 size=180\nTotal signatures=1\nChosen signature=1\n",
|
||||||
|
"installedSignatureVerified": true,
|
||||||
|
"installedStapleValidated": true,
|
||||||
|
"gatekeeperAccepted": true,
|
||||||
|
"pluginDiscovery": {
|
||||||
|
"bundleIdentifier": "com.dayu.beatygril.fxplug",
|
||||||
|
"formalPath": "/Library/Plug-Ins/FxPlug/beatygril.app/Contents/PlugIns/beatygril XPC Service.pluginkit",
|
||||||
|
"output": " com.dayu.beatygril.fxplug(1.1)\t97262612-DD61-47F2-B25E-D82B95C893EE\t2026-10-22 07:15:35 +0000\t/Library/Plug-Ins/FxPlug/beatygril.app/Contents/PlugIns/beatygril XPC Service.pluginkit\n (1 plug-in)\n"
|
||||||
|
},
|
||||||
|
"removedGeneratedPaths": [
|
||||||
|
"/Users/dayu/Documents/PaintFCP/build/delivery/previous-beatygril.app",
|
||||||
|
"/tmp/paintfcp-build-20261021",
|
||||||
|
"/Users/dayu/Documents/PaintFCP/build/delivery/notarization.zip"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"status": "verified",
|
||||||
|
"date": "2026-10-22",
|
||||||
|
"timezone": "Asia/Shanghai",
|
||||||
|
"installedProduct": {
|
||||||
|
"path": "/Library/Plug-Ins/FxPlug/beatygril.app",
|
||||||
|
"version": "1.3.0",
|
||||||
|
"build": "15"
|
||||||
|
},
|
||||||
|
"signatureAllArchitecturesVerified": true,
|
||||||
|
"duplicateInventory": {
|
||||||
|
"scope": "Listed local paths and existing explicit related PaintFCP paths on mounted volumes; Spotlight additionally queried. Not a full scan of every volume.",
|
||||||
|
"roots": [
|
||||||
|
"/Applications",
|
||||||
|
"/Library/Plug-Ins/FxPlug",
|
||||||
|
"/Users/dayu/Library/Plug-Ins/FxPlug",
|
||||||
|
"/Users/dayu/Documents/PaintFCP",
|
||||||
|
"/Users/dayu/Desktop",
|
||||||
|
"/Users/dayu/Downloads",
|
||||||
|
"/Users/dayu/Library/Developer/Xcode/DerivedData",
|
||||||
|
"/tmp/paintfcp-build-20261021"
|
||||||
|
],
|
||||||
|
"products": [
|
||||||
|
{
|
||||||
|
"path": "/Library/Plug-Ins/FxPlug/beatygril.app",
|
||||||
|
"version": "1.3.0",
|
||||||
|
"build": "15"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"errors": []
|
||||||
|
},
|
||||||
|
"temporaryPathsRemoved": [
|
||||||
|
"/tmp/paintfcp-build-20261021",
|
||||||
|
"build/delivery/previous-beatygril.app",
|
||||||
|
"build/delivery/notarization.zip"
|
||||||
|
],
|
||||||
|
"nativeEffectQA": "pending_user"
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"status": "waiting_for_host_exit",
|
||||||
|
"bundleIdentifier": "com.dayu.beatygril",
|
||||||
|
"installationPath": "/Library/Plug-Ins/FxPlug/beatygril.app",
|
||||||
|
"version": "1.3.0",
|
||||||
|
"build": "15",
|
||||||
|
"source": {
|
||||||
|
"commit": "2f2c081980dc610ac810f8daf92da8966f310802",
|
||||||
|
"trackedWorktreeChanges": []
|
||||||
|
},
|
||||||
|
"notarization": {
|
||||||
|
"id": "ca96837f-bf33-44fa-8d58-799026ce5c7d",
|
||||||
|
"message": "Processing complete",
|
||||||
|
"status": "Accepted"
|
||||||
|
},
|
||||||
|
"signingVerified": true,
|
||||||
|
"stapleValidated": true,
|
||||||
|
"stagingPluginUnregistered": true,
|
||||||
|
"nativeEffectQA": "pending_user",
|
||||||
|
"note": "Prepared Release is Accepted and stapled; installation is waiting for existing user hosts to close. The installed product has not been replaced."
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"status": "verified",
|
||||||
|
"date": "2026-10-22",
|
||||||
|
"commit": "2f2c081980dc610ac810f8daf92da8966f310802",
|
||||||
|
"remote": "https://dayu.media/git/dayu/paintfcp-fxplug.git",
|
||||||
|
"branch": "codex/new-beauty-controls",
|
||||||
|
"trackedFilesCompared": 205,
|
||||||
|
"gitFsckFullStrict": true,
|
||||||
|
"lfs": false,
|
||||||
|
"submodules": false,
|
||||||
|
"resources": "All tracked source, template and artwork bytes match; user QA media/signing credentials are external and not required to compile source."
|
||||||
|
}
|
||||||
+16
-3
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
更新时间:2026-10-22,Asia/Shanghai。项目根目录:`/Users/dayu/Documents/PaintFCP`。
|
更新时间:2026-10-22,Asia/Shanghai。项目根目录:`/Users/dayu/Documents/PaintFCP`。
|
||||||
|
|
||||||
当前正式版本为 **1.2.0(构建 14)**,APP 与 PKG 均已完成正式签名、公证和票据验证,APP 已安装,公开源码及文章已发布。没有待完成的发布阻塞项;后续工作应从新的用户反馈或下述已知差异继续,不必重新制作封面、重发文章或重复安装现有版本。
|
当前正式安装的 APP 为 **1.3.0(构建 15)**,已完成通用 Release 编译、正式签名、Apple 公证、票据验证及唯一正式路径安装。新增磨皮参数迁移与 1636 项自动检查已完成,原生效果视觉仍待用户实测。公开文章、PKG 与 GitHub Release 继续对应 **1.2.0**;本次未更新这些发行资料,也未覆盖模板或宣传图。
|
||||||
|
|
||||||
代码由 **OpenAI + Codex 全程编写,站长仅参与调试和测试**。文章和仓库须保留这个表述,不使用“站长原创代码”等说法。免费版本无需账号、激活码或付费授权;“自动注册”指系统插件注册。
|
代码由 **OpenAI + Codex 全程编写,站长仅参与调试和测试**。文章和仓库须保留这个表述,不使用“站长原创代码”等说法。免费版本无需账号、激活码或付费授权;“自动注册”指系统插件注册。
|
||||||
|
|
||||||
本交接整理前,工作区干净,`main`、`origin/main` 与 `github/main` 均为 `189a5d7634aa69db54330c90f8711b05d8e44b10`。这是文档新增前的基线;最新文档节点以 `git log -1` 和远端引用为准。
|
1.2.0 交接整理前,工作区干净,`main`、`origin/main` 与 `github/main` 均为 `189a5d7634aa69db54330c90f8711b05d8e44b10`。这是文档新增前的基线;最新文档节点以 `git log -1` 和远端引用为准。
|
||||||
|
|
||||||
## 先读和先查
|
## 先读和先查
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
| 入口 | 用途 |
|
| 入口 | 用途 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
|
| [1.3.0 交付回执](verification/v1.3.0/delivery-receipt.json) | 当前安装版、签名源码、公证、清理及原生视觉待测范围 |
|
||||||
| [README](../README.md) | 产品介绍、使用与版本变化 |
|
| [README](../README.md) | 产品介绍、使用与版本变化 |
|
||||||
| [恢复说明](../RECOVERY.md) | 精确源码节点、依赖、远端恢复记录 |
|
| [恢复说明](../RECOVERY.md) | 精确源码节点、依赖、远端恢复记录 |
|
||||||
| [GitHub 同步说明](GitHub同步说明.md) | 两个远端、公开克隆及 Release 验证 |
|
| [GitHub 同步说明](GitHub同步说明.md) | 两个远端、公开克隆及 Release 验证 |
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
| --- | --- |
|
| --- | --- |
|
||||||
| 显示名称 | 大鱼人像美化 |
|
| 显示名称 | 大鱼人像美化 |
|
||||||
| Xcode 产品名 | `beatygril`,保留现有拼写 |
|
| Xcode 产品名 | `beatygril`,保留现有拼写 |
|
||||||
| APP 版本 | `1.2.0` / `14`,arm64 与 x86_64 通用版本 |
|
| APP 版本 | `1.3.0` / `15`,arm64 与 x86_64 通用版本 |
|
||||||
| 唯一正式 APP | `/Library/Plug-Ins/FxPlug/beatygril.app` |
|
| 唯一正式 APP | `/Library/Plug-Ins/FxPlug/beatygril.app` |
|
||||||
| 主 Bundle ID | `com.dayu.beatygril` |
|
| 主 Bundle ID | `com.dayu.beatygril` |
|
||||||
| 嵌套插件 | `Contents/PlugIns/beatygril XPC Service.pluginkit` |
|
| 嵌套插件 | `Contents/PlugIns/beatygril XPC Service.pluginkit` |
|
||||||
@@ -237,6 +238,7 @@ GitHub Release 下载名为 `Dayu-Portrait-1.2.0.pkg`,字节相同,已匿名
|
|||||||
|
|
||||||
| 节点 | 完整提交 SHA |
|
| 节点 | 完整提交 SHA |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
|
| 1.3.0 正式签名源码(codex/new-beauty-controls) | `2f2c081980dc610ac810f8daf92da8966f310802` |
|
||||||
| 1.2.0 正式签名源码 | `696d5f39b30404ed5d1d4c25f61d17475c7fc91b` |
|
| 1.2.0 正式签名源码 | `696d5f39b30404ed5d1d4c25f61d17475c7fc91b` |
|
||||||
| `v1.2.0` 发布标签 | `3c7261c3a861b9f4704cfb36055d7b500c239dab` |
|
| `v1.2.0` 发布标签 | `3c7261c3a861b9f4704cfb36055d7b500c239dab` |
|
||||||
| 1.1.2 已验收渲染及面板源码 | `a2e33e8e00a99b95dc29d67a819cb0897eda5756` |
|
| 1.1.2 已验收渲染及面板源码 | `a2e33e8e00a99b95dc29d67a819cb0897eda5756` |
|
||||||
@@ -272,3 +274,14 @@ git switch --detach v1.2.0
|
|||||||
4. 新版本发布时,沿用固定身份和唯一正式路径,记录本次真实签名源码,完成 APP/PKG 公证与恢复验证,更新原文章和两个远端,不覆盖旧标签。
|
4. 新版本发布时,沿用固定身份和唯一正式路径,记录本次真实签名源码,完成 APP/PKG 公证与恢复验证,更新原文章和两个远端,不覆盖旧标签。
|
||||||
|
|
||||||
目标参考为 `/Applications/MSE18V2.app` 及用户原 MS 模板,仅用于只读分析。现有 REA、CPU 和 AIR 证据在 `docs/analysis/`;新分析按 `reverse-engineer-anything` 技能继续。不上传或打包原版 APP、模型、metallib、用户视频和完整人脸坐标。
|
目标参考为 `/Applications/MSE18V2.app` 及用户原 MS 模板,仅用于只读分析。现有 REA、CPU 和 AIR 证据在 `docs/analysis/`;新分析按 `reverse-engineer-anything` 技能继续。不上传或打包原版 APP、模型、metallib、用户视频和完整人脸坐标。
|
||||||
|
|
||||||
|
2026-10-22 用户已纠正“瘦身”为新增面板参数,目标仍是 `/Users/dayu/Downloads/MSE18V2.app`(2.4.0 / 20260724150000)。现沿 `codex/new-beauty-controls` 接入连续五官保护、非肤色区保护和局部微细锐化,保留旧 30/17/4 参数及归档;见[新版磨皮参数迁移](analysis/新版磨皮参数迁移.md)。1.3.0(15)已正式安装,签名、票据、Gatekeeper、PluginKit 正式路径和已知临时副本清理均验证通过。原生视觉由用户测试,见新交付回执。[原瘦身目标核对](analysis/瘦身迁移目标核对.md)只保留历史,不再是待澄清项。
|
||||||
|
|
||||||
|
|
||||||
|
## 1.3.0 接续说明
|
||||||
|
|
||||||
|
用户已保存并退出 Motion/FCP,交付脚本在宿主全部退出后安装新 APP。Apple 公证 ID 为 `ca96837f-bf33-44fa-8d58-799026ce5c7d`,状态 Accepted;最终签名源码为 `2f2c081980dc610ac810f8daf92da8966f310802`。交付标签 `v1.3.0` 包含后续回执和恢复文档,源码分支为 `codex/new-beauty-controls`,main 仍保留原发行状态。
|
||||||
|
|
||||||
|
新增稳定 float ID:75 五官保护量、76 非肤色区保护、77 局部微细锐化。旧 bool 30、独立全局磨皮 17 和全局锐化 4 均保留;后两项在更多设置中,不能重新解释其历史数值。PGBeautySettings v2 只追加三个 float,接受明确的 v1/160 字节旧状态。PGInspectorState 仍为 schema 1,缺 75 时从旧 bool 导入;旧 bool 为 true 时不得覆盖已读到的新浮点值。
|
||||||
|
|
||||||
|
1636 项检查与离屏面板已验,含 ASan 宿主/OSC/Inspector;本次未在原生宿主中重新操作新滑杆或验收效果视觉。正式插件发现只核验 PluginKit 路径,不把它写作 FCP 或 Motion 实际加载/画面通过。当前无需重新安装、重做封面或更新 1.2.0 安装包;用户反馈实际效果后继续针对性处理。
|
||||||
+7
@@ -131,3 +131,10 @@ Motion:独立普通视频项目,源PTS0、1920×1080/25fps/10秒,媒体通
|
|||||||
## 1.1.2 连续预览用户验收补充(2026-10-22)
|
## 1.1.2 连续预览用户验收补充(2026-10-22)
|
||||||
|
|
||||||
用户明确回复“拖动中已持续更新”,确认最终1.1.2(13)按住滑杆拖动时画面能够持续更新,关闭上节待反馈项。此项证据来自用户原生实测;未指定具体宿主,不声称两个宿主分别完成按住拖动验收,也没有测量每个鼠标事件的独立排帧。本次仅更新验收记录,不改变产品源码、安装版或既有发布标签。
|
用户明确回复“拖动中已持续更新”,确认最终1.1.2(13)按住滑杆拖动时画面能够持续更新,关闭上节待反馈项。此项证据来自用户原生实测;未指定具体宿主,不声称两个宿主分别完成按住拖动验收,也没有测量每个鼠标事件的独立排帧。本次仅更新验收记录,不改变产品源码、安装版或既有发布标签。
|
||||||
|
|
||||||
|
|
||||||
|
## 1.3.0(15)新增磨皮参数与正式安装
|
||||||
|
|
||||||
|
按用户纠正后的截图需求,迁移连续五官保护、非肤色区保护和局部微细锐化;保留旧 bool、全局磨皮/锐化 ID 与旧工程行为。正式签名源码 `2f2c081980dc610ac810f8daf92da8966f310802`。1636 项通过:57 Beauty、116 Face、796 几何、341 宿主适配 ASan、98 OSC ASan、228 Inspector ASan(含 1 项可选 PNG 输出)。保护 0/50/100 像素响应、色彩覆盖隔离、透明度、v1 状态迁移、新控件归档/插值/输入/重置/旁路/松手前发布均有检查;离屏面板已查看。
|
||||||
|
|
||||||
|
通用 Release 正式签名、公证 Accepted(`ca96837f-bf33-44fa-8d58-799026ce5c7d`)、票据、双架构严格签名、安装身份、Gatekeeper、PluginKit 正式路径与临时副本清理通过。独立从 origin 克隆签名源码节点,205 个受跟踪文件逐字节匹配且 strict/full fsck 通过。本次没有原生新滑杆/效果视觉验收,也没有生成新 PKG 或更新文章;用户已保存并退出宿主后才执行安装。详见 `verification/v1.3.0/` 与 `analysis/新版磨皮参数迁移.md`。
|
||||||
@@ -103,6 +103,46 @@ int main(void) { @autoreleasepool {
|
|||||||
s=PGBeautyDefaults();s.midtoneDetail=1;s.maskSoftness=0;s.maskEdgeProtect=0;s.featureProtection=1;
|
s=PGBeautyDefaults();s.midtoneDetail=1;s.maskSoftness=0;s.maskEdgeProtect=0;s.featureProtection=1;
|
||||||
float *protected=Render(context,[renderer processImage:source settings:s skinMask:white teethMask:nil eyeMask:half error:&error],extent);
|
float *protected=Render(context,[renderer processImage:source settings:s skinMask:white teethMask:nil eyeMask:half error:&error],extent);
|
||||||
Check(Difference(base,protected,6,40)<0.00001 && Texture(protected,56,88)<Texture(base,56,88)*0.82,@"Feature protection retains eye detail while smoothing nearby skin");free(protected);
|
Check(Difference(base,protected,6,40)<0.00001 && Texture(protected,56,88)<Texture(base,56,88)*0.82,@"Feature protection retains eye detail while smoothing nearby skin");free(protected);
|
||||||
|
// Independent protection controls use fractional coverage; neither changes
|
||||||
|
// exposure coverage nor invents smoothing when the smoothing amount is zero.
|
||||||
|
s=PGBeautyDefaults();s.midtoneDetail=1;s.maskSoftness=0;s.maskEdgeProtect=0;
|
||||||
|
float *featureFull=Render(context,[renderer processImage:source settings:s skinMask:white teethMask:nil eyeMask:half error:&error],extent);
|
||||||
|
s.featureProtectionAmount=.5;
|
||||||
|
float *featureHalf=Render(context,[renderer processImage:source settings:s skinMask:white teethMask:nil eyeMask:half error:&error],extent);
|
||||||
|
s.featureProtectionAmount=0;
|
||||||
|
float *featureNone=Render(context,[renderer processImage:source settings:s skinMask:white teethMask:nil eyeMask:half error:&error],extent);
|
||||||
|
float fullDelta=Difference(base,featureFull,6,40),halfDelta=Difference(base,featureHalf,6,40),noneDelta=Difference(base,featureNone,6,40);
|
||||||
|
Check(fullDelta<.00001 && halfDelta>fullDelta+.001 && noneDelta>halfDelta+.001,@"Five-feature protection has distinct ordered 0/50/100 percent pixel effects");
|
||||||
|
Check(Difference(featureFull,featureNone,56,88)<noneDelta*.25,@"Feature slider primarily changes marked features rather than nearby skin texture");
|
||||||
|
free(featureFull);free(featureHalf);free(featureNone);
|
||||||
|
s=PGBeautyDefaults();s.midtoneDetail=1;s.maskSoftness=0;s.maskEdgeProtect=0;s.featureProtection=0;
|
||||||
|
float *skinFull=Render(context,[renderer processImage:source settings:s skinMask:half teethMask:nil eyeMask:nil error:&error],extent);
|
||||||
|
s.nonSkinProtection=.5;
|
||||||
|
float *skinHalf=Render(context,[renderer processImage:source settings:s skinMask:half teethMask:nil eyeMask:nil error:&error],extent);
|
||||||
|
s.nonSkinProtection=0;
|
||||||
|
float *skinNone=Render(context,[renderer processImage:source settings:s skinMask:half teethMask:nil eyeMask:nil error:&error],extent);
|
||||||
|
Check(Difference(base,skinFull,56,88)<.00001 && Difference(base,skinHalf,56,88)>.001 && Difference(base,skinNone,56,88)>Difference(base,skinHalf,56,88)+.001,@"Non-skin protection progressively admits background into the local smoothing mask");
|
||||||
|
Check(Difference(skinFull,skinNone,6,40)<.00001,@"Non-skin protection leaves already-covered skin strength unchanged");
|
||||||
|
free(skinFull);free(skinHalf);free(skinNone);
|
||||||
|
s.midtoneDetail=0;
|
||||||
|
float *noSmoothing=Render(context,[renderer processImage:source settings:s skinMask:half teethMask:nil eyeMask:nil error:&error],extent);
|
||||||
|
Check(Difference(base,noSmoothing,4,W-4)<.00001,@"Releasing non-skin protection alone does not enable an independent global smoothing effect");free(noSmoothing);
|
||||||
|
s=PGBeautyDefaults();s.microDetail=1;s.maskSoftness=0;s.maskEdgeProtect=0;
|
||||||
|
float *micro=Render(context,[renderer processImage:source settings:s skinMask:half teethMask:nil eyeMask:nil error:&error],extent);
|
||||||
|
Check(Texture(micro,6,40)>Texture(base,6,40)*1.05 && Difference(base,micro,56,88)<.00001,@"Micro detail recovers texture within smoothing support, including without smoothing");
|
||||||
|
free(micro);
|
||||||
|
s=PGBeautyDefaults();s.skinBrightness=.7;s.maskSoftness=0;s.maskEdgeProtect=0;
|
||||||
|
float *colorProtected=Render(context,[renderer processImage:source settings:s skinMask:half colorMask:half teethMask:nil eyeMask:nil error:&error],extent);
|
||||||
|
s.nonSkinProtection=0;s.featureProtectionAmount=0;
|
||||||
|
float *colorReleased=Render(context,[renderer processImage:source settings:s skinMask:half colorMask:half teethMask:nil eyeMask:nil error:&error],extent);
|
||||||
|
Check(Difference(colorProtected,colorReleased,4,W-4)<.00001,@"Both new protection sliders leave skin exposure coverage unchanged");
|
||||||
|
free(colorProtected);free(colorReleased);
|
||||||
|
s=PGBeautyDefaults();s.skinBrightness=.7;s.maskSoftness=0;s.maskEdgeProtect=0;
|
||||||
|
colorProtected=Render(context,[renderer processImage:source settings:s skinMask:white teethMask:half eyeMask:half error:&error],extent);
|
||||||
|
s.featureProtectionAmount=0;s.featureProtection=0;s.nonSkinProtection=0;
|
||||||
|
colorReleased=Render(context,[renderer processImage:source settings:s skinMask:white teethMask:half eyeMask:half error:&error],extent);
|
||||||
|
Check(Difference(colorProtected,colorReleased,4,W-4)<.00001,@"Standalone renderer also keeps eye/teeth protection independent from exposure when the legacy bool changes");
|
||||||
|
free(colorProtected);free(colorReleased);
|
||||||
// A skin exposure adjustment must stay continuous across detail-protection
|
// A skin exposure adjustment must stay continuous across detail-protection
|
||||||
// holes. This models the eye/nose islands reported on the real beach clip.
|
// holes. This models the eye/nose islands reported on the real beach clip.
|
||||||
s=PGBeautyDefaults();s.skinBrightness=1;s.featureProtection=1;
|
s=PGBeautyDefaults();s.skinBrightness=1;s.featureProtection=1;
|
||||||
@@ -192,6 +232,7 @@ int main(void) { @autoreleasepool {
|
|||||||
// Every operation must preserve transparency rather than creating halos/opaque pixels.
|
// Every operation must preserve transparency rather than creating halos/opaque pixels.
|
||||||
for(int i=0;i<W*H;i++){p[i*4]*=0.4;p[i*4+1]*=0.4;p[i*4+2]*=0.4;p[i*4+3]=0.4;}
|
for(int i=0;i<W*H;i++){p[i*4]*=0.4;p[i*4+1]*=0.4;p[i*4+2]*=0.4;p[i*4+3]=0.4;}
|
||||||
CIImage *transparent=Image(p,extent);s=PGBeautyDefaults();s.midtoneDetail=1;s.skinBrightness=1;s.teethWhitening=1;s.eyeBrightening=1;s.skinTonePreset=3;s.highPassDetail=1;
|
CIImage *transparent=Image(p,extent);s=PGBeautyDefaults();s.midtoneDetail=1;s.skinBrightness=1;s.teethWhitening=1;s.eyeBrightening=1;s.skinTonePreset=3;s.highPassDetail=1;
|
||||||
|
s.microDetail=.7;s.nonSkinProtection=.3;s.featureProtectionAmount=.4;
|
||||||
float *alpha=Render(context,[renderer processImage:transparent settings:s skinMask:white teethMask:half eyeMask:half error:&error],extent);
|
float *alpha=Render(context,[renderer processImage:transparent settings:s skinMask:white teethMask:half eyeMask:half error:&error],extent);
|
||||||
BOOL alphaOK=YES,finite=YES;
|
BOOL alphaOK=YES,finite=YES;
|
||||||
for(int i=0;i<W*H;i++){if(fabsf(alpha[i*4+3]-0.4f)>0.0002)alphaOK=NO;for(int c=0;c<4;c++)if(!isfinite(alpha[i*4+c]))finite=NO;}
|
for(int i=0;i<W*H;i++){if(fabsf(alpha[i*4+3]-0.4f)>0.0002)alphaOK=NO;for(int c=0;c<4;c++)if(!isfinite(alpha[i*4+c]))finite=NO;}
|
||||||
|
|||||||
+11
-3
@@ -469,7 +469,9 @@ int main(int argc, const char *argv[]) {
|
|||||||
Check([plugin addParametersWithError:&error] && !error, @"host creates complete parameter set");
|
Check([plugin addParametersWithError:&error] && !error, @"host creates complete parameter set");
|
||||||
UInt32 identifiers[] = {PGAmount,PGBrightness,PGRadius,PGSharpness,PGMix,PGThreshold,PGSoftness,PGEdgeProtect,PGShowMask,PGMidtone,PGHue,PGSaturation,PGHighPass,PGThin,PGFaceBoxes,PGSingleFace,PGSelection,PGShort,PGNarrow,PGChin,PGVFace,PGJaw,PGCheekbone,PGSmallHead,PGSmallHeadRange,PGFeatureProtect,PGTeeth,PGEyeBright,PGBigEye,PGTrackBoxes,PGFastMulti,PGJumpGuard,PGEvenTone,PGTonePreset,PGInvertMask,PGDebugChannel,PGTrackEnabled,PGTarget,PGAnalyzeForward,PGAnalyzeBackward,PGClearTrack,PGStatus,PGTrackData1,PGTrackData2,PGTrackData3,PGSmoothingEnabled,PGColorEnabled,PGShapeEnabled,PGDetailEnabled,PGInspectorPanel};
|
UInt32 identifiers[] = {PGAmount,PGBrightness,PGRadius,PGSharpness,PGMix,PGThreshold,PGSoftness,PGEdgeProtect,PGShowMask,PGMidtone,PGHue,PGSaturation,PGHighPass,PGThin,PGFaceBoxes,PGSingleFace,PGSelection,PGShort,PGNarrow,PGChin,PGVFace,PGJaw,PGCheekbone,PGSmallHead,PGSmallHeadRange,PGFeatureProtect,PGTeeth,PGEyeBright,PGBigEye,PGTrackBoxes,PGFastMulti,PGJumpGuard,PGEvenTone,PGTonePreset,PGInvertMask,PGDebugChannel,PGTrackEnabled,PGTarget,PGAnalyzeForward,PGAnalyzeBackward,PGClearTrack,PGStatus,PGTrackData1,PGTrackData2,PGTrackData3,PGSmoothingEnabled,PGColorEnabled,PGShapeEnabled,PGDetailEnabled,PGInspectorPanel};
|
||||||
for (NSUInteger i = 0; i < sizeof(identifiers) / sizeof(UInt32); i++) Check(api.definitions[@(identifiers[i])] != nil, [NSString stringWithFormat:@"required parameter %u exists", identifiers[i]]);
|
for (NSUInteger i = 0; i < sizeof(identifiers) / sizeof(UInt32); i++) Check(api.definitions[@(identifiers[i])] != nil, [NSString stringWithFormat:@"required parameter %u exists", identifiers[i]]);
|
||||||
Check(api.depth == 0 && !api.duplicate && api.definitions.count == sizeof(identifiers) / sizeof(UInt32) + 6, @"parameter groups close and IDs are unique");
|
for(NSNumber *identifier in @[@(PGFeatureProtectionAmount),@(PGNonSkinProtection),@(PGMicroDetail)])
|
||||||
|
Check(api.definitions[identifier]!=nil,@"new protection/detail float parameter is registered");
|
||||||
|
Check(api.depth == 0 && !api.duplicate && api.definitions.count == sizeof(identifiers) / sizeof(UInt32) + 10, @"parameter groups close and IDs are unique");
|
||||||
Check([api.values[@(PGMidtone)] doubleValue] == 0 && [api.values[@(PGMix)] doubleValue] == 1, @"default detail and mix form identity filter");
|
Check([api.values[@(PGMidtone)] doubleValue] == 0 && [api.values[@(PGMix)] doubleValue] == 1, @"default detail and mix form identity filter");
|
||||||
Check([api.definitions[@(PGShort)][@"min"] doubleValue] == -1 && [api.definitions[@(PGShort)][@"max"] doubleValue] == 1, @"signed face control exposes both directions");
|
Check([api.definitions[@(PGShort)][@"min"] doubleValue] == -1 && [api.definitions[@(PGShort)][@"max"] doubleValue] == 1, @"signed face control exposes both directions");
|
||||||
Check([api.definitions[@(PGTrackData1)][@"flags"] unsignedLongLongValue] & kFxParameterFlag_HIDDEN, @"persistent tracking data stays hidden in host UI");
|
Check([api.definitions[@(PGTrackData1)][@"flags"] unsignedLongLongValue] & kFxParameterFlag_HIDDEN, @"persistent tracking data stays hidden in host UI");
|
||||||
@@ -480,7 +482,7 @@ int main(int argc, const char *argv[]) {
|
|||||||
NSDictionary *decoded = [NSPropertyListSerialization propertyListWithData:state options:0 format:nil error:nil];
|
NSDictionary *decoded = [NSPropertyListSerialization propertyListWithData:state options:0 format:nil error:nil];
|
||||||
Check([decoded[@"tracks"] count] == 3 && [decoded[@"settings"] length] == sizeof(PGBeautySettings), @"snapshot contains fixed settings schema and three target slots");
|
Check([decoded[@"tracks"] count] == 3 && [decoded[@"settings"] length] == sizeof(PGBeautySettings), @"snapshot contains fixed settings schema and three target slots");
|
||||||
PGBeautySettings settings; [decoded[@"settings"] getBytes:&settings length:sizeof(settings)];
|
PGBeautySettings settings; [decoded[@"settings"] getBytes:&settings length:sizeof(settings)];
|
||||||
Check(settings.version == 1 && settings.mix == 1 && settings.midtoneDetail == 0, @"snapshot round-trips default numeric state");
|
Check(settings.version == PGBeautySettingsVersion && settings.mix == 1 && settings.midtoneDetail == 0 && settings.featureProtectionAmount==1 && settings.nonSkinProtection==1 && settings.microDetail==0, @"snapshot round-trips v2 with neutral defaults for the new controls");
|
||||||
api.values[@(PGThin)] = @5; api.values[@(PGRadius)] = @(-9); api.values[@(PGSelection)] = @[@(-1), @2];
|
api.values[@(PGThin)] = @5; api.values[@(PGRadius)] = @(-9); api.values[@(PGSelection)] = @[@(-1), @2];
|
||||||
settings = [plugin settingsAtTime:api.hostTime];
|
settings = [plugin settingsAtTime:api.hostTime];
|
||||||
Check(settings.faceThin == 1 && settings.radius == 1 && settings.selectionX == 0 && settings.selectionY == 1, @"host parameter limits and normalized selection are enforced");
|
Check(settings.faceThin == 1 && settings.radius == 1 && settings.selectionX == 0 && settings.selectionY == 1, @"host parameter limits and normalized selection are enforced");
|
||||||
@@ -493,6 +495,12 @@ int main(int argc, const char *argv[]) {
|
|||||||
NSUInteger difference = MaximumDifference(SurfaceBytes(source), SurfaceBytes(destination));
|
NSUInteger difference = MaximumDifference(SurfaceBytes(source), SurfaceBytes(destination));
|
||||||
printf("Default IOSurface maximum byte difference: %lu\n", (unsigned long)difference);
|
printf("Default IOSurface maximum byte difference: %lu\n", (unsigned long)difference);
|
||||||
Check(difference <= 1, @"default adapter output preserves gamma-video numeric samples");
|
Check(difference <= 1, @"default adapter output preserves gamma-video numeric samples");
|
||||||
|
PGBeautySettings old=PGBeautyDefaults();old.version=1;
|
||||||
|
NSData *legacy=PlistState(@{@"settings":[NSData dataWithBytes:&old length:PGBeautySettingsV1Size],@"tracks":@[@"",@"",@""]});
|
||||||
|
Check(Render(plugin,destination,@[source],legacy,kCMTimeZero,&error,NULL) && MaximumDifference(SurfaceBytes(source),SurfaceBytes(destination))<=1,@"160-byte v1 snapshots migrate with neutral new controls and preserve original pixels");
|
||||||
|
RejectState(plugin,destination,source,PlistState(@{@"settings":[NSData dataWithBytes:&old length:sizeof(old)],@"tracks":@[@"",@"",@""]}),@"v1 with the new structure length is rejected instead of guessing its layout");
|
||||||
|
old.version=PGBeautySettingsVersion;
|
||||||
|
RejectState(plugin,destination,source,PlistState(@{@"settings":[NSData dataWithBytes:&old length:PGBeautySettingsV1Size],@"tracks":@[@"",@"",@""]}),@"v2 with a truncated legacy-sized payload is rejected");
|
||||||
CGColorSpaceRelease(destination.space); destination.space = CGColorSpaceCreateWithName(kCGColorSpaceLinearSRGB);
|
CGColorSpaceRelease(destination.space); destination.space = CGColorSpaceCreateWithName(kCGColorSpaceLinearSRGB);
|
||||||
Check(Render(plugin, destination, @[source], state, kCMTimeZero, &error, NULL), @"numeric host render accepts destination color-space metadata");
|
Check(Render(plugin, destination, @[source], state, kCMTimeZero, &error, NULL), @"numeric host render accepts destination color-space metadata");
|
||||||
difference = MaximumDifference(SurfaceBytes(source), SurfaceBytes(destination));
|
difference = MaximumDifference(SurfaceBytes(source), SurfaceBytes(destination));
|
||||||
@@ -510,7 +518,7 @@ int main(int argc, const char *argv[]) {
|
|||||||
RejectState(plugin, destination, source, PlistState(@{@"settings":[NSData data], @"tracks":@[@"",@"",@""]}), @"wrong settings size is rejected safely");
|
RejectState(plugin, destination, source, PlistState(@{@"settings":[NSData data], @"tracks":@[@"",@"",@""]}), @"wrong settings size is rejected safely");
|
||||||
settings = PGBeautyDefaults(); settings.version = 99;
|
settings = PGBeautyDefaults(); settings.version = 99;
|
||||||
RejectState(plugin, destination, source, PlistState(@{@"settings":[NSData dataWithBytes:&settings length:sizeof(settings)], @"tracks":@[@"",@"",@""]}), @"unknown saved settings version is rejected safely");
|
RejectState(plugin, destination, source, PlistState(@{@"settings":[NSData dataWithBytes:&settings length:sizeof(settings)], @"tracks":@[@"",@"",@""]}), @"unknown saved settings version is rejected safely");
|
||||||
settings.version = 1;
|
settings.version = PGBeautySettingsVersion;
|
||||||
RejectState(plugin, destination, source, PlistState(@{@"settings":[NSData dataWithBytes:&settings length:sizeof(settings)], @"tracks":@[@"",@""]}), @"wrong target slot count is rejected safely");
|
RejectState(plugin, destination, source, PlistState(@{@"settings":[NSData dataWithBytes:&settings length:sizeof(settings)], @"tracks":@[@"",@""]}), @"wrong target slot count is rejected safely");
|
||||||
RejectState(plugin, destination, source, PlistState(@{@"settings":[NSData dataWithBytes:&settings length:sizeof(settings)], @"tracks":@[@"",@7,@""]}), @"non-string target slot is rejected safely");
|
RejectState(plugin, destination, source, PlistState(@{@"settings":[NSData dataWithBytes:&settings length:sizeof(settings)], @"tracks":@[@"",@7,@""]}), @"non-string target slot is rejected safely");
|
||||||
for (NSUInteger top = 0; top < 2; top++) {
|
for (NSUInteger top = 0; top < 2; top++) {
|
||||||
|
|||||||
+103
-5
@@ -52,6 +52,9 @@ static NSControl *FindControl(NSView *view,Class type,NSString *label) {
|
|||||||
}
|
}
|
||||||
static void Fire(NSControl *control) {[control sendAction:control.action to:control.target];}
|
static void Fire(NSControl *control) {[control sendAction:control.action to:control.target];}
|
||||||
static BOOL Near(double a,double b) {return fabs(a-b)<.00001;}
|
static BOOL Near(double a,double b) {return fabs(a-b)<.00001;}
|
||||||
|
static PGInspectorState *State(NSDictionary *values,NSSet *disabled) {
|
||||||
|
return [PGInspectorState stateWithValues:values disabledParameters:disabled?:[NSSet set] hasEdits:YES];
|
||||||
|
}
|
||||||
static void RegistrationTests(void) {
|
static void RegistrationTests(void) {
|
||||||
PGHostAPI *api=[PGHostAPI new];beatygrilPlugIn *plugin=[[beatygrilPlugIn alloc]initWithAPIManager:api];[plugin addParametersWithError:nil];
|
PGHostAPI *api=[PGHostAPI new];beatygrilPlugIn *plugin=[[beatygrilPlugIn alloc]initWithAPIManager:api];[plugin addParametersWithError:nil];
|
||||||
NSUInteger visible=0;for(NSNumber *key in api.definitions){NSDictionary *d=api.definitions[key];if(!([d[@"flags"]unsignedIntValue]&kFxParameterFlag_HIDDEN)){visible++;Check(key.unsignedIntValue==PGInspectorPanel,@"only the custom panel is visible in the native parameter list");}}
|
NSUInteger visible=0;for(NSNumber *key in api.definitions){NSDictionary *d=api.definitions[key];if(!([d[@"flags"]unsignedIntValue]&kFxParameterFlag_HIDDEN)){visible++;Check(key.unsignedIntValue==PGInspectorPanel,@"only the custom panel is visible in the native parameter list");}}
|
||||||
@@ -65,11 +68,47 @@ static void RegistrationTests(void) {
|
|||||||
NSNumber *key=d[@"id"];Check(api.definitions[key]!=nil,@"every inspector control maps to an existing stable parameter ID");
|
NSNumber *key=d[@"id"];Check(api.definitions[key]!=nil,@"every inspector control maps to an existing stable parameter ID");
|
||||||
if([d[@"kind"]isEqual:@"slider"])Check(Near([d[@"min"]doubleValue],[api.definitions[key][@"min"]doubleValue]) && Near([d[@"max"]doubleValue],[api.definitions[key][@"max"]doubleValue]),@"UI and renderer enforce the same slider range");
|
if([d[@"kind"]isEqual:@"slider"])Check(Near([d[@"min"]doubleValue],[api.definitions[key][@"min"]doubleValue]) && Near([d[@"max"]doubleValue],[api.definitions[key][@"max"]doubleValue]),@"UI and renderer enforce the same slider range");
|
||||||
}
|
}
|
||||||
|
NSMutableArray *smoothIDs=[NSMutableArray new];
|
||||||
|
for(NSDictionary *d in PGInspectorControls())if([d[@"section"]isEqual:@"smooth"] && ![d[@"kind"]isEqual:@"master"])[smoothIDs addObject:d[@"id"]];
|
||||||
|
Check([smoothIDs isEqual:@[@(PGMidtone),@(PGMicroDetail),@(PGFeatureProtectionAmount),@(PGNonSkinProtection)]],@"primary smoothing card exposes the four new controls in reference order");
|
||||||
|
Check(PGInspectorDescriptor(PGFeatureProtect)==nil && [PGInspectorDescriptor(PGHighPass)[@"section"]isEqual:@"more"] && [PGInspectorDescriptor(PGSharpness)[@"section"]isEqual:@"more"],@"legacy boolean stays hidden while legacy global smoothing and sharpening remain available in more settings");
|
||||||
api.values[@(PGTrackEnabled)]=@YES;api.values[@(PGSingleFace)]=@YES;api.values[@(PGShowMask)]=@YES;
|
api.values[@(PGTrackEnabled)]=@YES;api.values[@(PGSingleFace)]=@YES;api.values[@(PGShowMask)]=@YES;
|
||||||
PGBeautySettings s=[plugin settingsAtTime:kCMTimeZero];Check(!s.trackingEnabled && !s.singleFace && !s.showMask,@"old manual analysis, selection and debug flags cannot override automatic output");
|
PGBeautySettings s=[plugin settingsAtTime:kCMTimeZero];Check(!s.trackingEnabled && !s.singleFace && !s.showMask,@"old manual analysis, selection and debug flags cannot override automatic output");
|
||||||
NSData *snapshot=Snapshot(plugin,kCMTimeZero);NSDictionary *plist=[NSPropertyListSerialization propertyListWithData:snapshot options:0 format:nil error:nil];
|
NSData *snapshot=Snapshot(plugin,kCMTimeZero);NSDictionary *plist=[NSPropertyListSerialization propertyListWithData:snapshot options:0 format:nil error:nil];
|
||||||
Check([plist[@"tracks"]isEqual:@[@"",@"",@""]],@"automatic render snapshots do not transfer persisted manual-analysis payloads");
|
Check([plist[@"tracks"]isEqual:@[@"",@"",@""]],@"automatic render snapshots do not transfer persisted manual-analysis payloads");
|
||||||
}
|
}
|
||||||
|
static void BeautyControlModelTests(void) {
|
||||||
|
PGInspectorState *defaults=State(@{},nil);
|
||||||
|
Check([defaults valueForParameter:PGFeatureProtectionAmount]==1 && [defaults valueForParameter:PGNonSkinProtection]==1 && [defaults valueForParameter:PGMicroDetail]==0,@"new controls default to full five-feature/non-skin protection and zero micro detail");
|
||||||
|
for(NSNumber *legacy in @[@NO,@YES]) {
|
||||||
|
PGInspectorState *migrated=State(@{@(PGFeatureProtect):legacy,@(PGHighPass):@.63},nil);
|
||||||
|
PGBeautySettings s=PGSettingsWithInspectorState(PGBeautyDefaults(),migrated);
|
||||||
|
Check([migrated valueForParameter:PGFeatureProtectionAmount]==legacy.boolValue && s.featureProtection==legacy.boolValue && Near(s.highPassDetail,.63) && s.nonSkinProtection==1,@"old schema dictionaries migrate five-feature bool without reinterpreting legacy global smoothing");
|
||||||
|
}
|
||||||
|
PGInspectorState *explicit=State(@{@(PGFeatureProtect):@NO,@(PGFeatureProtectionAmount):@.37},nil);
|
||||||
|
Check(Near([explicit valueForParameter:PGFeatureProtectionAmount],.37),@"an explicit numeric protection setting takes precedence over the old boolean");
|
||||||
|
NSDictionary *values=@{@(PGFeatureProtectionAmount):@.25,@(PGNonSkinProtection):@.6,@(PGMicroDetail):@.8,@(PGMidtone):@.7,@(PGHighPass):@.4,@(PGSharpness):@.5,@(PGHue):@12,@(PGBrightness):@.3,@(PGTonePreset):@2};
|
||||||
|
PGInspectorState *a=State(values,nil);
|
||||||
|
NSData *archive=[NSKeyedArchiver archivedDataWithRootObject:a requiringSecureCoding:YES error:nil];
|
||||||
|
PGInspectorState *restored=[NSKeyedUnarchiver unarchivedObjectOfClass:PGInspectorState.class fromData:archive error:nil];
|
||||||
|
Check([restored isEqual:a] && Near([restored valueForParameter:PGFeatureProtectionAmount],.25) && Near([restored valueForParameter:PGNonSkinProtection],.6) && Near([restored valueForParameter:PGMicroDetail],.8),@"secure document archive retains all three independent numeric controls");
|
||||||
|
NSMutableDictionary *right=[values mutableCopy];right[@(PGFeatureProtectionAmount)]=@.75;right[@(PGNonSkinProtection)]=@.2;right[@(PGMicroDetail)]=@.4;
|
||||||
|
PGInspectorState *mid=(PGInspectorState *)[a interpolateBetween:State(right,nil) withWeight:.5];
|
||||||
|
Check(Near([mid valueForParameter:PGFeatureProtectionAmount],.5) && Near([mid valueForParameter:PGNonSkinProtection],.4) && Near([mid valueForParameter:PGMicroDetail],.6),@"new floating-point protection and micro-detail keyframes interpolate independently");
|
||||||
|
for(NSNumber *key in @[@(PGFeatureProtectionAmount),@(PGNonSkinProtection),@(PGMicroDetail)]) {
|
||||||
|
PGInspectorState *bypassed=State(values,[NSSet setWithObject:key]);
|
||||||
|
PGBeautySettings s=PGSettingsWithInspectorState(PGBeautyDefaults(),bypassed);
|
||||||
|
Check(Near(s.featureProtectionAmount,key.unsignedIntValue==PGFeatureProtectionAmount?0:.25) && Near(s.nonSkinProtection,key.unsignedIntValue==PGNonSkinProtection?0:.6) && Near(s.microDetail,key.unsignedIntValue==PGMicroDetail?0:.8),@"each new bypass affects only its own render setting");
|
||||||
|
Check(s.featureProtection==(s.featureProtectionAmount>0) && Near(s.skinHue,12) && Near(s.skinBrightness,.3) && s.skinTonePreset==2 && Near(s.highPassDetail,.4) && Near(s.sharpness,.5),@"protection bypass preserves color and legacy detail settings and derives the old feature bool");
|
||||||
|
}
|
||||||
|
NSMutableDictionary *off=[values mutableCopy];off[@(PGSmoothingEnabled)]=@0;
|
||||||
|
PGBeautySettings s=PGSettingsWithInspectorState(PGBeautyDefaults(),State(off,nil));
|
||||||
|
Check(s.amount==0 && s.midtoneDetail==0 && s.highPassDetail==0 && s.microDetail==0 && Near(s.skinHue,12) && Near(s.skinBrightness,.3),@"smoothing master bypass also disables micro detail while preserving color adjustments");
|
||||||
|
PGInspectorState *untouched=[PGInspectorState stateWithValues:@{@(PGFeatureProtect):@NO} disabledParameters:[NSSet set] hasEdits:NO];
|
||||||
|
PGBeautySettings original=PGBeautyDefaults();original.featureProtectionAmount=.8;original.nonSkinProtection=.2;original.microDetail=.7;
|
||||||
|
PGBeautySettings result=PGSettingsWithInspectorState(original,untouched);
|
||||||
|
Check(memcmp(&original,&result,sizeof(result))==0,@"an untouched migrated inspector still leaves existing document settings unchanged");
|
||||||
|
}
|
||||||
static void ModelTests(void) {
|
static void ModelTests(void) {
|
||||||
PGInspectorState *plain=[PGInspectorState stateWithValues:@{} disabledParameters:[NSSet set] hasEdits:NO];
|
PGInspectorState *plain=[PGInspectorState stateWithValues:@{} disabledParameters:[NSSet set] hasEdits:NO];
|
||||||
PGBeautySettings original=PGBeautyDefaults();original.midtoneDetail=.5;original.faceChin=-.3;
|
PGBeautySettings original=PGBeautyDefaults();original.midtoneDetail=.5;original.faceChin=-.3;
|
||||||
@@ -191,13 +230,51 @@ static void ViewInteractionTests(void) {
|
|||||||
Fire(number);
|
Fire(number);
|
||||||
Check(number.currentEditor==nil && Near([(PGInspectorState *)api.values[@(PGInspectorPanel)] valueForParameter:PGChin],.25),@"Return commits once and releases the actual AppKit editor before host commands");
|
Check(number.currentEditor==nil && Near([(PGInspectorState *)api.values[@(PGInspectorPanel)] valueForParameter:PGChin],.25),@"Return commits once and releases the actual AppKit editor before host commands");
|
||||||
[window close];
|
[window close];
|
||||||
NSButton *preview=(NSButton *)FindControl(view,NSButton.class,@"人脸框预览");preview.state=NSControlStateValueOn;Fire(preview);s=api.values[@(PGInspectorPanel)];Check([s valueForParameter:PGTrackBoxes]==1,@"preview switch events change the automatic face box setting");
|
NSButton *preview=(NSButton *)FindControl(view,NSButton.class,@"检测框预览");preview.state=NSControlStateValueOn;Fire(preview);s=api.values[@(PGInspectorPanel)];Check([s valueForParameter:PGTrackBoxes]==1,@"preview switch events change the automatic face box setting");
|
||||||
for(NSNumber *width in @[@280,@320,@380,@520]) {
|
for(NSNumber *width in @[@280,@320,@380,@520]) {
|
||||||
[view setFrameSize:NSMakeSize(width.doubleValue,20)];[view layoutSubtreeIfNeeded];
|
[view setFrameSize:NSMakeSize(width.doubleValue,20)];[view layoutSubtreeIfNeeded];
|
||||||
Check(view.frame.size.height>500 && Near(view.frame.size.height,view.fittingSize.height) && Near(view.frame.size.height,view.intrinsicContentSize.height),@"width changes produce a complete consistent intrinsic/fitting height");
|
Check(view.frame.size.height>500 && Near(view.frame.size.height,view.fittingSize.height) && Near(view.frame.size.height,view.intrinsicContentSize.height),@"width changes produce a complete consistent intrinsic/fitting height");
|
||||||
for(NSView *card in view.subviews)if(!card.hidden)Check(NSMaxY(card.frame)<=NSHeight(view.bounds)+1 && NSMaxX(card.frame)<=NSWidth(view.bounds)+1,@"every visible card and footer remains inside the panel at all inspector widths");
|
for(NSView *card in view.subviews)if(!card.hidden)Check(NSMaxY(card.frame)<=NSHeight(view.bounds)+1 && NSMaxX(card.frame)<=NSWidth(view.bounds)+1,@"every visible card and footer remains inside the panel at all inspector widths");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void BeautyControlInteractionTests(void) {
|
||||||
|
PGInspectorTestAPI *api=[PGInspectorTestAPI new];beatygrilPlugIn *plugin=[[beatygrilPlugIn alloc]initWithAPIManager:api];[plugin addParametersWithError:nil];
|
||||||
|
api.values[@(PGFeatureProtectionAmount)]=@.37;api.values[@(PGHighPass)]=@.63;api.values[@(PGHue)]=@12;api.values[@(PGBrightness)]=@.3;
|
||||||
|
PGInspectorView *view=(PGInspectorView *)[plugin createViewForParameterID:PGInspectorPanel];[view refreshFromHost];
|
||||||
|
Check(Near([view.controller.state valueForParameter:PGFeatureProtectionAmount],.37) && !view.controller.state.hasEdits,@"an untouched inspector preserves native fractional protection when the legacy boolean is enabled");
|
||||||
|
[view.controller setValue:.35 forParameter:PGBrightness];
|
||||||
|
Check(Near([(PGInspectorState *)api.values[@(PGInspectorPanel)] valueForParameter:PGFeatureProtectionAmount],.37) && Near([api.values[@(PGFeatureProtectionAmount)]doubleValue],.37),@"first unrelated edit captures native fractional protection without replacing it with the legacy true value");
|
||||||
|
api.values[@(PGInspectorPanel)]=[PGInspectorState stateWithValues:@{} disabledParameters:[NSSet set] hasEdits:NO];
|
||||||
|
api.values[@(PGFeatureProtect)]=@NO;[view hostParameterChanged];
|
||||||
|
Check([view.controller.state valueForParameter:PGFeatureProtectionAmount]==0 && !view.controller.state.hasEdits,@"untouched inspector imports the old host five-feature boolean into the new numeric control");
|
||||||
|
[view.controller setValue:.35 forParameter:PGBrightness];
|
||||||
|
Check(![api.values[@(PGFeatureProtect)]boolValue] && Near([view.controller.state valueForParameter:PGFeatureProtectionAmount],0),@"first unrelated edit preserves disabled legacy feature protection");
|
||||||
|
NSArray *ids=@[@(PGFeatureProtectionAmount),@(PGNonSkinProtection),@(PGMicroDetail)],*names=@[@"五官保护",@"非肤色区保护",@"微细锐化"];
|
||||||
|
for(NSUInteger i=0;i<ids.count;i++) {
|
||||||
|
UInt32 key=[ids[i]unsignedIntValue];NSString *name=names[i];
|
||||||
|
NSSlider *slider=(NSSlider *)FindControl(view,NSSlider.class,name);
|
||||||
|
NSTextField *number=(NSTextField *)FindControl(view,NSTextField.class,[name stringByAppendingString:@"数值"]);
|
||||||
|
Check(slider && number && slider.enabled && number.enabled,@"each new control exposes an enabled native slider and numeric field");
|
||||||
|
number.stringValue=@"27%";Fire(number);
|
||||||
|
Check(Near([view.controller.state valueForParameter:key],.27) && [number.stringValue isEqual:@"27%"],@"new numeric controls accept direct percentages without inverse interpretation");
|
||||||
|
slider.doubleValue=.42;Fire(slider);
|
||||||
|
Check(Near([view.controller.state valueForParameter:key],.42) && [number.stringValue isEqual:@"42%"],@"actual new slider events publish their direct amount and update the percentage display");
|
||||||
|
NSButton *eye=(NSButton *)FindControl(view,NSButton.class,[@"启用 / 停用 · "stringByAppendingString:name]);Fire(eye);
|
||||||
|
Check(![view.controller.state isParameterEnabled:key] && Near([view.controller.state valueForParameter:key],.42) && !slider.enabled,@"new individual bypass preserves its value and disables its native controls");
|
||||||
|
if(key==PGFeatureProtectionAmount)Check(![api.values[@(PGFeatureProtect)]boolValue],@"bypassed numeric feature protection mirrors false into the legacy hidden boolean");
|
||||||
|
NSButton *reset=(NSButton *)FindControl(view,NSButton.class,[@"重置 · "stringByAppendingString:name]);Fire(reset);
|
||||||
|
Check([view.controller.state isParameterEnabled:key] && [view.controller.state valueForParameter:key]==(key==PGMicroDetail?0:1) && slider.enabled,@"new individual reset restores the proper default and clears bypass");
|
||||||
|
}
|
||||||
|
Check([api.values[@(PGFeatureProtect)]boolValue] && Near([view.controller.state valueForParameter:PGHighPass],.63) && Near([view.controller.state valueForParameter:PGHue],12) && Near([view.controller.state valueForParameter:PGBrightness],.35),@"new resets restore the legacy feature bool without modifying global smoothing, hue or brightness");
|
||||||
|
NSButton *multi=(NSButton *)FindControl(view,NSButton.class,@"多人模式");Check([multi.toolTip containsString:@"易抖动"],@"multi-face mode exposes its instability notice as a tooltip");
|
||||||
|
[view.controller setValue:.6 forParameter:PGMicroDetail];
|
||||||
|
NSButton *master=(NSButton *)FindControl(view,NSButton.class,@"磨皮");master.state=NSControlStateValueOff;Fire(master);
|
||||||
|
PGBeautySettings s=PGSettingsWithInspectorState(PGBeautyDefaults(),view.controller.state);
|
||||||
|
Check(s.microDetail==0 && s.midtoneDetail==0 && s.highPassDetail==0 && Near(s.skinHue,12) && Near(s.skinBrightness,.35),@"actual smoothing master event disables new detail processing independently from whitening");
|
||||||
|
master.state=NSControlStateValueOn;Fire(master);
|
||||||
|
Check(Near(PGSettingsWithInspectorState(PGBeautyDefaults(),view.controller.state).microDetail,.6),@"reenabling the master restores the stored micro-detail amount");
|
||||||
|
Check(api.actionDepth==0 && api.actionStarts==api.actionEnds && api.accessViolations==0,@"all new numeric, bypass, reset and master interactions use balanced host actions");
|
||||||
|
}
|
||||||
static void HostHandshakeTests(void) {
|
static void HostHandshakeTests(void) {
|
||||||
PGInspectorTestAPI *api=[PGInspectorTestAPI new];beatygrilPlugIn *plugin=[[beatygrilPlugIn alloc]initWithAPIManager:api];[plugin addParametersWithError:nil];
|
PGInspectorTestAPI *api=[PGInspectorTestAPI new];beatygrilPlugIn *plugin=[[beatygrilPlugIn alloc]initWithAPIManager:api];[plugin addParametersWithError:nil];
|
||||||
api.values[@(PGMidtone)]=@.5;
|
api.values[@(PGMidtone)]=@.5;
|
||||||
@@ -219,24 +296,45 @@ static void ContinuousPreviewTests(void) {
|
|||||||
PGInspectorTestAPI *api=[PGInspectorTestAPI new];beatygrilPlugIn *plugin=[[beatygrilPlugIn alloc]initWithAPIManager:api];[plugin addParametersWithError:nil];
|
PGInspectorTestAPI *api=[PGInspectorTestAPI new];beatygrilPlugIn *plugin=[[beatygrilPlugIn alloc]initWithAPIManager:api];[plugin addParametersWithError:nil];
|
||||||
api.parameterAPIsRequireAction=YES;api.actionRequiresView=YES;
|
api.parameterAPIsRequireAction=YES;api.actionRequiresView=YES;
|
||||||
PGInspectorView *view=(PGInspectorView *)[plugin createViewForParameterID:PGInspectorPanel];[view refreshFromHost];
|
PGInspectorView *view=(PGInspectorView *)[plugin createViewForParameterID:PGInspectorPanel];[view refreshFromHost];
|
||||||
NSSlider *slider=(NSSlider *)FindControl(view,NSSlider.class,@"短脸");
|
NSArray *names=@[@"短脸",@"五官保护",@"非肤色区保护",@"微细锐化"],*ids=@[@(PGShort),@(PGFeatureProtectionAmount),@(PGNonSkinProtection),@(PGMicroDetail)];
|
||||||
|
for(NSUInteger i=0;i<names.count;i++) {
|
||||||
|
UInt32 key=[ids[i]unsignedIntValue];NSSlider *slider=(NSSlider *)FindControl(view,NSSlider.class,names[i]);
|
||||||
void (^began)(void)=[slider valueForKey:@"interactionBegan"], (^ended)(void)=[slider valueForKey:@"interactionEnded"];
|
void (^began)(void)=[slider valueForKey:@"interactionBegan"], (^ended)(void)=[slider valueForKey:@"interactionEnded"];
|
||||||
Check(slider.continuous && began && ended,@"native slider emits continuous events and exposes balanced gesture callbacks");
|
Check(slider.continuous && began && ended,@"native slider emits continuous events and exposes balanced gesture callbacks");
|
||||||
began();
|
began();
|
||||||
for(NSNumber *value in @[@.2,@.5,@1]) {
|
for(NSNumber *value in @[@.2,@.5,@1]) {
|
||||||
NSUInteger publications=api.previewPublications;slider.doubleValue=value.doubleValue;Fire(slider);
|
NSUInteger publications=api.previewPublications;slider.doubleValue=value.doubleValue;Fire(slider);
|
||||||
PGInspectorState *visible=api.previewValues[@(PGInspectorPanel)];
|
PGInspectorState *visible=api.previewValues[@(PGInspectorPanel)];
|
||||||
Check(api.actionDepth==0 && api.previewPublications==publications+1 && Near([visible valueForParameter:PGShort],value.doubleValue),@"every drag step publishes a completed host snapshot before mouse-up");
|
Check(api.actionDepth==0 && api.previewPublications==publications+1 && Near([visible valueForParameter:key],value.doubleValue),@"every old and new slider step publishes a completed host snapshot before mouse-up");
|
||||||
Check(visible && Near(PGSettingsWithInspectorState(PGBeautyDefaults(),visible).faceShort,value.doubleValue),@"published frame settings contain each intermediate short-face value while gesture is still open");
|
PGBeautySettings s=PGSettingsWithInspectorState(PGBeautyDefaults(),visible);
|
||||||
|
double actual=key==PGShort?s.faceShort:key==PGFeatureProtectionAmount?s.featureProtectionAmount:key==PGNonSkinProtection?s.nonSkinProtection:s.microDetail;
|
||||||
|
Check(visible && Near(actual,value.doubleValue),@"published frame settings contain each intermediate new protection/detail value while gesture is still open");
|
||||||
}
|
}
|
||||||
NSUInteger publications=api.previewPublications;Fire(slider);
|
NSUInteger publications=api.previewPublications;Fire(slider);
|
||||||
Check(api.previewPublications==publications,@"unchanged drag events do not enqueue redundant previews");
|
Check(api.previewPublications==publications,@"unchanged drag events do not enqueue redundant previews");
|
||||||
ended();
|
ended();
|
||||||
|
}
|
||||||
Check(api.actionDepth==0 && api.actionStarts==api.actionEnds && api.accessViolations==0 && api.invalidActionSenders==0,@"step-wise publication preserves action-scoped APIs and the actual view sender");
|
Check(api.actionDepth==0 && api.actionStarts==api.actionEnds && api.accessViolations==0 && api.invalidActionSenders==0,@"step-wise publication preserves action-scoped APIs and the actual view sender");
|
||||||
}
|
}
|
||||||
|
static void OptionalInspectorPreview(void) {
|
||||||
|
NSString *path=NSProcessInfo.processInfo.environment[@"PAINTFCP_INSPECTOR_PNG"];
|
||||||
|
if(!path.length)return;
|
||||||
|
PGHostAPI *api=[PGHostAPI new];beatygrilPlugIn *plugin=[[beatygrilPlugIn alloc]initWithAPIManager:api];[plugin addParametersWithError:nil];
|
||||||
|
api.values[@(PGMidtone)]=@.4;
|
||||||
|
PGInspectorView *view=(PGInspectorView *)[plugin createViewForParameterID:PGInspectorPanel];[view refreshFromHost];
|
||||||
|
[view setFrameSize:NSMakeSize(380,20)];
|
||||||
|
NSWindow *window=[[NSWindow alloc]initWithContentRect:view.bounds styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO];
|
||||||
|
window.releasedWhenClosed=NO;window.appearance=[NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];window.contentView=view;
|
||||||
|
[window setContentSize:view.frame.size];[view layoutSubtreeIfNeeded];[window displayIfNeeded];
|
||||||
|
NSBitmapImageRep *bitmap=[view bitmapImageRepForCachingDisplayInRect:view.bounds];
|
||||||
|
[view cacheDisplayInRect:view.bounds toBitmapImageRep:bitmap];
|
||||||
|
NSData *png=[bitmap representationUsingType:NSBitmapImageFileTypePNG properties:@{}];
|
||||||
|
Check(png.length>0 && [png writeToFile:path atomically:YES],@"optional offscreen inspector PNG is written to the requested review path");
|
||||||
|
[window close];
|
||||||
|
}
|
||||||
int main(int argc,const char **argv) {@autoreleasepool {
|
int main(int argc,const char **argv) {@autoreleasepool {
|
||||||
[NSApplication sharedApplication];[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
|
[NSApplication sharedApplication];[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
|
||||||
RegistrationTests();ModelTests();ControllerTests();ViewInteractionTests();HostHandshakeTests();ContinuousPreviewTests();
|
RegistrationTests();ModelTests();BeautyControlModelTests();ControllerTests();ViewInteractionTests();BeautyControlInteractionTests();HostHandshakeTests();ContinuousPreviewTests();OptionalInspectorPreview();
|
||||||
if(argc>2) {
|
if(argc>2) {
|
||||||
NSData *inner=[NSData dataWithContentsOfFile:@(argv[1])],*outer=[NSData dataWithContentsOfFile:@(argv[2])];NSError *error=nil;
|
NSData *inner=[NSData dataWithContentsOfFile:@(argv[1])],*outer=[NSData dataWithContentsOfFile:@(argv[2])];NSError *error=nil;
|
||||||
NSKeyedUnarchiver *reader=[[NSKeyedUnarchiver alloc]initForReadingFromData:inner error:&error];reader.requiresSecureCoding=YES;
|
NSKeyedUnarchiver *reader=[[NSKeyedUnarchiver alloc]initForReadingFromData:inner error:&error];reader.requiresSecureCoding=YES;
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户