Support bounded 720x1280 avatar shapes through GLES and production gates
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import com.gorios.lanvoice.avatar.*
|
||||
|
||||
/** Expected five bodies/eight TALK bridges/two dances, synthetic metadata only. */
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun fullActionGraphCheck() {
|
||||
for((width,height) in listOf(480 to 848,720 to 1280)) {
|
||||
val pin="b".repeat(64)
|
||||
val bodies=listOf("neutral","happy","sad","idle-breathe","idle-shift").associateWith { id->
|
||||
val sha=java.security.MessageDigest.getInstance("SHA-256").digest(id.toByteArray()).joinToString("") { "%02x".format(it) }
|
||||
dynamicPack(if(id=="sad") 49 else 97,24,sha)
|
||||
dynamicPack(if(id=="sad") 49 else 97,24,sha,width,height)
|
||||
}
|
||||
fun clip(pack: ContinuousAvatarPack,path: String,audio: Boolean=false)=mapOf<String,Any?>(
|
||||
"path" to path,"sha256" to pack.body.sha256,"width" to 480,"height" to 848,"hasAudio" to audio,
|
||||
"path" to path,"sha256" to pack.body.sha256,"width" to pack.body.width,"height" to pack.body.height,"hasAudio" to audio,
|
||||
"frameCount" to pack.body.frameCount,"ptsUs" to pack.body.ptsUs,"durationUs" to pack.body.durationUs,
|
||||
"fpsNumerator" to pack.body.fpsNumerator,"fpsDenominator" to pack.body.fpsDenominator)
|
||||
val rows=bodies.map { (id,body)->mapOf<String,Any?>("id" to id,
|
||||
@@ -21,13 +23,13 @@ fun fullActionGraphCheck() {
|
||||
"fromAnchor" to "A","toAnchor" to "A","nativeLoop" to true,"clip" to clip(body,"$id/body.mp4")) }
|
||||
val bridges=bodies.keys.filter { it!="neutral" }.flatMap { id->listOf("neutral" to id,id to "neutral").map { (from,to)->
|
||||
val name="$from-$to";val sha=java.security.MessageDigest.getInstance("SHA-256").digest(name.toByteArray()).joinToString("") { "%02x".format(it) }
|
||||
val own=dynamicPack(25,24,sha);mouths[name]=own
|
||||
val own=dynamicPack(25,24,sha,width,height);mouths[name]=own
|
||||
mapOf<String,Any?>("id" to name,"from" to from,"to" to to,"fromFrame" to bodies.getValue(from).body.frameCount-1,
|
||||
"fromPtsUs" to bodies.getValue(from).body.ptsUs.last(),"toFrame" to 0,"toPtsUs" to 0L,"fromAnchor" to "A","toAnchor" to "A",
|
||||
"mouthAllowed" to true,"mouthRuntimeManifest" to mapOf("path" to "$name/manifest.json","sha256" to own.manifestSha),
|
||||
"clip" to clip(own,"$name/body.mp4"))
|
||||
} }
|
||||
val dance=dynamicPack(241,24,"f".repeat(64))
|
||||
val dance=dynamicPack(241,24,"f".repeat(64),width,height)
|
||||
val actions=listOf("asset_01","asset_02").map { id->mapOf<String,Any?>("id" to id,"kind" to "dance",
|
||||
"mouthAllowed" to false,"disallowTALK" to true,"entryAnchor" to "A","returnAnchor" to "A",
|
||||
"sourcePackageId" to "neutral","sourceFrame" to 0,"sourcePtsUs" to 0L,
|
||||
@@ -52,7 +54,24 @@ fun fullActionGraphCheck() {
|
||||
val wrong=mouths.getValue(name).copy(body=mouths.getValue(name).body.copy(sha256=bodies.getValue("neutral").body.sha256))
|
||||
check(read(bridgeData=mouths+(name to wrong))==null);assertions++
|
||||
}
|
||||
check(index.packages.values.all { it.body.width==width && it.body.height==height } &&
|
||||
index.edges.all { it.clip.width==width && it.clip.height==height } &&
|
||||
index.actionPack!!.assets.all { it.media!!.width==width && it.media.height==height });assertions++
|
||||
val otherWidth=if(width==480) 720 else 480;val otherHeight=if(height==848) 1280 else 848
|
||||
val wrongShape=bodies.getValue("happy").let { it.copy(body=it.body.copy(width=otherWidth,height=otherHeight)) }
|
||||
check(read(bodyData=bodies+("happy" to wrongShape))==null);assertions++
|
||||
for(i in (loops+bridges).indices) {
|
||||
val changed=(loops+bridges).mapIndexed { j,e -> if(j==i) e+("clip" to (e["clip"] as Map<String,Any?>)+
|
||||
mapOf("width" to otherWidth,"height" to otherHeight)) else e }
|
||||
check(read(root+("edges" to changed))==null);assertions++
|
||||
}
|
||||
for(i in actions.indices) {
|
||||
val changed=actions.mapIndexed { j,a -> if(j==i) a+("clip" to (a["clip"] as Map<String,Any?>)+
|
||||
mapOf("width" to otherWidth,"height" to otherHeight)) else a }
|
||||
check(read(root+("actions" to changed))==null);assertions++
|
||||
}
|
||||
val inflated=bodies.mapValues { (_,body)->body.copy(patches=body.patches.map { it.copy(width=80,height=44) }) }
|
||||
check(inflated.values.all { it.rgbaBytes<=BodyTimeline.MAX_RGBA_BYTES } && read(bodyData=inflated)==null);assertions++
|
||||
println("PASS: $assertions full5-body/13-edge/8-own-bridge/two241-frame-action parser assertions; RGBA=$bytes bytes, source0/return96/4s binding and total-cache rejection; fixtures only")
|
||||
println("PASS: $assertions ${width}x$height full5-body/13-edge/8-own-bridge/two241-frame-action parser assertions; RGBA=$bytes bytes, source0/return96/4s binding and total-cache rejection; fixtures only")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user