2023-10-24 21:24:55 CST W43D2

This commit is contained in:
aggresss
2023-10-24 21:24:55 +08:00
parent e163918619
commit 4329c27b55
47 changed files with 3577 additions and 165 deletions

View File

@@ -30,14 +30,19 @@ func (bf *AVBlowfish) GetPAddr() **uint32 {
}
// Custom: GetS gets `AVBlowfish.s` value.
func (bf *AVBlowfish) GetS() []uint32 {
return unsafe.Slice((*uint32)(&bf.s[0][0]), 4*256)
func (bf *AVBlowfish) GetS() (v [][]uint32) {
for i := 0; i < 4; i++ {
v = append(v, unsafe.Slice((*uint32)(&bf.s[i][0]), 256))
}
return v
}
// Custom: SetS sets `AVBlowfish.s` value.
func (bf *AVBlowfish) SetS(v []uint32) {
for i := 0; i < FFMIN(len(v), 4*256); i++ {
bf.s[i/256][i%256] = (C.uint32_t)(v[i])
func (bf *AVBlowfish) SetS(v [][]uint32) {
for i := 0; i < FFMIN(len(v), 4); i++ {
for j := 0; j < FFMIN(len(v[i]), 256); j++ {
bf.s[i][j] = (C.uint32_t)(v[i][j])
}
}
}
@@ -46,21 +51,6 @@ func (bf *AVBlowfish) GetSAddr() **uint32 {
return (**uint32)(unsafe.Pointer(&bf.s))
}
// Custom: GetSIdx gets `AVBlowfish.s` index value.
func (bf *AVBlowfish) GetSIdx(x, y int) uint32 {
return (uint32)(bf.s[x][y])
}
// Custom: SetSIdx sets `AVBlowfish.s` index value.
func (bf *AVBlowfish) SetSIdx(x, y int, v uint32) {
bf.s[x][y] = (C.uint32_t)(v)
}
// Custom: GetSIdxAddr gets `AVBlowfish.s` index address.
func (bf *AVBlowfish) GetSIdxAddr(x, y int) *uint32 {
return (*uint32)(&bf.s[x][y])
}
// AvBlowfishAlloc allocates an AVBlowfish context.
func AvBlowfishAlloc() *AVBlowfish {
return (*AVBlowfish)(C.av_blowfish_alloc())