Motion video signal encoder and encoding method
A motion video signal encoder maximizes image quality without exceeding transmission bandwidth available to carry the encoded motion video signal by comparing encoded frames of the motion video signal to a desired size of frame. If the size of encoded frames differ from the desired size, encoding is adjusted to produce encoded frames closer in size to the desired size. In addition, a cumulative bandwidth error records an accumulated amount of available bandwidth. The cumulative bandwidth error is adjusted as time elapses to add to the available bandwidth and as each frame is encoded to thereby consume bandwidth. As the cumulative bandwidth error grows in magnitude above or below zero, encoding is adjusted as needed to either improve image quality to more completely consume available bandwidth or to reduce image quality to thereby consume less bandwidth and to thereby cause the cumulative bandwidth error to move toward zero. Rapid changes in the amount of change or motion in the motion video signal are detected by comparing the amount of change between two consecutive frames and filtering the amount of change with previously measured amounts of change. Encoding is pre-compensated according to the filtered measurement of rapid change.
Latest Microsoft Patents:
- SEQUENCE LABELING TASK EXTRACTION FROM INKED CONTENT
- AUTO-GENERATED COLLABORATIVE COMPONENTS FOR COLLABORATION OBJECT
- RULES FOR INTRA-PICTURE PREDICTION MODES WHEN WAVEFRONT PARALLEL PROCESSING IS ENABLED
- SYSTEMS AND METHODS OF GENERATING NEW CONTENT FOR A PRESENTATION BEING PREPARED IN A PRESENTATION APPLICATION
- INFRARED-RESPONSIVE SENSOR ELEMENT
This is a continuation of U.S. patent application Ser. No. 09/653,124, filed Aug. 31, 2000, now U.S. Pat. No. 6,707,852, which is a divisional of U.S. patent application Ser. No. 08/841,838, filed on May 5, 1997, now U.S. Pat. No. 6,115,420, which is a continuation-in-part of U.S. patent application Ser. No. 08/819,507, filed Mar. 14, 1997, now U.S. Pat. No. 6,118,817, each of which are incorporated hereby reference.
FIELD OF THE INVENTIONThe present invention relates to digital video signal compression and, in particular, to a particularly efficient signal encoding mechanism for encoding digital video signals according to digital video standards such as the ITU standard H.263.
BACKGROUND OF THE INVENTIONWith the advent of digital video products and services, such as Digital Satellite Service (DSS) and storage and retrieval of video streams on the Internet and, in particular, the World Wide Web, digital video signals are becoming ever present and drawing more attention in the marketplace. Because of limitations in digital signal storage capacity and in network and broadcast bandwidth limitations, compression of digital video signals has become paramount to digital video storage and transmission. As a result, many standards for compression and encoding of digital video signals have been promulgated. For example, the International Telecommunication Union (ITU) has promulgated the H.261 and H.263 standards for digital video encoding. Additionally, the International Standards Organization (ISO) has promulgated the Motion Picture Experts Group (MPEG), MPEG-1, and MPEG-2 standards for digital video encoding.
These standards specify with particularity the form of encoded digital video signals and how such signals are to be decoded for presentation to a viewer. However, significant discretion is left as to how the digital video signals are to be transformed from a native, uncompressed format to the specified encoded format. As a result, many different digital video signal encoders currently exist and many approaches are used to encode digital video signals with varying degrees of compression achieved.
In general, greater degrees of compression are achieved at the expense of video image signal loss and higher quality motion video signals are achieved at the expense of lesser degrees of compression and thus at the expense of greater bandwidth requirements. It is particularly difficult to balance image quality with available bandwidth when delivery bandwidth is limited. Such is the case in real-time motion video signal delivery such as video telephone applications and motion video on demand delivery systems. It is generally desirable to maximize the quality of the motion video signal as encoded without exceeding the available bandwidth of the transmission medium carrying the encoded motion video signal. If the available bandwidth is exceeded, some or all of the sequence of video images are lost and, therefore, so is the integrity of the motion video signal. If an encoded motion video signal errs on the side of conserving transmission medium bandwidth, the quality of the motion video image can be compromised significantly.
The format of H.263 encoded digital video signals is known and is described more completely in “ITU-T H.263: Line Transmission of Non-Telephone Signals, Video Coding for Low Bitrate Communication” (hereinafter “ITU-T Recommendation H.263”). Briefly, in H.263 and other encoded video signal standards, a digital motion video image signal, which is sometimes called a video stream, is organized hierarchically into groups of pictures which include one or more frames, each of which represents a single image of a sequence of images of the video stream. Each frame includes a number of macroblocks which define respective portions of the video image of the frame. An I-frame is encoded independently of all other frames and therefore represents an image of the sequence of images of the video stream without reference to other frames. P-frames are motion-compensated frames and are therefore encoded in a manner which is dependent upon other frames. Specifically, a P-frame is a predictively motion-compensated frame and depends only upon one I-frame or, alternatively, another P-frame which precedes the P-frame in the sequence of frames of the video image. The H.263 standard also describes BP-frames; however, for the purposes of description herein, a BP-frame is treated as a P-frame.
All frames are compressed by reducing redundancy of image data within a single frame. Motion-compensated frames are further compressed by reducing redundancy of image data within a sequence of frames. Since a motion video signal includes a sequence of images which differ from one another only incrementally, significant compression can be realized by encoding a number of frames as motion-compensated frames, i.e., as P-frames. However, errors from noise introduced into the motion video signal or artifacts from encoding of the motion video signal can be perpetuated from one P-frame to the next and therefore persist as a rather annoying artifact of the rendered motion video image. It is therefore desirable to periodically send an I-frame to eliminate any such errors or artifacts. Conversely, I-frames require many times more bandwidth, e.g., on the order of ten times more bandwidth, than P-frames, so encoding I-frames too frequently consumes more bandwidth than necessary. Accordingly, determining when to include an I-frame, rather than a P-frame, in an encoded video stream is an important consideration when maximizing video image quality without exceeding available bandwidth.
Another important consideration when maximizing video image quality within limited signal bandwidth is the compromise between image quality of and bandwidth consumed by the encoded video signal as represented by an encoding parameter λ. In encoding a video signal, a particular value of encoding parameter λ is selected as a representation of a specific compromise between image detail and the degree of compression achieved. In general, a greater degree of compression is achieved by sacrificing image detail, and image detail is enhanced by sacrificing the degree of achievable compression of the video signal. In the encoding standard H.263, a quantization parameter Q effects such a comprise between image quality and consumed bandwidth by controlling a quantization step size during quantization in an encoding process.
However, a particular value of encoding parameter λ which is appropriate for one motion video signal can be entirely inappropriate for a different motion video signal. For example, motion video signals representing a video image which changes only slightly over time, such as a news broadcast (generally referred to as “talking heads”), can be represented by relatively small P-frames since successive frames differ relatively little. As a result, each frame can include greater detail at the expense of less compression of each frame. Conversely, motion video signals representing a video image which changes significantly over time, such as fast motion sporting events, require larger P-frames since successive frames differ considerably. Accordingly, each frame requires greater compression at the expense of image detail.
Determining an optimum value of encoding parameter λ for a particular motion video signal can be particularly difficult. Such is especially true for some motion video signals which include both periods of little motion and periods of significant motion. For example, in a motion video signal representing a football game includes periods where both teams are stationary awaiting the snap of the football from the center to the quarterback and periods of sudden extreme motion. Selecting a value of encoding parameter λ which is too high results in sufficient compression that frames are not lost during high motion periods but also in unnecessarily poor image quality during periods were players are stationary or moving slowly between plays. Conversely, selecting a value of encoding parameter λ which is too low results in better image quality during periods of low motion but likely results in loss of frames due to exceeded available bandwidth during high motion periods.
A third factor in selecting a balance between motion video image quality and conserving available bandwidth is the frame rate of the motion video signal. A higher frame rate, i.e., more frames per second, provides an appearance of smoother motion and a higher quality video image. At the same time, sending more frames in a given period of time consumes more of the available bandwidth. Conversely, a lower frame rate, i.e., fewer frames per second, consumes less of the available bandwidth but provides a motion video signal which is more difficult for the viewer to perceive as motion between frames and, below some threshold, the motion video image is perceived as a “slide show,” i.e., a sequence of discrete, still, photographic images. However, intermittent loss of frames resulting from exceeding the available threshold as a result of using an excessively high frame rate provides a “jerky” motion video image which is more annoying to viewers than a regular, albeit low, frame rate.
I-frame placement and encoding parameter λ value selection combine to represent a compromise between motion video image quality and conservation of available bandwidth. However, to date, conventional motion video encoders have failed to provide satisfactory motion video image quality within the available bandwidth.
SUMMARY OF THE INVENTIONIn accordance with the present invention, a primary open loop rate control selects an optimized encoding parameter λ by determining a desired size for an individual frame and comparing the size of the frame as encoded to the desired size. Encoding parameter λ represents a compromise between the distortion introduced into a motion video signal as a result of encoding the motion video signal and the amount of data required to represent the motion video signal as encoded and therefore the amount of bandwidth consumed in delivering the encoded motion video signal. A specific value of encoding parameter λ represents a specific compromise between image quality and consumed bandwidth. Encoding a motion video signal in accordance with encoding parameter λ effects the compromise between consumed bandwidth and video image quality represented by encoding parameter λ. If the encoded frame size is greater than the desired size, encoding parameter λ is increased to reduce the size of subsequently encoded frames to consume less bandwidth at the expense of image quality. Conversely, if the encoded frame size is less than the desired size, encoding parameter λ is reduced to increase the size of subsequently encoded frames to improve image quality and to fully consume available bandwidth. As a result, each frame is encoded in a manner which maximizes image quality while approaching full consumption of available bandwidth and guarding against exceeding available bandwidth.
Further in accordance with the present invention, a secondary close loop rate control ensures that overall available bandwidth is never exceeded. Encoding parameter λ is selected by accumulating a cumulative bandwidth error which represents the amount by which bandwidth consumed by encoding a motion video signal deviates from the amount of bandwidth which is available for encoding of the motion video signal. The cumulative bandwidth error accumulates as time passes and is consumed by encoded frames which are transmitted through the communication medium whose bandwidth is measured. Encoding frames which are consistently slightly too large results in incremental reductions in the cumulative bandwidth error which can have a negative value and which can grow in magnitude as a result of such reductions. In response to the reduction of the cumulative bandwidth error, encoding parameter λ is increased to reduce the size of subsequently encoded frames to consume less bandwidth at the expense of image quality. Encoding frames which are consistently slightly too small results in a incremental increases in the cumulative bandwidth error. In response to the increases in the cumulative bandwidth error, encoding parameter λ is decreased to increase the size of subsequently encoded frames to improve image quality and to fully consume available bandwidth. As a result, gradual trends of the primary open loop rate control which allow available bandwidth to accumulate or to be exceeded are thwarted. In addition, secondary closed loop rate control contributes to selecting an optimum compromise between image quality and available bandwidth.
Further in accordance with the present invention, motion video images which change from a slow changing scene to a rapidly changing scene are detected and encoding parameter λ is adjusted to more quickly adapt to the changing motion video signal and to continue to provide a particularly desirable compromise between image quality and available bandwidth. In particular, the absolute pixel difference between two consecutive frames is measured. Previously measured absolute pixel differences corresponding to previously encoded frames of the motion video signal are filtered to form a filtered previous absolute pixel difference. Encoding parameter λ is adjusted in accordance with the absolute pixel difference and the filtered previous absolute pixel difference independently of changes to encoding parameter λ as determined by the primary open loop rate control and secondary closed loop rate control described above. In particular, if the current absolute pixel difference is greater than the filtered previous absolute pixel difference, showing an increase in the rate of change between frames, encoding parameter λ is increased to reduce the size of subsequently encoded frames and to thereby make additional bandwidth available for such encoded frames. Conversely, if the current absolute pixel difference is less than the filtered previous absolute pixel difference, a decrease in the rate of change between frames is detected and encoding parameter λ is decreased to improve image quality and to more fully consume available bandwidth. As a result, the optimum compromise achieved by the primary open loop rate control and the secondary closed loop rate control is more stable, i.e., reaches equilibrium more quickly, when the rate of change between frames of a motion video image changes significantly and rapidly.
Further in accordance with the present invention, a scene change between frames of a motion video signal are detected and the first frame of the new scene is encoded as an I-frame. As a result, the encoded frame is only slightly larger than an equivalent P-frame since a scene change represents a particularly large change between the current frame and the previous frame. In addition, the encoding of the next I-frame is postponed until the expiration of a full I-frame interval which starts with the encoding of the scene change I-frame, even if the previous I-frame interval had partially elapsed but had not expired prior to encoding of the I-frame. A scene change is detected by measuring the absolute pixel difference between the current frame and the previous frame, filtering the absolute pixel difference with a previously filtered absolute pixel difference, and comparing the newly filtered absolute pixel difference to a threshold. The threshold is proportional to the previously filtered absolute pixel difference. If the newly filtered absolute pixel difference is greater than the threshold, the current frame is determined to be the first frame of a new scene and is therefore encoded as an I-frame.
Each of these mechanisms represents a significant improvement over the prior art and enhances the quality of a motion video image without exceeding available bandwidth. These mechanisms can be used individually or in combination.
In accordance with the present invention, a video signal encoder 100 (
Motion estimator/compensator 108 produces a current motion-compensated frame from the motion vectors and the current and reconstructed previous frames received from buffers 102 and 128. Motion estimator/compensator 108 passes the motion-compensated frame to transform coder 110 which performs a transformation, e.g., a direct cosine transformation (DCT), on the motion-compensated macroblocks of the motion-compensated frame to produce a transformed frame. Transform coder 110 passes the transformed frame to a quantizer 112. Quantizer 112 quantizes coefficients used in transform coder 110 and these coefficients are then used later for Huffman coding the transformed frame to complete compression of the current frame retrieved from buffer 102. Huffman coding is described more completely in copending U.S. patent application Ser. No. 08/818,805 now abandoned, for “Method and Apparatus for Implementing Motion Detection and Estimation in Video Compression” filed on Mar. 14, 1997, and that description is incorporated herein by reference.
As described briefly above, a reconstructed previous frame is used to estimate motion between consecutive frames. The reconstructed previous frame is formed as follows. A dequantizer 120 receives the encoded current frame from quantizer 112 and performs the inverse of the quantization performed by quantizer 112. The dequantized frame is transferred from dequantizer 120 to a transform decoder 122 which performs an inverse transformation of the transformation performed by transform coder 110. A frame reconstructor 124 receives the transformed frame and reconstructs a reconstructed current frame therefrom. Specifically, frame reconstructor 124 reconstructs motion-compensated macroblocks of the frame received from transform decoder 122 by reference to a previously reconstructed frame stored in buffer 128. The reconstructed current frame is stored in a buffer 126 and the reconstructed frame which is previously stored in buffer 126 is moved to buffer 128. Therefore buffer 128 stores a reconstructed previous frame which is reconstructed from the previously encoded frame. Dequantizer 120, transform decoder 122, and frame reconstructor 124 are conventional.
Quantization by quantizer 112 is important in the encoding of a frame because a significant loss of signal for the sake of better compression can happen during quantization of the transform parameters. Quantization of coefficients used in transform coder 112 is known and is described, for example, in ITU-T Recommendation H.263 and that discussion is incorporated herein by reference. During quantization, and during other steps in the encoding of a motion video signal, an expression, D+λR, represents a selected compromise between motion video image quality and the degree of compression and thus consumed bandwidth. Specifically, D represents the distortion of a particular block of a frame of the motion video signal, i.e., the amount by which the block as encoded deviates from the block prior to encoding, and R represents the rate, i.e., amount of data required to encode the block. λ 114 (
The expression, D+λR, is known and is used to select among various options when encoding a motion video signal. Generally, the expression, D+λR, is evaluated for each of a number of encoding options and the option for which the expression has a minimized value is selected as having the best compromise between image quality and available bandwidth. In particular, such selections are typically made during quantization where the bulk of image quality sacrifices for better compression are made. In general, a larger value stored in λ 114 results in a greater degree of compression, and thus less consumed bandwidth, at the expense of greater signal loss. Conversely, a smaller value stored in λ 114 generally results in less signal loss at the expense of a smaller degree of compression and thus greater consumed bandwidth.
As described above in greater detail, the appropriate value of λ 114 for a given motion video signal depends on the particular subject matter of the particular motion video signal and, in fact, can change dramatically within a given motion video signal. Accordingly, λ 114 is controlled by a λ adjuster 116. λ adjuster 116 is shown in greater detail in
In general, primary open loop rate control 202 (
In test step 306 (
In one embodiment, λ 114 is increased according to the following equation.
dλ=λ·(surplus/target)·damping_factor (1)
In equation (1), dλ represents the amount by which λ 114 is changed in step 308 (
In general, it is preferred that λ 114 (
After step 308 (
If, in test step 306 (
In step 312, primary open loop rate control 202 (
dλ=λ·(deficit/current_size)·damping_factor (2)
In equation (2), dλ represents the amount by which λ 114 is changed in step 312. Current_size represents the size of the current P-frame, and deficit represents the amount by which the target size exceeds the size of the current frame. Thus, λ 114 is decreased in step 312 by an amount which is proportional to the percentage of the size of the current P-frame which is exceeded by the target size. Damping_factor is directly analogous to the damping factor described above with respect to equation (1). In one embodiment, the damping factors in equations (1) and (2) are equivalent.
It is important to prevent λ 114 from decreasing too rapidly in which case available bandwidth can easily and quickly be exceeded. Therefore, primary open loop rate control 202 (
Thus, primary open loop rate control 202 determines an appropriate and relatively optimum compromise between image quality and bandwidth availability by comparing the size of the current encoded P-frame to a target, theoretically optimum, encoded P-frame size. However, use of primary open loop rate control 202 alone does not guarantee that the total available bandwidth will not be exceeded. For example, if P-frames are consistently slightly larger than the target size, available bandwidth can be eventually exceeded. Therefore, secondary closed loop rate control 204 uses a cumulative bandwidth buffer to ensure that the total available bandwidth is never exceeded.
Secondary closed loop rate control 204 monitors a cumulative bandwidth error to ensure that small cumulative excesses of bandwidth overlooked by primary open loop rate control 202 do not result in the encoded motion video signal exceeding the overall available bandwidth. Specifically, if the cumulative bandwidth error grows too large in magnitude, adjustments to λ 114 by secondary closed loop rate control 204 are large enough to compensate for any adjustments to λ 114 by primary open loop rate control 202.
Processing by secondary closed loop rate control 204 is illustrated in logic flow diagram 400 (
Loop step 406 and next step 418 define a loop in which each frame, both I-frames and P-frames, are processed according to steps 408–416. In step 408, secondary closed loop rate control 204 adjusts the cumulative bandwidth error according to the size of the current encoded frame, i.e., the most recently encoded frame received from I/P framer 106 (
In test step 410, secondary closed loop rate control 204 determines whether the cumulative bandwidth error is less than zero, i.e., indicates that more than the available bandwidth is being consumed. If the cumulative bandwidth error is not less than zero, processing transfers to test step 414 which is described more completely below. Conversely, if the cumulative bandwidth error is less than zero, bandwidth consumption is exceeding the available bandwidth and processing transfers to step 412 in which secondary closed loop rate control 204 increases λ 114. Accordingly, image quality is sacrificed to conserve bandwidth used by subsequent frames. In one embodiment, λ 114 is adjusted according to the following equation.
d=λ·(error_percentage·damping_factor+0.02) (3)
In equation (3), dλ represents the amount by which λ 114 is adjusted in step 412. Error_percentage represents the percentage of the maximum allowable bandwidth error indicated by the cumulative bandwidth error. Damping_factor represents a percentage of error_percentage which is to be applied to λ 114 for any one frame and is fixed at 10% in one embodiment. The constant 0.02 in equation (3) represents a minimum correction of λ 114 whenever a negative cumulative bandwidth error is detected by secondary closed loop rate control 204. In equation (3), the minimum correction is 2% of the current value of λ 114. Without a minimum correction factor of 0.02, small cumulative bandwidth errors would be permitted to grow significantly before the error_percentage of equation (3) grows large enough to correct λ 114. After step 412, processing of the current frame by secondary closed loop rate control 204 completes.
In test step 414, secondary closed loop rate control 204 (
Thus, primary open loop rate control 202 adjusts λ 114 for each encoded frame to reach an optimum compromise between image quality and conserved bandwidth while secondary closed loop rate control 204 ensures that small excessive uses of bandwidth do not accumulate such that frames are ultimately lost as a result of exceeding available bandwidth. It should be noted that adjustments to λ 114 in steps 412 (
While primary open loop rate control 202 (
In step 504 (
k=128000./(frame_size_ratio·bit_rate+128000.) (4)
In equation (4), k is the pre-compensation weight. Frame_size_ratio represents a ratio of the predetermined frame size to the size of frames of source video signal 1040 and is therefore inversely proportional to the size of frames of source video signal 1040. In one embodiment, the predetermined reference frame size is 320 columns and 240 rows of pixels, i.e., 76,800 pixels. Bit—rate represents the available bandwidth of the delivery medium of the encoded motion video signal. Thus, as the size of frames decrease or as bit_rate increases, conserving bandwidth is less important and the pre-compensation weight of k decreases to approach a value of zero. Conversely, as the size of frames increase or as bit_rate decreases, conserving bandwidth becomes more important and the pre-compensation weight of k increases to approach a value of one.
Processing transfers to step 508 (
dλ=k·(abs_diff/(prev_abs_diff+2.)) (5)
In equation (5), dλ represents the pre-compensation percentage by which λ 114 is adjusted by λ pre-compensator 206. K represents the pre-compensation weight described above with respect to step 506 and equation (4). Abs_diff represents difference between the current absolute pixel difference received in step 502 (
Thus, the pre-compensation percentage is proportional to the percentage by which the current absolute pixel difference deviates from the filtered previous absolute pixel difference. In addition, the sign of the pre-compensation percentage reflects the direction of the deviation of the current absolute pixel difference from the filtered previous absolute pixel difference. Thus, if recently encoded frames of the encoded motion video signal change from one another by only a relatively small amount and the current frame represents significant change from the previous frame, then a large positive deviation from the filtered previous absolute pixel difference will be reflected in the current absolute pixel difference. Accordingly, λ pre-compensator 206 (
By adding two to the filtered previous absolute pixel difference in the denominator of the ratio between the current absolute pixel difference and the filtered previous absolute pixel difference, λ pre-compensator 206 (
In step 510, λ pre-compensator 206 (
In step 512, λ pre-compensator 206 (
new_prev_abs_diff=(curr_abs_diff+prev_abs_diff)/2. (6)
In equation (6), curr_abs_diff represents the current absolute pixel difference, and prev_abs_diff represents the filtered previous absolute pixel difference. New_prev_abs_diff represents the new filtered previous absolute pixel difference which supplants the filtered previous absolute pixel difference and is used as the filtered previous absolute pixel difference in a subsequent performance of step 508 (
I-Frame Placement
As described above, I-frame placement is an important consideration in achieving an optimum balance between motion video image quality and available bandwidth. In general, I-frames are encoded periodically to clear any errors in the encoded motion video signal which can propagate from P-frame to P-frame. Therefore, an I-frame maximum interval specifies a maximum amount of time which is permitted to lapse between encoded I-frames. In one embodiment, the I-frame maximum interval is 10.0 seconds.
In addition to the I-frame maximum interval, it is periodically beneficial to encode a frame of the encoded motion video signal as an I-frame even if the I-frame maximum interval has not completely elapsed since the most recently encoded I-frame. In particular, when a scene changes in a motion video signal, i.e., when the current frame is generally unrelated to the previous frame, encoding the current frame as a P-frame requires nearly as much bandwidth as encoding the current frame as an I-frame. In addition, encoding the current frame as an I-frame eliminates noise which is perpetuated from P-frame to P-frame. Therefore, I/P framer 106 (
Processing by I/P framer 106 is illustrated in logic flow diagram 600 (
In test step 603, I/P framer 106 (
In test step 604, I/P framer 106 (
After step 608 (
As described briefly above, I/P framer 106 determines whether the current frame represents a scene change in the motion video signal in test step 604 (
While a large current absolute pixel difference can be a good indicator as to whether the current frame is the first frame of a new scene, selection of a single, fixed threshold of the current absolute pixel difference to make such a determination is difficult. Selection of a single, fixed threshold which is too low can cause frames in a high motion sequence to be misinterpreted as new scenes and encoded as I-frames and therefore consuming more bandwidth than can be spared. Conversely, selection of a single, fixed threshold which is too high can result in failing to detect the scene change and encoding frames representing scene changes as a P-frames and the efficiencies described above with respect to encoding I-frames at scene changes are not realized. Therefore, in step 703 (
Processing transfers from step 703 (
Thus, by comparing the amount of changes between consecutive frames to a predetermined threshold, I/P framer 106 (
Frame Rate Control
As described above, another important consideration in maximizing motion video image quality within limited bandwidth is the frame rate, i.e., the number of frames encoded in a particular period of time. Video signal encoder 100 (
Frame rate controller 120 predicts a frame rate which is relatively optimum for the particular motion video signal which video signal encoder 100 is encoding. The predicted optimum frame rate is based upon such factors as the delivery bandwidth, the size of the current frame as encoded, and the cumulative bandwidth error described above. Some frame rate control mechanisms reduce frame rates of encoded motion video signals in response to detecting imminent exhaustion of available bandwidth. Such mechanisms, while generally effective at preventing exhaustion of available bandwidth, can perpetuate high latency as bandwidth is consumed to the point at which exhaustion of available becomes imminent and reduction of such latency can be rather difficult. By predicting a relatively optimum frame rate for a particular sequence of frames during encoding of the sequence, frame rate controller 120 can prevent unnecessarily high latency in the delivery of the encoded motion video signal and exhaustion of the available bandwidth is not a prerequisite to adjustment of the frame rate.
The controlling of the frame rate by frame rate controller 120 is illustrated in logic flow diagram 800 (
seq_rate=(avg_worst_λ/λ)·(bit_rate/frame_size) (7)
In equation (7), seq_rate represents to the sequence rate determined by frame rate controller 120 (
Avg_worst_λ in equation (7) represents a worst allowable average value of λ 114, i.e., the value of λ 114 which represents the worst image quality permissible over an appreciable amount of time. In equation (7), λ represents the value of λ 114. Frame rate controller 120 determines avg_worst_λ from an initial value of λ which is determined in a manner described more completely below and from a worst allowable λ which is selectable by a person designing the motion video signal who makes a number of decisions regarding the nature of the motion video signal. Frame rate controller 120 determines avg_worst_λ according to the following equation.
avg_worst_λ=(init_λ+worst_λ)/2. (8)
In equation (8), init_λ represents the initial value ofl 114 which is described more completely below and worst_λ represents the worst allowable λ. The ratio in equation (7) of avg_worst_λ to λ 114 adjusts the ratio of bit_rate to frame_size according to the particular quality of the current encoded frame. For example, if λ 114 is smaller than avg_worst_λ, the ratio of avg_worst_λ to λ is greater than 1.0 and the predicted frame rate of step 802 according to equation (7) is larger than the ratio of bit_rate to frame_size. Such is appropriate since a small λ 114 indicates that the current frame is encoded with a higher image quality than is necessary and that a higher frame rate can be supported on the delivery medium. Conversely, if λ 114 is larger than avg_worst_λ, the ratio of avg_worst_λ to λ is less than 1.0 and the predicted frame rate of step 802 according to equation (7) is smaller than the ratio of bit_rate to frame_size. Such is appropriate since a large λ 114 indicates that the current frame is encoded with a lower image quality than is preferred and that a lower frame rate should be used such that better image quality can be obtained without exceeding available bandwidth.
Processing transfers from step 802 (
In step 806, to which processing transfers from step 804, frame rate controller 120 (
Processing transfers to step 808 in which frame rate controller 120 (
In step 810 (
weight=−(cum_bw_error/max_bw_error)+0.5 (9)
In equation (9), weight represents the cumulative bandwidth weight; cum_bw_error represents the cumulative bandwidth error determined by secondary closed loop rate control 204 (
Frame rate controller 120 adjusts the number of frames to drop using the cumulative bandwidth weight in step 810 (
Up to this point in logic flow diagram 800 (
λ Initialization
As described above, the particular value of λ 114 which is appropriate for encoding a particular motion video signal is dependent upon various characteristics of the motion video signal. If λ 114 initially has a value which is differs significantly from an optimum value for the motion video signal, either available bandwidth is consumed too quickly or image quality suffers unnecessarily until λ 114 is adjusted to have a more optimum value for the encoded motion video signal. Accordingly, λ adjuster 116 selects an initial value for λ 114 which is predicted to be appropriate for source video signal 1540, which is described in greater detail below. Specifically, λ adjuster 116 selects the initial value for λ 114 based on the frame size of source video signal 1540 and the delivery bandwidth at which encoded video signal 1550 is transmitted to a client computer system as described more completely below. The following equation shows the selection of the initial value of λ 114 by λ adjuster 116.
init_λ=ref_λ·ref_rate/(frame_size_ratio·bit_rate) (10)
In equation (10), init_λ represents the initial value of λ 114 selected by λ adjuster 116. Ref_λ represents a predetermined value of λ which is generally appropriate for some predetermined frame size and some predetermined delivery bandwidth. Ref_rate represents the predetermined reference delivery bandwidth in terms of an amount of data per unit of time. Frame_size_ratio represents a ratio of the predetermined frame size to the size of frames of source video signal 1040 (
Thus, if source video signal 1040 has frames which are larger than the predetermined reference frame size, the initial value of λ 114 (
By predicting an appropriate initial value of λ 114 according to the frame size of source video signal 1040 and the delivery bandwidth of encoded video signal 1050, λ adjuster 116 prevents excessive bandwidth consumption and unnecessarily poor image quality in the encoding of the first several frames of source video signal 1040.
Inclusion of Video Signal Encoder in a Computer System
In general, video signal encoder 100 (
Server computer 902 is shown in greater detail in
Memory 1004 can include any type of computer memory and can include, without limitation, randomly accessible memory (RAM), read-only memory (ROM), and storage devices which include storage media such as magnetic and/or optical disks. Memory 1004 includes video signal encoder 100 which is all or part of a computer process which in turn executes within processor 1002 from memory 1004. A computer process is generally a collection of computer instructions and data which collectively define a task performed by server computer 902.
Each of computer display devices 1020 can be any type of computer display device including without limitation a printer, a cathode ray tube (CRT), a light-emitting diode (LED) display, or a liquid crystal display (LCD). Each of computer display devices 1020 receives from processor 1002 control signals and data and, in response to such control signals, displays the received data. Computer display devices 1020, and the control thereof by processor 1002, are conventional.
Each of user input devices 1030 can be any type of user input device including, without limitation, a keyboard, a numeric keypad, or a pointing device such as an electronic mouse, trackball, lightpen, touch-sensitive pad, digitizing tablet, thumb wheels, or joystick. Each of user input devices generates signals in response to physical manipulation by a user and transmits those signals through interconnect 1006 to processor 1002.
Server computer 902 also includes video signal acquisition circuitry 1070 which can be, for example, a video camera and video image capture circuitry. Images captured by video image acquisition circuitry 1070 are stored in a buffer in memory 1004 as source video image 1040. Alternatively, motion video images can be captured separately, i.e., by another computer system, and stored in memory 1004 as source video signal 1040 for encoding and delivery to client computer 906 upon request. In addition, source video signal 1040 can be generated by processing of processor 1002 or by another computer and stored in memory 1004. Computer generated motion video images can be created, for example, by processing 3-dimensional (or 2-dimensional) video models by server computer 902 according to control signals generated by a user by physical manipulation of one or more of user input devices 1030.
As described above, video signal encoder 100 executes within processor 1002 from memory 1004. Specifically, processor 1002 fetches computer instructions from video signal encoder 100 and executes those computer instructions. Processor 1002, in executing video signal encoder 100, reads frames from source video signal 1040, processes and encodes those frames in the manner described above, and stores the encoded frames in encoded video signal 1050 or can transmit the encoded frames immediately through computer network 904 to client computer 906 (
Client computer 906 includes a processor 1102, memory 1104, interconnect 1106, computer display devices 1120, user input devices 1130, and network access circuitry 1160, which are analogous to processor 1002 (
The above description is illustrative only and is not limiting. The present invention is limited only by the claims which follow.
Claims
1. A method for encoding a motion video signal, the method comprising:
- determining a desired size for a first frame of the motion video signal;
- encoding the first frame of the motion video signal to form an encoded frame;
- determining an encoded size of the encoded frame;
- comparing the encoded size to the desired size;
- adjusting an encoding parameter such that encoding the first frame according to the encoding parameter as adjusted would form a different encoded frame having a size closer to the desired size than the encoded size is to the desired size; and wherein the adjusting employs first and second adjustment mechanisms, the first adjustment mechanism comprising a pre-compensator and the second adjustment mechanism comprises a first encoding adjuster and a second encoding adjuster that is based at least in part on a damping factor which reduces overcorrection of the encoding parameter; and
- encoding a second frame of the motion video signal according to the encoding parameter as adjusted.
2. The method of claim 1 wherein the second frame is subsequent to the first frame in the motion video signal.
3. The method of claim 1 where in the encoding parameter is a numerical representation of a compromise between consumed bandwidth and image quality of the motion video signal as encoded.
4. The method of claim 1 wherein the step of adjusting comprises:
- determining a difference between the encoded size and the desired size; and
- adjusting the encoding parameter by an amount which is proportional to the difference.
5. A computer readable medium comprising instructions which, when executed by a computer, performs the method of claim 1.
6. A computer readable medium useful in association with a computer which includes a processor and a memory, the computer readable medium having computer instructions stored thereon which are configured to cause the computer to encode a motion video signal by performing the steps of:
- determining a desired size for a first frame of the motion video signal;
- encoding the first frame of the motion video signal to form an encoded frame;
- determining an encoded size of the encoded frame;
- comparing the encoded size to the desired size;
- adjusting an encoding parameter such that encoding the first frame according to the encoding parameter as adjusted would form a different encoded frame having a size closer to the desired size than the encoded size is to the desired size; and wherein the adjusting employs first and second adjustment mechanisms, the first adjustment mechanism comprising a pre-compensator and the second adjustment mechanism comprises a first encoding adjuster and a second encoding adjuster that is based at least in part on a damping factor which reduces overcorrection of the encoding parameter; and
- encoding a second frame of the motion video signal according to the encoding parameter as adjusted.
7. The computer readable medium of claim 6 wherein the second frame is subsequent to the first frame in the motion video signal.
8. The computer readable medium of claim 6 where the encoding parameter is a numerical representation of a compromise between consumed bandwidth and image quality of the motion video signal as encoded.
9. The computer readable medium of claim 6 wherein the step of adjusting comprises:
- determining a difference between the encoded size and the desired size; and
- adjusting the encoding parameter by an amount which is proportional to the difference.
10. A computer system comprising:
- a processor;
- a memory operatively coupled to the processor; and
- a motion video signal encoder which executes in the processor from the memory and which, when executed by the processor, causes the computer to encode a motion video signal by performing the steps of:
- determining a desired size for a first frame of the motion video signal;
- encoding the first frame of the motion video signal to form an encoded frame;
- determining an encoded size of the encoded frame;
- comparing the encoded size to the desired size;
- adjusting an encoding parameter such that encoding the first frame according to the encoding parameter as adjusted would form a different encoded frame having a size closer to the desired size than the encoded size is to the desired size; and wherein the adjusting employs first and second adjustment mechanisms, the first adjustment mechanism comprising a pre-compensator and the second adjustment mechanism comprises a first encoding adjuster and a second encoding adjuster that is based at least in part on a damping factor which reduces overcorrection of the encoding parameter; and
- encoding a second frame of the motion video signal according to the encoding parameter as adjusted.
11. The computer system of claim 10 wherein the second frame is subsequent to the first frame in the motion video signal.
12. The computer system of claim 10 where in the encoding parameter is a numerical representation of a compromise between consumed bandwidth and image quality of the motion video signal as encoded.
13. The computer system of claim 10 wherein the step of adjusting comprises:
- determining a difference between the encoded size and the desired size; and
- adjusting the encoding parameter by an amount which is proportional to the difference.
14. A method, comprising:
- determining a desired size for a first frame of a motion video signal;
- encoding the first frame of the motion video signal to form an encoded frame;
- determining an encoded size of the encoded frame;
- comparing the encoded size to the desired size;
- adjusting an encoding parameter such that encoding the first frame according to the encoding parameter as adjusted would form a different encoded frame having a size closer to the desired size than the encoded size is to the desired size, and wherein the adjusting employs first and second adjustment mechanisms, the first adjustment mechanism comprising a pre-compensator and the second adjustment mechanism comprising a first encoding adjuster and a second different encoding adjuster; and
- encoding a second frame of the motion video signal according to the encoding parameter as adjusted.
15. The method of claim 14, wherein the pre-compensator is operable to adjust the encoding parameter based on a degree of change between the first frame and the second frame, and the first encoding adjuster comprises a primary open loop rate control adjuster and the second encoding adjuster comprises a secondary closed loop rate control adjuster, and wherein a higher weight is given to the secondary closed loop rate control adjuster.
16. The method of claim 15, wherein the degree of change comprises an absolute pixel difference between the first and second frames.
4259740 | March 31, 1981 | Snell et al. |
4394774 | July 19, 1983 | Widergren et al. |
4816914 | March 28, 1989 | Ericsson |
4862264 | August 29, 1989 | Wells et al. |
5050161 | September 17, 1991 | Golestani |
5088107 | February 11, 1992 | Piasecki et al. |
5144425 | September 1, 1992 | Joseph |
5247355 | September 21, 1993 | Frederiksen |
5313454 | May 17, 1994 | Bustini et al. |
5351095 | September 27, 1994 | Kerdranvat |
5414469 | May 9, 1995 | Gonzales et al. |
5434848 | July 18, 1995 | Chimento, Jr. et al. |
5453801 | September 26, 1995 | Kim |
5467413 | November 14, 1995 | Barrett |
5473379 | December 5, 1995 | Horne |
RE35158 | February 20, 1996 | Sugiyama |
5490252 | February 6, 1996 | Macera et al. |
5502492 | March 26, 1996 | Jung |
5504744 | April 2, 1996 | Adams et al. |
5512952 | April 30, 1996 | Iwamura |
5519701 | May 21, 1996 | Colmant et al. |
5533021 | July 2, 1996 | Branstad et al. |
5537155 | July 16, 1996 | O'Connell et al. |
5537408 | July 16, 1996 | Branstad et al. |
5557341 | September 17, 1996 | Weiss et al. |
5566175 | October 15, 1996 | Davis |
5574724 | November 12, 1996 | Bales et al. |
5576767 | November 19, 1996 | Lee et al. |
5583980 | December 10, 1996 | Anderson |
5600775 | February 4, 1997 | King et al. |
5606373 | February 25, 1997 | Dopp et al. |
5621660 | April 15, 1997 | Chaddha et al. |
5623312 | April 22, 1997 | Yan et al. |
5623313 | April 22, 1997 | Naveen |
5623690 | April 22, 1997 | Palmer et al. |
5663810 | September 2, 1997 | Kirk |
5699484 | December 16, 1997 | Davis |
5729295 | March 17, 1998 | Okada |
5734419 | March 31, 1998 | Botsford, III et al. |
5751378 | May 12, 1998 | Chen et al. |
5784115 | July 21, 1998 | Bozdagi |
5815217 | September 29, 1998 | Kumazawa et al. |
5825473 | October 20, 1998 | Kodaira |
5835163 | November 10, 1998 | Liou et al. |
5859667 | January 12, 1999 | Kondo et al. |
5875003 | February 23, 1999 | Kato et al. |
5892535 | April 6, 1999 | Allen et al. |
5929916 | July 27, 1999 | Legall et al. |
5936940 | August 10, 1999 | Marin et al. |
5978544 | November 2, 1999 | Shimada et al. |
6011589 | January 4, 2000 | Matsuura et al. |
6055025 | April 25, 2000 | Shahraray |
6081551 | June 27, 2000 | Etoh |
6115420 | September 5, 2000 | Wang |
6163574 | December 19, 2000 | Yagasaki |
6335990 | January 1, 2002 | Chen et al. |
6456648 | September 24, 2002 | Bultan et al. |
6480670 | November 12, 2002 | Hatano et al. |
6678324 | January 13, 2004 | Yamauchi |
6833846 | December 21, 2004 | Hasser |
- “Video Coding for Low Bitrate Communication”, ITU-T, Draft H.263: Line Transmission of Non-Telephone Signals, Int'l Telecommunication Union, (May 2, 1996).
- Chaddha, N., et al., “An end to end software only scalable video delivery system”, Proceedings Networks and Operating System Support for Digital Audio and Video, pp. 130-141, (Apr. 21, 1995).
- Chaddha, N., et al., “Hierarchical Vector Quantization of Perceptually Weighted Block Transforms”, IEEE, pp. 3-12, (1995).
- Linde, Y., et al., “An Algorithm for Vector Quantizer Design”, IEEE Transactions on Communications, vol. COM-28, No. 1, pp. 84-95, (Jan. 1980).
Type: Grant
Filed: Mar 16, 2004
Date of Patent: Dec 26, 2006
Patent Publication Number: 20040184535
Assignee: Microsoft Corporation (Redmond, WA)
Inventor: Albert S. Wang (Palo Alto, CA)
Primary Examiner: Nhon Diep
Attorney: Lee & Hayes, PLLC
Application Number: 10/803,070
International Classification: H04B 1/66 (20060101); H04N 7/12 (20060101);