init: 自 zomaintain/backend/rdplib 平移独立成库; module path 从上游 github.com/nakagami/grdp 改为 git.zeroonesoft.cn/golib/rdplib

This commit is contained in:
w11
2026-09-19 18:55:43 +08:00
commit 1096fbce9d
94 changed files with 36790 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
package rdpgfx
import (
"testing"
)
// BenchmarkIctToBGRA benchmarks ictToBGRA on a full 64×64 tile row (64 pixels).
func BenchmarkIctToBGRA(b *testing.B) {
n := rfxTileSize // 64 pixels per row
yRow := make([]int16, n)
cbRow := make([]int16, n)
crRow := make([]int16, n)
dst := make([]byte, n*4)
for i := range n {
yRow[i] = int16(i * 4)
cbRow[i] = int16(i%64 - 32)
crRow[i] = int16(i%32 - 16)
}
b.ResetTimer()
for b.Loop() {
ictToBGRA(yRow, cbRow, crRow, dst, n)
}
}
// BenchmarkRfxDecodeComponent benchmarks a full component decode pipeline:
// RLGR → differential/dequantize → inverse DWT.
func BenchmarkRfxDecodeComponent(b *testing.B) {
// Use the same coefficient pattern as the RLGR benchmarks (1/17 non-zero).
coeffs := make([]int16, 4096)
for i := range coeffs {
if i%17 == 0 {
coeffs[i] = int16(i%256 - 128)
}
}
data := rlgr1Encode(coeffs)
quant := rfxQuant{6, 6, 6, 6, 6, 6, 6, 6, 6, 6}
b.ResetTimer()
var dst []int16
for b.Loop() {
dst = rfxDecodeComponent(data, quant, 1)
coeffPool.Put((*coeffArr)(dst))
dst = nil
}
}
// BenchmarkRfxInverseDWT2D benchmarks the full 3-level inverse DWT on 4096 coefficients.
func BenchmarkRfxInverseDWT2D(b *testing.B) {
coeffs := make([]int16, 4096)
for i := range coeffs {
coeffs[i] = int16(i%64 - 32)
}
b.ResetTimer()
for b.Loop() {
rfxInverseDWT2D(coeffs)
}
}