test: record real host acceptance and exact CF trajectory comparison for build 78

这个提交包含在:
mac 于 2026-11-05 12:12:54 +08:00 提交
1 父节点 8bbd386abb
当前提交 16b20af39a
13 个文件已更改
+16305 -3

没有与搜索条件相匹配的文件

+16
查看文件
@@ -0,0 +1,16 @@
# 实际轨迹对照
`read_colorfinale_fcpxml.py`只读解析FCP导出的参数55,按确定的BlindDataObject读取内部归档,不实例化原版类、不跟随外部媒体、不把模板默认值当轨迹。`compare_tracks.py`读取该输出或`read_colorfinale_preset.py`输出,并对照大鱼v7作者蒙版。只比较精确CMTime键,缺键直接报告;必须明确单位、坐标方向、基准尺寸、时间偏移、视频SHA及预先选定阈值。
CF参数type0为静态值加轨迹键,type1为静态值乘轨迹键;FTKeyFrame.type是另一个枚举。其坐标为Y向上、弧度正向逆时针。依据见`research/ColorFinaleTrackSemantics78.json`。代码中不含原版可执行代码或模板。
`fixtures/host78`是本软件合成QA视频上实际宿主输出的几何数据,原始CF99帧、大鱼100帧。Dayu保留原tools字节,只移除无关预设字段;CF保留原始静态值和相对键,不拟合或预先转符号。FCP项目、时间线和媒体留在本机,未加入远程仓库;视频生成条件见`tools/create_workspace_host_fixture.py`,精确视频SHA记录在校准文件中。重新编码后的容器SHA可能不同,不能擅自修改校准绕过检查。
```sh
python3 tools/tracking/compare_tracks.py --self-test /tmp/dayu-track-comparator
python3 tools/tracking/compare_tracks.py --cf tools/tracking/fixtures/host78/cf-geometry.json --dayu tools/tracking/fixtures/host78/dayu-geometry-v7.json --calibration tools/tracking/fixtures/host78/real-calibration-overlap99.json --video '/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/大鱼调色_蒙版合成运动.mov' --cf-mask-id b842b22d-b5c3-4d4d-826c-c8b90a57a4b4 --dayu-mask-id 47D9F164-E13E-4FCB-9765-AC41826799C8 --output /tmp/dayu-real-track-report.json
```
共同99帧报告通过。使用`real-calibration-100.json`会退出2并报告原版缺失最后一帧;这是预期诚实结果,不是允许忽略的错误。完整报告`verification/HostTracking78-99.json`及`HostTracking78-100.json`保留原始输入SHA和所有样本。误差以960×540源像素计,宿主实际分析1920×1080,禁止混称。
当前证据只覆盖默认未分组矩形和单段合成平移,不能证明任意旋转缩放、遮挡、分组、镜像metadata、非方形像素、非零extent或键间插值完全一致。
+368
查看文件
@@ -0,0 +1,368 @@
#!/usr/bin/env python3
"""Compare explicit CF-reader JSON and Dayu v7 preset tracks, without class loading.
Only exact authored keys are compared. Missing keys are reported, never filled
by interpolation/extrapolation or nearest-frame matching. Calibration is explicit.
"""
import argparse
import base64
import csv
from fractions import Fraction
import hashlib
import json
import math
from pathlib import Path
import plistlib
import struct
import sys
MAX_JSON = 128 * 1024 * 1024
MAX_TOOLS = 24 * 1024 * 1024
def sha256(path):
digest = hashlib.sha256()
with Path(path).open('rb') as stream:
for block in iter(lambda: stream.read(1024 * 1024), b''):
digest.update(block)
return digest.hexdigest()
def read_json(path):
if Path(path).stat().st_size > MAX_JSON:
raise ValueError('JSON input exceeds limit')
return json.loads(Path(path).read_text(), parse_constant=lambda s: (_ for _ in ()).throw(ValueError(s)))
def rational(value):
if not isinstance(value, str):
raise ValueError('Times and offsets must be explicit rational strings, e.g. 1001/24000')
return Fraction(value)
def authored_time(value, scale, epoch):
if not all(isinstance(x, int) and not isinstance(x, bool) for x in (value, scale, epoch)) or scale <= 0:
raise ValueError('Invalid integer CMTime fields')
return epoch, Fraction(value, scale)
def decode_parameters(data):
if not isinstance(data, bytes) or len(data) != 128:
raise ValueError('Dayu mask parameters must match the verified 128-byte ABI')
version, kind, source, flags, *floats = struct.unpack('<4I28f', data)
if version not in (1, 2) or kind not in (0, 1, 2) or not all(math.isfinite(x) for x in floats):
raise ValueError('Unsupported/nonfinite tracked Dayu geometry')
if floats[2] <= 0 or floats[3] <= 0:
raise ValueError('Nonpositive Dayu mask size')
return dict(center=floats[:2], size=floats[2:4], radians=floats[4], kind=kind,
imageAspect=floats[8], version=version, sourceStage=source, flags=flags)
def read_dayu(path, mask_id):
preset = read_json(path)
if preset.get('format') != 'com.dayu.color.preset' or preset.get('version') != 7:
raise ValueError('An explicit full Dayu v7 JSON preset is required')
encoded = preset.get('tools')
if not isinstance(encoded, str) or len(encoded) > (MAX_TOOLS * 4 // 3 + 8):
raise ValueError('Invalid/oversized Dayu author document')
data = base64.b64decode(encoded, validate=True)
if len(data) > MAX_TOOLS:
raise ValueError('Dayu author document exceeds limit')
document = plistlib.loads(data)
if document.get('schema') not in (1, 2, 3):
raise ValueError('Unsupported Dayu author schema')
objects = list(document.get('sharedMasks', []))
bindings = []
for kind, masks in document.get('baseMasks', {}).items():
for mask in masks:
if mask.get('sharedID') == mask_id or mask.get('id') == mask_id:
bindings.append('base:' + kind)
if 'sharedID' not in mask:
objects.append(mask)
for node in document.get('layers', []):
for mask in node.get('masks', []):
if mask.get('sharedID') == mask_id or mask.get('id') == mask_id:
bindings.append(node['id'])
if 'sharedID' not in mask:
objects.append(mask)
selected = [mask for mask in objects if mask.get('id') == mask_id]
if len(selected) != 1:
raise ValueError('Dayu mask ID must select one unique author object')
mask = selected[0]
static = decode_parameters(mask['parameters'])
keys = {}
previous = None
for key in mask.get('keys', []):
time = authored_time(key['value'], key['scale'], key['epoch'])
if time in keys or (previous and (time[0] != previous[0] or time[1] <= previous[1])):
raise ValueError('Dayu keys must have one epoch, strict time order, and no duplicates')
geometry = decode_parameters(key['parameters'])
if geometry['kind'] != static['kind']:
raise ValueError('Dayu keyed mask kind changed')
geometry.update(manual=bool(key['manual']), confidence=float(key['confidence']))
if not math.isfinite(geometry['confidence']) or not 0 <= geometry['confidence'] <= 1:
raise ValueError('Invalid Dayu confidence')
keys[time] = geometry
previous = time
return dict(maskID=mask_id, bindings=bindings, static=static, keys=keys,
shared=any(m.get('id') == mask_id for m in document.get('sharedMasks', [])),
status=mask.get('status'), documentSchema=document['schema'])
def vector(value, count):
if not isinstance(value, list) or len(value) != count or not all(isinstance(v, (int, float)) and math.isfinite(v) for v in value):
raise ValueError('Unexpected CF vector dimension/nonfinite value')
return list(map(float, value))
def read_cf(path, version_index, mask_id):
source = read_json(path)
versions = ([v for v in source['versions'] if v.get('index') == version_index] if 'versions' in source
else [v for i, v in enumerate(source.get('candidates', [])) if i == version_index])
if len(versions) != 1:
raise ValueError('CF version index must select one reader output version')
version = versions[0]
masks = [m for m in version.get('masks', []) if m.get('id') == mask_id]
if len(masks) != 1:
raise ValueError('CF mask ID must select exactly one reader output shape')
channels = {}
for name, count in [('position', 2), ('rotation', 1), ('scale', 2)]:
parameter = masks[0][name]
static = vector(parameter['staticValue'], count)
keys = {}
for key in parameter['keys']:
t = key['time']
time = authored_time(t['value'], t['timescale'], t['epoch'])
if time in keys:
raise ValueError('Duplicate CF property key time')
keys[time] = vector(key['value'], count)
channels[name] = dict(static=static, keys=keys, parameterType=parameter.get('type'))
return dict(maskID=mask_id, channels=channels, sceneID=version.get('sceneID'),
aspectRatio=version.get('aspectRatio'), archiveSHA256=version.get('archiveSHA256'),
readerInputSHA256=source.get('inputSHA256'), readerScope=source.get('scope'))
def verify_calibration(config, video):
if config.get('calibration_confirmed') is not True:
raise ValueError('Calibration is unconfirmed: observe units/origin/time/seed before comparison')
if config.get('evidence_scope') not in ('generated', 'real_exports'):
raise ValueError('Declare whether inputs are generated samples or real exports')
required = ('same_video_and_range_evidence', 'same_seed_shape_evidence', 'time_mapping_evidence',
'position_unit_origin_evidence', 'rotation_unit_direction_evidence', 'size_mapping_evidence')
for name in required:
if not isinstance(config.get(name), str) or not config[name].strip():
raise ValueError('Missing observed calibration evidence: ' + name)
composition = config.get('cf_key_composition')
if composition not in ('absolute', 'animated_parameter'):
raise ValueError('Explicit CF key composition is required')
if config['evidence_scope'] == 'real_exports' and composition != 'animated_parameter':
raise ValueError('Raw real CF exports require verified animated-parameter composition')
metadata = config['video']
if sha256(video) != metadata['sha256']:
raise ValueError('Comparison video SHA-256 does not match the declared shared source')
if metadata.get('pixel_aspect') != '1/1':
raise ValueError('This comparator requires observed square pixels; non-square mapping is not established')
for dimension in ('width', 'height'):
if not isinstance(metadata[dimension], int) or metadata[dimension] <= 0:
raise ValueError('Invalid comparison video dimensions')
if config['cf_position']['units'] not in ('normalized', 'pixels') or config['cf_position']['origin'] not in ('top_left', 'bottom_left'):
raise ValueError('Explicit supported CF position units/origin are required')
if config['cf_rotation']['units'] not in ('radians', 'degrees') or config['cf_rotation']['positive_direction'] not in ('clockwise', 'counterclockwise'):
raise ValueError('Explicit supported CF rotation units/direction are required')
if config['cf_size']['mode'] not in ('normalized_dimensions', 'pixel_dimensions', 'reference_relative_scale'):
raise ValueError('Explicit CF local-axis size mapping is required')
frame = config['grid']
if not isinstance(frame['count'], int) or not 1 <= frame['count'] <= 100000 or rational(frame['step']) <= 0:
raise ValueError('Invalid expected frame grid')
for threshold in ('center_px', 'rotation_degrees', 'width_px', 'height_px'):
value = config['thresholds'][threshold]
if not isinstance(value, (int, float)) or not math.isfinite(value) or value < 0:
raise ValueError('Explicit finite comparison thresholds are required')
def cf_value(channel, time, composition):
if not channel['keys']:
return channel['static']
value = channel['keys'].get(time)
if value is None or composition == 'absolute':
return value
mode = channel['parameterType']
if mode not in (0, 1):
raise ValueError('Unverified CF animated-parameter type')
return [a+b if mode == 0 else a*b for a,b in zip(channel['static'], value)]
def summarize(values):
return None if not values else dict(count=len(values), maximum=max(values),
rms=math.sqrt(sum(x*x for x in values)/len(values)))
def compare(cf, dayu, config):
width, height = config['video']['width'], config['video']['height']
grid = config['grid'];start, step = rational(grid['start']), rational(grid['step'])
offset = rational(config['time']['cf_to_dayu_offset'])
cf_epoch, dayu_epoch = config['time']['cf_epoch'], config['time']['dayu_epoch']
samples = []
composition = config['cf_key_composition']
size = config['cf_size']
reference_scale = None
if size['mode'] == 'reference_relative_scale':
reference_time = rational(size['reference_time_dayu'])
reference_scale = cf_value(cf['channels']['scale'], (cf_epoch, reference_time-offset), composition)
if reference_scale is None or min(reference_scale) <= 0:
raise ValueError('CF scale has no exact valid reference-time sample')
if min(size['reference_local_width_normalized'], size['reference_local_height_normalized']) <= 0:
raise ValueError('Observed unrotated reference local-axis dimensions must be positive')
for frame in range(grid['count']):
t = start + frame*step
source_time = (cf_epoch, t-offset)
raw = {name: cf_value(channel, source_time, composition) for name, channel in cf['channels'].items()}
current = dayu['keys'].get((dayu_epoch, t))
missing = ['cf.' + name for name, value in raw.items() if value is None]
if current is None:
missing.append('dayu.authored_key')
sample = dict(frame=frame, time=f'{t.numerator}/{t.denominator}', epoch=dayu_epoch,
cfTime=f'{(t-offset).numerator}/{(t-offset).denominator}', missing=missing)
if not missing:
center = list(raw['position'])
if config['cf_position']['units'] == 'pixels':
center = [center[0]/width, center[1]/height]
if config['cf_position']['origin'] == 'bottom_left':
center[1] = 1-center[1]
angle = raw['rotation'][0]
if config['cf_rotation']['units'] == 'degrees':
angle = math.radians(angle)
if config['cf_rotation']['positive_direction'] == 'counterclockwise':
angle = -angle
dimensions = list(raw['scale'])
if min(dimensions) <= 0:
raise ValueError('Negative/reflected CF scale requires a verified shape transform mapping')
if size['mode'] == 'pixel_dimensions':
dimensions = [dimensions[0]/width, dimensions[1]/height]
elif reference_scale:
dimensions = [size['reference_local_width_normalized']*dimensions[0]/reference_scale[0],
size['reference_local_height_normalized']*dimensions[1]/reference_scale[1]]
delta = current['radians']-angle
errors = dict(center_px=math.hypot((current['center'][0]-center[0])*width,
(current['center'][1]-center[1])*height),
rotation_degrees=abs(math.degrees(math.atan2(math.sin(delta), math.cos(delta)))),
rotation_unwrapped_degrees=abs(math.degrees(delta)),
width_px=abs(current['size'][0]-dimensions[0])*width,
height_px=abs(current['size'][1]-dimensions[1])*height)
sample.update(cfRaw=raw, cfCanonical=dict(center=center, size=dimensions, radians=angle),
dayu=current, errors=errors,
exceeds=[name for name, threshold in config['thresholds'].items() if errors[name] > threshold])
samples.append(sample)
matched = [s for s in samples if not s['missing']]
manual = [s['frame'] for s in matched if s['dayu']['manual'] and rational(s['time']) != start]
failed = [s for s in matched if s['exceeds']]
missing = [s for s in samples if s['missing']]
all_names = ('center_px', 'rotation_degrees', 'rotation_unwrapped_degrees', 'width_px', 'height_px')
passed = not missing and not failed and not manual
return dict(status='pass' if passed else 'fail', evidenceScope=config.get('evidence_scope'),
originalRuntimeEquivalenceEstablished=False,
selectedTrajectoryNumericAgreementWithinThreshold=passed,
realExportsCompared=config.get('evidence_scope') == 'real_exports',
expectedFrames=len(samples), matchedFrames=len(matched), missingFrames=len(missing),
firstMissing=missing[0] if missing else None,
firstThresholdFailure=failed[0] if failed else None,
interiorManualKeyFrames=manual,
metrics={name:summarize([s['errors'][name] for s in matched]) for name in all_names},
thresholds=config['thresholds'],
note='Exact authored keys only. Missing keys may be loss or export omission; inspect runtime to distinguish. '
'A matching numeric report does not establish matching render pixels or arbitrary-footage equivalence.',
cf={k:v for k,v in cf.items() if k != 'channels'},
dayu={k:v for k,v in dayu.items() if k not in ('keys', 'static')},
calibration=config, samples=samples)
def self_test(directory):
directory.mkdir(parents=True, exist_ok=True)
video = directory/'generated-source.bin';video.write_bytes(b'GENERATED TEST DATA, NOT ACTUAL QA VIDEO\n')
mask_id = 'f072709b-9cca-4ad3-b5a1-e930862ea322'
cf_id = 'c1014285-bd83-4c12-b099-d1bd28c45f70'
def packed(x, y, w, h, angle):
values = [x,y,w,h,angle,0,1,.3,16/9,0,0,1/12,1/24,.002,.02,0,1,0,0,0,1,0,0,0,1,1,0,1]
return struct.pack('<4I28f', 1,1,0,0,*values)
times = [Fraction(i*1001,24000) for i in range(4)]
cf_channels = {name:dict(staticValue=value,keys=[]) for name,value in
[('position',[.2,.7]),('rotation',[0]),('scale',[2,3])]}
keys=[]
for i,t in enumerate(times):
x,y,w,h,angle=.2+i*.03,.3+i*.02,.4*(1+i*.1),.5*(1+i*.05),i*.04
keys.append(dict(value=t.numerator,scale=t.denominator,epoch=0,parameters=packed(x,y,w,h,angle),manual=i==0,confidence=.95))
for name,value in [('position',[x,1-y]),('rotation',[-math.degrees(angle)]),('scale',[2*(1+i*.1),3*(1+i*.05)])]:
# Same rational time encoded at a different CMTime timescale; CF has a +2s source origin.
ct=t+2
cf_channels[name]['keys'].append(dict(time=dict(value=ct.numerator*2,timescale=ct.denominator*2,epoch=0),value=value))
mask=dict(id=mask_id,enabled=True,combine=0,parameters=packed(.2,.3,.4,.5,0),nodes=b'',keys=keys)
doc=dict(schema=3,layers=[],baseMasks=dict(hsl=[dict(sharedID=mask_id)],spider=[dict(sharedID=mask_id)]),sharedMasks=[mask])
preset=dict(format='com.dayu.color.preset',version=7,tools=base64.b64encode(plistlib.dumps(doc,fmt=plistlib.FMT_BINARY)).decode())
cf_json=dict(versions=[dict(index=0,sceneID='generated-scene',aspectRatio=16/9,masks=[dict(id=cf_id,**cf_channels)])])
config=dict(calibration_confirmed=True,evidence_scope='generated',cf_key_composition='absolute',video=dict(sha256=sha256(video),width=1920,height=1080,pixel_aspect='1/1'),
time=dict(cf_to_dayu_offset='-2/1',cf_epoch=0,dayu_epoch=0),grid=dict(start='0/1',step='1001/24000',count=4),
cf_position=dict(units='normalized',origin='bottom_left'),cf_rotation=dict(units='degrees',positive_direction='counterclockwise'),
cf_size=dict(mode='reference_relative_scale',reference_time_dayu='0/1',reference_local_width_normalized=.4,reference_local_height_normalized=.5),
thresholds=dict(center_px=.001,rotation_degrees=.001,width_px=.001,height_px=.001))
for name in ('same_video_and_range_evidence','same_seed_shape_evidence','time_mapping_evidence','position_unit_origin_evidence','rotation_unit_direction_evidence','size_mapping_evidence'):
config[name]='Generated fixture construction only; no vendor runtime was observed.'
cf_path=directory/'generated-cf-reader-output.json';cf_path.write_text(json.dumps(cf_json,indent=2))
dy_path=directory/'generated-dayu-v7-preset.json';dy_path.write_text(json.dumps(preset,indent=2))
cfg_path=directory/'generated-confirmed-calibration.json';cfg_path.write_text(json.dumps(config,indent=2))
verify_calibration(config,video);cf=read_cf(cf_path,0,cf_id);dy=read_dayu(dy_path,mask_id);report=compare(cf,dy,config)
assert report['status']=='pass' and report['matchedFrames']==4 and not report['originalRuntimeEquivalenceEstablished']
assert dy['shared'] and len(dy['bindings'])==2
(directory/'generated-pass-report.json').write_text(json.dumps(report,indent=2))
del cf['channels']['position']['keys'][(0,times[2]+2)]
missing=compare(cf,dy,config);assert missing['status']=='fail' and missing['missingFrames']==1 and missing['firstMissing']['frame']==2
(directory/'generated-missing-frame-report.json').write_text(json.dumps(missing,indent=2))
cf=read_cf(cf_path,0,cf_id);dy['keys'][(0,times[1])]['center'][0]+=.01
mismatch=compare(cf,dy,config);assert mismatch['status']=='fail' and mismatch['firstThresholdFailure']['frame']==1 and mismatch['metrics']['center_px']['maximum']>19
(directory/'generated-mismatch-report.json').write_text(json.dumps(mismatch,indent=2))
rejected=0
unconfirmed=dict(config,calibration_confirmed=False)
try:verify_calibration(unconfirmed,video)
except ValueError:rejected+=1
bad=dict(preset,tools=base64.b64encode(plistlib.dumps(dict(schema=3,layers=[],baseMasks={},sharedMasks=[dict(mask,parameters=b'bad')]),fmt=plistlib.FMT_BINARY)).decode())
bad_path=directory/'generated-invalid-dayu.json';bad_path.write_text(json.dumps(bad))
try:read_dayu(bad_path,mask_id)
except ValueError:rejected+=1
assert rejected==2
assert cf_value(dict(static=[.5,.5],keys={(0,Fraction(0)):[.1,-.2]},parameterType=0),(0,Fraction(0)),'animated_parameter') == [.6,.3]
assert cf_value(dict(static=[2,3],keys={(0,Fraction(0)):[.5,2]},parameterType=1),(0,Fraction(0)),'animated_parameter') == [1,6]
result=dict(pass_=True,scope='Generated samples only; no CF export, real video tracking, FCP or preferences accessed.',
checks=['128-byte-Dayu-ABI-and-unique-shared-bindings','exact-NTSC-CMTime-with-different-timescales-and-source-offset',
'explicit-bottom-origin-and-degree-direction-conversion','relative-two-axis-size-calibration',
'no-interpolation-on-missing-authored-frame','numeric-mismatch-detection','unconfirmed-calibration-rejected','malformed-ABI-rejected','type0-additive-key-composition','type1-multiplicative-key-composition'])
(directory/'self-test.json').write_text(json.dumps(result,indent=2));print(json.dumps(result))
def main():
parser=argparse.ArgumentParser(description=__doc__)
for name in ('cf','dayu','calibration','video','output','csv'):
parser.add_argument('--'+name,type=Path)
parser.add_argument('--cf-version-index',type=int,default=0);parser.add_argument('--cf-mask-id');parser.add_argument('--dayu-mask-id')
parser.add_argument('--self-test',type=Path,metavar='GENERATED_FIXTURE_DIRECTORY')
args=parser.parse_args()
if args.self_test:self_test(args.self_test);return
if not all((args.cf,args.dayu,args.calibration,args.video,args.output,args.cf_mask_id,args.dayu_mask_id)):
parser.error('explicit CF JSON, Dayu preset, calibration, video, selected mask IDs and output are required')
config=read_json(args.calibration);verify_calibration(config,args.video)
report=compare(read_cf(args.cf,args.cf_version_index,args.cf_mask_id),read_dayu(args.dayu,args.dayu_mask_id),config)
report['inputs']={name:dict(path=str(path.resolve()),sha256=sha256(path)) for name,path in
[('cfReaderJSON',args.cf),('dayuPreset',args.dayu),('calibration',args.calibration),('video',args.video)]}
args.output.write_text(json.dumps(report,ensure_ascii=False,indent=2,allow_nan=False)+'\n')
if args.csv:
fields=['frame','time','epoch','cfTime','missing','exceeds','center_px','rotation_degrees','rotation_unwrapped_degrees','width_px','height_px']
with args.csv.open('w',newline='') as stream:
writer=csv.DictWriter(stream,fields);writer.writeheader()
for sample in report['samples']:
row={name:sample.get(name,'') for name in fields};row.update(sample.get('errors',{}));row['missing']=';'.join(sample['missing']);row['exceeds']=';'.join(sample.get('exceeds',[]));writer.writerow(row)
print(json.dumps({k:report[k] for k in ('status','evidenceScope','expectedFrames','matchedFrames','missingFrames','metrics')}))
if report['status']!='pass':sys.exit(2)
if __name__=='__main__':
try:main()
except (ValueError,KeyError,TypeError,IndexError,OSError,plistlib.InvalidFileException) as error:
print('Comparison refused: '+str(error),file=sys.stderr);sys.exit(1)
文件差异过大,未显示。 加载差异
@@ -0,0 +1,6 @@
{
"format": "com.dayu.color.preset",
"version": 7,
"tools": "YnBsaXN0MDDUAAEAAgADAAQABQALAAwBzlliYXNlTWFza3NWc2NoZW1hW3NoYXJlZE1hc2tzVmxheWVyc9EABgAHU2hzbKEACNEACQAKWHNoYXJlZElEXxAkNDdE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A/AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAgD8AAIA/AAAAAAAAgD8QEQjWABQAGAAZABoAGwAcAGoAawAfAG0AHgAhTxCAAQAAAAEAAAAAAAAAAAAAAE3N/D6tNPw+8szMPQHMzD3MiLO4AAAAAAAAgD+amZk+AACAPwAAAAAAAAAAq6qqPauqKj1vEgM7CtejPAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAgD8AAIA/AAAAAAAAgD8QEggiP31w/dYAFAAYABkAGgAbABwAbwBwAB8AcgAeACFPEIABAAAAAQAAAAAAAAAAAAAA5rv7Ptw0/D7Wx8w9EszMPWr7nbgAAAAAAACAP5qZmT4AAIA/AAAAAAAAAACrqqo9q6oqPW8SAzsK16M8AAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAgD8AAAAAAACAPxATCCI/ffxP1gAUABgAGQAaABsAHAB0AHUAHwAgAB4AIU8QgAEAAAABAAAAAAAAAAALine truncated
"sourcePresetSHA256": "6d5ca8469f487ec73103c436ed0c0514940ca7837807e617355fdd41587fed5a"
}
@@ -0,0 +1,49 @@
{
"calibration_confirmed": true,
"evidence_scope": "real_exports",
"video": {
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/大鱼调色_蒙版合成运动.mov",
"sha256": "2cf7368ade39eb064593afc098661d348e83dd0cd3f8ab5d9b9826aa7870b6e7",
"width": 960,
"height": 540,
"pixel_aspect": "1/1"
},
"grid": {
"start": "0/1",
"step": "1/25",
"count": 100
},
"time": {
"cf_to_dayu_offset": "0/1",
"cf_epoch": 0,
"dayu_epoch": 0
},
"cf_position": {
"units": "normalized",
"origin": "bottom_left"
},
"cf_rotation": {
"units": "radians",
"positive_direction": "counterclockwise"
},
"cf_size": {
"mode": "reference_relative_scale",
"reference_time_dayu": "0/1",
"reference_local_width_normalized": 0.1,
"reference_local_height_normalized": 0.1
},
"thresholds": {
"center_px": 1,
"rotation_degrees": 0.1,
"width_px": 1,
"height_px": 1
},
"same_video_and_range_evidence": "FCP QA projects reference identical 960x540,25fps,100-frame MOV SHA256 listed here, 4s clips from source zero. Dayu actual analyzer logs 1920x1080; errors below use original source pixels.",
"same_seed_shape_evidence": "Both native host UIs created ungrouped rectangle center(.5,.5), full width .1,height .1,scale(1,1),rotation0 at source0. Dayu authored floats differ only by float32 quantization. Mask IDs are explicit CLI arguments.",
"time_mapping_evidence": "Both actual exports carry epoch0 source time keys beginning0, step1/25, clipoffset0. CF ends98/25; Dayu ends99/25. No interpolation, retiming, nearest-key or fitted offset.",
"position_unit_origin_evidence": "GradeKit arm64 SHA e868a8c6df64bf03b7c24af5657c5ac7a2259a1943dfe06e01dbb7881df018a3: init0x21f48,convertObjectPoint0x2210c,renderMaskForShape0x24174 establish normalized Y-up; parameter type0 uses static+raw at0x2ff68/0x30010. Canonical y=1-yCF.",
"rotation_unit_direction_evidence": "GradeKit renderMaskForShape0x24174 passes evaluated scalar directly to CGAffineTransformRotate; installed SDK contract radians positive CCW. Canonical Dayu top-left angle negates CF angle. No trajectory sign fitting.",
"size_mapping_evidence": "GradeKit FTTrackerRect.bounds0x74d7c,boundingPointsForExtent0x74de0: size(.1,.1) full frame fractions. Parameter type1 static*raw at0x30018. Reference scale(1,1), so dimensions .1*evaluatedScale. Zero-origin square-pixel ungrouped footage only.",
"note": "Thresholds set before first real comparison: center1sourcepixel,size1sourcepixel,rotation0.1degree. Full100-frame comparison intentionally reports original missing frame99; separate common99 comparison does not claim full-range or arbitrary-footage equivalence.",
"cf_key_composition": "animated_parameter"
}
@@ -0,0 +1,49 @@
{
"calibration_confirmed": true,
"evidence_scope": "real_exports",
"video": {
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/大鱼调色_蒙版合成运动.mov",
"sha256": "2cf7368ade39eb064593afc098661d348e83dd0cd3f8ab5d9b9826aa7870b6e7",
"width": 960,
"height": 540,
"pixel_aspect": "1/1"
},
"grid": {
"start": "0/1",
"step": "1/25",
"count": 99
},
"time": {
"cf_to_dayu_offset": "0/1",
"cf_epoch": 0,
"dayu_epoch": 0
},
"cf_position": {
"units": "normalized",
"origin": "bottom_left"
},
"cf_rotation": {
"units": "radians",
"positive_direction": "counterclockwise"
},
"cf_size": {
"mode": "reference_relative_scale",
"reference_time_dayu": "0/1",
"reference_local_width_normalized": 0.1,
"reference_local_height_normalized": 0.1
},
"thresholds": {
"center_px": 1,
"rotation_degrees": 0.1,
"width_px": 1,
"height_px": 1
},
"same_video_and_range_evidence": "FCP QA projects reference identical 960x540,25fps,100-frame MOV SHA256 listed here, 4s clips from source zero. Dayu actual analyzer logs 1920x1080; errors below use original source pixels.",
"same_seed_shape_evidence": "Both native host UIs created ungrouped rectangle center(.5,.5), full width .1,height .1,scale(1,1),rotation0 at source0. Dayu authored floats differ only by float32 quantization. Mask IDs are explicit CLI arguments.",
"time_mapping_evidence": "Both actual exports carry epoch0 source time keys beginning0, step1/25, clipoffset0. CF ends98/25; Dayu ends99/25. No interpolation, retiming, nearest-key or fitted offset.",
"position_unit_origin_evidence": "GradeKit arm64 SHA e868a8c6df64bf03b7c24af5657c5ac7a2259a1943dfe06e01dbb7881df018a3: init0x21f48,convertObjectPoint0x2210c,renderMaskForShape0x24174 establish normalized Y-up; parameter type0 uses static+raw at0x2ff68/0x30010. Canonical y=1-yCF.",
"rotation_unit_direction_evidence": "GradeKit renderMaskForShape0x24174 passes evaluated scalar directly to CGAffineTransformRotate; installed SDK contract radians positive CCW. Canonical Dayu top-left angle negates CF angle. No trajectory sign fitting.",
"size_mapping_evidence": "GradeKit FTTrackerRect.bounds0x74d7c,boundingPointsForExtent0x74de0: size(.1,.1) full frame fractions. Parameter type1 static*raw at0x30018. Reference scale(1,1), so dimensions .1*evaluatedScale. Zero-origin square-pixel ungrouped footage only.",
"note": "Thresholds set before first real comparison: center1sourcepixel,size1sourcepixel,rotation0.1degree. Full100-frame comparison intentionally reports original missing frame99; separate common99 comparison does not claim full-range or arbitrary-footage equivalence.",
"cf_key_composition": "animated_parameter"
}
+129
查看文件
@@ -0,0 +1,129 @@
#!/usr/bin/env python3
"""Extract CF parameter 55 from FCP-exported XML without loading vendor code.
Template defaults are reported as nil, never as tracking evidence. Only explicit
Motion custom-data carriers are decoded; external resources are not followed.
"""
from pathlib import Path
import argparse, base64, hashlib, json, plistlib, sys, urllib.parse
import xml.etree.ElementTree as ET
from read_colorfinale_preset import decode_archive, geometry, identifier
NATIVE='*-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
STANDARD='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
MAX_BYTES=128*1024*1024
def native_carrier(text):
text=''.join(text.split())
if not text or len(text)>MAX_BYTES*2 or any(c not in NATIVE for c in text):
raise ValueError('Unsupported Motion native-data text')
normal=text.translate(str.maketrans(NATIVE,STANDARD))
raw=base64.b64decode(normal+'='*((-len(normal))%4),validate=True)
if len(raw)<10:raise ValueError('Truncated Motion custom-data carrier')
count=int.from_bytes(raw[:8],'big')
if count>MAX_BYTES or raw[8]!=42 or len(raw)<9+count:
raise ValueError('Invalid Motion custom-data length/tag')
padding=raw[9+count:]
if len(padding)>3 or any(padding):raise ValueError('Unsupported Motion data trailer')
archive=raw[9:9+count]
if not archive.startswith((b'bplist',b'<?xml')):raise ValueError('Expected native keyed plist archive')
return archive,{'bytes':len(raw),'archiveBytes':count,'zeroTrailerBytes':len(padding)}
def root_object(archive):
obj=plistlib.loads(archive)
if not isinstance(obj,dict) or obj.get('$archiver')!='NSKeyedArchiver':
raise ValueError('Expected NSKeyedArchiver data')
table=obj.get('$objects',[]);top=obj.get('$top',{})
if not isinstance(table,list) or len(table)>200000:raise ValueError('Invalid keyed object table')
blind=top.get('BlindDataObject')
if blind is not None:
if not isinstance(blind,plistlib.UID) or blind.data>=len(table):raise ValueError('Invalid BlindDataObject UID')
data=table[blind.data]
legacy=top.get('DataIsLegacy');legacy=table[legacy.data] if isinstance(legacy,plistlib.UID) and legacy.data<len(table) else legacy
if data=='$null':return None,None,{'wrapper':'BlindDataObject','legacy':legacy}
if not isinstance(data,bytes):raise ValueError('BlindDataObject is not NSData bytes')
# No recursive scanning: the established blind-data field must itself
# contain the complete inner keyed archive.
if not data.startswith((b'bplist',b'<?xml')):
raise ValueError('BlindDataObject uses an unverified legacy/external format')
value=decode_archive(data)
return value,data,{'wrapper':'BlindDataObject','legacy':legacy}
ref=top.get('root',top.get('$0'))
if ref is None:raise ValueError('Unknown keyed archive root field')
if isinstance(ref,plistlib.UID) and ref.data==0:return None,None,{'wrapper':'direct-nil'}
return decode_archive(archive),archive,{'wrapper':'direct-object'}
def carrier_report(param,context,extract_dir=None,index=0):
if param.findtext('numberOfKeypoints','0').strip()!='0':raise ValueError('Animated custom carrier needs a real verified fixture')
value=param.findtext('dataValue')
if value is None:raise ValueError('No current dataValue; defaults are not substituted for actual state')
outer,metadata=native_carrier(value);scene,raw,wrapper=root_object(outer)
result=dict(context,parameterID=55,carrier=metadata,outerArchiveSHA256=hashlib.sha256(outer).hexdigest(),**wrapper)
if scene is None:return dict(result,status='nil',masks=[],keyCount=0)
if not isinstance(scene,dict) or scene.get('$class')!='FTTrackerScene':
raise ValueError('Parameter 55 did not decode to FTTrackerScene; got '+repr(scene.get('$class') if isinstance(scene,dict) else type(scene).__name__))
masks=geometry(scene);count=sum(len(m[p]['keys']) for m in masks for p in ('position','rotation','scale'))
result.update(status='scene',sceneID=identifier(scene.get('identifier')),aspectRatio=scene.get('aspectRatio'),
archiveSHA256=hashlib.sha256(raw).hexdigest(),masks=masks,keyCount=count)
if extract_dir:
extract_dir.mkdir(parents=True,exist_ok=True);dest=extract_dir/('cf-scene-'+str(index)+'.bplist')
if dest.exists() and dest.read_bytes()!=raw:raise ValueError('Refusing to replace a different extracted archive: '+str(dest))
if not dest.exists():dest.write_bytes(raw)
result['archivePath']=str(dest.resolve())
return result
def is_cf(effect):
text=' '.join(str(x) for x in effect.values())
text=urllib.parse.unquote(text).casefold();return 'colorfinale' in text or 'color finale' in text
def inspect(path,extract_dir=None):
if path.is_dir():path=path/'Info.fcpxml'
if path.stat().st_size>MAX_BYTES:raise ValueError('Input XML exceeds limit')
data=path.read_bytes();root=ET.fromstring(data)
output={'input':str(path.resolve()),'inputSHA256':hashlib.sha256(data).hexdigest(),
'sourceKind':root.tag,'scope':'Data-only extraction. Template defaults do not establish actual tracked host state.',
'candidates':[]}
if root.tag=='ozml':
# Installed templates store the parameter directly below their filter.
for f in root.iter('filter'):
for p in f.findall('parameter'):
if p.get('id')=='55':output['candidates'].append(carrier_report(p,{'templateFilter':f.attrib},extract_dir,len(output['candidates'])))
elif root.tag=='fcpxml':
effects={e.get('id'):e.attrib for e in root.findall('./resources/effect')}
parents={child:parent for parent in root.iter() for child in parent}
for f in root.iter('filter-video'):
effect=effects.get(f.get('ref'),{})
if not is_cf(effect):continue
context={};ancestor=parents.get(f)
while ancestor is not None:
if ancestor.tag in ('event','project'):context[ancestor.tag]=ancestor.attrib
elif ancestor.tag in ('asset-clip','clip','video') and 'clip' not in context:
context['clip']={'tag':ancestor.tag,**ancestor.attrib}
ancestor=parents.get(ancestor)
for p in f.findall('param'):
if p.get('key','').split('/')[-1]!='55':continue
text=p.get('value','');normal=''.join(text.split())
decoded=base64.b64decode(normal+'='*((-len(normal))%4),validate=True)
inner=ET.fromstring(decoded)
candidates=[x for x in inner.iter('parameter') if x.get('id')=='55']
if len(candidates)!=1:raise ValueError('Expected one ID55 parameter in FCP custom XML carrier')
output['candidates'].append(carrier_report(candidates[0],{
**context,'filter':f.attrib,'effect':effect,'fcpxmlParameter':p.attrib|{'value':'<opaque-value-omitted>'}},
extract_dir,len(output['candidates'])))
else:raise ValueError('Unsupported XML root; expected FCPXML or Motion ozml')
output['candidateCount']=len(output['candidates']);output['maskCount']=sum(len(x['masks']) for x in output['candidates'])
output['keyCount']=sum(x['keyCount'] for x in output['candidates'])
output['status']='extracted' if any(x['status']=='scene' for x in output['candidates']) else ('nil' if output['candidates'] else 'not-found')
return output
def main():
p=argparse.ArgumentParser(description=__doc__);p.add_argument('input',type=Path);p.add_argument('--output',type=Path);p.add_argument('--extract-dir',type=Path);a=p.parse_args()
result=inspect(a.input,a.extract_dir);text=json.dumps(result,ensure_ascii=False,indent=2,allow_nan=False)+'\n'
if a.output:a.output.write_text(text)
else:sys.stdout.write(text)
if __name__=='__main__':
try:main()
except (ValueError,TypeError,KeyError,IndexError,plistlib.InvalidFileException,ET.ParseError,OSError) as error:
print('Cannot extract verified CF XML scene: '+str(error),file=sys.stderr);sys.exit(1)