1. 程式人生 > >關於MPEG2中的影象序列和影象組頭GOP

關於MPEG2中的影象序列和影象組頭GOP

影象序列

影象序列是由影象組構成的,是隨機存取段落

sequence_header_code – The sequence_header_code is the bit string ‘000001B3’ in hexadecimal

sequence_end_code – The sequence_end_code is the bit string ‘000001B7’ in hexadecimal.

MPEG-2為了實現隨機訪問,在碼流中會插入repeat_sequence_header,它可以插在I、P幀或GOP前面;假如是場編碼,只能插在第一場前面。

影象組頭

影象組(GOP)是為方便隨機存取而加的,影象組是隨機存取視訊單位

。一個GOP由一串IBP幀組成,起始為I幀。基準幀(I/P)的反覆頻率用M表示,它描述為多少幀裡出現一次I/P幀。GOP的長度是一個I幀到下一個I 幀的間隔,即多少幀裡面出現一次I幀,一般用N表示,這個長度是可變的,長GOP可以提供高的壓縮比,但是會造成隨機存取的延遲(必須等到下一個I幀)和誤差的積累(P幀的誤差傳播)。一般是一秒內有兩個I幀,用來作為隨機存取的入口。在MPEG2中也沒有規定GOP的結構,幀反覆方式可以是IP,IB,IBP,IBBP,甚至全部是I幀。

M=1 N=X:IPPP...

M=2 N=X:IBPBP...

M=3 N=X:IBBPBBP...

MPEG-2標準中的GOP語法結構如下:

group_start_code – The group_start_code is the bit string ‘000001B8’ in hexadecimal.

closed_gop – This is a one-bit flag which indicates the nature of the predictions used in the first consecutive B-pictures (if any) immediately following the first coded I-frame following the group of picture header.closed_gop is set to ‘1’ to indicate that these B-pictures have been encoded using only backward prediction or intracoding.

broken_link – This is a one-bit flag which shall be set to ‘0’ during encoding. It is set to ‘1’ to indicate that the first
consecutive B-Pictures (if any) immediately following the first coded I-frame following the group of picture header may not be correctly decoded because the reference frame which is used for prediction is not available (because of the action of editing).A decoder may use this flag to avoid displaying frames that cannot be correctly decoded.

http://lyj2682.spaces.live.com/blog/cns!177B1314D2038BE4!142.entry