本文整理汇总了Golang中github.com/jfreymuth/go-vorbis/ogg.BitReader.Read32方法的典型用法代码示例。如果您正苦于以下问题:Golang BitReader.Read32方法的具体用法?Golang BitReader.Read32怎么用?Golang BitReader.Read32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jfreymuth/go-vorbis/ogg.BitReader
的用法示例。
在下文中一共展示了BitReader.Read32方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Decode
func (f *floor1) Decode(r *ogg.BitReader, books []codebook, n uint32) []uint32 {
if !r.ReadBool() {
return nil
}
range_ := [4]uint32{256, 128, 86, 64}[f.multiplier-1]
y := make([]uint32, 0, len(f.xList))
y = append(y, r.Read32(ilog(int(range_)-1)), r.Read32(ilog(int(range_)-1)))
for _, classIndex := range f.partitionClassList {
class := f.classes[classIndex]
cdim := class.dimension
cbits := class.subclass
csub := (uint32(1) << cbits) - 1
cval := uint32(0)
if cbits > 0 {
cval = books[class.masterbook].DecodeScalar(r)
}
for j := 0; j < int(cdim); j++ {
book := class.subclassBooks[cval&csub]
cval >>= cbits
if book != 0xFF {
y = append(y, books[book].DecodeScalar(r))
} else {
y = append(y, 0)
}
}
}
return y
}
示例2: ReadFrom
func (f *floor1) ReadFrom(r *ogg.BitReader) error {
f.partitionClassList = make([]uint8, r.Read8(5))
var maximumClass uint8
for i := range f.partitionClassList {
class := r.Read8(4)
f.partitionClassList[i] = class
if class > maximumClass {
maximumClass = class
}
}
f.classes = make([]floor1Class, maximumClass+1)
for i := range f.classes {
class := &f.classes[i]
class.dimension = r.Read8(3) + 1
class.subclass = r.Read8(2)
if class.subclass != 0 {
class.masterbook = r.Read8(8)
}
class.subclassBooks = make([]uint8, 1<<class.subclass)
for i := range class.subclassBooks {
class.subclassBooks[i] = r.Read8(8) - 1
}
}
f.multiplier = r.Read8(2) + 1
f.rangebits = r.Read8(4)
f.xList = append(f.xList, 0, 1<<f.rangebits)
for _, class := range f.partitionClassList {
for i := uint8(0); i < f.classes[class].dimension; i++ {
f.xList = append(f.xList, r.Read32(uint(f.rangebits)))
}
}
f.sort = make([]uint32, len(f.xList))
for i := range f.sort {
f.sort[i] = uint32(i)
}
sort.Sort(f)
f.step2 = make([]bool, len(f.xList))
f.finalY = make([]uint32, len(f.xList))
return nil
}