Files
baji-vc/docs/AVATAR_MOUTH_062.md
zenord 7d8ea95f07 feat: add aperture mouth candidate and early foreground permissions
Route runtime04 curve values to five source-frame lip geometries with level0 body bypass and spatial opacity1 for all other levels. Preserve the continuous decoded body clock and clean home. Request normal permissions after foreground host layout independently of network; support offline manual consent without capture or connection. Add strict 97x5 parsing, renderer and permission regressions, offline EGL shader pixel goldens and exact debug-candidate packaging. Naturalness, visible talk, device colors and perceived response remain pending.
2026-10-12 22:55:20 +08:00

72 lines
12 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 0.6.2-mouth-dev / code15 — runtime04 device candidate
Coordinator approved runtime04 for Android debug/device validation after reviewing fixed-frame comparisons and IMPORT. This is a mouth-method candidate, not final natural-quality approval or a claim that the user's deformation report is resolved. Code14 remains the separate UI-only/runtime03 baseline; its artifact is never overwritten. No new AI generation or fees, backend/provider/TTS/voice/model changes, system toolchain changes, sensor capture or automatic device installation.
## Exact material and admission scope
Private input: `.runtime/avatar-imports/a01-neutral-graph-v1/runtime-04/`.
Manifest SHA256: `0a3c4918ba746019cf1df885bec66e5858a8950997dac4f64e7d37094be64dad`.
Body SHA256: `177dbc0ab809e3c9c684899ffbd9cf3a2c357973c7037134f5d79e4e6cdfc762` (unchanged from runtime03),97frames,480×848,24fps,4041667us,H264/yuv420p/no audio.
Owner preview `review/mouth-fix-20s-clean.mp4` SHA256: `a72d69d06b795db737b549f00f14f2b2dfff0670cd5320c1a0ab51e6a951236a`.
485 straight RGBA8 PNGs represent97body frames×5aperture levels. They use each source frame's own lip seam and a maximum0.9px local opening deformation. This replaces the runtime03 method that mixed a different open-lip image over the source lip. It does not warp the whole face or introduce another body phase. The source seam detection is an offline dark/red heuristic; it is not an affine/identity solution. Tiny opening may be inconspicuous at full-body scale. Body-loop seam and dynamic naturalness remain pending.
Exact SHA is admitted only by `-PavatarNatural=true -PavatarMouthCandidate=true -PnaturalManifestSha=<runtime04 SHA>` in debug. Existing manifest fields remain unchanged: publishApproval=false, naturalQualityStatus=pending_coordinator, deviceTestStatus=pending, safeTransitions pending, approvedEdges empty, rights unverified. Production flags are false and motion allowlist stays empty. Runtime03, controlled01, all source imports and earlier APKs retain their bytes. Code15 bundles runtime03 for baseline preservation but selects only runtime04; invalid runtime04 falls back to verified static reference rather than silently selecting another motion pack.
## Runtime contract
Parser distinguishes packId runtime03 from runtime04 and rejects cross-schema opacity/aperture substitution. Runtime04 patch rows have actual frameIndex/ptsUs,x/y/width/height and exactly five ordered `levels`: levelIndex0..4,aperture0/.25/.5/.75/1,path/sha256. Top-level row path/sha must match level4. All485paths are unique and bounded; width/height≤128,rect inside480×848,total decoded RGBA≤8MB. Every file hash and decoded PNG dimension is checked before rendering. There is no atlas; small textures are independently bounded and cached once, with no per-frame PNG decode, SSD or whole-body Bitmap allocation.
Latest actual PCM playback-head activity still supplies only mouth intent. The independent controller retains idle/opening/talk1/talk2/end-talk curves,250ms bridges and500ms legal talking units; old generation/revision and callbacks are fenced. Opening reversal completes the short bridge then closes; stop/abort finishes the current mouth unit then end-talk. Audio abort remains immediate and never waits for video.
Curve value g now selects the **nearest geometry aperture level**, not opacity. Exact halfway ties choose the lower level deterministically. For example g=.125→level0,g>.125→level1,g=.5→level2. Level0 bypasses the patch and outputs the original body sample. Any other selected level uses global opacity1 and only its spatial alpha a:
`out = body*(1-a) + selectedPatchRGB*a`
There is no second multiplication by g, interpolation between two level images, or crossfade of two lip anatomies. Nearest selection can reveal stepping; no larger aperture or temporal smoothing is added without visual evidence. Runtime03 retains its old g×a path only when explicitly building the old runtime03 variant.
`ContinuousFramePresenter` selects the level, texture slot and opacity from the same latched body key and mouth sample. One MediaCodec output is pending at a time; SurfaceTexture timestamp is checked against decoded PTS,patch frame index follows0..96 and loop ordinal increments only at full wrap. Body,patch and mouth selection draw in one EGL pass/swap,using one Fit quad. Mouth changes do not seek/restart body. Background releases decoder/EGL/GL textures and fences callbacks. Decoder/GL/hash/dimension failure returns to the verified still image and cannot block audio.
## UI and versions
Both versions have only full-screen white Fit avatar+one48dp bottom-right safe-inset gear at home. Settings holds all statuses,errors,permissions,privacy controls,face sharing,emotions,diagnostic report/player text and offline controls. Opening/closing the sheet does not key the renderer/session. Code15's settings explicitly label source-own-lip five-level micro-motion,stepping,visibility and deformation improvement as pending device validation. No engineering banner covers the face.
Code15 also fixes permission timing, superseding code13/code14's HELLO-before-consent policy. Normal first RESUMED entry waits for the attached Compose host to be laid out, then requests MIC and CAMERA sequentially without waiting for health/WS/HELLO. Asked flags persist before launching the dialog; repeated drive/recomposition/rotation/reconnect cannot prompt again automatically. Explicit permission buttons and permanent-denial application-settings entries are always in settings and work even when network connection fails. Already granted permission is a no-op. Stale/wrong callbacks cannot clear another pending request or alter preferences.
Consent is separate from collection: microphone capture/upload starts only in foreground after real HELLO; no connection means no uplink. Normal camera analysis may start when foreground, granted and cameraWanted, independently of network, after pending dialogs finish. Camera denial permits audio; mic denial prevents recording. Camera-off choices persist. Sharing remains independent/defaultoff and clears on camera-off/disconnect/background. System privacy indicators/dialogs stay visible. Permission onPause/onStop stops all sensors; only the bounded pending-permission connection continuation survives. A callback in background cannot start anything.
Explicit offline extra constructs no VoiceSession/AudioOutputGate/ExpressionController and automatically requests no permissions. Its settings show each actual granted/ungranted state and manual MIC/CAMERA permission buttons; a user can consent through the real system dialog or application settings without network. Granting in offline mode still never starts capture/analysis, and no adb pm grant is used. Opening a system dialog may pause/release the video according to Activity lifecycle; merely opening/closing the in-Activity settings sheet does not.
## Reproduction and validation
Portrait inputs remain private/ignored. Restore the accepted arms reference and controlled01/runtime03 baselines using the import commands in AVATAR_UI_062.md. Then:
```sh
/home/ubuntu/miniconda3/bin/python3 scripts/package-avatar-mouth.py --import-only
python3 scripts/check-reply-regressions.py --suite avatar --runtime-manifest .runtime/avatar-imports/a01-neutral-graph-v1/runtime-03/manifest.json > logs/avatar-mouth-062/actual-manifest-tests.txt 2>&1
python3 scripts/check-reply-regressions.py --suite avatar --runtime-manifest .runtime/avatar-imports/a01-neutral-graph-v1/runtime-04/manifest.json >> logs/avatar-mouth-062/actual-manifest-tests.txt 2>&1
./scripts/check-avatar-regressions.sh
/home/ubuntu/miniconda3/envs/gori-speech/bin/python gateway/scripts/check-archive.py --vad-model /home/ubuntu/miniconda3/envs/gori-speech/lib/python3.12/site-packages/silero_vad/data/silero_vad.onnx > logs/avatar-safe-061/gateway-tests.txt 2>&1
/home/ubuntu/miniconda3/bin/python3 scripts/check-avatar-shader.py --runtime .runtime/avatar-imports/a01-neutral-graph-v1/runtime-04 --output logs/avatar-mouth-062/shader-golden
./scripts/build.sh compileDebugKotlin assembleDebugAndroidTest -PavatarNatural=true -PavatarMouthCandidate=true -PnaturalManifestSha=0a3c4918ba746019cf1df885bec66e5858a8950997dac4f64e7d37094be64dad > logs/avatar-mouth-062/android-test-compile.txt 2>&1
/home/ubuntu/miniconda3/bin/python3 scripts/package-avatar-mouth.py
```
Missing/drifted data stops packaging. Current permission tests additionally cover first-foreground requests before HELLO, sequential callbacks across onStop, one-shot denial/permanent/manual retry, network-independent/offline consent-only, granted no-op, MIC after HELLO, foreground camera without network, and genuine background guards. Packaging verifies strict97×5hash/dimension/bounds,the production Kotlin parser for both actual manifests,current source regression fingerprints,all74isolated gateway tests,completebodydecode/CFR,CPUlevel0bypass+selectedgeometryspatialmask math,compiled optional UI probe,SDK/ABI/same debug certificate,exact ZIPavatar bytes/MP4stored,and HTTPAPK/checksum. It preserves all existing artifacts and requires a new filename/versioncode for later revisions. To reproduce code14 exactly,use its source commit9ea5eb31c16f5a1360880c57370b590057090f0a in an isolated checkout;current code15 has extended renderer fingerprints.
New JVM checks cover97×5selection slots,nearest/tie boundaries,nonfinite values,level0opacity0/nonzeroopacity1,missing/duplicate/invalid levels,path/bounds/memory rejection,cross-schema rejection,and the actual renderer's chosen texture+opacity through wrap/abort/background/error/resource teardown under deterministic Android/EGL doubles. Existing9JVM entrypoints cover partial PCM/head activity,silence/underrun,oldturn/reversal,permissions/autoentry and all prior suites. UI source contracts run; optional sensor-free physical UI probe is compiled,not executed here.
The C/EGL golden harness executes the production shader strings on Mesa llvmpipe,substituting a2D body sampler for OES.40cases cover synthetic top-bottom/subpixel UV/portrait+landscape Fit,a nontrivial body texture transform,straightalpha spatial blending,exact alpha0 body identity,and actual runtime04 frames0/26/43/52/69/96 at all5levels. Observed maximum RGB discrepancy is1/255 against independent bilinear CPU golden. This is actual offline GLES execution,but does **not** validate Android Bitmap premul roundtrip,hardware OES/YUV conversion,SurfaceTexture transform delivered by the phone,physical display timing or perceived naturalness. No proven Android double-premul/root bug is claimed.
## Coordinator offline device acceptance
Artifact: `artifacts/lan-voice-v062-mouth-candidate-arm64-debug.apk` plus `.apk.sha256`,version0.6.2-mouth-dev/code15,arm64/min26/target34,same debug certificate. Device must be online before coordinator installation;this task does not reconfigure USB/wireless/network or clear data.
```sh
adb -s 0123456789ABCDEF install -r lan-voice-v062-mouth-candidate-arm64-debug.apk
adb -s 0123456789ABCDEF shell am force-stop com.gorios.lanvoice
adb -s 0123456789ABCDEF shell am start -W -n com.gorios.lanvoice/.MainActivity --ez avatar_offline_preview true
```
Open gear for Idle/Talk/Abort/Trace. Check visible small repeated talk without deforming lips or extra shadows,nearest-level stepping,stop/resume/reversal,body blink/sway continuity and wrap,settings open/close without body reset,portrait/landscape/tablet Fit,background release/resume and failure fallback. Actual perception,≤1s response,performance/temperature,hardware shader colors and final naturalness remain unknown. Nearly static mouth is not success;do not certify the fix solely from hashes,CPU equality or low pixel differences. Camera/face algorithm acceptance remains separate.