Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h264: full SPS parsing #253

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

h264: full SPS parsing #253

wants to merge 4 commits into from

Conversation

mildsunrise
Copy link
Contributor

Please review #252 first, as it's a dependency for this PR.

Extends H264SeqParameterSet to parse the full descriptor (right now it's not parsing the VUI).

I've basically adapted the code from nal-extractor:
https://github.com/medooze/nal-extractor/blob/main/lib/SPS.ts
https://github.com/medooze/nal-extractor/blob/main/test/SPS.test.ts

output for:

64001eacb2010020f3cf80b5060606a50000030001000003003c9f162e48

is:

[H264SeqParameterSet
	profile_idc=64
	constraint_set0_flag=0
	constraint_set1_flag=0
	constraint_set2_flag=0
	reserved_zero_5bits=0
	level_idc=1e
	seq_parameter_set_id=0
	log2_max_frame_num_minus4=0
	pic_order_cnt_type=2
	log2_max_pic_order_cnt_lsb_minus4=0
	delta_pic_order_always_zero_flag=0
	offset_for_non_ref_pic=0
	offset_for_top_to_bottom_field=0
	num_ref_frames_in_pic_order_cnt_cycle=0
	num_ref_frames=3
	gaps_in_frame_num_value_allowed_flag=0
	pic_width_in_mbs_minus1=31
	pic_height_in_map_units_minus1=31
	frame_mbs_only_flag=1
	mb_adaptive_frame_field_flag=0
	direct_8x8_inference_flag=1
	frame_crop=[
		left_offset=0
		right_offset=6
		top_offset=0
		bottom_offset=6
	]
	vui_parameters=[
		aspect_ratio_info=[
			aspect_ratio_idc=1
		]
		overscan_info=[
			<Not present>
		]
		video_signal_type=[
			video_format=5
			video_full_range_flag=0
			colour_description=[
				colour_primaries=6
				transfer_characteristics=6
				matrix_coefficients=6
			]
		]
		chroma_loc_info=[
			type_top_field=1
			type_bottom_field=1
		]
		timing_info=[
			num_units_in_tick=1
			time_scale=61
			fixed_frame_rate_flag=1
		]
		nal_hrd_parameters=[
			<Not present>
		]
		vcl_hrd_parameters=[
			<Not present>
		]
		pic_struct_present_flag=1
		bitstream_restriction=[
			motion_vectors_over_pic_boundaries_flag=1
			max_bytes_per_pic_denom=0
			max_bits_per_mb_denom=0
			log2_max_mv_length_horizontal=10
			log2_max_mv_length_vertical=10
			max_num_reorder_frames=0
			max_dec_frame_buffering=3
		]
	]
	separate_colour_plane_flag=0
[/H264SeqParameterSet]

For some reason time_scale says 61 rather than 60. I'll investigate later.

nested objects are treated very differently by Dump(),
and the output syntax differs a lot between objects,
so introduce a base Descriptor class and macros to avoid
repeating stuff like the field name.

Dump() now takes an optional prefix, so that nested objects
are dumped with the same syntax but indented as needed.
@mildsunrise
Copy link
Contributor Author

(rebased)

@murillo128
Copy link
Member

is this ready for review?

@mildsunrise
Copy link
Contributor Author

it is missing a relatively small change for it to compile without RTTI. sorry, I'll push that change tomorrow.
for all other intents and purposes, this can be considered ready to review yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants