The present invention contains subject matter related to Japanese Patent Application JP 2005-233573 filed in the Japanese Patent Office on Aug. 11, 2005,the entire contents of which being incorporated herein by reference.
1. Field of the Invention
The present invention relates to a coding apparatus, a coding method and a coding program for controlling the coding rate of an image sequence and also to a recording medium storing such a program.
2. Description of the Related Art
Known rate control techniques that can be used for encoding an image sequence according to a bit plane coding system include rate control that utilizes truncation of cutting off the coding path so as to achieve a target bit rate after coding and multi-loop rate control of controlling the coding rate only by means of the quantization step size given before coding.
The former technique has a short processing time because it is possible to accurately control the coding rate by a single coding operation. On the other hand, since a constant coding rate is assigned to frames, the image quality can vary significantly from frame to frame to consequently degrade the image quality as a whole particularly when the degree of coding facility varies among frames. The latter technique has a small dispersion and a good image quality because a high coding rate is assigned to frames showing a low degree of coding facility while a low coding rate is assigned to frames showing a high degree of coding facility. On the other hand, since it is not possible to know the relationship between the quantization step size and the generated bit rate before coding and hence it is necessary to search for an optimal quantization step size by repeatedly coding all the frames in order to accurately control the coding rate. In short, this technique involves a time consuming process.
While the two techniques have respective advantages and disadvantages, the multi-loop rate control technique is preferable when non-linearly pursuing a high image quality as in the case of digital cinema.
Meanwhile, binary search (binary tree search) is a popular technique for searching for an optimal quantization step size for multi-loop plate control (see Patent Document 1: Jpn. Pat. Appln. Laid-Open Publication No. H. 10-191343). Binary search involves the use of an algorithm for searching for a target value from sorted data. With binary search, the range of search is divided into two at an intermediate point to see which one includes the target value and the range of search that includes the target value is divided into two at an intermediate point. This process is repeated until the target value is located. The quantization step size and the generated bit rate show such a relationship that the generated bit rate falls as the quantization step size increases so that the target value can be regarded as sorted data and hence the technique of binary search can feasibly be employed.
Referring to
Then, in Step S23, it is determined if the absolute value of the difference between the target bit rate R and the generated bit rate R (Δ) is less than the threshold value Th or not and, if it is not less than the threshold value Th, it is determined in Step S24 if the target bit rate R is less than the generated bit rate R (Δ) or not. Δ is set as Δmin in Step S25 when the target bit rate R is less than the generated bit rate R (Δ) and the processing operation returns to Step S21, whereas Δ is set as Δmax when the target bit rate R is more than the generated bit rate R (Δ) and the processing operation returns to Step S21.
On the other hand, the process simply ends if it is determined in Step S23 that the absolute value of the difference between the target bit rate R and the generated bit rate R (Δ) is less than the threshold value Th.
Thus, it is possible to reliably determine an optimal quantization step size by means of binary search. However, it is necessary to encode all the frames 5 to 10 times in a rate control operation for the purpose of achieving a practically feasible level of accuracy. Then, the processing time will be very long. Therefore, there is a demand for a method of searching for an optimal quantization step size at high speed.
In view of the above-identified circumstances, it is desirable to provide a coding apparatus, a coding method, a coding program that can search for an optimal quantization step size at high speed when controlling the coding rate of an image sequence as well as a recording medium storing such a program.
According to an embodiment of the present invention, there is provided a coding apparatus for coding an image sequence of a plurality of frames, the apparatus including: a skip binary search means for coding a frame out of every first skip number of frames of the image sequence, while changing the quantization step size according to a binary search algorithm, and determining a quantization step size with which the generated bit rate is approximate to the target bit rate; a quantization step size correction means for determining the quantization step size good for achieving the target bit rate by using an approximate straight line expressing the relationship of the quantization step size determined by the skip binary search means and the generated bit rate; a first coding means for coding a frame out of every second skip number of frames of the image sequence with the quantization step size corrected by the quantization step size correction means; a quantization step size forecasting means for determining the quantization step size good for achieving the target bit rate by using the generated bit rate generated by the first coding means; and a second coding means for coding all the frames of the image sequence with the quantization step size forecast by the quantization step size forecasting means.
According to an embodiment of the present invention, there is also provided a coding method of coding an image sequence of a plurality of frames, the method including: a skip binary search step of coding a frame out of every first skip number of frames of the image sequence, while changing the quantization step size according to a binary search algorithm, and determining a quantization step size with which the generated bit rate is approximate to the target bit rate; a quantization step size correction step of determining the quantization step size good for achieving the target bit rate by using an approximate straight line expressing the relationship of the quantization step size determined in the skip binary search step and the generated bit rate; a first coding step of coding a frame out of every second skip number of frames of the image sequence with the quantization step size corrected in the quantization step size correction step; a quantization step size forecasting step of determining the quantization step size good for achieving the target bit rate by using the generated bit rate generated in the first coding step; and a second coding step of coding all the frames of the image sequence with the quantization step size forecast in the quantization step size forecasting step.
According to an embodiment of the present invention, there is also provided a program for causing a computer to execute the coding processing and a recording medium having recorded therein the program.
Thus, according to a coding apparatus, a coding method, a coding program as well as a recording medium storing such a program of the present invention, it is possible to search for an optimal quantization step size at high speed when controlling the coding rate of an image sequence by means of quantization step size.
Now, embodiments of the present invention will be described in greater detail by referring to the accompanying drawings. The illustrated embodiments are coding apparatus for controlling the coding rate of an image sequence according to a bit plane coding system by means of a coding method.
(First Embodiment)
The skip binary search section 10 receives as input an image sequence of (n+1) frames (In [0] through In [n]) and a target bit rate (R [bpp]). Then, the skip binary search section 10 encodes the frames selected by using the number of skip frames M of the image sequence and keeps on encoding, changing the quantization step size according to a binary search algorithm, to determine a quantization step size Δskip with which the generated bit rate is approximate to the target bit rate R. The number of skip frames M indicates that every M-th frame of the image sequence is encoded. For example, when the total number of frames is 20 and M=10, the skip binary search section 10 encodes only the shaded two frames in
Now, the processing sequence of the skip binary search section 10 will be described below by referring to the flowchart of
Firstly, in Step S1, the average value of the largest value Δmax and the smallest value Δmin of the range of search is defined as quantization step size Δ. In Step S2, every M-th frame (=m [0]) of the image sequence is coded with the quantization step size Δ to determine the generated bit rate R (Δ, m [0]).
The operation of Step S2 will be described in greater detail by referring to the flowchart of
Referring to
In Step S13, frame In [i] is coded with the quantization step size Δ. The code quantity that is generated when coding frame In [i] with the quantization step size Δ is expressed by r (Δ, M, i). Subsequently, in Step S14, the code quantity r (Δ, M, i) is added to determine the generated code quantity rall (Δ, M). Ultimately, the generated code quantity rall (Δ, M) becomes equal to the sum of the code quantities r (Δ, M, i) of all the coded frames. In Step S14, the value of j is incremented by 1.
Then, in Step S15, i is incremented by one and, in Step S16, it is determined if the value of i is not more than n or not. The operation returns to Step S12 when the value of i is not more than n, whereas the operation proceeds to Step S17 when the value of i is larger than n. In Step S17, the generated bit rate R (Δ, m) [bpp] is computationally determined from the generated code quantity rall (Δ, M) that is determined in Step S14. If the horizontal size and the vertical size of the frame image are Xsize and Ysize respectively, the generated bit rate R (Δ, m) is computationally determined by means of formula (1) shown below.
R(Δ, M)=rall(Δ, M)/(Xsize*Ysize*j) (1)
Returning to
If, on the other hand, it is determined in Step S3 that the absolute value of the difference between the target bit rate R and the generated bit rate R (Δ, m [0]) is not smaller than the threshold value Th, Δskip (=Δ) and R (Δskip, m [0]) are stored to end the processing operation.
The skip binary search section 10 supplies the obtained quantization step size Δskip, the generated bit rate R (Δskip, m [0]) at that time, the quantization step size Δlast in the immediately preceding loop and the generated bit rate R (Δlast, m [0]) at that time to the quantization step size correcting section 11 and the quantization step size forecasting section 13.
Returning now to
More specifically, as shown in
The first coding section 12 encodes every m [1]-th frame of the image sequence. The actual processing sequence is similar to that of the flowchart of
The purpose of the first coding section 12 is to make the number of coded frames larger than that of the skip binary search section 10 (and hence the number of skip frames M smaller than that of the skip binary search section 10) in order to improve the accuracy of the estimated quantization step size. Therefore, the number of skip frames m [0] and the number of skip frames m [1] show a relationship of m [0]>m [1].
The first coding section 12 supplies the generated bit rate R (Δa, m [1]) to the quantization step size forecasting section 13.
The quantization step size forecasting section 13 finely adjusts the quantization step size, using Δskip, R (Δskip, m [0]), Δlast and R (Δlast, m [0]) supplied from the skip binary search section 10 and R (Δa, m [1]) supplied from the first coding section 12. The quantization step size forecasting section 13 also utilizes the fact that the relationship between the quantization step size and the generated bit rate can be approximated by a straight line.
More specifically, as shown in
The second coding section 14 encodes all the frames of the image sequence with the quantization step size Δe supplied from the quantization step size forecasting section 13. The actual processing sequence is similar to that of the flowchart of
As described above, the coding apparatus 1 of the first embodiment does not encode all the frames repeatedly to search for an optimal quantization step size but determines the quantization step size Δa by coding every m [0]-th frame and approximating the relationship between the quantization step size and the generated bit rate by a straight line and then the quantization step size Δe by coding every m [1]-th (<m [0]) frame with the quantization step size Δa and by means of linear approximation. With the above-described arrangement, it is possible for the coding apparatus 1 to search for an optimal quantization step size at higher speed.
(Second Embodiment)
The processing sequence of the first embodiment is simple and the number of coded frames does not heavily rely on the image sequence to the end of the rate control operation. Then, however, it may sometimes not be possible to conduct an intended rate control operation particularly in the case of an image sequence where the image changes remarkably from frame to frame. Thus, the coding apparatus of the second embodiment is adapted to repeat the loop until getting to the target bit rate in order to ensure a desired accuracy level even in the case of an image sequence where rate control is difficult.
The skip binary search section 20 operates just like the above-described skip binary search section 10. More specifically, the skip binary search section 20 receives as input an image sequence of (n+1) frames (In [0] through In [n]) and a target bit rate (R [bpp]). Then, the skip binary search section 20 encodes the frames selected by using the number of skip frames M (=m [0]) of the image sequence and keeps on encoding, changing the quantization step size according to a binary search algorithm, to determine a quantization step size Δskip with which the generated bit rate is approximate to the target bit rate R. The skip binary search section 20 supplies the obtained quantization step size Δskip, the generated bit rate R (Δskip, m [0]) at that time, the quantization step size Δlast in the immediately preceding loop and the generated bit rate R (Δlast, m [0]) at that time to the quantization step size correcting section 22 and the quantization step size forecasting section 25.
The number of skip frames updating section 21 updates the number of skip frames M from m [i] to m [i+1] (starting from i=0). The relationship of m [i]>m [i+1] holds true because the accuracy of estimating the quantization step size is raised by reducing the number of skip frames stepwise. Note, however, m [i+1] is equal to 1 when m [i] becomes equal to 1, which is the smallest value and m [i] may typically take values such as m [i]={120, 48, 6, 1, 1, 1, 1 . . . }.
The quantization step size correcting section 22 finely adjusts the quantization step size. The quantization step size correcting section 22 operates just like the above-described quantization step size correcting section 11 for the first loop (i=1). More specifically, the quantization step size correcting section 22 computationally determines the quantization step size Δa by approximating the relationship between the quantization step size and the generated bit rate by means of a straight line, using Δskip, R (Δskip, m [0]), Δlast and R (Δlast, m [0]) supplied from the skip binary search section 20. However, for the second loop and the subsequent loops (i≧2), the quantization step size correcting section 22 computationally determines the quantization step size Δa by approximating the relationship between the quantization step size and the generated bit rate by means of a straight line, using Δa and R (Δa, m [i−1]) (which correspond to Δlast and R (Δlast, m [0] listed above) supplied from the first coding section 23 and Δe and R (Δe, m [i−1]) (which correspond to Δskip and R (Δskip, m [0] listed above) supplied from the second coding section 26, although the correcting method is same.
The first coding section 23 encodes every m [i]-th frame of the image sequence, with the quantization step size Δa supplied from the quantization step size correcting section 22. The first coding section 23 supplies the generated bit rate R (Δa, m [i]) to the first end of loop judging section 24.
The first end of loop judging section 24 uses that the number of skip frames m [i] is equal to 1, or m [i]=1, and the absolute value of the difference between the target bit rate R and the generated bit rate R (Δa, m [i]) is smaller than the threshold value Th as conditions to be met for ending the loop and judges if these conditions are met or not. If the conditions for ending the loop are met, the code stream coded by the first coding section 23 is output to the outside to complete the processing operation. If, on the other hand, the conditions for ending the loop are not met, the processing operation proceeds to the quantization step size forecasting section 25 to continue.
The quantization step size forecasting section 25 finely adjusts the quantization step size. The quantization step size forecasting section 25 operates just like the above-described quantization step size forecasting section 13 for the first loop (i=1). More specifically, the quantization step size forecasting section 25 computationally determines the quantization step size Δe, using Δskip and R (Δskip, m [0]), Δlast and R (Δlast, m [0]) supplied from the skip binary search section 20 and R (Δa, m [i]) supplied from the first coding section 23. However, for the second loop and the subsequent loops (i≧2), the quantization step size forecasting section 25 computationally determines the quantization step size Δe, using Δa and R (Δa, m [i−1]) (which correspond to Δlast and R (Δlast, m [0] listed above) supplied from the first coding section 23 and Δe and R (Δe, m [i−1]) (which correspond to Δskip and R (Δskip, m [0] listed above) supplied from the second coding section 26, although the correcting method is same.
The second coding section 26 encodes every m [i]-th frame of the image sequence, with the quantization step size Δe supplied from the quantization step size forecasting section 25. The second coding section 26 supplies the generated bit rate R (Δe, m [i]) to the second end of loop judging section 27.
The second end of loop judging section 27 uses that the number of skip frames m [i] is equal to 1, or m [i]=1, and the absolute value of the difference between the generated bit rate R (Δe, m [i]) and the target bit rate R is smaller than the threshold value Th as conditions to be met for ending the loop and judges if these conditions are met or not. If the conditions for ending the loop are met, the code stream coded by the second coding section 26 is output to the outside to complete the processing operation. If, on the other hand, the conditions for ending the loop are not met, the processing operation returns to the number of skip frames updating section 21 to repeat the loop.
If m [i]={120, 48, 6, 1, 1, 1, 1 . . . }, the processing sequence of
Thus, with the coding apparatus 2 of the second embodiment, the loop is repeated until the conditions for ending the loop are met as judged by the first end of loop judging section 24 or the second end of loop judging section 27 to guarantee the accuracy of coding rate control.
While an image sequence is coded according to a bit plane coding system in the above description of the embodiments, the present invention is by no means limited thereto and the present invention can be applied to any other image coding system such as the MPEG (Moving Picture Experts Group) system that is adapted to intra-frame coding for all frames.
The series of processing steps of each of the above-described embodiments can be executed by software. Then, a computer program may be installed in the hardware dedicated to a computer, which may be a general purpose personal computer adapted to install various application programs, for the software directly or by way of a network or a recording medium.
It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and alterations may occur depending on design requirements and other factors insofar as they are within the scope of the appended claims or the equivalents thereof.
Number | Date | Country | Kind |
---|---|---|---|
2005-233573 | Aug 2005 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
5721589 | Murata | Feb 1998 | A |
6658161 | Chen et al. | Dec 2003 | B1 |
20020118753 | Kawashima | Aug 2002 | A1 |
20030016878 | Motosu et al. | Jan 2003 | A1 |
20030031128 | Kim et al. | Feb 2003 | A1 |
20060129909 | Butt et al. | Jun 2006 | A1 |
Number | Date | Country |
---|---|---|
10 191343 | Jul 1998 | JP |
10191343 | Jul 1998 | JP |
WO 96 28937 | Sep 1996 | WO |
Number | Date | Country | |
---|---|---|---|
20070036214 A1 | Feb 2007 | US |