Browse Source

Use bounded contrast and bulk YUV writes in hardware rate probe

stream-multiview
evgeny 6 days ago
parent
commit
13feaca674
  1. 13
      tools/chatgui-android/app/src/debug/java/com/utun/chat/data/CallVideoProbe.kt

13
tools/chatgui-android/app/src/debug/java/com/utun/chat/data/CallVideoProbe.kt

@ -92,10 +92,15 @@ class CallVideoProbe : Instrumentation() {
for ((index, plane) in image.planes.withIndex()) {
val width = image.width shr (if (index == 0) 0 else 1)
val height = image.height shr (if (index == 0) 0 else 1)
val buffer = plane.buffer.duplicate(); val start = buffer.position()
for (y in 0 until height) for (x in 0 until width) {
random = random * 1664525 + 1013904223
buffer.put(start + y * plane.rowStride + x * plane.pixelStride, if (index == 0) (random ushr 24).toByte() else 128.toByte())
val buffer = plane.buffer.duplicate(); val start = buffer.position(); val row = ByteArray(width) { 128.toByte() }
for (y in 0 until height) {
// Ограниченный контраст: полностью случайный 8-bit шум превышает возможности аппаратного CBR даже при QP=51.
if (index == 0) for (x in 0 until width) {
random = random * 1664525 + 1013904223; row[x] = (112 + (random ushr 27)).toByte()
}
val offset = start + y * plane.rowStride
if (plane.pixelStride == 1) { buffer.position(offset); buffer.put(row) }
else for (x in 0 until width) buffer.put(offset + x * plane.pixelStride, row[x])
}
}
return random

Loading…
Cancel
Save