import (
"math"
)
type Params struct {
width uint32
height uint32
profile, level uint32
nal_length_size int16
}
type NALBitstream struct {
m_data []byte
m_len int
m_idx int
m_bits int
m_byte uint8
m_zeros int
}
func NewNALBitstream(data []byte, size int) *NALBitstream {
ret := &NALBitstream{
m_len: size,
m_idx: 0,
m_bits: 0,
m_byte: 0,
m_zeros: 0,
}
//copy(,data)
ret.m_data = data
return ret
}
func (nalb *NALBitstream) GetBYTE() byte {
if nalb.m_idx >= nalb.m_len {
return byte(0)
}
b := nalb.m_data[nalb.m_idx]
nalb.m_idx++
if b == byte(0) {
nalb.m_zeros++
if (nalb.m_idx < nalb.m_len) && (nalb.m_zeros == 2) && (nalb.m_data[nalb.m_idx] == 0x03) {
nalb.m_idx++
nalb.m_zeros = 0
}
} else {
nalb.m_zeros = 0
}
return b
}
func (nalb *NALBitstream) GetBit() uint32 {
if nal
Go语言解析H265 SPS
最新推荐文章于 2023-04-06 21:43:19 发布
本文深入探讨如何使用Go语言解析H265的Sequence Parameter Set (SPS)信息,涵盖关键步骤和技术细节,对于理解H265编码及视频处理具有指导意义。
摘要由CSDN通过智能技术生成