Reputation: 59
Could someone explain me the difference between the H.264 header and H.265 header? I just need to parse H265 header but I have difficult to find proper reference.
I did a first version of the parser. I need to retrieve the pic_width_in_luma_samples, pic_height_in_luma_samples, and the aspectRatioH, aspectRatioV.
my code is something like:
while (buf->Size > 0)
{
//forbidden bit
flushbits(buf, 1);
int nNALType = showbits(buf, 6);
if (nNALType == NAL_TYPE_SPS)
{
// flushbits until I retrieve desired parameter
flushbits(buf, 4); // sps_video_parameter_set_id
}
else
{
// align bits
buf->Size -= buf->BitsLeft & 0x7;
}
}
this is the correct way to do? There is a method where I can skip bits until I find a "start sequence" that indicates my desired SPS NAL TYPE?
Upvotes: 1
Views: 7023
Reputation: 165
follow those step to parse H265
Upvotes: 3
Reputation: 8274
The syntax of H.264 and H.265 is relative similar.
Both have parameter sets (PPS, SPS) you find the details in the specification below. For H.265 - page 33 section 7.3 describes the video parameters sets in detail. The specification is done in 'C' like pseudocode so relatively easy to translate the specification into compiling code.
You can always look at some existing code - for example:
The H.264 (AVC) specification is here:
https://www.itu.int/rec/T-REC-H.264-202108-I/en
The H.265 (HEVC) specification is here:
https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.265-201802-S!!PDF-E&type=items
Upvotes: 4