KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have gotten the SPS in NALU ( AVC Decoder Configuration Record ), and trying to parse the video width / height from it. 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 This is my code parse the SPS but gets the wrong values. pic_width_in_mbs_minus1 is 5, and pic_height_in_map_units_minus1 is 1. Actually the video is 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) { int r = 0; int i; for (i = 0; i < n; i++) { r |= ( ReadBit() << ( n - i - 1 ) ); } return r; } unsigned int ReadExponentialGolombCode() { int r = 0; int i = 0; while( (ReadBit() == 0) && (i < 32) ) { i++; } r = ReadBits(i); r += (1 << i) - 1; return r; } unsigned int ReadSE() { int r = ReadExponentialGolombCode(); if (r & 0x01) { r = (r+1)/2; } else { r = -(r/2); } return r; } public: void Parse(const unsigned char * pStart, unsigned short nLen) { m_pStart = pStart; m_nLength = nLen; m_nCurrentBit = 0; int profile_idc = ReadBits(8); int constraint_set0_flag = ReadBit(); int constraint_set1_flag = ReadBit(); int constraint_set2_flag = ReadBit(); int constraint_set3_flag = ReadBit(); int constraint_set4_flag = ReadBit(); int constraint_set5_flag = ReadB
Tags (comma-separated)
Save Edits
Cancel