我在NALU(AVC解码器配置记录)中获得了SPS,并试图从中解析视频宽度/高度.
67 64 00 15 ac c8 60 20 09 6c 04 40 00 00 03 00 40 00 00 07 a3 c5 8b 67 80
Run Code Online (Sandbox Code Playgroud)
这是我的代码解析SPS但得到错误的值.pic_width_in_mbs_minus1是5,pic_height_in_map_units_minus1是1.实际上视频是512 X 288px
typedef struct _SequenceParameterSet
{
private:
const unsigned char * m_pStart;
unsigned short m_nLength;
int m_nCurrentBit;
unsigned int ReadBit()
{
ATLASSERT(m_nCurrentBit <= m_nLength * 8);
int nIndex = m_nCurrentBit / 8;
int nOffset = m_nCurrentBit % 8 + 1;
m_nCurrentBit ++;
return (m_pStart[nIndex] >> (8-nOffset)) & 0x01;
}
unsigned int ReadBits(int n) …Run Code Online (Sandbox Code Playgroud)