Question

I am working with x264 encoder api where for every encoded picture i get a number of nal unit. is there any way i can check whether nals are valid or not in my VS2010 Debugger. Currently i can see the following information::

i_ref_idc        -858993460
i_type           -858993460
b_long_startcode -858993460
i_first_mb       -858993460
i_last_mb        -858993460
i_payload        27
p_payload        0x06b94d68
i_padding        -858993460

i m not sure whether these negative values are representing that nals are invalid or it is missing information.
Basically how can i check that the nals i got from x264_encoder_encode() is a valid nal unit?
NOTE :: i m using these nals to stream live using LIVE555.

Was it helpful?

Solution 2

This is definitely invalid. You can not know for sure if a nalu is 100% valid without parsing the entire thing. But you can sanity check values.

i_ref_idc is a 2 bit field. Anything outside the range of 0-3 is not sane.

i_type is 5 bits. But in reality an encoder will only produce 1-15 or 19-21 inclusive

b_long_startcode is boolean, so you cant sanity check it

i_first_mb and i_last_mb will be less then ceil(width/8.0) * ceil(height/8.0)

i_payload is the size, of the data p_payload point to, so pick a high value here. 10*with*height should suffice.

OTHER TIPS

-858993460 are also known as 0xСССССССС and indicate that values were not initialized by the encoder.

i_payload, p_payload are size of payload in bytes and pointer to the data. There is not basically a validity check for this data other than feeding data to a decoder and testing against availability of output and decoding errors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top