Support bounded 720x1280 avatar shapes through GLES and production gates
This commit is contained in:
@@ -13,6 +13,7 @@ import sys
|
||||
from PIL import Image
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
SUPPORTED_SHAPES={(480,848),(720,1280)}
|
||||
|
||||
def require(value,reason):
|
||||
if not value: raise ValueError(reason)
|
||||
@@ -49,7 +50,7 @@ def check_runtime(manifest_path, expected_sha, kotlin=True):
|
||||
decoded=json.loads(probe.stdout);streams=decoded['streams'];frames=decoded['frames']
|
||||
require(len(streams)==1 and streams[0]['codec_type']=='video' and body['hasAudio'] is False,'conversation must be silent video')
|
||||
stream=streams[0]
|
||||
require(stream['codec_name']=='h264' and (stream['width'],stream['height'])==(body['width'],body['height'])==(480,848),'codec/shape mismatch')
|
||||
require(stream['codec_name']=='h264' and (stream['width'],stream['height'])==(body['width'],body['height']) and (body['width'],body['height']) in (SUPPORTED_SHAPES if dynamic else {(480,848)}),'codec/shape mismatch')
|
||||
require(Fraction(stream['r_frame_rate'])==Fraction(body['fpsNumerator'],body['fpsDenominator']),'measured nominal fps mismatch')
|
||||
require(len(frames)==count,'decoded actual N mismatch')
|
||||
pts=[int((Decimal(frame['best_effort_timestamp_time'])*1_000_000).to_integral_value()) for frame in frames]
|
||||
@@ -65,6 +66,8 @@ def check_runtime(manifest_path, expected_sha, kotlin=True):
|
||||
if dynamic: require(patch['ptsUs']==expected[i],'schema2 exact patch PTS binding')
|
||||
width,height=patch['width'],patch['height']
|
||||
require(type(width) is int and type(height) is int and 1<=width<=128 and 1<=height<=128,'patch shape bound')
|
||||
require(all(isinstance(patch[k],(int,float)) and not isinstance(patch[k],bool) for k in ('x','y')) and
|
||||
0<=patch['x']<=body['width']-width and 0<=patch['y']<=body['height']-height,'patch pixel bounds')
|
||||
levels=patch['levels'] if aperture else [patch]
|
||||
require(len(levels)==(5 if aperture else 1),'five own levels required')
|
||||
for level in levels:
|
||||
@@ -82,7 +85,7 @@ def check_runtime(manifest_path, expected_sha, kotlin=True):
|
||||
for name,sha in verified.items():
|
||||
require(hashlib.sha256((directory/name).read_bytes()).hexdigest()==sha,'asset changed during gate')
|
||||
evidence={'status':'passed','scope':'read_only_machine_gate_no_approval_no_activation','manifest_sha256':digest,
|
||||
'body_sha256':body['sha256'],'schema_version':manifest['schemaVersion'],'actual_frame_count':count,
|
||||
'body_sha256':body['sha256'],'schema_version':manifest['schemaVersion'],'body_shape':[body['width'],body['height']],'actual_frame_count':count,
|
||||
'actual_pts_count':len(pts),'actual_duration_us':duration,'patch_images':len(paths),'rgba_cache_bytes':rgba,
|
||||
'verified_files':len(verified),'full_decode':'passed','production_kotlin_parser':'passed' if kotlin else 'checked_by_bundle_parser','naturalness':'pending','real_device':'not_run'}
|
||||
return evidence, verified
|
||||
|
||||
Reference in New Issue
Block a user