1. Field of the Invention
The present invention relates to an encoding apparatus and, more particularly, to an encoding apparatus, an encoding method, and a program for multiplexing a plurality of encoded streams.
2. Description of the Related Art
In recent years, making of products of video cameras for performing a high-definition recording by using a disk medium, a hard disk, or a memory as a storage medium has been started. It is considered that those video cameras will spread more and more in future because they are so small as to be easily carried and can record images of high image quality. In such apparatuses, in order to perform the high-definition recording, the image is stored into a recording medium as a video stream which has been compression-encoded by, for example, MPEG4 part-10: AVC (ISO/IEC 14496-10; another name, H.264). According to such a compression-encoding method, an inter-frame prediction (inter-prediction) using a correlation between images and an intra-frame prediction (intra-prediction) using a correlation within a frame are used and an arithmetic coding is also used, thereby realizing a high-efficient compression-encoding.
A video camera arranged such that left and right image signals are input to form a 3D image has also been put into practical use.
The Official Gazette of Japanese Patent Application Laid-Open No. H09-65372 discloses an apparatus for encoding and recording respective right and left images. This Official Gazette proposes such an apparatus that a code amount to be assigned when each image is encoded is adaptively set on a picture unit basis in accordance with a correlation between the right image and the left image, thereby making degrees of deterioration of encoding of the right and left images even.
In the case of encoding the right and left images like a related art mentioned above, it is an important subject to make image quality of the right image and that of the left image even. It is also important to suppress a deterioration in encoding of the right and left images as much as possible and maintain high image quality. Therefore, in order to more efficiently encode within limited bit rates, in addition to the conventional inter-frame prediction and arithmetic coding, a parallax prediction which makes it possible to predict one of the right and left images from the other is performed as a technique peculiar to a 3D image.
When the recording of the right and left images is started, if bit rates and buffer sizes are merely set and the encoding is performed, an encoding efficiency of the parallax prediction changes in accordance with a feature of the input image, so that degrees of deterioration of encoding of the right and left images differ. In the encoding apparatus in the related art, in such a case, unnaturalness as a 3D image is reduced by matching the degrees of deterioration of encoding of the right and left images with the larger one.
However, the encoding apparatus in the related art has such a problem that the set bit rates are not effectively used so that the image quality deteriorates.
In consideration of the above problems, it is an aspect of the invention to provide an encoding apparatus in which bit rates and buffer sizes regarding the encoding of right and left images are properly distributed at the start of recording, thereby preventing a deterioration in image quality and enabling the encoding to be efficiently performed.
According to an aspect of the invention, an encoding apparatus of the present invention which inputs a first image and a second image from an input source different from an input source of the first image and encodes those images, is arranged such that a first bit rate and a second bit rate which are respectively assigned to a first encoding unit configured to encode the input first image and a second encoding unit configured to encode the input second image on the basis of the first image are adaptively decided on the basis of photographing mode information or distortion ratios of encoding by the encoding units.
Further features of the present invention will become apparent from the following description of exemplary embodiments with reference to the attached drawings.
Exemplary embodiments of the present invention will now be described in detail in accordance with the accompanied drawings. The encoding apparatus of the invention is an image encoding apparatus which can be used to encode a 3D image photographed in, for example, a video camera or the like and can be controlled by a control unit for controlling the whole camera.
In this case, the encoding apparatus of the invention can be realized as hardware, software, or a combination thereof which operates under control of the control unit of the camera. The invention is not limited to the video camera but, naturally, can be applied to any apparatus so long as it has a photographing function of a 3D image corresponding to image input units 101 and 103 in
First Embodiment
The encoding apparatus of the present embodiment has a construction in which a right image signal and a left image signal are input and the signals are respectively encoded by a plurality of different encoding units, thereby forming one multiplexed stream.
The construction and operation of the encoding apparatus of the present embodiment will be described hereinbelow with reference to
Encoding Processing
The image input unit 101 inputs the image signal (first image signal) from an image pickup element for the left eye (not shown) and outputs to an encoding unit 102.
The encoding unit 102 (first encoding unit) performs an inter-frame motion prediction and a motion compensation to the input first image signal every macro block as a unit of encoding and executes an orthogonal transform and a quantization. The encoding unit 102 entropy-encodes the quantized image signal, forms an encoded stream (first encoded stream), and outputs to a multiplexing unit 105. The image input unit 103 inputs the image signal (second image signal) from an image pickup element for the right eye (not shown) and outputs to an encoding unit 104.
The encoding unit 104 (second encoding unit) performs a parallax prediction and a parallax compensation using a parallax between the right and left images, by using the image signal obtained by decoding the encoded stream formed by the encoding unit 102 to the input second image signal every macro block as a unit of encoding. Subsequently, the encoding unit 104 executes an orthogonal transform and a quantization. After that, the encoding unit 104 entropy-encodes the quantized image signal, forms an encoded stream (second encoded stream), and outputs to the multiplexing unit 105.
The multiplexing unit 105 inputs the encoded streams output from the encoding units 102 and 104, multiplexes them by the well-known format such as MPEG2-TS or MOV, and records the formed multiplexed stream onto a recording medium 108. The multiplexing unit 105 includes a random access memory (RAM) and performs the multiplexing (combining process) the encoded streams on the RAM.
A photographing mode selection unit 106 selects a desired one of a plurality of photographing modes and notifies a bit rate setting unit 107 of information showing the selected photographing mode. The photographing mode selection unit also has a function for properly setting a shutter speed, an iris, an exposure, and the like of the image pickup operation which is executed by the image pickup element, into the image input units 101 and 103 on the basis of a photographing image analogized in the selected photographing mode.
The photographing mode selection unit 106 may be an obtaining unit (photographing mode information obtaining unit) of information of the photographing mode selected by a photographing mode selection unit provided separately from the unit 106. In this case, a condition setting of the photographing which is executed by the image pickup element is performed by, for example, the control unit of the video camera in which the encoding apparatus of the present embodiment operates. In this case, the image input units 101 and 103 become units each for inputting the image signal from the image pickup element (input source of the image signal) and can be used as an encoding apparatus in an image processing apparatus such as a PC or the like without limiting to the camera or the like having an image pickup unit.
The bit rate setting unit 107 which is comprised of a processor (computer), adaptively sets a first bit rate into the encoding unit 102 and adaptively sets a second bit rate into the encoding unit 104 in accordance with the photographing mode notified from the photographing mode selection unit 106. In the invention, it is assumed that a sum of the first and second bit rates is constant (predetermined value). In the embodiment, the predetermined value has preliminarily been set to a value which does not exceed a bit rate of the multiplexed stream which is formed by the multiplexing unit 105. That is, in the present embodiment, a distribution ratio (assignment of the bit rate to each encoding unit) of the first and second bit rates within a predetermined value is adaptively set in accordance with the photographing mode.
Photographing Mode
Bit Rate Selection Processing
A method of setting the bit rates according to the photographing mode will be described with reference to
In S302, a distribution ratio of the values of the first and second bit rates is set under such a condition that a total value of them reaches the foregoing predetermined value so that the value of the first bit rate is larger than that of the second bit rate. In S303, whether or not a photographing scene (sports mode) in which the inter-frame difference is large and the parallax difference is small is analogized is discriminated on the basis of the notified photographing mode. If it is determined that such a photographing scene is analogized, the processing routine advances to S304. If NO, the processing routine is branched to S305.
In S304, the distribution ratio of the first and second bit rates is set so that the value of the first bit rate is smaller than the value set in S302. In S305, whether or not a photographing scene (macro mode) in which the inter-frame difference is large and the parallax difference is small is analogized is discriminated on the basis of the notified photographing mode. If it is determined that such a photographing scene is analogized, the processing routine advances to S306. If NO, the processing routine is branched to S307.
In 306, the distribution ratio of the first and second bit rates is set so that the value of the first bit rate is smaller than the value set in S304.
S307 is a setting processing in the case where a photographing scene (low-light mode) in which the inter-frame difference is large and the parallax difference is large is analogized from judgment results of S301, S303, and S305 based on the input photographing mode. In 307, the distribution ratio of the first and second bit rates is set so that the value of the first bit rate is smaller than the value set in S306.
In a landscape mode 401, the distribution to the first bit rate is largest.
In a sports mode 402, the distribution to the first bit rate is further smaller than that in the landscape mode 401.
In a macro mode 403, the distribution to the first bit rate is further smaller than that in the sports mode 402.
In a low-light mode 404, the distribution to the first bit rate is further smaller than that in the macro mode 403.
As mentioned above, according to the present embodiment, the encoding efficiencies of the inter-prediction and the parallax prediction are analogized from the scene analogized in the photographing mode and the distribution ratio of the first and second bit rates can be properly determined. Thus, the bit rates and the buffer sizes regarding the encoding of the right and left input images can be properly distributed at the time of the recording start. Such an encoding that a difference of the encoding deterioration between the right and left images, which difference is a cause of a feeling of discomfort of the 3D image, is reduced and the deterioration in image quality can be prevented can be performed. Consequently, the encoding deterioration of the encoded streams of the right and left image signals can be made even and the 3D image having the good image quality can be obtained.
When the parallax difference is small, since the bit rate of the encoding unit 102 can be set to a value near an upper limit value (the predetermined value mentioned above), encoding precision in the encoding units 102 and 104 can be further raised. Therefore, the encoded streams can be formed as a natural 3D image, and the encoding apparatus of the 3D image suitable for the user can be provided.
Embodiment 2
In a manner similar to the first embodiment, the encoding apparatus is also an apparatus in which the left image signal and the right image signal are input, they are encoded by the plurality of different encoding units, and thereafter, one multiplexed stream is formed. The same component elements as those in the encoding apparatus of the first embodiment are denoted by the same reference numerals.
In the first embodiment, the distribution of the bit rate of each of the encoding unit for the left eye and the encoding unit for the right eye is adjusted in accordance with the selected photographing mode. However, in the second embodiment, the distribution of the bit rate is adjusted on the basis of an encoding distortion ratio of each encoding unit.
Encoding Processing
The image input units 101 and 103 are similar to those in the first embodiment.
The multiplexing unit 105 is also similar to that in the first embodiment, forms a multiplexed stream of the well-known format such as MPEG2-TS or MOV, and records onto the recording medium 108. In a manner similar to the encoding unit 102 in the first embodiment, an encoding unit 502 entropy-encodes the image signal input by the image input unit 101, forms an encoded stream, and selectively outputs its result to a distortion ratio calculation unit 503 and the multiplexing unit 105. That is, prior to the encoding (regular encoding) which starts in response to an encoding start instruction of the input image signal, the encoded stream obtained by encoding (regular encoding) the input image signal is output only to the distortion ratio calculation unit 503. On the other hand, in the regular encoding, the encoding unit 502 outputs the encoded stream to the multiplexing unit 105 and does not output to the distortion ratio calculation unit 503.
The distortion ratio calculation unit 503 calculates a first distortion ratio such as a PSNR (Peak Signal-to-Noise Ratio) by using the image signal input by the image input unit 101 and the image signal obtained by decoding the first encoded stream, and outputs the calculated first distortion ratio to a bit rate setting unit 508. The first distortion ratio is not limited to the PSNR but may be another well-known distortion ratio.
In a manner similar to the encoding unit 104 in the first embodiment, an encoding unit 505 entropy-encodes the image signal input by the image input unit 103 by a similar method, forms an encoded stream, and selectively outputs its result to a distortion ratio calculation unit 506 and the multiplexing unit 105. That is, in a manner similar to the encoding unit 502, at the time of the provisional encoding of the input image signal, the encoding unit 505 outputs the formed encoded stream only to the distortion ratio calculation unit 506. On the other hand, in the regular encoding, the encoding unit 505 outputs the encoded stream to the multiplexing unit 105 and does not output to the distortion ratio calculation unit 506.
The distortion ratio calculation unit 506 calculates a second distortion ratio such as a PSNR (Peak Signal-to-Noise Ratio) by using the image input by the image input unit 103 and the image signal obtained by decoding the second encoded stream, and outputs the calculated second distortion ratio to the bit rate setting unit 508. The second distortion ratio as well as the first distortion ratio is not limited to the PSNR but may be another well-known distortion ratio.
The bit rate setting unit 508 discriminates a magnitude of a difference between the first distortion ratio calculated in the distortion ratio calculation unit 503 and the second distortion ratio calculated in the distortion ratio calculation unit 506. If it is determined that there is no difference, the encoding start instruction is output to the encoding units 502 and 505. This discrimination can be made by, for example, a method whereby a predetermined value which is preliminarily and properly set is compared with the difference (absolute value) between the first and second distortion ratios and, when the difference is equal to or less than the predetermined value, it is determined (regarded) that there is no difference. If it is determined that the difference exists, the first bit rate is adaptively set into the encoding unit 502 and the second bit rate is adaptively set into the encoding unit 505 on the basis of the first and second distortion ratios. This setting processing is performed so that the sum of the first and second bit rates reaches a maximum assigned bit rate which can be assigned to the multiplexed stream formed by the multiplexing unit 105. That is, the bit rate setting unit adaptively distributes the maximum assigned bit rate to the first and second bit rates on the basis of the calculated distortion ratios. The maximum assigned bit rate is set to a predetermined value smaller than the bit rate of the multiplexed stream.
Bit Rate Setting Processing
A bit rate setting method in the embodiment will be described with reference to
In S601, whether or not the encoding is started is discriminated.
If it is decided that the encoding is started, the processing routine is finished. If NO, the processing routine is branched to S602. “Encoding” in this case is the foregoing “regular encoding” and is started by the encoding start instruction.
In S602, the first distortion ratio calculated in the distortion ratio calculation unit 503 and the second distortion ratio calculated in the distortion ratio calculation unit 506 are obtained. The distortion ratios which are obtained at this time are values calculated with respect to the present picture of the input image signals. Therefore, the bit rates which are determined by using the obtained distortion ratios are applied to the next picture. This point will be clarified from the following equations (1). With respect to the first picture (i=1), it is assumed that bit rates R1(0) and R2(0) set as default ones are applied.
In S603, the presence or absence of the difference (absolute value) between the obtained first and second distortion ratios is discriminated as mentioned above. If the absence of the difference is decided, the encoding start instruction is formed in S605 and, thereafter, the processing routine is returned to S601. If the presence of the difference is decided, the processing routine advances to S604. In S604, the distribution ratio of the first and second bit rates is determined by using the first and second distortion ratios.
In this instance, for example, a first bit rate R1 and a second bit rate R2 are determined by using the following equations (1).
R1(i)=R1(i−1)+K(SN—2(i−1)−SN—1(i−1))
R2(i)=R2(i−1)+K(SN—1(i−1)−SN—2(i−1)) (1)
Where, a suffix “i” is an argument showing the number (1, 2, 3, . . . ) of the picture which was provisionally encoded; R1 the first bit rate; R2 the second bit rate; SN_1 the first distortion ratio; SN_2 the second distortion ratio; and K a feedback coefficient of the distortion ratio. The feedback coefficient K is a constant for converting the distortion ratio into the bit rate so that the converted bit rate may be added to the bit rate R1 or R2. While keeping the sum of the first and second bit rates constant in accordance with the above equations (1), the bit rate setting unit 508 controls the distribution of the bit rates in such a manner that the bit rate of the larger distortion ratio is reduced and, on the contrary, the bit rate of the smaller distortion ratio is raised. As will be obviously understood from the equations (1), as a result of the control, if the first distortion ratio SN_1 and the second distortion ratio SN_2 are equal, the setting value of the bit rate which is decided is equal to that of the previous picture. In the encoding apparatus of the embodiment, the foregoing processings are repeated on a picture basis and the optimum distribution of the bit rates to the first and second encoding units is decided.
In the embodiment, the provisional encoding is performed to the first I picture and subsequent five P pictures in the input image signal.
The bit rate setting unit 508 performs the provisional encoding to the six pictures and accomplishes a state where the difference between the first and second distortion ratios is eliminated in the seventh picture.
By constructing the encoding apparatus as mentioned above, prior to starting the recording of the input image signal to the recording medium 108, the difference between the distortion ratios of the encoding by the encoding units 502 and 505 is compared with that at the start of the provisional encoding and can be decreased. Therefore, the encoded stream can be formed as a natural 3D image in which a deterioration in recording image quality has been suppressed, and the encoding apparatus suitable for the user can be provided.
Although the provisional encoding has been performed by using the I picture and the P pictures in the present embodiment, the provisional encoding may be performed by using the pictures including the B picture. In this case, a number (argument i) of the picture to be properly subjected to the provisional encoding is set in the bit rate setting unit 508.
Embodiment 3
Although the encoding apparatus of the present embodiment has a construction similar to that in the embodiment 2, its operation differs from that in the embodiment 2. That is, in the embodiment 3, the actual encoding (regular encoding) is started without executing the provisional encoding and, thereafter, the encoding apparatus is made operative so as to adjust the distribution of the first and second bit rates.
The operation of the encoding apparatus of the embodiment will be described hereinbelow.
The bit rate setting unit 508 adaptively sets the first bit rate into the encoding unit 502 and adaptively sets the second bit rate into the encoding unit 505 by the following method on the basis of the first distortion ratio calculated by the distortion ratio calculation unit 503 and the second distortion ratio calculated by the distortion ratio calculation unit 506.
In more detail, first, when the encoding is started, the sum of the first and second bit rates is set to a value smaller than the maximum assigned bit rate. The initial values R1(0) and R2(0) of the bit rate distribution are previously set in consideration of experience or the like. After that, while increasing the sum of the first and second bit rates so as to reach the maximum assigned bit rate, the setting of the distribution of the first and second bit rates is determined on a picture basis of the input image signal. Since other component elements are similar to those in the embodiment 2, their description is omitted here.
The bit rate setting method of the embodiment will be described with reference to
In S801, whether or not the set sum of the first bit rate R1 and the second bit rate R2 is equal to the maximum assigned bit rate is discriminated.
If it is decided that the sum is equal to the maximum assigned bit rate, the processing routine is finished. If NO, the processing routine is branched to S802.
In S802, the first distortion ratio calculated in the distortion ratio calculation unit 503 and the second distortion ratio calculated in the distortion ratio calculation unit 506 are obtained. The distortion ratios which are obtained at this time are equal to the values calculated with respect to the present picture of the input image signal. Therefore, the bit rates which are determined by using the obtained distortion ratios are applied to the next picture. This point will be obvious from the following equations (2), which will be described hereinafter.
In S803, the first bit rate and the second bit rate are determined with respect to the picture of the input image signal by using the obtained first and second distortion ratios.
In this instance, the first bit rate R1 and the second bit rate R2 are determined by using, for example, the following equations (2).
Where, the suffix “i” is the argument showing the number (1, 2, 3, . . . ) of the encoded picture; Rt a sum of the first and second bit rates; Rd a bit rate which is increased on a picture basis; SN_1 the first distortion ratio; SN_2 the second distortion ratio; and K the feedback coefficient of the distortion ratio. The feedback coefficient K is a constant for converting the distortion ratio into the bit rate so that the converted bit rate may be added to the bit rate R1 or R2.
As will be understood from the equations (2), the bit rate setting unit 508 controls in such a manner that while increasing the sum Rt of the first and second bit rates by a predetermined amount unit (Rd) on a picture basis, the bit rate corresponding to the smaller distortion ratio is more increased. By this control, the first and second bit rates are set so that the difference between the first and second distortion ratios is eliminated.
As a result of the control in the present embodiment mentioned above, if the set sum of the first and second bit rates reaches the maximum assigned bit rate or exceeds it, the distribution of the bit rates at that time is maintained after that.
In the embodiment, after the start of encoding was instructed, as a result that the first and second bit rates are adjusted during a period of time in which the six pictures are encoded, the sum of them reaches the maximum assigned bit rate. The distribution of the bit rates adjusted by the sixth picture is applied to the seventh and subsequent pictures.
Also by the construction of the embodiment mentioned above, as compared with that at the start of encoding, the first and second bit rates can be distributed to the values to which the different encoding efficiencies are reflected so as to decrease the difference between the first and second distortion ratios. Therefore, the encoded stream can be formed as a natural 3D image in which the deterioration in recording image quality has been suppressed, and the encoding apparatus suitable for the user can be provided.
Each of the processings illustrated in
The foregoing program may be a program for realizing a part of the foregoing functions. Further, the foregoing program may be what is called a differential file (differential program) in which the foregoing functions can be realized by a combination with the program which has already been recorded in a computer system.
All or a part of the functions of the processings illustrated in
“Computer-readable recording medium” mentioned here incorporates a portable medium such as flexible disk, magnetooptic disk, ROM, CD-ROM, or the like, and a storage device such as a hard disk or the like built in the computer system. Further, it is assumed that such a medium also incorporates a storage device which holds the program for a predetermined time such as a volatile memory (RAM) in the computer system serving as a server or a client in the case where the program has been transmitted through a network such as Internet or the like or a communication line such as a telephone line or the like.
The foregoing program may be transmitted from the computer system in which the program has been stored in the storage device or the like to another computer system through a transmission medium or by a transmission wave in the transmission medium. “Transmission medium” for transmitting the program denotes a medium having a function for transmitting information such as network (communication network) like Internet or the like or communication line (communication wire) like a telephone line or the like.
A program product such as a computer-readable recording medium or the like in which the program has been recorded can be also applied as an embodiment of the invention. The program, recording medium, transmission medium, and program product mentioned above are incorporated in the purview of the invention.
While the present invention has been described with reference to exemplary embodiments, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.
This application claims the benefit of Japanese Patent Application No. 2010-272538, filed on Dec. 7, 2010 which is hereby incorporated by reference herein in its entirety.
Number | Date | Country | Kind |
---|---|---|---|
2010-272538 | Dec 2010 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
6304602 | Yokoyama | Oct 2001 | B1 |
6516137 | Posch et al. | Feb 2003 | B1 |
6690724 | Kadono | Feb 2004 | B1 |
6940911 | Sugiyama | Sep 2005 | B2 |
7415160 | Cho et al. | Aug 2008 | B2 |
7466863 | Ito | Dec 2008 | B2 |
7515197 | Suzuki | Apr 2009 | B2 |
7574129 | Tsukuda | Aug 2009 | B2 |
RE41004 | Oshima | Nov 2009 | E |
7724289 | Kudo | May 2010 | B2 |
7917000 | Shimazaki et al. | Mar 2011 | B2 |
7936376 | Fukuhara | May 2011 | B2 |
8155187 | Isu et al. | Apr 2012 | B2 |
8264566 | Park et al. | Sep 2012 | B2 |
8339415 | Sekizawa | Dec 2012 | B2 |
8634458 | Ishii | Jan 2014 | B2 |
8675084 | Bolton et al. | Mar 2014 | B2 |
20020003576 | Konishi et al. | Jan 2002 | A1 |
20070031139 | Tsukuda | Feb 2007 | A1 |
20070071094 | Takeda et al. | Mar 2007 | A1 |
20080056359 | Isu et al. | Mar 2008 | A1 |
20080056360 | Isu et al. | Mar 2008 | A1 |
20080056385 | Isu et al. | Mar 2008 | A1 |
20090002507 | Fukuhara | Jan 2009 | A1 |
20090238263 | Jaggi et al. | Sep 2009 | A1 |
20100119214 | Shimazaki et al. | May 2010 | A1 |
20100315416 | Pretlove et al. | Dec 2010 | A1 |
20100315486 | Lee et al. | Dec 2010 | A1 |
20110007131 | Okada et al. | Jan 2011 | A1 |
20110043614 | Kitazato | Feb 2011 | A1 |
20110063422 | Yoo | Mar 2011 | A1 |
20110069153 | Nakane | Mar 2011 | A1 |
20110075734 | Sakazume | Mar 2011 | A1 |
Number | Date | Country |
---|---|---|
1909638 | Feb 2007 | CN |
100474900 | Apr 2009 | CN |
09-065372 | Mar 1997 | JP |
H09-065372 | Mar 1997 | JP |
Entry |
---|
Dec. 3, 2013 Chinese Office Action that issued in Chinese Patent Application No. 201110405080.5. |
Number | Date | Country | |
---|---|---|---|
20120140030 A1 | Jun 2012 | US |