51 {{0, 0, 3, 0, 0}, 3, {0,0,1}},
52 {{0, 1, 3, 0, 0}, 4, {0,0,0,1}},
53 {{2, 1, 3, 0, 0}, 6, {0,0,0,0,0,1}},
55 {{0, 0, 3, 1, 0}, 4, {0,0,1,2}},
56 {{0, 0, 3, 2, 0}, 5, {0,0,1,2,0}},
57 {{0, 0, 3, 3, 0}, 6, {0,0,1,2,0,0}},
58 {{0, 0, 3, 1, 3}, 7, {0,0,1,2,0,0,0}},
60 {{0, 0, 3, 1, 0}, 8, {0,0,1,2,0,0,1,3}},
61 {{0, 0, 3, 1, 0}, 9, {0,0,1,2,0,0,0,1,3}},
62 {{0, 0, 3, 1, 1}, 10, {0,0,1,2,0,0,0,0,1,3}},
64 {{0, 0, 0, 0, 0}, 0, {}},
65 {{1, 0, 0, 0, 0}, 1, {0}},
66 {{2, 0, 0, 0, 0}, 2, {0,0}},
67 {{3, 0, 0, 0, 0}, 3, {0,0,0}},
73 for (
unsigned i = 0; i <
sizeof(
tests)/
sizeof(*
tests); i++)
79 vector<uint8_t> nalUnit;
83 cout <<
"Self-Test: " << i <<
", {";
84 for (
unsigned j = 0; j <
tests[i].data_len; j++)
86 cout << hex << (
unsigned int)
tests[i].data[j] << dec;
87 if (j <
tests[i].data_len-1)
95 #define VERIFY(a,b,m) \
98 cout << endl << " MISSMATCH " #m << ", E(" << b.m << ") != " << a.m; \
101 VERIFY(actual,
tests[i].expected, m_numZeroByteBytes);
102 VERIFY(actual,
tests[i].expected, m_numStartCodePrefixBytes);
103 VERIFY(actual,
tests[i].expected, m_numBytesInNALUnit);
104 VERIFY(actual,
tests[i].expected, m_numTrailingZero8BitsBytes);
114 int main(
int argc,
char*argv[])
123 ifstream in(argv[1], ifstream::in | ifstream::binary);
130 unsigned numNALUnits = 0;
132 cout <<
"NALUnits:" << endl;
136 vector<uint8_t> nalUnit;
140 int nal_unit_type = -1;
143 nal_unit_type = nalUnit[0] & 0x1f;
146 cout <<
" - NALU: #" << numNALUnits <<
" nal_unit_type:" << nal_unit_type << endl
154 annexBStatsTotal += annexBStatsSingle;
164 switch (nalUnit[0] & 0x1f) {
165 case 1:
case 2:
case 3:
case 4:
case 5:
166 annexBStatsTotal_VCL += annexBStatsSingle;
169 annexBStatsTotal_Filler += annexBStatsSingle;
172 annexBStatsTotal_Other += annexBStatsSingle;
176 cout <<
"Summary: " << endl
184 cout <<
"Summary(VCL): " << endl
192 cout <<
"Summary(Filler): " << endl
200 cout <<
"Summary(Other): " << endl
228 unsigned totalBytes_T2abHRD = 0;
235 cout <<
"Totals (bytes):" << endl;
236 cout <<
" Type1 HRD: " << totalBytes_T1HRD << endl;
237 cout <<
" Type2 HRD: " << totalBytes_T2aHRD << endl;
238 cout <<
" Type2b HRD: " << totalBytes_T2abHRD << endl;
reading functions for Annex B byte streams
UInt m_numLeadingZero8BitsBytes
int main(int argc, char *argv[])
UInt m_numTrailingZero8BitsBytes
UInt m_numStartCodePrefixBytes
Bool byteStreamNALUnit(InputByteStream &bs, vector< uint8_t > &nalUnit, AnnexBStats &stats)