Abstract:
An encoder includes an encoder engine, a storage device and a controller to implement an iterative coding process. The encoder engine compresses a selected portion of a data sequence. The storage device stores the compressed portion of the data sequence after each iteration. The controller selects the portion of the data sequence to compress for each iteration. The controller gathers statistics from the compressed portion of the data sequence. The gathered statistics include statistics generated by the selected frames and statistics extrapolated from the selected frames for the non-selected frames. The controller adjusts coding parameters of the encoder engine on each iteration until the gathered statistics meet a specified performance requirement.

Description:
CROSS REFERENCE TO RELATED APPLICATIONS 
     This application claims priority to U.S. Provisional Patent Application No. 60/737,803, filed Nov. 18, 2005, herein incorporated by reference in its entirety. 
    
    
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention generally relates to video encoders. More specifically, the present invention provides multipass encoding of a video sequence without encoding the entire video sequence on each pass. 
     2. Background Art 
     Highly efficient video compression can be achieved by multipass encoding. With multipass encoding, a video sequence is encoded several times and each encoding pass uses the results of the preceding pass to adjust coding parameters to optimize, for example, average bit rate and/or decoder buffer fullness. Overall, the mulitpass encoding process is a trial and error process: select initial coding parameters, code the video sequence, examine the results to determine if performance requirements are met and recode as necessary using adjusted coding parameters for each subsequent iteration. 
     For long sequences of digital video, however, coding the entire video sequence several times is inefficient and greatly increases the time required to generate an efficiently compressed sequence. Accordingly, what is needed is an encoder capable of generating a compressed video sequence by multipass encoding without encoding the entire video sequence on each pass. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The accompanying drawings illustrate the present invention and, together with the description, further serve to explain the principles of the invention and to enable one skilled in the pertinent art to make and use the invention. 
         FIG. 1  is a functional block diagram of an encoding system according to an aspect of the present invention. 
         FIG. 2  provides a flowchart illustrating operational steps for implementing a subsampling multipass encoding scheme according to an aspect of the present invention. 
         FIG. 3  illustrates a flowchart illustrating operational steps for implementing a subsampling multipass encoding scheme exploiting regions of homogeneity according to an aspect of the present invention. 
     
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     Embodiments of the present invention provide apparatuses and methods whereby an encoder efficiently generates a highly compressed video sequence using multipass encoding without coding all portions of the video sequence on each pass. In this regard, the present invention enables independent encoders to generate highly compressed video sequences in less time and by using fewer processing resources. 
       FIG. 1  is a functional block diagram of an encoding system  100  according to an aspect of the present invention. The encoding system  100  includes a video encoder engine  102 , an encoder controller  104  and a memory/storage device  106 . The storage device  106  receives and stores source image data  108 . The source image data  108  is an uncompressed video sequence that can include frame type assignment information. The storage device  106  provides the source image data  108  to the encoder engine  102 . The encoder engine  102  encodes the source image data  108  to produce coded data  110 . The coded data  110  is a compressed video data sequence. The encoder engine  102  encodes the source image data  108  based on coding parameters  112  provided by the controller  104 . 
     During intermediate encoding passes or iterations, the coded data  110  can be stored in the storage device  106 . The controller  104  can review the coded data  110  to determine coding results  114  of the encoding process. Specifically, the controller  104  can determine whether the results of any given encoding stage meet specified coding requirements such as, for example, an estimated decoder buffer fullness level or an average bit rate expectation. After a final encoding pass, when the controller  104  determines that coding requirements are met, the coded data  110  can be provided to a communication channel  116 . The communication channel  116  can be a real-time delivery system such as a communication network (e.g., a wireless communication network) or a computer network (e.g., the Internet). Alternatively, the communication channel  116  can be a storage medium (e.g., an electrical, optical or magnetic storage device) that can be physically distributed. Overall, the topology, architecture and protocol governing operation of the communication channel  116  is immaterial to the present discussion unless identified herein. 
     The controller  104  can determine what portion of the source image data  108  will be encoded on any given encoding pass. The selected frames can then be encoded on a first pass and any intermediate passes. The controller “subsamples” the source image data  108  when less than the entire sequence is selected for encoding. That is, during subsampling, the controller  104  directs the encoder engine  102  to only encode select frames from the video sequence rather than the entire sequence. The controller  104  uses the coding results  114  of the selected encoded frames to extrapolate information regarding the non-selected frames. Coding parameters can therefore be adjusted as necessary for a subsequent encoding pass based on the coding results of the selected frames and the extrapolated results of the non-selected frames. Further, the number, type and position of the frames selected for encoding can also be adjusted on each pass. When the coding results  114  of the coded data  110  meet specified requirements, the controller  104  can instruct the encoder engine  102  to encode the source image data  108  a final time to produce a complete coded data sequence  110 . 
     A variety of techniques, as described further below, can be used by the controller  104  to selectively subsample the source image data  108  and to extrapolate statistics for the non-selected frames based on selected encoded frames. Further, these techniques can be expanded to accommodate layered encoding. Overall, the encoding system  100  provides the efficient generation of a highly compressed coded data sequence  110  using multipass encoding. By not requiring the encoding of all portions of the source image data  108  on each coding pass, the encoding system  100  reduces the time needed to simulate the coded data  110  and confirm that coding requirements are met. In turn, a complete coded data sequence can be generated more quickly while ensuring the complete coded data sequence is highly compressed. 
     The encoding system  100  can be used to encode a variety of information including data, voice, audio, video and/or multimedia information according to known compression standards or protocols. In an embodiment of the present invention, the encoder engine  102  can implement digital video encoding protocols such as, for example, any one of the Moving Picture Experts Group (MPEG) standards (e.g., MPEG-1, MPEG-2, or MPEG-4) and/or the International Telecommunication Union (ITU) H.264 standard. Additionally, the constituent components of the encoding system  100  can be implemented in hardware, software or any combination thereof. 
     Further, coding adjustments made by the controller  104  and implemented by the encoder engine  102  can include a variety of techniques for adjusting bit rate. For example, a quantization parameter (qp) can be used whereby qp is increased to lower bit rate and is decreased to increase bit rate. The quantization parameter can also be based on a masking function φ r . The masking function φ r  can be used to define areas of high and low activity of a video picture. Regions of higher activity typically require a higher bit rate while regions defined as low activity may require a lower bit rate, thereby determining a corresponding encoding bit rate. Coding adjustments based on qp or φ r  can be made within a given frame, across several frames or across several clips as described in co-pending application Ser. No. 11/118,616, filed Apr. 28, 2005, herein incorporated by reference in its entirety. 
       FIG. 2  provides a flowchart  200  illustrating operational steps for implementing a subsampling multipass encoding scheme according to an aspect of the present invention. Specifically,  FIG. 2  provides a description of the possible operation of an encoding system of the present invention (e.g., the encoding system  100  depicted in  FIG. 1 ). 
     The flowchart  200  begins with an initialization step (not depicted in  FIG. 2  as a separate step). In the initialization step, source image data can be provided. Frame type selections (e.g., I vs. P vs. B, or reference vs. non-reference) can be provided with the source image data. Further, default coding selections can be available (e.g., default qp and/or φ r  determinations). 
     At step  202 , one of the subsampling schemes, to be described further below, can be chosen and a portion of the provided source image data can be selected for encoding. On the first pass, either a limited portion of the frames or all the frames can be selected. On intermediate passes, the frames may be subsampled as desired. For example, more frames or less frames can be selected for coding on a next pass. On a final pass, all of the frames can be selected and encoded to produce a fully encoded video sequence. 
     At step  204 , the selected frames of a particular pass can be encoded. The selected frames can be encoded according to selected encoding parameters (e.g., qp). Statistics (e.g., resulting bit rate and/or estimated decoder buffer fullness) relating to the encoding of the selected frames can also be generated and collected. 
     At step  206 , statistics (e.g., resulting bit rate and/or estimated decoder buffer fullness) for the frames not selected for encoding in step  202  can be determined. The statistics can be extrapolated from the statistics generated in step  204  for the selected frames. Extrapolation can be based on various parameters such as, for example, the number, type, location and dependence of the non-selected frames in relation to the selected frames as described in more detail below. 
     At step  208 , overall results can be determined and evaluated. Overall results can be determined based on the generated statistics of the selected frames and the extrapolated statistics of the non-selected frames. These combined results can then be compared to specified coding requirements (e.g., average bit rate or estimate buffer fullness for a completely coded sequence). 
     Step  210  can be implemented or executed when the specified coding requirements are met or expected to be met for an entire coded sequence. The coding parameters used for coding the selected frames can be applied to the non-selected frames. Alternatively, the coding parameters can be adjusted prior to encoding the omitted frames. The non-selected frames can then be encoded and combined with the previously encoded frames to produce a complete encoded sequence. Alternatively, the entire uncompressed video sequence can be re-encoded. 
     Step  212  can be implemented or executed when the specified coding requirements are not met or expected to be met for an entire coded sequence. Accordingly, a subsequent encoding pass can be implemented. Coding parameters (e.g., qp and/or φ r  can be adjusted before returning to step  204  for another round of coding and evaluation. Alternatively, the process can proceed to an optional step  214  to select a new subsampling scheme for further passes to conserve processing resources at the encoder. 
     Various subsampling schemes and corresponding extrapolation techniques of the present invention are described below. 
     In an embodiment of the present invention, the frames of a given video sequence may be subsampled on a first pass and all intermediate passes. The selected frames can be coded and corresponding statistics can be generated. Statistics (e.g., bit rate) for the non-selected frames may be extrapolated based on the statistics assembled for the selected and coded frames. Parameters of interest (e.g., average bit rate, buffer fullness, etc.) can be calculated based on the generated and extrapolated statistics. On the last pass, all the frames can be selected and encoded. Subsampling can be implemented according to a variety of techniques including, for example (a) coding all reference frames and omitting all non-reference frames; (b) coding all reference frames and one non-reference frame located between selected reference frames; or (c) coding a portion of the reference frames and, optionally, a single non-reference frame after each selected reference frame thereafter (such that a portion of the reference frames and the non-reference frames dependent thereon can be omitted). 
     In another embodiment of the present invention, the frames of a given video sequence may be subsampled on a first pass and all intermediate passes. The selected frames can be coded and corresponding statistics can be generated. Statistics (e.g., bit rate) for the non-selected frames can be extrapolated based on the statistics assembled for the selected and coded frames. Parameters of interest (e.g., average bit rate, buffer fullness, etc.) can be calculated based on the generated and extrapolated statistics. On the last pass, all the frames can be selected and encoded. Subsampling can be implemented on a Group of Pictures (GOP) basis. That is, for each GOP, the initial frame (e.g., an I-frame) can be coded along with only select B-frames. The selected B-frames can include, for example, the non-stored B-frames with a GOP. Statistics for the omitted B-frames can be extrapolated from the statistics generated from the coded B-frames. For example, the statistics of the remaining B-frames can be set equal to the average value of the statistics for the selected B-frames. Under this scenario, it is possible for some B-frames to not be encoded until the final pass. 
     In another embodiment of the present invention, all the frames of a given video sequence can be encoded on a first pass. Statistics for each of the coded frames can be stored for use on subsequent coding stages. Within the encoded video sequence, regions of homogeneity can be identified from the statistics gathered in the first round of coding. Regions of homogeneity can include, for example, regions where the bit rate is relatively constant or has a linear relationship among sub-regions. On subsequent passes, only select frames are encoded within each region of homogeneity and statistics for the non-selected frames within a region can be extrapolated. Within each region, only a few B-frames or even only one B-frame can be selected for coding during the intermediate stages. As a result, uncoded B-frames within a region can be assigned the average statistics of the coded B-frame(s). 
       FIG. 3  illustrates a flowchart  300  illustrating operational steps for implementing a subsampling multipass encoding scheme exploiting regions of homogeneity according to an aspect of the present invention. The present invention is not limited to this operational description. Rather, it will be apparent to persons skilled in the relevant art(s) from the teachings herein that other process control flows are within the scope and spirit of the present invention. In the following discussion, the steps in  FIG. 3  are described. 
     At step  302 , all of the frames of a video sequence can be encoded. The frames can be encoded using default coding parameters. Statistics from this encoded step can be kept or stored for later use. 
     At step  304 , parameters such as bit rate and buffer fullness can be examined. If these parameters meet specified requirements, then step  306  may be executed. If all frames are selected in step  302 , then step  306  may not need to be implemented. Step  306  may be implemented, however, if it is determined that other portions of the video sequence can be encoded using the coding parameters applied to the frames coded in step  302 . 
     If the parameters evaluated in step  304  do not meet specified requirements, then step  308  can be implemented. At step  308 , regions of homogeneity within the encoded frames can be identified. 
     At step  310 , a portion of the frames within a given region of homogeneity can be selected for encoding on a subsequent pass. For example, a single B-frame within a region of homogeneity can be selected. 
     At step  312 , the remainder of the video sequence can be reviewed and frames can be selected for re-coding within each region of homogeneity. 
     At step  314 , coding parameters (e.g., qp and/or φ r ) can be adjusted in response to the coding results collected and examined in step  304 . 
     At step  316 , the selected frames within the identified regions of homogeneity can be encoded. Statistics for the coded frames can then be generated. 
     At step  318 , statistics for the non-selected frames within each region of homogeneity can be derived from the statistics generated for the selected frames. Based on the generated and extrapolated statistics, overall coding results for each region of homogeneity and the entire video sequence can be determined. 
     At step  320 , the coding results of each region of homogeneity and the entire video sequence can be compared to specified requirements. If the requirements are met or satisfied, then step  306  can be implemented such that the remaining uncoded frames can be re-encoded (or all frames re-encoded) a final time. If the requirements are not met, then either step  310  or step  314  can be implemented. Step  314  can be implemented if the same selected frames within each region of homogeneity are to be re-encoded on a subsequent pass. Step  310  can be implemented if some or all of the selected frames within the regions of homogeneity are to be adjusted or re-selected. It is also possible to use the statistics stored from step  302  along with the results derived in step  318  to review and re-identify the regions of homogeneity within the coded video sequence. In this way, the estimated regions of homogeneity can be further refined. 
     In another embodiment of the present invention, the frames of a given video sequence can be subsampled on a first pass and all intermediate passes. The selected frames can be coded and corresponding statistics can be generated. Statistics (e.g., bit rate) for the non-selected frames can be extrapolated based on the statistics assembled for the selected and coded frames. Parameters of interest (e.g., average bit rate, buffer fullness, etc.) can be calculated based on the generated and extrapolated statistics. On the last pass, all the frames can be selected and encoded. Subsampling can be implemented on a Group of Pictures (GOP) basis. That is, for each GOP, the initial frame (e.g., an I-frame) can be coded along with select P-frames and, optionally, select B-frames. Statistics for omitted B-frames (e.g., non-stored B-frames that depend on non-selected P-frames) can be extrapolated from the statistics generated from coded B-frames. Likewise, statistics for omitted P-frames can be extrapolated from the statistics generated from coded P-frames. For example, the statistics of the remaining B-frames and P-frames can be set equal to the average value of the statistics for the selected B-frames and P-frames, respectively. 
     In another embodiment of the present invention, all the frames of a given video sequence can be encoded on a first pass. Statistics for each of the coded frames can be stored for use on subsequent coding stages. Within the encoded video sequence, regions of homogeneity can be identified from the statistics gathered in the first round of coding. Regions of homogeneity can include, for example, regions where the bit rate is relatively constant or has a linear relationship among sub-regions. On subsequent passes, only select frames are encoded within each region of homogeneity and statistics for the non-selected frames within a region can be extrapolated. Within each region, only a few P-frames or even only one P-frame is selected for coding during the intermediate stages. Accordingly, uncoded P-frames within a region can be assigned the average statistics of the coded P-frame(s). Further, select B frames within each region of homogeneity can be encoded (e.g., B-frames that depend on the selected P-frame(s)). Statistics can then be extrapolated for the remaining B-frames based on the coded frames. 
     In another embodiment of the present invention, none of the frames of a given video sequence are encoded on a first pass. Instead, the frames are surveyed to gather and store statistics on the frames. On subsequent passes, the stored statistics can be used to determine regions of homogeneity. Within each identified region of homogeneity, a select portion of the frames can be encoded. Statistics for the unencoded frames within each region of homogeneity can be derived from statistics generated from the coded frames. 
     In another embodiment of the present invention, any of the encoding methods described above can be applied to a layered encoding scenario. In a layered encoding scenario, an encoder of the present invention produces a base layer and one or more enhancement layers. The base layer can be decoded independently and typically produces a picture of medium quality when decoded. An enhancement layer typically cannot be decoded independently but instead is dependent upon a specified base layer. The enhancement layer typically includes information that enhances or improves the quality of the picture provided by the base layer or the base layer and any previously applied enhancement layers. Accordingly, in an aspect of the present invention, any layer can use any of the subsampling encoding methods described herein. 
     In another embodiment of the present invention, two layers can be defined for each video sequence. A first layer includes a portion of the frames in the video sequence (e.g., all of the reference frames in the video sequence). A second layer includes all of the frames in the video sequence. In a first stage of coding, the first layer can be encoded over multiple passes until the estimated bit rate of the first layer falls within a first specified tolerance level of a target bit rate. The first specified tolerance level represents the confidence an encoder of the present invention has in the estimated bit rate. This confidence can depend upon several factor including, for example, the number or percentage of skipped macroblocks or region of pixels, the number or percent of intra macroblocks or region of pixels, the uniformity of bit rate change over a window of frames, etc. The bit rate can be estimated on each encoding pass of the first layer by executing a low complexity encoding of the first layer frames (e.g., using the subsampling techniques described herein) and determining the resulting bit rate. 
     In a second stage of coding, the second layer can be encoded over multiple passes until the estimated bit rate of the second layer falls within a second specified tolerance level of the target bit rate. The bit rate can be estimated on each encoding pass of the second layer by executing a low complexity encoding of the second layer frames (e.g., using the subsampling techniques described herein) and determining the resulting bit rate. The resulting bit rate can be adjusted by a scale factor derived from the statistics gathered during the last stage of encoding for the first layer. For example, an encoder of the present invention may store the ratio of frame bits between the reference frames and the non-reference frames after the last stage of coding the first layer. The encoder can then assume that this ratio is fixed for operations involving the coding of the second layer. 
     In another embodiment of the present invention, an encoder of the present invention defines a layer for each pass as a function of its confidence in an estimated bit rate. A layer can be defined to include all frames within a video sequence if the encoder of the present invention has no prior knowledge of the sequence. As knowledge is gathered from a layer on each coding pass, or if prior information on a sequence is known, then the layer is redefined by adaptively removing frames from the previous layer. Prior knowledge may include motion compensated sum of absolute difference values, masking values, previous bit rate estimates, location variations in estimated bit rate, etc. Frames can be removed based on a confidence measure derived from the prior or accumulated knowledge which can include a measure of the homogeneity of a local neighborhood of frames. Frames within a local neighborhood of frames can be selectively removed based on an assigned reference count of a frame. Specifically, frames can be assigned a reference count specifying the number of frames that depend on the given frame. Accordingly, frames with lower count reference frames can be removed prior to higher count reference frames. Selectively removing frames as described can be applied to any of the methods described above. 
     While various embodiments of the present invention have been described above, it should be understood that they have been presented by way of example and not limitation. It will be apparent to one skilled in the pertinent art that various changes in form and detail can be made therein without departing from the spirit and scope of the invention. Therefore, the present invention should only be defined in accordance with the following claims and their equivalents.