[Mp4-tech] time_scale and num_units in tick: what am I missing?

Glenn Connery glenn.connery arroyo.tv
Tue Feb 7 13:30:32 ESTEDT 2006


Okay, so I'm having trouble parsing a seq_parameter_set_rbsp which contains 
vui_parameters, so I'm getting lost in the following bits.  Everything I 
compute agrees with another program up to the timing info.  Here's the MPEG-2 
transport stream packet:
47 41 2c 39 01 60 00 00 01 e0 00 00 82 c0 0a 31 
57 e1 5a 21 11 57 e1 3e 01 00 00 00 01 09 10 00 
00 00 01 67 4d 40 1e 89 99 82 c1 22 c1 bd c1 41 
41 7c 00 00 03 00 04 00 00 03 00 ca 10 00 00 00 
01 68 ea 88 35 c8 00 00 00 01 65 b8 00 20 00 af 
fe d4 a7 99 63 a3 da 16 1b c2 4b b2 86 de 8f 0d 
58 fb 4f 60 9e b0 8e 20 00 00 24 b0 8c 91 50 b2 
7e 90 54 df 21 13 74 7d c0 0b 09 8a 95 d5 81 d5 
8a 32 04 0e a7 35 bb 21 06 9f af 00 02 fe 72 88 
05 7c ac 89 0f b0 68 3e 80 a6 cf 3b 8a 47 87 d6 
4f 1d b4 8d 39 43 72 d0 d7 11 a2 63 55 9a fd 53 
ff e9 68 23 e9 5b 91 7c d3 31 b0 f7             .
which has a PES header (00 00 01 e0), an AU delimiter (00 00 01 09) and then 
the 26-bytes of the SEQ following the 00 00 01 67:
4d 40 1e 89 99 82 c1 22 c1 bd c1 41 41 7c 00 00 03 00 04 00 00 03 00 ca 10 00
Here's my parse, by HAND of this, which agrees with my code.  And agrees with 
this other program up to the timing info.  Oh, by the way, its a PAL sample 
(25fps):
00: 4d  0100 1101
01: 40  0100 0000
02: 1e  0001 1110
03: 89  1000 1001
04: 99  1001 1001
05: 82  1000 0010
06: c1  1100 0001
07: 22  0010 0010
08: c1  1100 0001
09: bd  1011 1101
10: c1  1100 0001
11: 41  0100 0001
12: 41  0100 0001
13: 7c  0111 1100
14: 00  0000 0000
15: 00  0000 0000
16: 03  0000 0011
17: 00  0000 0000
18: 04  0000 0100
19: 00  0000 0000
20: 00  0000 0000
21: 03  0000 0011
22: 00  0000 0000
23: ca  1100 1010
24: 10  0001 0000
25: 00  0000 0000
[ 01001101 ]  profile_idc = 77			// u(8)
[ 0100 ] CF0 = 0 CF1 = 1 CF2 = 0 CF3 = 0	// u(1) u(1) u(1) u(1)
[ 0000 ] Reserved					// u(4)
[ 00011110 ] level_idc = 30				// u(8)
[ 1 ] seq_parameter_set_id = 0			// ue(v)
[ 0001001 ] log2_max_frame_num_minus4 = 8(12) // ue(v)
[ 1 ] pic_order_cnt_type = 0			// ue(v)
[ 00110 ] log2_max_pic_order_cnt_lsb_minus4 = 5(9) // ue(v)
[ 011 ] num_ref_frames = 2				// ue(v)
[ 0 ] gaps_in_frame_num_value_allowed_flag = 0 // u(1)
[ 000010110 ] pic_width_in_mbs_minus1 = 21(22) // ue(v)
[ 000010010 ] pic_height_in_map_units_minus1 = 17(18) // ue(v)
[ 0 ] frame_mbs_only_flag = 0			// u(1)
[ 0 ] mb_adaptive_frame_field_flag = 0		// u(1)
[ 1 ] direct_8x8_inference_flag = 1		// u(1)
[ 0 ] frame_cropping_flag = 0			// u(1)
[ 1 ] vui_parameters_present_flag = 1		// u(1)
[ 1 ] aspect_ratio_info_present_flag = 1 	// u(1)
[ 0000 0110 ] aspect_ratio_idc = 6 		// u(8)
[ 1 ] overscan_info_present_flag = 1		// u(1)
[ 1 ] overscan_appropriate_flag = 1		// u(1)
[ 1 ] video_signal_type_present_flag = 1	// u(1)
[ 101 ] video_format = 5				// u(3)
[ 1 ] video_full_range_flag = 1			// u(1)
[ 1 ] colour_description_present_flag = 1	// u(1)
[ 0000 0101 ] colour_primaries = 5		// u(8)
[ 0000 0101 ] transfer_characteristics = 5	// u(8)
[ 0000 0101 ] matrix_coefficient = 5		// u(8)
[ 1 ] chroma_loc_info_present_flag = 1		// u(1)
[ 1 ] chroma_sample_loc_type_top_field = 0		// ue(v)
[ 1 ] chroma_sample_loc_type_bottom_field = 0	// ue(v)
[ 1 ] timing_info_present_flag = 1			// u(1)
[ 0000 0000 0000 0000 0000 0000 1100 0000 ] num_units_in_tick = 192	// u(32)
[ 0000 0001 0000 0000 0000 0000 0000 0000 ] time_scale = 16777216  // u(32)
... 11 0000 0000 1100 1010 0001 0000 0000 0000
Now the other program says the num_units_in_ticks is 1 and the time_scale is 
50.  So 50 fields per second, which is obviously correct.  And my values make 
no sense at all.  But from what I can see the spec is straight-forward--these 
two values are simply u(32)'s, with no masking or other interpretation of any 
kind.
What am I missing?  Was there some kind of addendum to the spec since the 
version I'm looking at?  Or some other text I'm missing?  
Thanks for any help,
Glenn


More information about the Mp4-tech mailing list