# HG changeset patch # User michael # Date 1080697497 0 # Node ID 68baf8877c07cd4df05444f66a8205afec2fe3fa # Parent 9aabf1beeb4f924f0085d5e3c98012c56e9df352 reversing the change to the forw/backw pointers, its somewhat simpler to update it if the forward pointer is first much more efficient encoding of the frame_code table stream_id -> stream_id_plus1, that way 0 is the special case instead of stream_count and we can be sure the table needs only 8bit per entry replace timestamp_msb by timestamp (and obviously dont code the lsb if the whole is coded) thats simpler and more compact add a msb_timestamp flag to the frame_code[].flags diff -r 9aabf1beeb4f -r 68baf8877c07 DOCS/tech/mpcf.txt --- a/DOCS/tech/mpcf.txt Tue Mar 30 10:58:41 2004 +0000 +++ b/DOCS/tech/mpcf.txt Wed Mar 31 01:44:57 2004 +0000 @@ -67,8 +67,8 @@ Bitstream syntax: packet header + forward ptr v backward ptr v - forward ptr v align_byte while(not byte aligned) @@ -88,12 +88,21 @@ version v stream_count v checksum_threshold v - for(i=0; i<256; i++){ - flags[i] v - if(flags&64){ - stream_id[i] v - lsb_size[i] v - data_size_mul[i] v + for(i=0; i<256; ){ + tmp_flag v + tmp_stream v + tmp_mul v + tmp_size v + count v + for(j=0; j= tmp_mul){ + tmp_size=0; + tmp_stream++; + } } } reserved_bytes @@ -110,7 +119,7 @@ time_base_nom v time_base_denom v msb_timestamp_shift v - inital_timestamp_predictor v(3) + initial_timestamp_predictor v(3) initial_data_size_predictor v(2) fixed_fps u(1) index_flag u(1) @@ -148,14 +157,15 @@ if(flags[frame_code]&1){ packet header } - if(stream_id[frame_code]==stream_count){ + if(stream_id_plus1[frame_code]==0){ stream_id v } - if(frame_type == 2){ - msb_timestamp v - } - if((flags[frame_code]&12) == 12){ - lsb_timestamp v + if(flags[frame_code]&16){ + if(flags[frame_code]&4){ + timestamp v + }else{ + lsb_timestamp v + } } if(flags[frame_code]&2){ data_size_msb v @@ -302,30 +312,29 @@ different from the first byte of any startcode flags[frame_code] - the bits of the flags from MSB to LSB are CKKTTDP + the bits of the flags from MSB to LSB are KKTTTDP P is 1 for type 1 and 2 packets, 0 for type 0 packets - TT is the timestamp_code 00,01,10 use the last timestamp + the first, - second and third last unique timestamp difference, so if the - timestamp differences, are +3,+1,+2,+2,+1 then last diff is + TTT is the timestamp_code, 000,001,010 use the last timestamp + the + first, second and third last unique timestamp difference, so if + the timestamp differences, are +3,+1,+2,+2,+1 then last diff is +1, second is +2 and third is +3 - if TT is 11, then the timestamp is calculated by + 100,101 mean that the lsb or full timestamp is coded + if TTT is 100, then the timestamp is calculated by mask = (1< no keyframe, 01-> keyframe, 10-> equal to last of the same stream, 11-> opposite from last of the same stream KK must be 00 or 01 if the packet_type is not 0 - if C is 1 then stream_id, data_size_mul and data_size_lsb are not - stored, but predicted from the last ones - the value 1000001 (65) is used to mark illegal frame_code bytes, at - least flags[78] must be 65 + flags=1 can be used to mark illegal frame_code bytes + frame_code=78 must have flags=1 frame_type 0       is indicated by (flags[frame_code]&1)==0 @@ -334,22 +343,17 @@ there SHOULD not be more then 0.5 seconds or 16kbyte of type 0 frames wihout a intervening frame of different frame_type -stream_id[frame_code] - if its not coded in the main_header then its equal to the last one - from the main header +stream_id_plus1[frame_code] must be <250 + if its 0 then the stream_id is coded in the frame data_size_mul[frame_code] - if its not coded in the main_header then its equal to the last one - from the main header must be <250 data_size_lsb[frame_code] - if its not coded in the main_header then its equal to the last one - from the main header + 1 must be <250 -data_size +data_size if(data_size_lsb == data_size_mul) data_size= last; else if(data_size_lsb == data_size_mul+1) @@ -360,18 +364,15 @@ last and next last are reset to the values stored in the stream header if an frame with type > 0 is encountered -msb_timestamp - most significant bits of the timestamp, SHOULD be 0 for the first frame - lsb_timestamp least significant bits of the timestamp in time_base precission Example: IBBP display order - keyframe msb_timestamp=0 lsb_timestamp=0 -> timestamp=0 + keyframe timestamp=0 -> timestamp=0 frame lsb_timestamp=3 -> timestamp=3 frame lsb_timestamp=1 -> timestamp=1 frame lsb_timestamp=2 -> timestamp=2 ... - keyframe msb_timestamp=1 lsb_timestamp=1 -> timestamp=257 + keyframe msb_timestamp=257 -> timestamp=257 frame lsb_timestamp=255->timestamp=255 frame lsb_timestamp=0 -> timestamp=256 frame lsb_timestamp=4 -> timestamp=260