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
+52
View File
@@ -0,0 +1,52 @@
//go:build arm64
package grdp
import "encoding/binary"
// bgr32BatchToRGBA converts n BGRA32 pixels (4 bytes each: B,G,R,X in memory) to
// RGBA using NEON. Processes 8 pixels per iteration; remainder is scalar.
func bgr32BatchToRGBA(dst []byte, src []byte, n int) {
n8 := n &^ 7
if n8 > 0 {
bgr32toRGBAarm64(&dst[0], &src[0], n8)
}
for i := n8; i < n; i++ {
s := i * 4
binary.LittleEndian.PutUint32(dst[s:],
uint32(src[s+2])|uint32(src[s+1])<<8|uint32(src[s])<<16|0xFF000000)
}
}
//go:noescape
func bgr32toRGBAarm64(dst *byte, src *byte, n int)
func rgb555BatchToRGBA(dst []byte, src []byte, n int) {
n8 := n &^ 7
if n8 > 0 {
rgb555toRGBAarm64(&dst[0], &src[0], n8)
}
for i := n8; i < n; i++ {
d := binary.BigEndian.Uint16(src[i*2:])
binary.LittleEndian.PutUint32(dst[i*4:],
uint32((d&0x7C00)>>7)|uint32((d&0x03E0)>>2)<<8|uint32((d&0x001F)<<3)<<16|0xFF000000)
}
}
func rgb565BatchToRGBA(dst []byte, src []byte, n int) {
n8 := n &^ 7
if n8 > 0 {
rgb565toRGBAarm64(&dst[0], &src[0], n8)
}
for i := n8; i < n; i++ {
d := binary.BigEndian.Uint16(src[i*2:])
binary.LittleEndian.PutUint32(dst[i*4:],
uint32((d&0xF800)>>8)|uint32((d&0x07E0)>>3)<<8|uint32((d&0x001F)<<3)<<16|0xFF000000)
}
}
//go:noescape
func rgb555toRGBAarm64(dst *byte, src *byte, n int)
//go:noescape
func rgb565toRGBAarm64(dst *byte, src *byte, n int)