Rate control for mpeg transcoder without a priori knowledge of picture type
Abstract
A rate control system suitable for use with a digital video transcoder, such as one conforming to the MPEG standard. The proposed rate control system starts coding with any reasonable set of assumed Group of Pictures (GOP) parameters, thereby avoiding a processing delay of about one GOP which would otherwise be incurred to extract the complete GOP structure information from a pre-compressed bit stream. In addition, the system avoids the need to store the data corresponding to the GOP, thereby reducing the memory required for transcoding. Encoding of a first picture in a sequence or GOP begins without a priori knowledge of the picture type of subsequent pictures. A reasonable set of GOP parameters is assumed to determine an encoding bit budget. The bit budget is gradually corrected as successive pictures are coded according to their picture types. Changes in the GOP structure of pre-compressed bitstreams can be addressed, for example, when switching channels, inserting commercials, and the like. Target rates with incorrect starting GOP parameters will converge within a few GOPs.

Term
Term ended
Expired 18 October 2019, 6.9 years ago.
- Priority
- Filed
- Granted
- Expired
- Today
76 claims: 37 independent, 39 dependent
- 1CA 02286640 1999-10-18 What is claimed is :1. A method for allocating bits for coding pictures in a bitstream received at a digital video transcoder, comprising the steps of: (a) providing an assumed distance M' between a first picture of said bitstream and the next closest subsequent P-picture of said bitstream in a display order of said bitstream;(b) providing an assumed bit budget as a function of said assumed distance M';(c) coding said first picture in accordance with said assumed bit budget;(d) determining a picture type of a second picture that immediately follows said first picture in said bitstream in an encoding order of said bit stream;(e) adjusting said assumed bit budget according to said picture type of said second picture;and (f) allocating bits for coding said second picture in accordance with said adjusted bit budget.
- 4The method of one of claims 1 to 3, wherein said first picture is a P-picture and said second picture is a B-picture, comprising the further step of:determining an actual distance M' 1 between said first picture and said next closest subsequent Ppicture, in said display order, according to said picture type of said second picture.
- 13A method for allocating bits for coding a sequence of pictures in a bitstream received at a digital video transcoder, comprising the steps of:(a) providing an assumed length Ν' of a particular group of pictures (GOP) of said bitstream;(b) providing an assumed bit budget as a function of said assumed length Ν';(c) allocating bits for coding a first picture of said particular GOP in accordance with said assumed bit budget ;(d) determining a picture type of a second picture that immediately follows said first picture;(e) adjusting said assumed bit budget according to said picture type of said second picture;and (f) allocating bits for coding said second picture in accordance with said adjusted bit budget. CA 02286640 1999-10-18
- 19The method of one of claims 13 to 18, comprising the further step of:providing an assumed distance M’ between said first picture and the next closest subsequent P-picture of said bitstream, in a display order of said bitstream;wherein said bits are allocated for coding said first picture in said step (c) in accordance with said assumed distance M'.
- 25The method of one of claims 20 to 24, comprising the further steps of:determining if N'' N, an actual length of said particular GOP, after coding N'' pictures in said particular GOP;and, if N'' N: further adjusting said adjusted bit budget according to N and N'';and allocating bits for coding pictures in said bitstream following the N 11 coded pictures according to said further adjusted bit budget. 26
- 26The method of one of claims 20 to 24, comprising the further steps of:determining if N’’ N, an actual length of said particular GOP, after coding N' 1 pictures in said particular GOP;and, if Ν' 1 N : further adjusting said adjusted bit budget according to M=M'';and allocating bits for coding pictures in said bitstream following the Ν'' coded pictures according to said further adjusted bit budget. CA 02286640 1999-10-18
- 32The method of one of claims 28 to 31, comprising the further step of:determining if N’’ N, an actual length of said particular GOP, after coding Ν’’ pictures in said particular GOP;and, if N'' N: further adjusting said adjusted bit budget according to N and Ν'';and allocating bits for coding pictures in said bitstream following the N’’ coded pictures according to said further adjusted bit budget.
- 33The method of one of claims 28 to 32, comprising the further steps of:CA 02286640 1999-10-18 determining if N'' N, an actual length of said particular GOP, after coding Ν'' pictures in said particular GOP;and, if N'' N: further adjusting said adjusted bit budget according to M=M*';and allocating bits for coding pictures in said bitstream following the N'' coded pictures according to said further adjusted bit budget.
- 35The method of one of claims 13 to 34, comprising the further step of:accounting for changes in an actual distance M'' between I-pictures and/or P-pictures in said particular GOP by determining an actual distance M’' between an Ipicture or P-picture that follows said first picture in said particular GOP, in a display order of said bitstream, and a subsequent I-picture or P-picture in said particular GOP;and adjusting said assumed bit budget in accordance with said actual distance M 1 '. CA 02286640 1999-10-18
- 36An apparatus for allocating bits for coding pictures in a bitstream received at a digital video transcoder, comprising:(a) means for providing an assumed distance M’ between a first picture of said bitstream and the next closest subsequent P-picture of said bitstream in a display order of said bitstream;(b) means for providing an assumed bit budget as a function of said assumed distance M';(c) means for coding said first picture in accordance with said assumed bit budget;(d) means for determining a picture type of a second picture that immediately follows said first picture in said bitstream in an encoding order of said bit stream;(e) means for adjusting said assumed bit budget according to said picture type of said second picture;and (f) means for allocating bits for coding said second picture in accordance with said adjusted bit budget.
- 39The apparatus of one of claims 36 to 38, wherein said first picture is a P-picture and said second picture is a B-picture, further comprising:means for determining an actual distance M'' between said first picture and said next closest subsequent P-picture, in said display order, according to said picture type of said second picture.
- 43The apparatus of one of claims 36 to 42, wherein said first and second pictures are P-pictures, further comprising:means for determining an actual distance M'' between said first picture and said next closest subsequent P-picture, in said display order, according to said picture type of said second picture.
- 48An apparatus for allocating bits for coding a sequence of pictures in a bitstream received at a digital video transcoder, comprising:(a) means for providing an assumed length Ν' of a particular group of pictures (GOP) of said bitstream;(b) means for providing an assumed bit budget as a function of said assumed length Ν';(c) means for allocating bits for coding a first picture of said particular GOP in accordance with said assumed bit budget;(d) means for determining a picture type of a second picture that immediately follows said first picture ;CA 02286640 1999-10-18 (e) means for adjusting said assumed bit budget according to said picture type of said second picture;and (f) means for allocating bits for coding said second picture in accordance with said adjusted bit budget.
- 54The apparatus of one of claims 48 to 53, further comprising:means for providing an assumed distance M' between said first picture and the next closest subsequent Ppicture of said bitstream, in a display order of said bitstream;wherein said bits are allocated for coding said first picture by said coding means (c) in accordance with said assumed distance M'. CA 02286640 1999-10-18
- 60The apparatus of one of claims 55 to 59, further comprising:means for determining if Ν'' N, an actual length of said particular GOP, after coding Ν'' pictures in said particular GOP;means for further adjusting said adjusted bit budget according to N and N'' if N'' N;and means for allocating bits for coding pictures in said bitstream following the N'' coded pictures according to said further adjusted bit budget if N'' N.
- 61The apparatus of one of claims 55 to 59, further comprising:means for determining if Ν'' N, an actual length of said particular GOP, after coding N 1 ' pictures in said particular GOP;CA 02286640 1999-10-18 means for further adjusting said adjusted bit budget according to M=M' 1 if N'' N;and means for allocating bits for coding pictures in said bitstream following the N'' coded pictures according to said further adjusted bit budget if N'' N.
- 67The apparatus of one of claims 63 to 66, further comprising:means for determining if N'' N, an actual length of said particular GOP, after coding N' 1 pictures in said particular GOP;means for further adjusting said adjusted bit budget according to N and Ν' 1 if Ν' ' N;and CA 02286640 1999-10-18 means for allocating bits for coding pictures in said bitstream following the N 1 ' coded pictures according to said further adjusted bit budget if N'' N.
- 68The apparatus of one of claims 63 to 66, further comprising:means for determining if N*' N, an actual length of said particular GOP, after coding Ν'' pictures in said particular GOP;means for further adjusting said adjusted bit budget according to M=M’' if N'' N;and means for allocating bits for coding pictures in said bitstream following the N'' coded pictures according to said further adjusted bit budget if N' 1 N.
- 70The apparatus of one of claims 48 to 69, further comprising:means for accounting for changes in an actual distance M'' between I-pictures and/or P-pictures in said particular GOP by determining an actual distance M'' between an I-picture or P-picture that follows said first picture in said particular GOP, in a display CA 02286640 1999-10-18 order of said bitstream, and a subsequent I-picture or P-picture in said particular GOP;and means for adjusting said assumed bit budget in accordance with said actual distance M''.
- 71A method for allocating bits for coding a sequence of pictures in a bitstream received at a digital video transcoder, comprising the steps of:(a) providing a length of groups of pictures (GOPs) of said bitstream;(b) providing a distance between each I-picture and a next successive P-picture in said GOPs;(c) maintaining a count of a number of remaining I-, P- and B-pictures, respectively, in each GOP as each picture in said GOPs is coded;(d) providing an assumed bit budget in response to said steps (a), (b) and (c) for coding pictures in said GOPs;(e) verifying, and adjusting, if necessary, said length after each I-picture in said GOPs is coded;(f) verifying, and adjusting, if necessary, said distance after each I-picture and/or P-picture in said GOPs is coded;(g) verifying, and adjusting, if necessary, the count of the number of remaining I-, P- and B-pictures, in response to said steps (e) and (f);and (g) adjusting, if necessary, said assumed bit budget in response to said steps (e), (f) and (g). CA 02286640 1999-10-18
- 74An apparatus for allocating bits for coding a sequence of pictures in a bitstream received at a digital video transcoder, comprising:(a) means for providing a length of groups of pictures (GOPs) of said bitstream;(b) means for providing a distance between each Ipicture and a next successive P-picture in said GOPs;(c) means for maintaining a count of a number of remaining I-, P- and B-pictures, respectively, in each GOP as each picture in said GOPs is coded;(d) means for providing an assumed bit budget in response to said means (a), (b) and (c) for coding pictures in said GOPs;(e) means for verifying, and adjusting, if necessary, said length after each I-picture in said GOPs is coded;CA 02286640 1999-10-18 (f) means for verifying, and adjusting, if necessary, said distance after each I-picture and/or P picture in said GOPs is coded;(g) means for verifying, and adjusting, if necessary, the count of the number of remaining I-, Pand B-pictures, in response to said means (e) and (f);and (g) means for adjusting, if necessary, said assumed bit budget in response to said means (e), (f) and (g).
Independent claims37
483 paragraphs in 59 sections, as filed
CA 02286640 1999-10-18
RATE CONTROL FOR MPEG TRANSCODER WITHOUT A PRIORI KNOWLEDGE OF PICTURE TYPE
The present invention relates to a digital video transcoder and method for allocating bits for encoding successive pictures in a group of pictures (GOP) without a priori knowledge of the picture types in the GOP.
With digital video coding standards such as MPEG, input pictures can be coded in three different picture types, namely I, P and B. The three pictures require quite different numbers of bits for encoding because of the different nature of their temporal processing. Hence, an intelligent bit allocation strategy should assign a number of bits for encoding according to the picture's type. This implies a requirement of a priori knowledge of the picture types for a given bit budget. This requirement is not a problem for a standalone encoder as the encoder can determine the picture type for each input picture.
In fact, the encoder can plan ahead for the types of the input pictures. In contrast, a transcoder has no such a priori knowledge regarding a picture's type before actually processing the picture. This creates difficulty in allocating an appropriate number of bits for encoding pictures in a transcoder.
CA 02286640 1999-10-18
Accordingly, it would be desirable to have a method and apparatus for allocating bits for encoding pictures in a transcoder without a priori knowledge of the picture type. The system should avoid a processing delay of about one GOP which would otherwise be incurred to extract the complete GOP structure information from a pre-compressed bit stream. In addition, the system should avoid the need to store the data corresponding to the GOP, thereby reducing the memory required for transcoding.
The system should be compatible with both variable bit rate and constant bit rate bitstreams.
The system should be compatible with 15 statistical multiplexing and remultiplexing systems.
The present invention provides an apparatus and method having the above and other advantages.
CA 02286640 1999-10-18
The present invention relates to a digital video transcoder and method for allocating bits for encoding successive pictures in a group of pictures (GOP) without a priori knowledge of the arrangement of picture types in the GOP.
1. Progressive Refresh Sequence:
A method for allocating bits for coding a progressive refresh sequence of pictures in a bitstream received at a digital video transcoder includes the steps of: (a) providing an assumed distance M' between a first picture of the bitstream and the next closest subsequent P-picture of the bitstream (in display order); (b) providing an assumed bit budget as a function of the assumed distance M'; (c) coding the first picture in accordance with the assumed bit budget; (d) determining a picture type of a second picture that immediately follows the first picture in the bitstream; (e) adjusting the assumed bit budget according to the picture type of the second picture; and (f) allocating bits for coding the second picture in accordance with the adjusted bit budget.
Thus, a bit budget for coding the pictures is initially assumed for the first picture, and the bit budget is updated as the second picture type is known. A target number of bits is allocated for coding each picture according to the bit budget.
CA 02286640 1999-10-18
The first and second picture types generally indicate the picture distribution in the sequence.
The assumed bit budget is proportional to the assumed distance and a bit rate of the bitstream, and inversely proportional to a frame rate of the bitstream.
The pictures in the bitstream may form a progressive refresh sequence, where there is no GOP structure .
1.1 P-picture followed by B-picture:
When the first picture is a P-picture and the second picture is a B-picture, the method includes the further step of: determining an actual distance M’' between the first picture and the next closest subsequent P-picture (in display order) according to the picture type of the first picture and the picture type of the second picture.
The actual distance M’' is determined according to a difference between a temporal reference of the first picture, in a display order of the bitstream, and a temporal reference of the second picture, in the display order, plus one picture.
The method may include the further step of allocating bits for coding the remaining M’’-l pictures following the first picture in accordance with the adjusted bit budget.
The assumed bit budget is adjusted in the adjusting step (f) by + (M''-M') *bit rate/frame rate, where bit rate is a bit rate of the
CA 02286640 1999-10-18 bitstream, and frame rate is a frame rate of the bitstream.
1.2 P-picture followed by P-picture:
When the first and second pictures are Ppictures, the method includes the further step of: determining an actual distance M’' between the first picture and the next closest subsequent P-picture (in display order) according to the picture type of the first picture and the picture type of the second picture. The actual distance M'' is determined according to a difference between a temporal reference of the second picture and a temporal reference of the first picture. The temporal references are determined in relation to a display order of the bitstream.
The assumed bit budget is adjusted in the adjusting step (f) by -(M'-l)*bit rate/frame rate, where bit rate is a bit rate of the bitstream, and frame rate is a frame rate of the bitstream.
The method includes the further step of allocating bits for coding a series of M’' pictures following an initial M'' pictures that includes the first and second pictures in the bitstream in accordance with the adjusted bit budget. Thus, the adjustments to the bit budget in one series of pictures is carried over to the next series to allow correct coding of the next series.
CA 02286640 1999-10-18
2, Non-progressive Refresh Sequence:
Generally, the invention enables transcoding to begin by assuming a reasonable set of GOP parameters, including M, the distance between each I-picture and the next P-picture, and N, the GOP length. M and N are adjusted during transcoding as additional information becomes available regarding the GOP structure, e.g., the distribution of picture types in the GOP and the length of the GOP.
The assumed M can be corrected to the actual value within two frames, and the assumed N can be corrected to the actual value within one GOP. M should be verified, and adjusted if necessary, after each I- or P-picture, and N should be verified, and adjusted if necessary, after each I-picture. When M and/or N are adjusted, a bit rate R for coding the pictures, and ni, n<sub>P</sub>, and n<sub>B</sub>, the remaining numbers of I, P and B-pictures in the current GOP, respectively, are also adjusted.
A method for allocating bits for coding a nonprogressive refresh sequence of pictures in a bitstream received at a digital video transcoder, includes the steps of: (a) providing an assumed length Ν' of a particular group of pictures (GOP) of the bitstream; (b) providing an assumed bit budget as a function of the assumed length Ν'; providing an assumed distance M' between the first picture and the next closest subsequent P-picture of the bitstream (in display order); (c) allocating bits for coding a first picture of the particular GOP in accordance with the assumed bit budget, and Ν' and
CA 02286640 1999-10-18
Μ' ; (d) determining a picture type of a second picture that immediately follows the first picture; (e) adjusting the assumed bit budget according to the picture type of the second picture; and (f) allocating bits for coding the second picture in accordance with the adjusted bit budget.
The assumed bit budget is proportional to the assumed length Ν' and a bit rate of the bitstream, and inversely proportional to a frame rate of the bitstream.
M'' may change within a GOP. Thus, the method may include the step of periodically verifying M’' throughout the GOP. For example, M'' may be calculated at every I-picture and/or P-picture that follows the first I-picture. The assumed bit budget is adjusted each time in accordance with M’’.
2.1 I-picture followed by I-picture:
When the first and second pictures are Ipictures, the method comprises the further step of: determining an actual distance M'' between the first picture and the next closest subsequent I-picture of the bitstream according to the picture type of the second picture, and adjusting the assumed bit budget in accordance with M''
The actual distance M'' is determined according to a difference between a temporal reference of the second picture, in a display order of the bitstream, and a temporal reference of the first picture, in the display order.
CA 02286640 1999-10-18
The adjusting step (e) comprises the step of: adjusting the assumed bit budget by -(N'-l)*bit rate/frame rate, where bit rate” is a bit rate of the bitstream, frame rate is a frame rate of the bitstream, and N=M=M''.
The method comprises the further step of: allocating bits for coding the remaining pictures in the particular GOP following the second picture in accordance with the adjusted bit budget.
2.2 I-picture followed by P-picture:
When the first picture is an I-picture and the second picture is a P-picture, the method comprises the further steps of: determining an actual distance M'' between the first picture and the next closest subsequent P-picture (in display order) according to the picture type of the second picture; and adjusting the assumed length Ν' of the GOP in accordance with the actual distance M'' to provide an adjusted assumed length Ν''; wherein: the adjusting step (e) is responsive to the adjusted assumed length Ν' .
The assumed length Ν' of the particular GOP is adjusted in the adjusting step thereof by a factor, M(N’/M<sup>T</sup>'), where M=M'', to provide the adjusted assumed length Ν''.
The adjusting step (e) comprises the step of: adjusting the assumed bit budget by a factor (Ν''N')*bit rate/frame rate, where bit rate is a bit rate of the bitstream, and frame rate is a frame rate of the bitstream.
CA 02286640 1999-10-18
The adjusting step (e) comprises the still further step of: adjusting the assumed bit budget by a factor, (M’'-1') *bit rate/frame rate, where bit rate is a bit rate of the bitstream, frame rate is a frame rate of the bitstream, and M=M''.
Thus, both the GOP length and the distance M are used to adjust the bit budget, which in turn affects the target bit allocation for each picture.
The method includes the further step of allocating bits for coding the remaining pictures in the particular GOP following the second picture in accordance with the adjusted bit budget.
The method includes the further steps of determining if N’’>N or N’’<N, where N is an actual length of the current GOP, after coding Ν'' pictures in the current GOP. This is accomplished by observing the picture that is reached after coding N’' pictures. For example, if the picture reached after coding Ν'' pictures is a P-picture in the current GOP, then N’’<N. If the picture reached after coding Ν'' pictures is an I-picture, this signals the start of the next GOP, so Ν''=N. If an I-picture is coded before the Ν'' are all coded, this indicates N’’>N. The already adjusted bit budget is then further adjusted based on whether Ν''<N or N''>N, and bits are allocated for coding pictures in the bitstream following the Ν'' coded pictures according to the further adjusted bit budget.
CA 02286640 1999-10-18
2.3 I-picture followed by B-picture:
When the first picture is an I-picture and the second picture is a B-picture, the method comprises the further steps of: determining an actual distance M'' between the first picture and the next closest subsequent P-picture (in display order) according to the picture type of the second picture; and adjusting the assumed length N’ of the GOP in accordance with the actual distance M'' to provide an adjusted assumed length N’’; wherein: the adjusting step (e) is responsive to the adjusted assumed length Ν' .
The assumed length Ν' of the particular GOP is adjusted in the adjusting step thereof by a factor, M(N'/M'<sup>r</sup>), where M=M'', to provide the adjusted assumed length Ν''.
The adjusting step (e) comprises the step of: adjusting the assumed bit budget by a factor (N''N')*bit rate/frame rate, where bit rate is a bit rate of the bitstream, and frame rate is a frame rate of the bitstream.
The method comprises the further steps of: allocating bits for coding the remaining pictures in the particular GOP following the second picture in accordance with the adjusted bit budget.
Additionally, as discussed above, the already adjusted bit budget may be further adjusted based on whether N''<N or N'<sup>T</sup>>N, and bits may be allocated for coding pictures in the bitstream following the Ν'' coded pictures according to the further adjusted bit budget.
CA 02286640 1999-10-18
Thus, the information learned regarding GOP length and M, the distance between I and/or Ppictures, in one GOP are used in coding the following GOPs. Target rates with incorrect starting GOP parameters will converge within a few GOPs .
Corresponding apparatus structures are also presented.
CA 02286640 1999-10-18
FIG. 1 (a) illustrates a progressive refresh sequence of pictures in display order for continuing GOPs .
FIG. 1(b) illustrates the sequence of pictures of FIG. 1(a) in encoding order.
FIG. 2(a) illustrates a progressive refresh sequence of pictures in display order for an initial GOP in a bitstream followed by continuing GOPs.
FIG. 2 (b) illustrates the sequence of pictures of FIG. 2(a) in encoding order.
FIG. 3 illustrates an MPEG-2 bitstream structure .
FIG. 4(a) illustrates a coding method for a progressive refresh picture sequence in accordance with the present invention.
FIG. 4(b) illustrates a coding method for a non-progressive refresh picture sequence in accordance with the present invention.
FIG. 4(c) illustrates a continuation of the coding method of FIG. 4(b) in accordance with the present invention.
FIG. 5 illustrates an estimated GOP length Ν'' in accordance with the present invention.
FIG. 6 illustrates a rate control system in accordance with the present invention.
FIGs 7(a)-7(d) illustrate a C-language flowchart for implementing the present invention.
CA 02286640 1999-10-18
The present invention relates to a digital video transcoder and method for allocating bits for encoding successive pictures in a group of pictures (GOP) without a priori knowledge of the picture types in the GOP.
A novel rate control scheme and apparatus is presented for a digital video transcoder, such as one conforming to the MPEG standard, that requires no a priori (e.g., beforehand) knowledge of the picture types. Studies indicate that the picture target rates determined by the proposed rate control system with and without a priori knowledge of the picture types are very close.
MPEG defines three picture types in terms of temporal processing. They are the intra-frame coded picture (I-picture), forward temporal predictive coded picture (P-picture), and the bi-directional temporal predictive coded picture (B-picture).. In MPEG video coding, pictures of an input video sequence are often grouped into groups of pictures (GOPs), where each GOP may contain one I-picture, a number of P-pictures, and optionally one or more Bpictures between I or P-pictures. The structure of a GOP can often be described by two variables: (1)
N - the number of pictures in a GOP, or the GOP length, and (2) M - the distance between I or Ppictures. An example of a GOP with N=15 and A/=3, in display order, is:
CA 02286640 1999-10-18 ' m-2^m-\nfim+\^m+1^m+3^'m+4^'m+5^m+6 ' ' m+N-2^m+N^m+N+l ' where the subscripts are the picture's temporal references, and the consecutive numbers denote consecutively displayed pictures.
In general, I-pictures require many more bits for encoding than P- and B-pictures because Ipictures do not take advantage of temporal correlations between successive pictures (e.g., frames) . B-pictures use the least numbers of. bits for encoding because they have two temporal references and can therefore be temporally predicted more efficiently than P-pictures. P-pictures use a number of bits for encoding that is generally between that used for B- and I-pictures.
Clearly, the bits assigned to each picture for encoding should be based on its type, or its need. Furthermore, a GOP can have all the three types of pictures, and the organization of the three picture types within a GOP can be very flexible. Therefore, to wisely allocate a bit budget for encoding the pictures within a GOP, it is necessary to have a priori knowledge of the types of pictures in the GOP, or the GOP structure. This requirement is not a problem for a standalone encoder (i.e., an encoder that is not part of a transcoder) since the encoder can decide the type for each picture, and plan ahead in allocating bits based on the type and arrangement of pictures in a GOP. In other words, the
CA 02286640 1999-10-18 information on GOP structure is available to the encoder.
In contrast to the standalone encoder, a transcoder converts a pre-compressed bitstream into another bitstream at a new rate. The inputs to a transcoder are pre-compressed bitstreams. Before processing a picture, the transcoder has no a priori knowledge of the picture's type, and hence no a priori knowledge of the GOP structures of the precompressed bitstreams.
Moreover, some transcoding schemes re-use the motion vector (MV) fields of the received precompressed bitstream for encoding the output bitstream at the new data rate. In this case, the picture types of the pre-compressed pictures are maintained. This means that the transcoder has no control of the GOP structures of the new output bitstreams .
Furthermore, with conventional schemes, it is possible for the GOP structure information to' be extracted from the pre-compressed bitstreams. For example, after scanning a pre-compressed bitstream by the first two I-pictures, a transcoder should be able to determine the GOP structure. However, this requires a processing delay of about one GOP and a requirement of extra memory to hold all the bits for the GOP.
The present invention discloses a novel rate control system for a digital video transcoder, such as that conforming to the MPEG standard, with no
CA 02286640 1999-10-18 requirement of a priori knowledge of the GOP structures of the pre-compressed bitstreams. A rate control scheme is disclosed that causes no processing delay and requires no extra memory. The scheme starts with any reasonable set of GOP parameters, and then gradually corrects these GOP parameters, if necessary, as successive precompressed pictures are received at the transcoder. The scheme compensates for changing GOP parameters used by the encoder(s).
Furthermore, we analyze the differences in target bit rates determined by the proposed rate control scheme with and without a priori knowledge of the GOP structure of the pre-compressed bitstream. We show that the target rates with and without a priori knowledge of GOP structure tend to be the same within only one or two GOPs. We demonstrate the differences in target rates in both numerical examples and real video sequences.
Below, in section 1, we will first overview the rate control for MPEG video coding. In section 2, we present the novel rate control for MPEG transcoder. In section 3, we analyze the differences in target rates determined by the proposed rate control with and without a priori knowledge of GOP structure. In section 4, we present the simulation and comparison results. Conclusions are discussed in section 5.
1. RATE CONTROL FOR MPEG VIDEO CODING
CA 02286640 1999-10-18
In MPEG video coding, pictures of all the three types (I, P or B) undergo the block Discrete Cosine Transform (DCT). The DCT coefficients are then quantized and variable length encoded. The resulting number of bits for each picture depends on the complexity of its corresponding block DCT image. I-pictures are coded without reference to any other pictures and, therefore, their DCT images usually require the most number of bits. P-pictures are first forward temporally predicted, and their temporal prediction difference images are then coded. The temporal prediction difference images usually contain much less information than the original pictures, and therefore need less bits for coding. B-pictures with two temporal references can often be better temporally predicted than Ppictures. Hence, B-pictures require the least number of bits. An intelligent bit allocation strategy should assign the bits to a picture based on the picture's type, or the picture's complexity.
Let X<sub>n</sub> be the complexity measure for picture n in a GOP of N pictures. In MPEG Test Model 5 (TM5), the complexity measure for a picture is defined as the product of the average quantization parameter used for the picture and the resulting number of bits. Logically, the bits allocated for a picture should be proportional to the picture's complexity measure, X<sub>n</sub>, i.e.,
T„ = CX<sub>n</sub> -I (1)
CA 02286640 1999-10-18 where C is a constant. Here, we have assumed a linear model between the picture complexity measure and the number of bits required for coding. Furthermore, without any bias, a GOP of N pictures should be allocated bits rate
R = N <sup>aop</sup>'<sup>N</sup> frame rate bits.
(2:
Clearly, the total number of bits assigned to all the pictures within a GOP of TVpictures should be equal to R<sub>GOPN</sub> / i.e., w-i w-i w-i
R<sub>mr</sub>., =Y.t,=Ycx. = cYx, (3) n=0 n=0
From equations (1) and (3), we have X„ p__<sup>n</sup> n <sup>1</sup>n TV-1 ^GOPfrJ
ΣΑ
Λ=0
Assume that all the pictures of the same type, i.e., I, P or B, have the same complexity measure, which is a reasonable assumption, at least for continuous scenes. We only need three complexity measures, one for each picture type. That is, Xj for I-pictures, X<sub>P</sub> for P-pictures, and X<sub>B</sub> for Bpictures. The target rate for frame n of type zef/.P.-S} and complexity measure X„<sub>t&</sub>{<sub>IPB</sub>} can therefore be written as:
7'
X..
N<sub>I</sub>X<sub>I</sub> + N<sub>P</sub>X<sub>P</sub>+N<sub>B</sub>X<sub>E</sub>
R.
GOF.N (5)
CA 02286640 1999-10-18 where Nj , N<sub>p</sub> and N<sub>B</sub> are the numbers of I, P and Bpictures, respectively, in the GOP. By eqn. (5), the pictures of the same type are assigned the same number of bits. This bit allocation strategy can be further modified by considering only the distribution of the remaining number of bits over the remaining pictures in the current GOP, i.e.,
HjXj + n<sub>p</sub>X<sub>p</sub> + n<sub>B</sub>X<sub>B</sub> where n<sub>7</sub> , n<sub>p</sub> and n<sub>B</sub> are, respectively, the remaining numbers of I, P and B-pictures in the current GOP, and R is the remaining number of bits, defined as ni «'=0 where <= denotes the assignment statement.
The remaining number of bits, R, needs to be updated at the beginning of each GOP as, bit rate
R — R + Rrnp r.j — R T N · ' <sup>aop</sup>-<sup>N</sup> frame rate (8:
We now show that eqn. (6) also assigns the same number of bits to the pictures of the same type as long as the encoder can meet the target rate at each picture. For example, assume that frame n is a Bpicture. Frame n can actually be either an I, P or B-picture. The encoder meets the nominal rate, T<sub>n</sub>, for frame n. The target rate for frame n +1, T n+l >
is therefore:
CA 02286640 1999-10-18
<img file="CA2286640C_D0001.tif" />
(9a)
X.
(9b) fijXj +n<sub>p</sub>X<sub>p</sub> + 1)^3
<img file="CA2286640C_D0002.tif" />
(9c) (9d) rijXj +n<sub>p</sub>X<sub>p</sub> +n<sub>B</sub>X<sub>B</sub>
As seen, the target rate for frame n + \,T<sub>n+}</sub>, depends upon only the type of frame n+1, i.e.,
X„<sub>+It</sub> . In other words, regardless of the type (either I, P or B) of frame n, frame « + 1 will be assigned the same number of bits according to its own type. This implies that equations (5) and (6) are actually the same if the pictures of the same type have the same complexity measure, and the encoder can meet the target rate at each picture. Equation (6) is, however, more practical as it addresses the changes in picture complexity measures and the difference between the target and actual rates at each picture.
In practice, the quality requirement may not be the same for the different picture types. For example, B-pictures are never used as references in the future temporal prediction. Hence, they can tolerate more distortion than I- and P-pictures. To address this concern of different quality
CA 02286640 1999-10-18 requirements, we can further introduce a weighting factor for each picture type, K<sub>nt</sub>, as
<td> T<sub>n</sub>-C</td><td></td><td> !K<sub>n</sub>,</td>
<td colspan="2"> where</td><td></td>
<td></td><td> k,</td><td> for I picture</td>
<td></td><td> Kp</td><td> for P picture</td>
<td></td><td><sup>K</sup>B</td><td> for B picture</td>
(11)
The bit allocation strategies (e.g., equations 5 and 6) now become:
x<sub>nt</sub>iK<sub>nt</sub>
T<sub>n</sub> =-----<sup>R</sup>OOP N ( 5b )
Ν,Χ, !K, +N<sub>p</sub>X<sub>p</sub>/K<sub>p</sub> + N<sub>b</sub>X<sub>b</sub> !K<sub>b</sub><sup>aoF</sup>-<sup>N</sup> and p ___nJ_ n ( fib ) <sup>n</sup>~ n<sub>1</sub>X<sub>I</sub>/K<sub>1</sub>+n<sub>p</sub>X<sub>P</sub>/K<sub>p</sub>+n<sub>B</sub>X<sub>B</sub>/K<sub>B</sub>
Equation (6b) is the same one used in MPEG TM5 when K, = K<sub>p</sub> - ] and K<sub>B</sub> = 1.4.
The bit allocation strategy (e.g., equations 5 and 6) requires a priori knowledge of GOP structure, i.e., the numbers of I-, P- and B-pict.ures in a GOP, N, ,N<sub>P</sub>, and N<sub>B</sub>, or the remaining number of I, P and B-picture in the current GOP, n^rip and n<sub>B</sub> Given a pair of GOP structure variables, N and M , we can have N<sub>;</sub> = N<sub>p</sub> = N/M - N, and N<sub>b</sub>=N-N<sub>p</sub>-Nj. From Nj,N<sub>p</sub>, and N<sub>B</sub>, we can also calculate n<sub>s</sub>,n<sub>p</sub> and n<sub>B </sub>during encoding. For example, if a P-picture is just
CA 02286640 1999-10-18 encoded, the remaining number of P-pictures in the current GOP is decreased by 1, i.e., n<sub>p</sub>=n<sub>p</sub>-l.
As discussed, this information is unfortunately not available for a transcoder. Without a complete knowledge of the GOP structure of pre-compressed bitstreams, it is difficult to perform an intelligent bit allocation strategy. A transcoder can learn the GOP structure of a pre-compressed bitstream by scanning the bitstream through the first two I-pictures. This, however, may cause a processing delay by one GOP and require extra memory for holding the bits of the GOP.
2. RATE CONTROL FOR A TRANSCODER
We now describe a novel rate control system for a transcoder with no requirement of a priori knowledge of GOP structure of the pre-compressed bitstreams. The proposed rate control system causes no processing delay and requires no extra memory.
It can start with any reasonable set of GOP parameters, and then gradually corrects these GOP parameters as encoding progresses, if necessary.
Table 1 (a) shows all the possible picture organizations where the subscripts are the pictures' temporal references, in display order. Each picture refers to a frame or field, or portion thereof. For example, the present invention is compatible with coding of video object planes (VOPs) as known from the MPEG-4 standard. The present invention is
CA 02286640 1999-10-18 compatible with both progressive scan and interlaced scan video.
For the sequence GOP(N=M=1), there are only Ipictures. For the sequence GOP(N,M=1), there are only I- and P-pictures. For the sequence GOP(N=M), there are only I- and B-pictures. For the sequence GOP(N,M), there are I-, P- and B-pictures. For the sequence GOP(M=1), there are only P-pictures. For the sequence GOP(M), there are only P- and Bpictures.
The first four cases in Table 1(a) are nonprogressive refresh sequences since they have Ipictures. The last two case (e.g., GOP(M=1) and GOP(M)) have no I-pictures, but use a progressive refresh where P-pictures contain I-slices. An Islice is an intra-coded portion of a picture typically extending horizontally across the picture. The location of the I-slice changes in successive Ppictures to refresh a different portion of the successive P-pictures. Hence, with a progressive refresh, the GOP length N is no longer necessary in describing the picture organization. Nevertheless, M can still be used to indicate the distance between two consecutive P-pictures. The distance is measured in terms of number of pictures herein, although any corresponding measure, such as time, can be used. In terms of bit allocation, we can set N = M ' Nj -0 (as there is no I pictures for progressive refresh sequence), N<sub>p</sub> - NIM-Nj =1,
CA 02286640 1999-10-18
N<sub>b</sub> = N - N<sub>p</sub> - Nj = N- N<sub>p</sub> in N = M bit allocation equation (5) for progressive refresh.
Table 1(b) shows the corresponding forms of picture organizations in encoding order (e.g., in bitstream order) for the picture sequences of Table 1(a). If M = 1 (there is no B-picture in the sequence), the encoding order is actually the same as the display order. On the other hand, if M 1 (e.g., there are M-1 B-pictures between successive I- or P-pictures), the future I- or P-pictures have to be encoded before the M-l B-pictures.
Furthermore, for the first GOP (e.g., initial or non-continuous GOP, designated GOP<sub>0</sub>) in a video sequence with M , there may not be any B-pictures before the first I or P-picture, as shown in Table 2(a). Table 2(a) shows possible picture organizations of the first (initial) GOP after a sequence header in a video stream, in display order. The initial GOPs are designated GOP<sub>0</sub>. For example, for GOP<sub>0</sub>(M), the first picture is designated P<sub>o</sub>. An initial GOP may be processed by a transcoder when a bitstream is initially acquired or re-acquired, for example .
Table 2(b) shows the first GOP of Table 2(a) in encoding order. Here, an initial GOP with ΜΦ 1 is shown, where the second I- or P-picture is encoded before any B-picture. The second picture in encoding order will be either an I or P-picture, as shown in Table 2(b).
CA 02286640 1999-10-18 (O ? Φ I ?
E £ E E
CL· CD CQ CÛ
LO
CM .n
CB ¥ ¥ 1 _<sup>E</sup>_<sup>E</sup>O_
E
Q_ _Q)
JS ta +
£
CL
CD +
¥ T V e e e
CL. CQ CQ +
E
CL £
CÛ
E
CQ tq
JS
J3 (O s
CO
Q_ ¥ ¥ ¥ e e e
Q_ CQ CQ ¥ ¥ I _<sup>ε</sup>_<sup>Ε</sup>ο_
S
CM CM _J> ÛÛ CL
CQ ¥ V <7 E E E
CL· CO CO
CQ sis CQ CQ CQ + E E E E E _<sup>E</sup>O_ CQ CQ Q_ CQ _ S S _?Q_ CL + E E E E E _<sup>E</sup>O_ CQ CQ Q. CQ + -T+ E E E E E _<sup>E</sup>Û_ CÛ CQ CL CQ i s s
CQ CQ CQ _<sup>E</sup> __<sup>E</sup> _<sup>E</sup> __<sup>e</sup> CL· CL·
V E E E E E _<sup>E</sup>O_ CQ CO Q_ CQ + Τ' T- + Τ' + E E E E E _<sup>E</sup>CL CQ CQ CL CQ
CM CM CM
CQ CQ CQ
CQ CQ CQ <sup>;</sup>_<sup>E</sup>_<sup>E</sup>_<sup>E</sup>Q- Q_
<td> S</td><td> II</td><td> 2</td><td></td><td></td><td></td><td> 2</td><td> II</td><td> s</td><td></td><td></td><td></td><td> S X</td>
<td> II</td><td> s</td><td> II</td><td></td><td> II</td><td></td><td> II</td><td></td><td> II</td><td> s</td><td> II</td><td> ·</td><td> Il ·Τ_ -</td>
<td> Z Q_</td><td> zf Q_</td><td> LZ Q_</td><td colspan="3"> Z Q_ Q_ ST</td><td> 2 Q.</td><td> Z CL</td><td> zz Q_</td><td> zz Q_</td><td> Q_</td><td> Q_</td><td> zzS <0 0 0 Q_ Q_ CL</td>
<td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O O O</td>
<td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O</td><td> O O O</td>
Table 2(b)
GOP<sub>0</sub>(N = M): Ιθ I<sub>m</sub> B<sub>2</sub> ... l<sub>2M</sub> B^
GOP<sub>0</sub>(N,M): l<sub>0</sub> P<sub>M</sub> B<sub>1</sub> B<sub>2</sub> ... B<sub>MJ</sub> P<sub>2M</sub> B<sub>M+1</sub> ... B^
GOP<sub>0</sub>(M): P<sub>o</sub> P<sub>m</sub> B<sub>1</sub> B<sub>2</sub> ... B<sub>mj</sub> P<sub>2m</sub> B^
CA 02286640 1999-10-18
FIG. 1(a) illustrates a progressive refresh sequence of pictures in display order for continuing GOPs. Specifically, the progressive refresh sequence GOP(M) from Table 1(a) is illustrated for a distance between P-pictures of M=3, and for a continuing (e.g., non-initial, or open) GOP. Additionally, the GOP length is N=M=3 pictures.
In the video sequence 100, a first GOP 110 includes pictures P<sub>7</sub>, B<sub>8</sub> and Bg, while a second GOP 120 includes pictures Pi<sub>0</sub>, B<sub>n</sub> and Bi<sub>2</sub>, and a third GOP 130 includes pictures P<sub>13</sub>, Bn, and Bi<sub>5</sub>. The subscript 7 for P<sub>7</sub> is chosen simply as an example. A subsequent GOP includes Ρ<sub>Χ6</sub> as its first picture.
FIG. 1(b) illustrates the sequence of pictures of FIG. 1(a) in encoding order. The encoded video sequence 150 corresponds to the sequence GOP(M) from Table 1(b). Since B<sub>s</sub> and B<sub>9</sub> are temporally backward predicted from P<sub>10</sub>, B<sub>8</sub> and B<sub>9</sub> follow P<sub>10</sub> in the. encoded sequence 150. Similarly, B<sub>n</sub> and B<sub>12</sub> follow Pi3, and B<sub>14</sub> and B<sub>15</sub> follow P<sub>16</sub>.
FIG. 2(a) illustrates a progressive refresh sequence of pictures in display order for an initial GOP in a bitstream followed by continuing GOPs. Specifically, the progressive refresh sequence GOP<sub>o</sub> (M) from Table 2(a) is illustrated for a distance between P-pictures of M=3, and a GOP length is N=M=3 pictures.
In the video sequence 200, a first, initial GOP 210 includes pictures P<sub>o</sub>, Bi and B<sub>2</sub>, while a second, continuing GOP 220 includes pictures P<sub>3</sub>, B<sub>4</sub> and B<sub>5</sub>, and a third, continuing GOP 230 includes pictures
CA 02286640 1999-10-18
P<sub>G</sub>, B<sub>7</sub>, and B<sub>8</sub>. A subsequent GOP includes P<sub>9</sub> as its first picture.
FIG. 2(b) illustrates the sequence of pictures of FIG. 2(a) in encoding order. The encoded video sequence 250 corresponds to the sequence GOP<sub>0</sub> (M) from Table 2(b). Since B<sub>x</sub> and B<sub>2</sub> are temporally backward predicted from P<sub>3</sub>, Bi and B<sub>2</sub> follow P<sub>3</sub> in the encoded sequence 250. Essentially, the Bpictures that would use P<sub>o</sub> for backward temporal prediction are not present, so P<sub>3</sub>, Bi and B<sub>2</sub> follow P<sub>o</sub>. Similarly, B<sub>4</sub> and B<sub>5</sub> follow P<sub>6</sub>, and B<sub>7</sub> and B<sub>8 </sub>follow P<sub>9</sub>.
FIG. 3 illustrates an MPEG-2 bitstream structure. A sequence layer 300 includes a sequence header 302, followed by a number of GOPs, e.g., GOPs 304, 306 and 308, followed by additional sequence headers and GOPs, including sequence header 312. A GOP layer 320 includes a GOP header 322, followed by data from a number of pictures, e.g., pictures 324, 326 and 328. A picture layer 330 includes a picture header 332, followed by a number of slices, e.g., slices 334 and 336. A slice layer 335 includes a slice header 337, followed by a number of macroblocks, e.g., macroblocks 338 and 339. A macroblock layer 340 includes a macroblock header 342, followed by a number of blocks, e.g., blocks 344, 346 and 348. A block layer includes DCT coefficients 352.
For a given pre-compressed bitstream, the transcoder can start processing anywhere in the bitstream. Initially, the transcoder will skip all
CA 02286640 1999-10-18 the bits until reaching the sequence header 300, which contains information about picture size, frame rate, and the like. Optionally, the GOP header 322 may follow the sequence header 302 (for non-progressive refresh only). If a GOP header does follow the sequence header 302, the bitstream is definitely a non-progressive refresh sequence. Otherwise, the bitstream may, or may not, be of progressive refresh. The picture layer 330 then follows.
The picture immediately following the sequence header (i.e., the first picture in the GOP, i.e., picture 324) can be either an I or P-picture. If it is an I-picture, the bitstream is a non-progressive refresh sequence. Otherwise, the bitstream is a progressive refresh sequence. The bit allocation procedures of the present invention for bitstreams with progressive refresh and non-progressive refresh are slightly different. In the following two subsections, we detail both.
The following notation will be used:
N,M - the actual values (i.e., reflecting the true GOP structure) of the GOP parameters, N and M;
N',M' - the initial assumed values of the GOP parameters, N and M;
Ν'',M'' - the (current) updated values of the GOP parameters, N and M;
Ν^Νρ,Νβ - the numbers of I, P and B pictures, respectively, in a GOP;
n<sub>Iz</sub>np,n<sub>B</sub> - the number of I, P and B pictures, respectively, remaining in the current GOP;
CA 02286640 1999-10-18
R - the number of remaining bits for the current GOP;
bit_rate - the effective output bit rate in bits per second that may be variable (we assume that bit_rate is available to transcoder);
frame_rate - the effective frame_rate in frames per second, which may not be the same as the frame_rate embedded in the sequence header due to the presence of the repeat_first_field (we assume that frame_rate is available to transcoder);
div - Integer division with truncation of the result toward zero; and <= - Assignment statement (from the right to the left).
(i) Progressive Refresh
For a progressive refresh sequence, there will be no GOP header, and the first picture immediately following the sequence header (in encoding order) has to be a P-picture. See sequences GOP (M=l.) and
GOP(M) in Table 1(b) and GOP<sub>0</sub> (M) in Table 2(b).
Instead of waiting to correctly determine M, we proceed to process the first P-picture with any reasonable assumed M <sub>r</sub> say M', and a bit budget of R = R<sub>a0PM</sub> = M'ffbit rate ! freinte _rate) bits in calculating the target bit rate (see eqn. 6). Note that with
M', we have N<sub>p</sub> = 1 and N<sub>B</sub>=M'-N<sub>P</sub>. For example, refer to FIG. 1(a) or 2(a), where the distance between P-pictures is M'=3, the number of P-pictures
CA 02286640 1999-10-18 in a GOP is one, and the number of B-pictures in a GOP is two.
The second picture in the GOP, in encoding order, can be either a B-picture (GOP(M)) or a Ppicture (GOP(M = 1) or GOP<sub>0</sub>(A/)), as shown in Tables 1(b) and 2 (b), respectively.
In either case, we can calculate the actual value of M from the temporal references of the first two pictures of a GOP in encoding order. Specifically, let temp ref pictured and temp ref picture! be the temporal references for the first and second pictures, respectively. The temporal reference may be embedded in the picture header. If the second picture is a B-picture, e.g., sequence (GOP(M)) in Table 1(b), the correct value of M , say M”, is:
M = temp _ ref _ picture! - temp _ ref _ picture! +1. ( 12 )
For example, in FIG. 1(b), consider P<sub>w</sub> and B<sub>8 </sub>as first and second pictures, respectively, in an encoded video sequence. Then, temp_ref_picturel is the temporal reference of Ρ<sub>ΐ0</sub> (e.g., 10), temp_ref_picture2 is the temporal· reference of B<sub>0 </sub>(e.g., 8), and M''=10-8+1=3. Note that the temporal references refer to the display order of the pictures.
Otherwise, if the second picture is a Ppicture, e.g., sequence (G()P(M = 1) in Table 1(b), or sequence GOP<sub>0</sub>(M)) in Table 2 (b) , the correct value of the distance between P-pictures is:
CA 02286640 1999-10-18
Μ = temp _ ref _ picture! - temp _ ref _ picturei . ( 13 )
For example, in FIG. 2(b), consider P<sub>o</sub> and P<sub>3</sub> as first and second pictures, respectively, in an encoded video sequence. Then, temp_ref_picturel is the temporal reference of P<sub>o</sub> (e.g., 0), temp_ref_picture2 is the temporal reference of P<sub>3 </sub>(e.g., 3), and M''=3-0=3.
With a correct value of M , say M, the remaining number of bits, R (see eqn. 7), is adjusted accordingly. Specifically, if the second picture is a B-picture, as with sequence (GOPfMf) in Table 1(b), R is updated as η n ,, , bü <sup>r</sup><*te
R = R + (M -M )--=-. (14) frame rate
As seen, for M>M' (actual distance between P-pictures is greater than assumed distance), the first P-picture has been assigned relatively more bits and, therefore, the remaining pictures will be assigned relatively fewer bits. For M<M' (actual distance between P-pictures is less than assumed distance), the first P-picture has been assigned relatively fewer bits and the remaining pictures will be assigned relatively more bits.
On the other hand, if the second picture is a P-picture, e.g., as with sequences (GOP(M =1) in Table 1 (b) , or sequence GOP<sub>a</sub>(Mf) in Table 2 (b) , there are no B-pictures between the first two Ppictures in the encoded video sequence. Hence, the bits allocated for the assumed M'-\ B-pictures
CA 02286640 1999-10-18 between two P pictures (in encoding order) should be subtracted from R, as n r* z. „ bit rate
R = R-(M'-\)--=-. (15) frame _ rate
We then set M =M . If the transcoder can meet the target rate at each picture, at the end of the first M pictures, we will have R-0. Hence, we will have a bit budget
R = R<sub>GOPJUf</sub> -M-(bit_rate!frame_rate) bits for next M pictures. To address any subsequent change in M, we check the value of M after each P-picture.
FIG. 4(a) illustrates a coding method for a progressive refresh picture sequence in accordance with the present invention. The aforementioned bit allocation technique for progressive refresh sequences is summarized as follows.
At block 400, the pre-compressed digital video bitstream is received at a transcoder. The coded pictures are in an encoding order. At block .405, the bitstream is processed to detect a sequence header. At block 410, the picture type of the first picture following the sequence header is determined. If it is an I-picture, processing continues at block A in FIG. 4(b).
If the first picture following the sequence header is a P-picture, processing continues at block 415, where an assumed distance M' is set. M' is defined herein as a distance between the first picture following the sequence header, and the next P-picture in the display order. At block 420, an
CA 02286640 1999-10-18 assumed bit budget R is determined based on M’, the bit rate and the frame rate of the bitstream. At block 422, a target bit rate T is set in accordance with eqn. 6b. At block 425, the first picture is coded according to T. At block 430, if the next picture (e.g., the second picture) is a P-picture, the actual distance M'' is determined at block 435 according to eqn. 13. At block 440, the bit budget R is adjusted using eqn. 15. At block 445, M is set to M .
At block 430, if the next picture in the sequence, e.g., the second picture, is a B-picture, the actual distance M'' is determined at block 450 according to eqn. 12. At block 455, the bit budget R is adjusted using eqn. 14. At block 460, M is set to M''. At block 462, the target bit rate T is set (e.g., using eqn. 6) . Next, the remaining M-.l pictures (including the second picture) are coded according to T at block 465.
At block 470, the next picture is processed. This may be the first picture of the next series of M*' pictures, for example. At block 475, processing returns, e.g., to block 415. However, note that, instead of blindly assuming the length and bit budgets at blocks 415 and 420, respectively, the values determined in the previous series of M' ' pictures may be used. Nevertheless, the actual distance M’’ may be verified, e.g., after every Ppicture.
CA 02286640 1999-10-18 (ii) Non-Progressive Refresh
For non-progressive refresh, there may be an optional GOP header following the sequence header. Then, a picture layer follows. The first picture immediately following a sequence header, or a GOP header, has to be an I-picture. For an intelligent bit allocation, we need to know both N and M . We can, however, start transcoding of a pre-compressed bitstream with any reasonable pair of N and M , say Ν' and M', and with a bit budget of
R = R<sub>gopn</sub> = N'-(bit rate/frame_rate) bits in determining the target rate for the first I-picture (see eqn.
6) .
Note that with Ν' and M', we have N<sub>}</sub> = 1, N<sub>P</sub>=N'/M'-N<sub>I</sub> and N<sub>B</sub>=N'-N<sub>{</sub>-N<sub>P</sub>. The actual value of
M , say M, can then be calculated from the temporal references of the first two pictures, similar to progressive refresh. If the second picture is an I- or P-picture, eqn. (13) is used in calculating the value of M . Otherwise, the second picture is a B-picture, and eqn. (12) is used. We then set M -M .
If the second picture is also an I-picture (GOP(N=M = Y) and GOP/N - ΛΥ)), we actually have had the correct N value too, i.e., N = M , as shown in Table 1(b) and 2(b). The remaining number of bits,
R (see eqn. 7), is adjusted accordingly, as:
CA 02286640 1999-10-18 bit _ rate frame _ rate (16)
This is because there are no P- and B-pictures between the first and second I-pictures. Hence, the bits allocated to the assumed N-l (P and B) pictures between two I pictures should be deducted from R.
If the second picture is not an I-picture, it will take somewhat longer to obtain the correct value of N, by about one GOP. The assumed N' may not be dividable by the correct M. Hence, we need to adjust Ν' , and accordingly, n<sub>p</sub> and n<sub>B</sub> . We adjust N to N with the correct M value, and n<sub>p</sub> and n<sub>B</sub>, as
Ν=(ΝΊΜ)·Μ ; (17) n<sub>p</sub>=N/M-l; and (18a) n<sub>B</sub> = Ν'ΊΜ-n<sub>p</sub>-1 . (18b)
We then adjust the remaining number of bits, R (see eqn. 7), with N as bit rate
R = R + (N-N')· (19) frame _ rate
Furthermore, if the second picture is a Ppicture, GOP(N,M=1) or GOP<sub>0</sub>(N,M) as shown in Tables 1(b) and 2(b), the remaining number of bits, R, needs additional adjustment as bit rate
R = R - (M - 1) (19b) frame_ rate
This is because there are M-l fewer B-pictures than assumed before the first I-picture.
CA 02286640 1999-10-18
There can be only three scenarios, i.e.,
1. N''=N, that is, the current GOP length Ν'' is equal to the actual GOP length N;
2. N'' <N, that is, the current GOP length Ν'' is smaller than the actual GOP length N; and
3. N'' >N, that is, the current GOP length Ν'' is greater than the actual GOP length
N.
Clearly, if N = N, we will reach an I-picture after processing Ν'' pictures - the beginning of the second GOP. We have a correct N, so we maintain it.
If N<N, the GOP length is shorter than the actual GOP length. The assumed GOP length is at least M pictures shorter than the actual GOP length because of the nature of the GOP structure (see Tables 1(b) and 2(b)). Here, we have assumed that the value of M will not change within a GOP.
Note that M may be checked periodically within a GOP, such as after each I- and/or P-picture, if there is a chance that M may change within a GOP. Additionally, if M changes within the GOP, N and R should be adjusted accordingly.
We extend the GOP of TV pictures by M additional pictures, i.e., (21) and adjust R by addingR<sub>a0PM</sub> additional bits for the M additional pictures, i.e.,
CA 02286640 1999-10-18
R = R + R, gop,m
R+M 37 bit rate (22:
frame _ rate
If the extended GOP length is still shorter than the actual GOP length, we repeat the above procedure until reaching the end of the actual GOP.
If N>N, the GOP length is longer than the actual GOP length. At the end of the actual GOP, we will have a correct GOP length, N, and we will use the correct length N for the rest of the GOPs.
Since the assumed GOP length ( N”} is longer than the actual GOP length (N), there will be some bits left over from the first actual GOP for coding pictures in the second actual GOP. Hence, the bits allocated for the second actual GOP need to be adjusted as:
R = 2R,
OOP.N
GOP,N<sup>n</sup> j;) <sub>=</sub> 2JV. -fi) ,23) where R,
GOP.N frame _ rate frame
R is the number of bits used for encoding the first N pictures.
FIG. 4(b) illustrates a coding method for a non-progressive refresh picture sequence in accordance with the present invention. The aforementioned bit allocation technique for nonprogressive refresh sequences is summarized as follows .
At block A processing continues from block A of FIG. 4(a). At block 500, an assumed GOP length Ν' is provided, and at block 502, an assumed distance M' is provided. M' here is a distance
CA 02286640 1999-10-18 between the first I-picture in a GOP and the next Ior P-picture in the display order. This distance may or may not be the same as the GOP length. Generally, compatible values of Ν' and M' should be selected, for example, N'>M' and Ν' is dividable by M'. At block 504, an assumed bit budget R is provided according to Ν', and at block 505, a target bit rate T is determined, e.g., using eqn. 6, for coding the pictures in the GOP.
At block 506, the first picture in the GOP is coded. At block 508, if the next picture, e.g., the second picture of the GOP, is an I-picture, processing continues at block 510, where the actual distance M'' is determined using eqn. 13. At block 514, M is set to M'', and at block 516 N is set to M since the distance M'' and the GOP length are the same .
At block 518, the bit budget is adjusted according to eqn. 16, and at block 524 processing returns, e.g., to block 500. Note that, at blocks 500 and 502, Ν' and M' can be set to the values N and M, respectively, of the previous GOP. N and M can be verified for each GOP.
At block 508, if the next picture, e.g., the second picture in the GOP, is a P-picture, processing continues at block 530, where the actual distance M'' is determined using eqn. 13. At block 532, M is set to M''. At block 534, the GOP length is updated as N''=M[N'/M']. At block 536, the remaining number of B-pictures in the current GOP, n<sub>B/</sub> is adjusted using eqn. 18. At block 538, the
CA 02286640 1999-10-18 bit budget is adjusted using eqn. 19, and at block 540, the bit budget is adjusted again, using eqn. 19b, and processing continues at B.
At block 508, if the next picture, e.g., the second picture in the GOP, is a B-picture, processing continues at block 542, where the actual distance M’' is determined using eqn. 12. At block 544, M is set to M''. At block 546, the GOP length is updated as N'’=M[N'/M']. At block 548, the remaining number of B-pictures in the current GOP, n<sub>B</sub>, is adjusted using eqn. 18. At block 550, the bit budget is adjusted using eqn. 19, and processing continues at B.
FIG. 4(c) illustrates a continuation of the coding method of FIG. 4(b) in accordance with the present invention. Processing continues at B from FIG. 4(b). At block 552, the target bit rate T is set using eqn. 6, and at block 554, a counter is set to one. At block 556, the next picture in the GOP is coded. At block 558, counter is incremented. Counter essentially tracks the position of the current picture in the GOP. At block 560, a determination is made as to whether the end of the current GOP has been reached. If so, a determination is made at box 562 as to whether counter=N''. If so, this indicates that Ν'' is the same as N, the actual GOP length. Essentially, the assumed GOP length Ν'' turned out to be correct. Processing continues at block 566, where the next GOP is coded.
CA 02286640 1999-10-18
If the condition at block 562 is false, this indicates that N''>N (e.g., the assumed GOP length Ν'' is too large), and the bit rate is adjusted at block 564 using eqn. 23. Processing continues at block 566, where the next GOP is coded.
If the end of the current GOP has not been reached yet at block 560, a determination is made at block 570 as to whether counter=N''. If not, process continues at block 556. If counter=N'' at block 570, this indicates that N''<N (e.g., the assumed GOP length Ν'' is too small). At block 572, the assumed GOP length Ν'' is incremented by M. at block 574, the bit budget is adjusted using eqn. 22, at block 576, the next M pictures are coded, and at block 578 a determination is made as to whether the end of the current GOP has been reached. If not, processing continues at block 572, where the assume GOP length Ν'' is again incremented by M.
When the end of the current GOP is reached, at block 578, processing continues at block 566, where the next GOP is coded.
The coding method of FIG. 4(c) can be understood further with reference to FIG. 5.
FIG. 5 illustrates an estimated GOP length Ν'' in accordance with the present invention. A sequence of pictures is shown generally, in display order, at 500. A first GOP, GOP(N,M) 520, begins at an I-picture 502, and the next GOP 580 begins at an I-picture 510. A subsequent GOP begins at an Ipicture 515.
CA 02286640 1999-10-18
The estimated GOP length Ν'' 530 is equal to the actual GOP length N. However, the estimated GOP length Ν'' 540 is less than the actual GOP length N by two M distances 542 and 544. In particular, the estimated GOP length Ν'' 540 extends from the Ipicture 502 to a P-picture 504, the M-distance 542 extends from the P-picture 504 to a P-picture 506, and the M-distance 544 extends from the P-picture 506 to the I-picture 510. The estimated GOP length Ν'' 550 extends from the I-picture 502 to a Ppicture 512, and is therefore greater than the actual GOP length N. Generally, Ν'' should be selected initially as a multiple of the estimated distance between I and/or P-pictures.
A C-language pseudo code for the bit-allocation procedure, both with and without progressive refresh, is shown below. The same algorithm is represented by the flowchart in FIGs 7(a)-7(d). A single bitstream can switch arbitrarily between the progressive refresh and I-picture (non-progressive) refresh modes.
CA 02286640 1999-10-18 /* * The following is a brief description of the variables:
* * N Estimated open GOP length (pictures) * M Number of consecutive B-pictures plus 1 * N<sup>1</sup> Initial guess for the GOP length in pictures * M' Initial guess for the number of consecutive B-pictures plus 1 * N Updated estimate of the open GOP length * M Updated estimate of number of consecutive B-pictures plus 1 * R Number of bits remaining in this GOP * n Number of pictures remaining in this GOP * ni Number of I-pictures remaining in this GOP * np Number of P-pictures remaining in this GOP * nb Number of B-pictures remaining in this GOP * Xi Complexity of an I-picture * Xp Complexity of a P-picture * Xb Complexity of a B-picture * Ki I-picture complexity divider * Kp P-picture complexity divider * Kb B-picture complexity divider * X Complexity temporary variable * T Target number of bits for the current picture type *
* pict_type Current picture type * prev_pict_type Previous picture type in coding order * tempref Current picture temporal reference
CA 02286640 1999-10-18 * prevtempref * progrefresh * GOP flag * seq_hdr_flag
Previous picture temporal reference (coding order) Non-zero if progressive refresh is in progress Non-zero if GOP header preceded the current picture Non-zero if sequence header preceded current picture * bit_rate() Current average output bitrate * frame_rate() Average display frame rate using repeatfirstfield * Notes:
* * 1) The div operation denotes computer integer division with * truncation toward 0.
* * 2) A GOP begins with a I-picture in coding order and extends to * the next I-picture (exclusive) regardless of whether the GOP * syntax is present in the bitstream. When progressive refresh * is used a GOP consist of a P-picture plus the following run of * consecutive B-pictures.
*/
FindSequenceHeader();
N = Ν'; // (Ν' % Mj == 0; N is estimated open GOP length
M = M';
R = 0; n = 0;
prev_pict_type = BPICTURE; for (;;) { /*
CA 02286640 1999-10-18 * get_picture_header() parses the video sequence and the optional * GOP layer, and returns the picture type and temporal reference * of the next coded picture.
*/ pict type = get_pict_header(&temp_ref, &GOP_flag, &seq_hdr_flag); if (seqhdrflag) progrefresh = (pict type != I_PICTURE); switch (pict type) { case I PICTURE:
if (prev_pict_type != B PICTURE) { /* * GOP(N=M=1), GOP(N,M=1) or GOPO(N=M). Recalculate M, * start new GOP and correct R for missing B pictures.
*/
M” = GOP flag ? (tempref + 1) :
((tempref- prev_temp_ref + 1024) & 0x3FF);
R -= n * bit_rate() / frame_rate();
M = M;
N = (prev_pict_type == I PICTURE) ? M : (N - n); n = 0;
} if (prog refresh) // End of progressive refresh
N = N’;
progrefresh = 0;
if (n <= 0) { // GOP length is equal to expected length
CA 02286640 1999-10-18
R += N * bit_rate() / frame_rate();
} else { // GOP length is shorter than expected
N -= n;
N = (N div Μ) * M;
R += (N - n) * bit_rate() I frame_rate();
} n = N; ni = 1;
np = N/M - 1 ; nb = N - ni - np;
X = Xi / Ki;
prev_temp_ref= tempref; break;
case PPICTURE:
if (prev_pict_type != B PICTURE) { /* * GOP(M=1) or GOPO(M) [progressive refresh] * GOPfN,M=l) or GOPO(N,M) [non-progressive refresh] */
M = (temp_ref - prev_temp_ref + 1024) & 0x3FF;
R -= (M - 1 ) * bit_rate() / frame_rate(); nb -= M - 1 ;
n -= M - 1 ;
if f(M != M) && Iprogrefresh) {
CA 02286640 1999-10-18
N = (N div M) * M; // open, not actual, GOP length n += (N - N) - (M - M);
R += ((N - N) - (M - M)) * bit_rate() / frame_rate(); np = n div M; nb = n - np;
N = N;
}
M = M;
} if (n <= 0) { /* * End of GOP in progressive refresh mode or GOP is * longer than expected in non-progressive refresh mode.
*/
N += M;
R += M * bit_rate() / frame_rate(); n = M; ni = 0; np = 1; nb = M - 1 ;
}
X = Xp / Kp;
prev_temp_ref = temp_ref; break;
CA 02286640 1999-10-18 case BJPICTURE:
if (prevpicttype != BPICTURE) { /* * GOP(N=M), GOP(N,M), GOPO(N,M) [non-progressive refresh] * GOP(M)
[progressive refresh] */
M = (prevtempref - tempref + 1025) & 0x3FF; if(M != M) { if (prog_refresh) { nb +- M - M;
R += (M - M) * bit_rate() / frame_rate();
} else {
N = (NdivM) * M; n += N - N;
R += (N - N) * bit_rate() I frame_rate(); np = (n + 1) div M - 1; nb = n - np;
N = N;
»
I
M = M;
»
I }
X = Xb / Kb; break;
CA 02286640 1999-10-18 /* * Calculate the target bit rate */
T = X * R / (ni*Xi/Ki + np*Xp/Kp + nb*Xb/Kb);
switch (picttype) { // Decrement pic count for each picture type case IPICTURE: ni—; break; case PPICTURE. np—; break; case BPICTURE: nb—; break;
} n = n - 1 ; // Number of pictures left in GOP prev_pict_type = picttype;
/* * transcode_picture() does the actual transcoding which maintains * in original picture type (I, P or B). This function returns * the actual size of the transcoded picture in bits. This func* tion updates the complexity (Xi, Xp, Xb) for each picture type.
*/
R -= transcode_picture(pict_type, T);
}
CA 02286640 1999-10-18
This pseudo-code is expressed in a flowchart 700 in FIGs 7(a)-7(d). Note that ni, np and nb are the same as n<sub>I;</sub> n<sub>P</sub> and n<sub>B</sub>, respectively, as used elsewhere .
Box 702 denotes searching for the video sequence header in order to obtain parameters necessary to begin transcoding. Initialization for the loop over transcoded pictures occurs here.
Box 704 is the call to get_pict_header() which consumes the picture header and all higher level syntax. The picture type (I, P or B picture) is returned. GOP_flag is true (non-zero) if a GOP header was encountered; seq_hdr_flag is true (nonzero) if a video sequence header occurred before the current coded picture and after the previous coded picture .
Box 706 tests seq_hdr_flag. If true, prog_refresh is set to 1 (true) if the current picture is not an I-picture in box 708
Box 710 is the switch statement based on picture types. Although not shown in the code or flowchart, an MPEG-2 D-picture is treated like an Ipicture in this algorithm.
If the previous picture type was not a Bpicture (box 712), then a new value of M is determined from the temporal references. If the GOP is being shortened, the excess bits due to the expected GOP length are deleted from R and the new values of Μ, N, n are set (box 714). R is the target number of bits (not the actual number) remaining to code the rest of the GOP. If the
CA 02286640 1999-10-18 actual GOP size is different, the difference in bits (positive or negative) remains in R and affects the target size for the next GOP. This forms a feedback loop to drive the average GOP size to N*bit_rate() / frame_rate().
The function bit_rate() returns the current target transcoder output bitrate which may change due to channel capacity or statistical multiplexing considerations. The function frame_rate() is the average coded frame rate, which is the frame rate specified in the video sequence header modified by the effects of the repeat_first_field flag in the various coded pictures. The quantity bit_rate() / frame_rate() denotes the desired current average coded picture size (in bits) to be output by the transcoder. It is an average because it does not consider the different MPEG picture types. Thus the target number of bits for a GOP, N * bit_rate() / frame_rate(), is N (the GOP length in pictures) times the average picture size.
If the transcoder is operating in progressive refresh mode, this mode is disabled because the current picture is an I-picture and N is set to the initial guess for GOP length (boxes 716 and 718).
<td> If the</td><td colspan="2"> condition</td><td colspan="2"> in 720 is</td><td colspan="2"> true, the correct</td>
<td> value of N</td><td> has</td><td> been</td><td> used.</td><td> In</td><td> this case, R</td><td> is</td>
<td> updated with</td><td> the</td><td colspan="2"> number of</td><td> bits</td><td> needed for a</td><td> new GOP</td>
<td> of length N</td><td> (box</td><td> 722) .</td><td> If</td><td> the</td><td> 720 condition</td><td> is</td>
false, the our previous estimate of N is wrong (the GOP is shorter than expected) and N and R are updated accordingly (box 724).
CA 02286640 1999-10-18
Box 726 resets the picture type down counters (ni, np, nb) according to the GOP type, the number of picture to go in the GOP (n), calculates the normalized I-picture complexity (X) and updates the previous picture type.
Box 728 is the start of the P-picture case in the switch statement. If the previous picture was not a B-picture (box 730), then a new value of M (M) is calculated from the temporal references.
The difference between the two 10-bit temporal reference number will be negative a wrap around occurred; this is why 1024 is added. When no wrap around occurs, the 0x3FF, which is the hexadecimal representation of the binary number 1111111111, removes the 2<sup>10</sup> bit leaving the positive difference; otherwise the addition of 1024 make the negative difference positive and this result is not modified by the bit-wise AND operation. Since the previous picture was not a B-picture, potential corrections to n (number of pictures left in the GOP), nb (number of B-picture left in the GOP) and R (number of bits allocated for the remaining picture in the GOP) may be required.
If M has changed and the transcoder is not in progressive refresh mode (box 732), then corrections to N, n, np, nb and R are made in box 734.
Box 736 updates M (previously calculated in
M ) .
If the end of GOP has been reached, (n less than or equal to zero - box 738), then the GOP is actually longer than expected. In this case, the
CA 02286640 1999-10-18 values of N, R, n, ni, np and nb are updated to reflect an increase GOP length of M pictures (one P-picture and M-l B-pictures) in box 740 .
Box 742 calculates the normalized P-picture complexity, X, and resets prev_temp_ref to be the current temporal reference.
For B-pictures, where the previous picture was not a B-picture (conditional in box 744), the new value of M (in M) is computed.(see box 746) from the difference in temporal reference. This calculation provide for the possibility that the 10bit temporal reference may have wrapped around (hence the +1024 and the mask to 10 bits).
If the value of M has changed (condition tested in box 748), then the state variables must be updated depending on prog_refersh (box 750). In the progressive refresh case, nb and R need to be modified (box 752). If I-picture refresh is in progress, N, np, nb, n and R all need to change (box 754).
A new normalized complexity for B-picture is computed in box 758.
Following the switch statement, the target size, T, for the next picture is calculated in box 760. This number is the intended size of the current picture when transcoded to the new bit rate. The actual size, returned by transcode_picture() is used to decrement R (see box 770). Following the calculation of T, the number of picture remaining in the GOP, n, and the number of pictures of the
CA 02286640 1999-10-18 current type (ni, np or nb) must be decremented (see boxes 762 to 768).
3. DIFFERENCE IN TARGET RATES
The target bit rates for a picture determined with different sets of GOP parameters can be different (see equations 5 and 6). We now analyze the differences in target rates with and without a correct starting GOP structure. For sake of simplification in analysis, we assume that:
1. The transcoder can meet the target rate at each picture. This implies that the remaining number of bits at the end of a GOP is equal to zero, and that a GOP of N pictures is assigned exactly R<sub>G</sub>op,n <sup>=</sup> N · (bit _ rate I frame _ rate) bits.
2. Within a GOP, all the pictures of the same type have the same complexity measure.
3. We have a correct M value. In fact, we can have a correct M right after reading the header of the second picture.
Note that the above assumptions are only for simplifying the analysis, and may not be 100¾ true for a real transcoder. For example, a transcoder may not 100¾ meet the target rate at a frame, and therefore at the end of a GOP, the remaining number of bits R may not be zero bits.
It has been shown that with conditions 1 and 2, equations (5) and (6) will be identical. That is, all the pictures of the same type in a GOP are
CA 02286640 1999-10-18 assigned the same number of bits. We use eqn. (5) in our analysis of differences in target rates. Assume that a pre-compressed bitstream is coded with a set of GOP parameters as follows:
N,M-->N<sub>I</sub>,N<sub>P</sub>,N<sub>B</sub>
For comparison, we start transcoding of the pre-compressed bitstream with two different GOP structures, one with a correct GOP structure (I) and the second with an incorrect GOP structure (II) as follows :
Starting GOP (I) : N, M - - > N,, N<sub>p</sub>, N <sub>B</sub>
Starting GOP(II) : Ν',M' - - > N,,N<sub>P</sub>,N<sub>B</sub>
Let 7<sub>n</sub>and Γ„be the target rates for frame n with GOP(I) and GOP(II), respectively. The difference between these two target rates is:
δ = τ;-γ, = (ι-Ι1).<sub>λ</sub> !24a) nJ (iK<sub>nB</sub>
Ν'j ^L+N'^X + N' — <sup>1</sup> TS ' y <sup>ΰ</sup> IS ! N p <sub>B</sub> χ P-GOP.N·
X.
X,
N, ^ + N<sub>P</sub>^ + N<sub>a</sub>^<sup>1</sup> K, <sup>P</sup> -R,
GOPJJ )T<sub>n</sub> (24b)
Y Y Y
N+ + N JL <sub>(1</sub> _ <sup>K</sup>P .Xp<sub>T</sub> (24c)
N'
K, + N'
K<sub>D</sub> + N'
K<sub>u</sub>
CA 02286640 1999-10-18 (NN', -Ν'N,)^- + (NN<sup>1</sup>,-Ν'NPf-<sup>p</sup>- + -N'NB)
K, K„ K<sub>o</sub> 1 (T^Al + TV^Ta + T^ Aa)
K,
K<sub>c</sub>
K„ <sup>B</sup> —·τ<sub>η</sub>.
N <sup>n</sup> (24d)
To better understand this difference in target bit rate, let us examine two numerical examples. In the first example, we assume the starting GOP (II) is shorter than the actual GOP, i.e.,
7V = 15 M = 3 --> 7V<sub>;</sub>=1 N<sub>p</sub>=4 N<sub>B</sub>=1§
7V'=12 V=3 --> 7V\ = 1 Ν' <sub>p</sub> = 3 N'<sub>B</sub> = 8
If we set K,=K<sub>P</sub>=1 and K<sub>B</sub>= 1.4, and use the complexity measures as initialized in MPEG TM5, i.e. ,
X, = 160· bit rate ! frame _ rate
X<sub>p</sub> = 60·bit rate!frame_rate (25)
X<sub>B</sub> = 40- bit rate / frame _rate we have the difference between the two target rates as follows:
<sub>Δ = T</sub> _<sub>r =</sub> (15-12)17, + (15-3-12-4)Ύ<sub>Ρ</sub>+(15-8-12-10)^/1.4 _1_ <sub>? </sub><sup>n</sup> (X, +3X<sub>P</sub> + 817,,/1.4) 15 ' (26)
Here, the target rate with a priori knowledge of the GOP structure is 3.5% higher than the rate without a priori knowledge of the GOP structure using the rate control system of the present invention. A shorter GOP results in smaller target rates for all three types of pictures.
= 3.5%-7
CA 02286640 1999-10-18
In the second numerical example, the starting GOP (II) has a length longer than the actual one,
i.e.,
N = 15 M = 3 --> JV,=1 W<sub>P</sub>=4 N<sub>B</sub> = 10 TV* = 18 M'=3 --> N',=] N'<sub>p</sub> = 5 N'<sub>B</sub>=Y1 The difference in target rates is <sub>Δ =</sub> _ <sub>r =</sub> (15 - 18)A<sub>y</sub> + (15 · 5 -18 · 4)A<sub>P</sub> + (15 · 12 -18· 10)A<sub>g</sub>/1.4 J_ (A, + 5X<sub>P</sub> +12A<sub>S</sub>/1.4) '15’ (27)
Here, the target rate with a priori knowledge of the GOP structure is 1.7% lower than the rate without a priori knowledge of the GOP structure using the rate control system of the present invention. A longer GOP results in the assignment of more bits to all the pictures of three types.
The differences in target bit rates will remain until the end of either the starting GOP or the actual GOP, depending on whether the starting GOP is shorter or longer than the actual GOP length.
If the starting GOP is shorter than the actual = -1.7%
GOP (i.e. N <N ), at the end of the starting GOP, we will extend the GOP of Ν' pictures by M pictures with additional bits of R<sub>Cl</sub>
The
GOP.M remaining number of bits is therefore equal to bit rate
R = R + R<sub>gopm</sub>=M(28) framerate
Note that we have assumed R - 0 at the end of the starting GOP of Ν' pictures. The additional M pictures actually form another GOP of N = M
CA 02286640 1999-10-18 pictures with N',-0, N'<sub>p</sub> = \ and N'<sub>g</sub> = Μ-1, and a bit budget of M · (bit rate i frame rate) bits. The differences in target rates for the M additional pictures of either P or B type (see eqn. 24) can be simplified as:
_
<img file="CA2286640C_D0003.tif" />
(29)
For the first numerical example, the difference in target bit rates is:
(-3)X, +(15-3·4)Ύ<sub>Ρ</sub> +(15·2-3·10)Ύ<sub>β</sub>/1,·4 J — τ =η.ΌΚ>·τ 15 (30) (X<sub>p</sub>+2X<sub>B</sub>/i.4)
Here, the target rate with a priori knowledge of the GOP structure is 17.0¾ higher than the rate without a priori knowledge of the GOP structure using the rate control system of the present invention. Relatively more bits are assigned to the pictures of the extended GOP since relatively fewer bits were assigned to the previous pictures. If the extended GOP of M pictures still cannot end the actual GOP of N pictures, we repeat the above procedure until reaching the end of the actual GOP. The differences in target rates for the pictures in the extended GOPs of M pictures will remain the same because all the extended GOPs of M pictures have the same pattern of picture organization and the same bit budget.
CA 02286640 1999-10-18
At the end of the first actual GOP of N pictures and also at the end of the last extended GOP of M pictures, we have complete information about the actual GOP structure with the remaining number of bits 7? = 0. Hence, from the second GOP, there will be no difference in target rates. Two target rates with and without a priori knowledge of GOP structure using the rate control system of the present invention will be the same from the second actual GOP.
On the other hand, if the assumed starting GOP length is longer than the actual GOP length (i.e.
N'>N), at the end of the actual GOP, we have the complete information about the actual GOP structure, but the remaining number of bits R Φ 0. That is, there will be some left over bits to allocate over the second (actual) GOP. Hence, instead of simply giving R<sub>GOPN</sub> bits to the second (actual) GOP, we have to adjust R as R = 2R<sub>G0PN</sub> - (R<sub>GOPN</sub>, - R) (see eqn.
23). The target bit rates with correct and incorrect starting GOP structures will still not be the same in the second (actual) GOP. The difference in target rates in the second (actual) GOP is
Δ=?;-Γ<sub>λ</sub> (31a)
X..
Y Y Y <sub>Νι</sub>/.Χχ<sub>ι +Νρ</sub><sup>Λ</sup>Χ. <sub>+ Ν</sub> (R (ΪΟΙ’,Ν (R<sub>Gi</sub>
GOP.N· κ,
Κρ (31b)
CA 02286640 1999-10-18 n,t n,t
Ν,^Χ,+NpXx + N,
K<sub>R</sub> ( RgOP.N * (h aop.N'
-R)) :3ic)
P ^B
Here, R<sub>G0PN</sub>,-R is the number of bits assigned for the first N pictures, which is equal to:
^GOP.N’ ~ <sup>!</sup> K,
K<sub>B</sub> + Np
Xb
K<sub>B</sub> y
V<sup>1</sup> —L <sub>+</sub> jj< -/- <sub>+</sub> fj' <sup>;V</sup> / p- <sup>T</sup> '<sup>V</sup> P v <sup>T 7V</sup> Β y Λ, A „ A y GOP, Ν' Xi. D (32:
Hence, the difference in target rate becomes:
n,t <sup>1</sup> K, + Np
Kp + Np
Kp
GOP,N
N,
Kp + Np
Kp
Ν'
K, + N'
Xf
Kp + Ν'
X,
Kp (33a)
-R.
GOP, Ν'.
(NN', -Ν'N,)^ + (NN'p-N'N<sub>p</sub>)Xx + (NN'<sub>B</sub> -Ν' N<sub>B</sub> )
K, K<sub>o</sub> K<sub>o</sub> 1 (Ν’,/ + N’<sub>f</sub>/ + N·, XL)
J\.j rip <sup>B</sup> —·Τ<sub>η </sub>N <sup>n</sup> (33b)
By comparing equations (24) and (33), we should see the differences in target rates in the first and second actual GOP have the same absolute values, but different signs. In fact, a longer starting GOP uses more bits for the first actual GOP and therefore leaves less bits for the second actual
GOP. For the second numerical example, the differences in target rates for pictures in the second actual GOP are:
CA 02286640 1999-10-18
Δ = Γ„-Γ<sub>η</sub> = 1.7%·Γ„ (34)
At the end of the second actual GOP, the remaining number of bits 7? = 0 . The third actual GOP will be assigned R<sub>GOPtN</sub> bits. From the third actual GOP, there will be no difference in target rates .
Target rates with respect to frame number for the two numerical examples were analyzed. The target rate with a correct starting GOP (N = 15,M = 3 ) was the benchmark for comparison. Comparative data was obtained for a starting GOP (N = 12, M-3 ) , and for a starting GOP (N- 18, M = 3) . It was verified that all the pictures of the same type are assigned the same number of bits. Moreover, if the starting GOP is shorter than the actual GOP, fewer bits are assigned to the pictures before the end of the starting GOP, and more bits are assigned to the pictures of an extended GOP of M pictures. There is no difference in target rates starting from the second actual GOP.
On the other hand, if the starting GOP is longer than the actual one, slightly more bits are assigned to the pictures in the first actual GOP and fewer bits for the pictures in the second actual GOP. From the third actual GOP, the target rates are the same.
4. SIMULATION RESULTS
CA 02286640 1999-10-18
Simulations were conducted in evaluating the rate control system of the present invention. Test sequences were first coded at a bit rate of 15 Mbits/sec. with different sets of GOP parameters, as shown in Table I. The compressed bitstreams were then transcoded to a new rate of 3 Mbits/s with a starting GOP of /V = 15and A/=3.
<td></td><td> GOP1</td><td> GOP2</td><td> GOP3</td>
<td> N</td><td> 30</td><td> 12</td><td> 8</td>
<td> M</td><td> 3</td><td> 2</td><td> 1</td>
Target rates were analyzed for a correct starting set of GOP parameters, and for a starting GOP of 77 = 15 and M = 3 . Note that, in practice, a transcoder (or encoder) may not always meet the target rates at each frame. Hence, the remaining number of bits at the end of each GOP, R, may not be zero. The non-zero R will be passed to the next GOP (see eqn. 8). This implies that GOPs may be given slightly different number of bits. It was seen that a longer starting GOP assigns more bits for the pictures in the first GOP, as compared with a correct starting GOP. Hence, fewer bits are left for the pictures in the second GOP. The target rates with correct and incorrect GOP starts converging at the third GOP. On the other hand, a shorter starting GOP results in smaller target rates for the first few pictures and then more bits for the rest in the first GOP. Target rates become close from the second GOP.
CA 02286640 1999-10-18
To prove the effectiveness of the bit rate allocation system under a variety of test conditions, a sequence was coded with various GOP lengths, e.g., // = 15, 12, 12, 18, 18, 15, 15, 9, 9,
30. Target rates were analyzed at each GOP for the correct GOP length, and by using the previous GOP structure length as the starting GOP length for each GOP. The results were close with this stress test.
FIG. 6 illustrates a rate control system in accordance with the present invention. Precompressed bitstreams, e.g., program 1 and program 2, are provided to respective transcoders 620 and 630. One or several bitstreams and transcoders may be present. The bitstreams may be received realtime at the transcoders from a remote source, such as via a satellite broadcast, or may be provided from a local storage medium, for example.
The transcoders 620, 630 partially decompress the respective bitstreams, and encode the partially decompressed data at a different data rate, typically by using a different quantization parameter, according to a target bit rate signal· provided by a rate control processor 605.
The rate control processor 605 receives information from the transcoders, including the picture type of the current picture, and the quantization parameter used to encode the current picture. This information is processed as described herein to set the target bit rates. The rate control processor 605 may include known processing circuitry, such as a central processing unit (CPU)
CA 02286640 1999-10-18
612, and a memory 614. The memory 614 may be a nonvolatile memory that stores data, for example, for providing the initial distances M' and Ν' discussed previously. The rate control processor includes computing circuitry for executing the C-language like pseudo-code discussed previously.
A user interface 608 may communicate with the rate control processor 605 to set the default distances M' and Ν' or other relevant parameters in the rate control process.
The transcoded data from the transcoders 620, 630 is provided to a multiplexer (MUX) 660, and then to an encoder buffer 670. A buffer fullness signal is provided from the encoder buffer 670 to the rate control processor 605. The encoded data is finally transmitted over a channel at its new transcoded data rate.
5. CONCLUSION
A novel rate control system suitable for use with a digital video transcoder, such as one conforming to the MPEG standard, has been presented. The proposed rate control causes no processing delay and requires no extra memory. It can start with any reasonable set of GOP parameters, and then gradually corrects them when necessary as successive pictures are coded. Hence, it is able to address changes in the GOP structure of pre-compressed bitstreams, for example, when switching channels, inserting commercials, and the like. It has been shown that
CA 02286640 1999-10-18 the target rates with correct and incorrect starting GOP parameters will converge within one or two GOPs. The differences in target rates are within a fairly small margin. Moreover, similar target rates.
correspond to a similar PSNR or picture quality.
Although the invention has been described in connection with various specific embodiments, those skilled in the art will appreciate that numerous adaptations and modifications may be made thereto without departing from the spirit and scope of the invention as set forth in the claims.
Contents59
21 sheets
Sheet 1 Sheet 2 Sheet 3 Sheet 4 Sheet 5 Sheet 6 Sheet 7 Sheet 8 Sheet 9 Sheet 10 Sheet 11 Sheet 12 Sheet 13 Sheet 14 Sheet 15 Sheet 16 Sheet 17 Sheet 18 Sheet 19 Sheet 20 Sheet 21
17 members in 8 offices
Priority claims4
| Document | Office | Kind | Date |
|---|---|---|---|
| 09198867 | United States of America | – | |
| 19886798 | United States of America | A | |
| 09198867 | – | – | – |
| US19980198867 | – | – | – |
Members17
| Document | Office | Kind | |
|---|---|---|---|
| CA2286640A1 | Canada | A1 | |
| CN1255022A | China | A | |
| EP1005232A2 | European Patent Office (EPO) | A2 | |
| KR20000035651A | Republic of Korea | A | |
| TW450006B | Taiwan Province of China | B | |
| US2002159523A1 | United States of America | A1 | |
| US6570922B1 | United States of America | B1 | |
| EP1005232A3 | European Patent Office (EPO) | A3 | |
| US7020198B2 | United States of America | B2 | |
| CN1269360C | China | C | |
| EP1005232B1 | European Patent Office (EPO) | B1 | |
| AT385650T | Austria | T | |
| ATE385650T1 | Austria | T1 | |
| DE69938093D1 | Germany | D1 | |
| KR100880055B1 | Republic of Korea | B1 | |
| DE69938093T2 | Germany | T2 | |
| CA2286640CThis record | Canada | C |
2 legal events, as the office reported them to INPADOC
Over the term
Point at a mark for the eventEvents
| Event | Code | |
|---|---|---|
| ExpiryMKEX | MKEX | |
| Examination requestEEER | EEER |
Numbers
- Publication
- 2286640
- Publication, DOCDB
- 2286640
- Publication, EPODOC
- CA2286640
- Application
- 2286640
- Application, DOCDB
- 2286640
- Application, EPODOC
- CA19992286640
Titles2
- English
- RATE CONTROL FOR MPEG TRANSCODER WITHOUT A PRIORI KNOWLEDGE OF PICTURE TYPE
- French
- REGULATION DE DEBIT DANS UN TRANSCODEUR MPEG, SANS CONNAISSANCE PREALABLE DU TYPE D'IMAGE
Classification
- CPC, 10
- H04N21/23655
- H04N19/40
- H04N19/159
- H04N19/172
- H04N19/61
- H04N19/114
- H04N19/152
- H04N19/157
- H04N19/177
- H04N19/577
- IPC, 5
- H04N7 50
- H04N7 26
- H04N7 46
- H04N21 2365
- H04N21 434