Mercurial > mplayer.hg
comparison DOCS/tech/mpcf.txt @ 12261:d43f1c599701
remove data_size prediction
merge lsb and full timestamp
maybe clarify flags
author | michael |
---|---|
date | Fri, 23 Apr 2004 15:48:17 +0000 |
parents | 362cf8df665e |
children | a6b64a263ca2 |
comparison
equal
deleted
inserted
replaced
12260:9d7e95b0a7e5 | 12261:d43f1c599701 |
---|---|
119 language_code vb | 119 language_code vb |
120 time_base_nom v | 120 time_base_nom v |
121 time_base_denom v | 121 time_base_denom v |
122 msb_timestamp_shift v | 122 msb_timestamp_shift v |
123 initial_timestamp_predictor v(3) | 123 initial_timestamp_predictor v(3) |
124 initial_data_size_predictor v(2) | |
125 fixed_fps u(1) | 124 fixed_fps u(1) |
126 index_flag u(1) | 125 index_flag u(1) |
127 reserved u(6) | 126 reserved u(6) |
128 for(;;){ | 127 for(;;){ |
129 codec_specific_data_type v | 128 codec_specific_data_type v |
155 } | 154 } |
156 frame_code f(8) | 155 frame_code f(8) |
157 if(stream_id_plus1[frame_code]==0){ | 156 if(stream_id_plus1[frame_code]==0){ |
158 stream_id v | 157 stream_id v |
159 } | 158 } |
159 if((flags[frame_code]&3)==3){ | |
160 coded_timestamp v | |
161 } | |
160 if(flags[frame_code]&4){ | 162 if(flags[frame_code]&4){ |
161 if(flags[frame_code]&1){ | |
162 timestamp v | |
163 }else{ | |
164 lsb_timestamp v | |
165 } | |
166 } | |
167 if(flags[frame_code]&8){ | |
168 data_size_msb v | 163 data_size_msb v |
169 } | 164 } |
170 data | 165 data |
171 | 166 |
172 Index: | 167 Index: |
293 48000 1024 375 8 | 288 48000 1024 375 8 |
294 Note: the advantage to using a large sample_rate_mul is that the | 289 Note: the advantage to using a large sample_rate_mul is that the |
295 timestamps need fewer bits | 290 timestamps need fewer bits |
296 | 291 |
297 msb_timestamp_shift | 292 msb_timestamp_shift |
298 amount of bits msb_timestamp is shifted left before adding lsb_timestamp | 293 amount of bits in lsb_timestamp |
299 MUST be <16 | 294 MUST be <16 |
300 | 295 |
301 fixed_fps | 296 fixed_fps |
302 1 indicates that the fps is fixed | 297 1 indicates that the fps is fixed |
303 | 298 |
323 the meaning of this byte is stored in the main header | 318 the meaning of this byte is stored in the main header |
324 the value 78 ('N') is forbidden to ensure that the byte is always | 319 the value 78 ('N') is forbidden to ensure that the byte is always |
325 different from the first byte of any startcode | 320 different from the first byte of any startcode |
326 | 321 |
327 flags[frame_code] | 322 flags[frame_code] |
328 the bits of the flags from MSB to LSB are KDTTT | 323 the bits of the flags from MSB to LSB are KDTT |
329 TTT is the timestamp_code, 000,001,010 use the last timestamp + the | 324 TT is the timestamp_code |
330 first, second and third last unique timestamp difference, so if | 325 00,01,10 predicted delta timestamps |
331 the timestamp differences, are +3,+1,+2,+2,+1 then last diff is | 326 11 timestamp coded, either lsb or full timestamp |
332 +1, second is +2 and third is +3 | 327 |
333 100,101 mean that the lsb or full timestamp is coded | 328 predicted delta timestamp use the last timestamp from the |
334 if TTT is 100, then the timestamp is calculated by | 329 current stream + the first, second and third last unique |
335 mask = (1<<msb_timestamp_shift)-1; | 330 timestamp difference, so if the timestamp differences, where |
336 delta= last_timestamp - mask/2 | 331 +3,+1,+2,+2,+1 then last difference is +1, second is +2 and |
337 timestamp= ((timestamp_lsb-delta)&mask) + delta | 332 third is +3 |
338 TTT must be 101 if the packet_type is not 0 | 333 predicted delta timestamps MUST NOT be used in type > 0 frames |
339 the last timestamp differences are reset to the | 334 or in type 0 frames if there was no full timestamp in the |
335 current stream after the last type > 0 frame | |
336 | |
337 the least recent used delta timestamps are reset to the | |
340 initial_timestamp_predictor values from the stream header if a | 338 initial_timestamp_predictor values from the stream header if a |
341 packet of type not 0 in encountered | 339 packet of type not 0 in encountered |
342 if D is 1 then data_size_msb is coded, otherwise its 0 | 340 if D is 1 then data_size_msb is coded, otherwise data_size_msb is 0 |
343 K is the keyframe_type | 341 K is the keyframe_type |
344 0-> no keyframe, | 342 0-> no keyframe, |
345 1-> keyframe, | 343 1-> keyframe, |
346 flags=7 can be used to mark illegal frame_code bytes | 344 flags=16 can be used to mark illegal frame_code bytes |
347 frame_code=78 must have flags=7 | 345 frame_code=78 must have flags=16 |
348 | 346 |
349 frame_type | 347 frame_type |
350 if the first byte of a frame is 'N' then the frame_type is 2 otherwise | 348 if the first byte of a frame is 'N' then the frame_type is 2 otherwise |
351 its 0 | 349 its 0 |
352 there SHOULD not be more then 0.5 seconds or 16kbyte of type 0 frames | 350 there SHOULD not be more then 0.5 seconds or 16kbyte of type 0 frames |
367 | 365 |
368 data_size_lsb[frame_code] | 366 data_size_lsb[frame_code] |
369 must be <250 | 367 must be <250 |
370 | 368 |
371 data_size | 369 data_size |
372 if(data_size_lsb == data_size_mul) | 370 data_size= data_size_lsb + data_size_msb*data_size_mul; |
373 data_size= last; | 371 |
374 else if(data_size_lsb == data_size_mul+1) | 372 coded_timestamp |
375 data_size= next_last; | 373 if coded_timestamp < (1<<msb_timestamp_shift) then its a |
376 else if(data_size_lsb < data_size_mul) | 374 lsb timestamp, otherwise its a full timestamp + (1<<msb_timestamp_shift) |
377 data_size= data_size_lsb + data_size_msb*data_size_mul; | 375 lsb timestamps are converted to full timesamps by: |
378 else reserved | 376 mask = (1<<msb_timestamp_shift)-1; |
379 next_last is the second last unique data_size, for example: | 377 delta= last_timestamp - mask/2 |
380 previous data_size: 123,500,312,500,500 last=500, next_last=312 | 378 timestamp= ((timestamp_lsb-delta)&mask) + delta |
381 last and next_last are reset to the initial_data_size_predictor values | 379 a full timestamp must be used if the packet_type is not 0 or there is no |
382 stored in the stream header if an frame with type > 0 is encountered | 380 reference timestamp available after the last not 0 frame with the |
383 | 381 current stream_id |
382 | |
384 lsb_timestamp | 383 lsb_timestamp |
385 least significant bits of the timestamp in time_base precission | 384 least significant bits of the timestamp in time_base precission |
386 Example: IBBP display order | 385 Example: IBBP display order |
387 keyframe timestamp=0 -> timestamp=0 | 386 keyframe timestamp=0 -> timestamp=0 |
388 frame lsb_timestamp=3 -> timestamp=3 | 387 frame lsb_timestamp=3 -> timestamp=3 |