Add uniform Yangmi framing candidate for code37
This commit is contained in:
@@ -117,6 +117,20 @@ fun dynamicBodyCheck() {
|
||||
rejected(legacy+("body" to (legacy["body"] as Map<String,Any?>)+mapOf("width" to 720,"height" to 1280)))
|
||||
val fit=bodyFit(360,800,720,1280)
|
||||
check(fit.left==0f && fit.top==80f && fit.width==360f && fit.height==640f)
|
||||
for((w,h) in listOf(720 to 1280,360 to 800,800 to 480)) {
|
||||
val original=bodyFit(w,h,720,1280)
|
||||
val zoomed=bodyFit(w,h,720,1280,1.45f,.489f)
|
||||
fun near(a: Float,b: Float)=kotlin.math.abs(a-b)<.001f
|
||||
check(near(zoomed.width,original.width*1.45f) && near(zoomed.height,original.height*1.45f))
|
||||
check(near(zoomed.left+zoomed.width/2,w/2f) && near(zoomed.top+zoomed.height*.489f,h/2f))
|
||||
// The exact same source coordinates map body pixels and mouth rects.
|
||||
val patch=pack.patches[0]
|
||||
val displayX=zoomed.left+(patch.x+patch.width/2f)*zoomed.width/720
|
||||
val sourceX=(displayX-zoomed.left)*720/zoomed.width
|
||||
check(near(sourceX,patch.x+patch.width/2f))
|
||||
}
|
||||
for(zoom in listOf(Float.NaN,Float.POSITIVE_INFINITY,.9f,2.1f))check(runCatching { bodyFit(720,1280,720,1280,zoom) }.isFailure)
|
||||
for(center in listOf(Float.NaN,.39f,.61f))check(runCatching { bodyFit(720,1280,720,1280,1.45f,center) }.isFailure)
|
||||
fun render(codecW: Int,codecH: Int): Pair<List<ComposedBodyFrame>,List<String>> {
|
||||
TestScheduler.reset();CodecFixture.reset();GLFixture.reset()
|
||||
CodecFixture.width=codecW;CodecFixture.height=codecH;CodecFixture.frames=97;CodecFixture.fps=24
|
||||
|
||||
Reference in New Issue
Block a user