The present invention relates to a technique of reproducing an image and, more particularly, to a technique of reproducing moving image data using inter-frame encoding.
In recent years, digital video cameras and. digital cameras which encode moving image data by using inter-frame encoding such as MPEG and record/reproduce the data are widely used.
In encoding image data by using MPEG, it is done in accordance with a virtual buffer model called vbv_buffer in order to guarantee that encoded image data will be decoded by a decoder without any loss. The decoder decodes image data input from a recording medium or transmission line in accordance with the vbv_buffer model.
An operation of reproducing, from a recording medium, image data encoded by MPEG and decoding it will be described with reference to
At time t0 shown in
On the basis of vbv_delayA(0) detected by a vbv_delay detection circuit 504, the decoding time calculation circuit 506 calculates the time t0 given by
t0=ta+vbv_delayA(0) (1)
The vbv_delay data is information representing a time during which each picture data of an MPEG stream stays in the buffer memory when the picture data is to be decoded.
The decoding time t0 calculated by the decoding time calculation circuit 506 is supplied to the control circuit 507. At the time t0, the control circuit 507 reads out the reproduced data V0 of the stream A from the buffer 503 and outputs the data from an output terminal 508 to a decoder (not shown).
Decoding time tq from the time t0 is calculated by the decoding time calculation circuit 506 by
tq=t0+Tv×q(q=0, 1, 2, . . . ) (2)
and supplied to the control circuit 507, where Tv is the reciprocal of the frame frequency (e.g., 29.97 Hz) of the image data.
When the time t0 has come, the control circuit 507 notifies the decoding time calculation circuit 506 of it. The decoding time calculation circuit 506 supplies next decoding time t1 to the control circuit 507.
At the time t1, the control circuit 507 reads out V1 of the stream A of the reproduced data fetched in the buffer 503, outputs the data to the output terminal 508, and sends it to the decoder (not shown).
In the above-described way, the image data is reproduced until times t2, t3, . . . , tn so that reproduction of the stream A is ended.
The encoder must encode image data without causing overflow or underflow of the above-described vbv_buffer model. The decoder can decode image data without any failure such as frame skip or frame hold by executing reproduction in accordance with the vbv_buffer model.
Consider a case wherein another stream B is reproduced next to the stream A recorded on the recording medium.
To reproduce without causing overflow or underflow of the vbv_buffer model on the decoder side, the control circuit 507 controls the reproduction circuit 502 and buffer 503 such that after the final reproduced data of the stream A is read out from the buffer 503 at decoding time tn the data of the stream B is fetched in the buffer 503, as shown in
The control circuit 507 notifies the decoding time calculation circuit 506 of the fetch time tn of the stream B and fetches the stream B in the buffer 503 through the reproduction circuit 502.
The vbv_delay detection circuit 504 detects vbv_delayB(0) and supplies it to the decoding time calculation circuit 506. On the basis of the fetch time tn and vbv_delayB(0), the decoding time calculation circuit 506 calculates a decoding time tm given by
tm=tn+vbv_delayB(0) (3)
(tn+3=tm
The decoding time of the stream B is calculated by the decoding time calculation circuit 506 by
tr=tn+Tv×r(r=0, 1, 2, . . . ) (4)
The control circuit 507 controls the fetch/read in/from the buffer in the same way as for the stream A, as shown in
In the above-described method, neither buffer overflow nor underflow occurs because the stream B is fetched in the buffer 503 after the stream A is completely read out from the buffer 503 at the decoding time of the last data of the stream A. However, since decoding cannot be executed at the reproduction transition from the stream A to the stream B, i.e., at times tn+1 and tn+2, the reproduced image of the stream A cannot smoothly be switched to that of the stream B. That is, the continuity of a reproduced image is disrupted.
To solve this problem, Japanese Patent Laid-Open No. 2002-158968 proposes a technique in which fetch of the stream B in the buffer 503 is started from an end time te of fetch of the stream A in the buffer 503, as shown in
Although this method can solve the problem of interruption of the discontinuity of a reproduced image, there is still room for improvement.
The present invention has been in consideration of the above-described problems, and has as its object to suppress discontinuity of a moving image as much as possible in continuous reproduction of the moving image.
In order to solve the above-described problem and achieve the object, according to the first aspect of the present invention, there is provided an image reproduction apparatus comprising: a reproducing device which reproduces an image data stream encoded by using inter-frame encoding; a buffer device which temporarily stores the encoded image data stream reproduced by the reproducing device; a buffer size setting device which sets an amount of image data which can be stored in the buffer device; a decoding time calculation device which calculates a decoding time as a timing at which the encoded image data stream is output from the buffer device to a decoder; and a control device which controls the buffer device, the buffer size setting device, and the decoding time calculation device to set the amount of image data which can be stored in the buffer device to at least twice a maximum value of an amount required by an encoded data stream reproducible by the image reproduction apparatus, start storing a second encoded image data stream in the buffer device after storage of a first encoded image data stream in the buffer device is ended before the first image data stream is completely output to the decoder, and calculate a decoding time of the second image data stream on the basis of a time when storage of the first image data stream in the buffer device is ended. According the second aspect of the present invention, there is provided an image reproduction apparatus comprising: a reproducing device which reproduces an image data stream encoded by using inter-frame encoding; a buffer device which temporarily stores the encoded image data stream reproduced by the reproduction device; a buffer size setting device which sets an amount of image data which can be stored in the buffer device; a decoding time calculation device which calculates a decoding time as a timing at which the encoded image data stream is output from the buffer device to a decoder; and a control device which controls the buffer device, the buffer size setting device, and the decoding time calculation device to set a storage size required by a first encoded image data stream as the storage size of the buffer device, start fetching a second encoded image data stream in the buffer device immediately after fetch of the first image data stream in the buffer device is ended, set again a sum of a value of a storage size required by the second image data stream and a value of the storage size required by the preceding first image data stream as the storage size of the buffer device, and calculate a decoding time of the second image data stream on the basis of a time when fetch of the first image data stream in the buffer device is ended. According to the third aspect of the present invention, there is provided a method of controlling an image reproduction apparatus including a reproducing device which reproduces an image data stream encoded by using inter-frame encoding, a buffer device which temporarily stores an encoded image data stream reproduced by the reproducing device, a buffer size setting device which sets an amount of image data which can be stored in the buffer device, and a decoding time calculation device which calculates a decoding time as a timing at which the encoded image data stream is output from the buffer device to a decoder, comprising: a buffer size setting step of causing the buffer size setting device to set the storage size of the buffer device to at least twice a maximum value of a storage size required by an encoded data stream reproducible by the image reproduction apparatus; a data fetch step of starting fetching a second encoded image data stream in the buffer device immediately after fetch of a first encoded image data stream in the buffer device is ended; and a decoding time calculation step of causing the decoding time calculation device to calculate a decoding time of the second image data stream on the basis of a time when fetch of the first image data stream in the buffer device is ended. According to the fourth aspect of the present invention, there is provided a method of controlling an image reproduction apparatus including a reproducing device which reproduces an image data stream encoded by using inter-frame encoding, a buffer device which temporarily stores an encoded image data stream reproduced by the reproduction device, a buffer size setting device which sets an amount of image data which can be stored in the buffer device, and a decoding time calculation device which calculates a decoding time as a timing at which the encoded image data stream is output from the buffer device to a decoder, comprising: a buffer size setting step of causing the buffer size setting device to set a storage size required by a first encoded image data stream as the storage size of the buffer device; a data fetch step of starting fetching a second encoded image data stream in the buffer device immediately after fetch of the first image data stream in the buffer device is ended; a buffer size re-setting step of setting again a sum of a value of a storage size required by the second image data stream and a value of the storage size required by the preceding first image data stream as the storage size of the buffer device; and a decoding time calculation step of causing the decoding time calculation device to calculate a decoding time of the second image data stream on the basis of a time when fetch of the first image data stream in the buffer device is ended. According to the fifth aspect of the present invention, there is provided a program characterized by causing a computer to execute the above control method.
According to the sixth aspect of the present invention, there is provided a computer-readable storage medium characterized by storing the above program.
Other objects and advantages besides those discussed above shall be apparent to those skilled in the art from the description of a preferred embodiment of the invention which follows. In the description, reference is made to accompanying drawings, which form a part hereof, and which illustrate an example of the invention. Such example, however, is not exhaustive of the various embodiments of the invention, and therefore reference is made to the claims which follow the description for determining the scope of the invention.
Preferred embodiments of the present invention will be described below in detail with reference to the accompanying drawings.
Referring to
When the reproduction mode starts, the buffer size determination circuit 111 sends, to the control circuit 112, a maximum value VFmax of the buffer size processible by the image reproduction apparatus of this embodiment. The control circuit 112 calculates a value twice the maximum value VFmax of the buffer size input from the buffer size determination circuit 111 by
VS=VFmax×2 (5)
to set a size (storable data amount) VS of the buffer memory 103.
Upon receiving a reproduction instruction, the control circuit 112 controls the reproduction circuit 102 to reproduce a designated stream A from the recording medium 101. The reproduction circuit 102 reads out the data of the stream A from the recording medium 101 and writes the data in the buffer memory 103.
The control circuit 112 reads out the stream A from the recording medium through the reproduction circuit 102 and writes the readout data in the buffer memory 103 until time t0 shown in
The time t0 is calculated by the decoding time calculation circuit 110 in the following way.
The vbv_delay detection circuit 107 in
t0=ta+vbv_delayA(0) (1)
and supplies the decoding start time t0 of the first frame other control circuit 112. At the time t0, the control circuit 112 reads out the data V0 of the first frame of the stream A from the buffer memory 103, supplies the data V0 to the decoder 104.
Decoding time tq from the time t0 shown in
tq=t0+Tv×q(q=0, 1, 2, . . . ) (2)
and supplied to the control circuit 507, where Tv is the reciprocal of the frame frequency (e.g., 29.97 Hz) of the image data.
The control circuit 112 controls the reproduction circuit 102 to continuously reproduce the stream A from the recording medium 101 and write it in the buffer memory 103 even after the time t0. On the basis of the decoding time supplied from the decoding time calculation circuit 110, reproduced data V1, V2, . . . are read out from the buffer memory 103 at times t1, t2, . . . , and supplied to the decoder 104.
As shown in
The buffer size detection circuit 106 detects vbv_buffer_size (=v_size(B)) data in the sequence header at the start of the stream B and checks whether the sum of the vbv_buffer_size (=v_size(B)) data and vbv_buffer_size (=V_size(A)) data of the stream A exceeds the set size VS of the buffer memory 103.
The vbv_buffer_size data is described in the sequence header of an elementary stream in an MPEG stream. A sequence header is header information inserted in the sequence layer of an elementary stream in MPEG data. The vbv_buffer_size data is added to, e.g., each data of one GOP and indicates the maximum occupation data amount of the buffer memory in decoding the data of the sequence layer. Hence, at the time of decoding, data stored in the buffer memory never exceeds vbv_buffer_size.
The buffer occupation amount detection circuit 105 detects the occupation amount of reproduced data in the buffer memory 103 and notifies the control circuit 112 of the occupation amount. The control circuit 112 monitors whether the buffer occupation amount supplied from the buffer occupation amount detection circuit 105 exceeds the buffer size VS set for the buffer memory 103. If the occupation amount is going to exceed the buffer size VS, reproduction from the recording medium is stopped to interrupt data fetch in the buffer memory 103.
It is checked from this point of time whether the sum of v_size(B) and the data amount of the stream A stored in the buffer memory 103 exceeds the set size VS. When the sum becomes smaller than the set size VS, the read of the data of the stream B from the recording medium is started.
As shown in
The vbv_delay detection circuit 107 detects the vbv_delay value (=vbv_delayB(0)) on the basis of vbv_delay data of the first frame of the stream B and supplies the vbv_delay value to the decoding time calculation circuit 110. The buffer fetch end detection circuit 109 detects the end time te (time te in
The decoding time calculation circuit 110 calculates
ty=te+vbv_delayB(0) (6)
and supplies the time ty to the control circuit 112.
If the time ty satisfies
(ty−t0) mod (Tv)≠0 (7)
(A mod B indicates the remainder obtained by dividing A by B), the control circuit 112 stops reading the stream B from the recording medium 101 to interrupt the write in the buffer memory 103 at the time ty (the time from the time ty to time tn+1 in
ty≦tn+1 (8)
the decoding time calculation circuit 110 calculates a decoding start time tk of the stream B by
tk=tn+1 (9)
The time tn+1 and the read time tn of the last data Vn of the stream A from the buffer memory 103 have a relationship given by
tn+1=tn+Tv (10)
Decoding time tn after the time tk of the stream B (time tn+1(=tn+Tv)) is given by
tu=tk+Tv×u(u=0, 1, 2, . . . ) (11)
When
ty>tn+1 (12)
and expression (7) holds, we have
When
(ty−t0) mod (Tv)=0 (13)
we have
tk=t0+[ty−t0]=ty (14)
Hence, the decoding time tu of the stream B after the time tk is given by
tu=tk+Tv×u(u=0, 1, 2, . . . ) (11)
The decoding time calculation circuit 110 calculates the decoding time tu of the stream B in the above-described way and supplies the time tu to the control circuit 112. The control circuit 112 reads out the reproduced data of the stream B from the buffer memory 103 in accordance with the decoding time from the decoding time calculation circuit 110 and supplies the reproduced data to the decoder 104. In other words, the control circuit 112 controls the buffer memory 103 to read out reproduced data from the buffer memory 103 in accordance with the decoding time (times tn+1(tk), tn+1(tk+Tv×u), . . . , tu, . . . in
As described above, in this embodiment, a size at least twice the buffer memory occupation data amount vbv_buffer_size of MPEG data processible by the reproduction apparatus is set as the size of the buffer memory in the reproduction mode. When the stream B is to be reproduced from the recording medium next to the stream A, the time te at which the last data of the reproduced data of the preceding stream A is read out from the recording medium is detected. From the read end time te, fetch of the reproduced data of the next stream B in the buffer memory is started.
That is, the apparatus is designed such that even when data stored in the buffer memory 103 exceeds vbv_buffer_size, the data of the stream B can be stored in the buffer memory 103. In addition, the decoding start time of the first frame of the stream B is calculated from the read end time te of the data of the final frame of the stream A. Discontinuity which occurs when the reproduced image of the stream A is switched to that of the stream B can be minimized. Hence, discontinuity of a moving image can also be minimized (in this embodiment, when ty≦tn+1, the continuity of decoding times is maintained, as shown in
Referring to
The same reference numerals as in
When reproduction from the recording medium 101 is started to fetch a stream A in the buffer memory 103, the buffer size detection circuit 106 detects vbv_buffer_size (=v_size(A)) described in the sequence header of an elementary stream in the stream A and supplies the size to the decoding time calculation circuit 202. The bit rate detection circuit 201 detects a bit rate Ra on the basis of bit rate information of the stream A described in the sequence header in the stream A and supplies the bit rate Ra to the decoding time calculation circuit 202. The buffer fetch start detection circuit 108 detects a fetch start time taof the stream A in the buffer memory 103 and supplies the time to the decoding time calculation circuit 202.
The decoding time calculation circuit 202 calculates a decoding start time t0 of the first frame of the stream A by
t0=ta+v_size(A)/Ra (14)
and supplies the decoding time to t0 the control circuit 112.
The value v_size(A)/Ra indicates a time required from the start of storage of data at the bit rate Ra in the buffer memory 103 until storage of data in V_size(A).
Decoding time tq from the time t0 is calculated by the decoding time calculation circuit 202 by
tq=t0+Tv×q(q=0, 1, 2, . . . ) (2)
and supplied to the control circuit 112.
The buffer fetch end detection circuit 109 detects a data fetch end time te of the stream A in the buffer memory 103 and supplies the time te to the decoding time calculation circuit 202 and control circuit 112.
The buffer size detection circuit 106 detects vbv_buffer_size (=v_size(B)) of a stream B and supplies it to the decoding time calculation circuit 202. The bit rate detection circuit 201 detects a bit rate Rb and supplies it to the decoding time calculation circuit 202.
The decoding time calculation circuit 202 calculates
ty=te+v_size(B)/Rb (15)
and supplies the time ty to the control circuit 112.
Calculation of a decoding start time tk and decoding time tu of the stream B and the method of fetching/reading the stream B in/from the buffer memory are the same as in the first embodiment.
As described above, a size at least twice the maximum buffer size vbv_buffer_size processible by the reproduction apparatus is prepared in the buffer memory, as in the first embodiment. The time te at which the last data of the reproduced data of the preceding stream A is read out from the recording medium is detected. From the read end time te, fetch of the reproduced data of the next stream B in the buffer memory is started. That is, even when the fetch amount in the buffer memory exceeds vbv_buffer_size, the data of the stream B can be fetched in the buffer memory. The reproduction time of the stream B is recalculated on the basis of the read end time te, the bit rate of the stream B, and vbv_buffer_size. Hence, discontinuity of decoding times can be minimized at the reproduction transition from the stream A to the stream B. Discontinuity of a moving image can also be minimized (in this embodiment, when ty≦tn+1, the continuity of decoding times is maintained, as shown in
Referring to
The same reference numerals as in
When reproduction of a stream A recorded on the recording medium 101 starts, the buffer size detection circuit 106 detects vbv_buffer_size (=v_size(A)) of the stream A and supplies it to the buffer size determination circuit 301. The buffer size determination circuit 301 calculates the value vbv_buffer_size=v_size(A) of the stream A by
Vsize=v_size(A) (16)
and supplies the value Vsize to the control circuit 302.
The control circuit 302 sets the value Vsize (=v_size(A)) as the size of the buffer memory 103.
Derivation of a reproduction start time t0 and decoding time tq of the stream A and buffer fetch/read control are the same as in the first or second embodiment.
When fetch of a stream B in the buffer memory 103 starts at a fetch end time te of the stream A in the buffer memory 103, the buffer size detection circuit 106 detects vbv_buffer_size (=v_size(B)) of the stream B and supplies it to the buffer size determination circuit 301.
The buffer size determination circuit 301 calculates the sum of the value vbv_buffer_size=v_size(A) of the stream A and the value vbv_buffer_size=v_size(B) of the stream B by
Vsize=v_size(A)+v_size(B) (17)
and supplies the value Vsize to the control circuit 302.
The control circuit 302 sets the value Vsize (=v_size(A)+v_size(B)) again as the size of the buffer memory 103.
Read control of the stream A, buffer fetch/read control of the stream B, and calculation of a decoding start time tk and decoding time tu are the same as in the first or second embodiment.
At a read end time tn of last data Vn of the stream A from the buffer memory 103, the control circuit 302 notifies the buffer size determination circuit 301 that sweep of the stream A from the buffer memory 103 is ended.
Upon recognizing that sweep of the stream A from the buffer memory 103 is ended, on the basis of vbv_buffer_size=v_size(B) of the stream B, the buffer size determination circuit 301 sets Vsize as
Vsize=v_size(B) (18)
and supplies the value to the control circuit 302.
The control circuit 302 sets Vsize=v_size(B) supplied from the buffer size determination circuit 301 again as the size of the buffer memory 103.
Buffer fetch/read control of the stream B from the time tn and calculation of the decoding start time tk and decoding time tu are the same as in the first or second embodiment.
As described above, in seamless reproduction, vbv_buffer_size=v_size(A) of the preceding stream A is detected. While only the reproduced data of the stream A is present in the buffer memory, the buffer size is set to vbv_buffer_size=v_size(A) of the stream A. The time te at which the last data of the stream A is read out from the recording medium is detected. From the fetch end time te, fetch of the next stream B in the buffer memory is started. Then, vbv_buffer_size=v_size(B) of the stream B is detected. While both the stream A and the stream B are present in the buffer memory, the buffer size is set again to v_size(A)+v_size(B). With this arrangement, even when the fetch amount of the stream B in the buffer memory exceeds vbv_buffer_size, the data can be fetched in the buffer memory. The reproduction time of the stream B is recalculated on the basis of the read end time te of the stream A. Hence, discontinuity of decoding times can be minimized at the reproduction transition from the stream A to the stream B. Discontinuity of a moving image can also be minimized (in this embodiment, when ty≦tn+1, the continuity of decoding times is maintained, as shown in
As described above, according to the above-described embodiments, in continuous reproduction of a moving image, discontinuity of the moving image can be suppressed as much as possible.
The object of the embodiments can also be achieved by supplying a storage medium (or recording medium) which records software program codes for implementing the functions of the above-described embodiments to a system or apparatus and causing the computer (or CPU or MPU) of the system or apparatus to read out and execute the program codes stored in the storage medium. In this case, the program codes read out from the storage medium implement the functions of the above-described embodiments by themselves, and the storage medium which stores the program codes constitutes the present invention. The functions of the above-described embodiments are implemented not only when the readout program codes are executed by the computer but also when the operating system (OS) running on the computer performs part or all of actual processing on the basis of the instructions of the program codes.
The functions of the above-described embodiments are also implemented when the program codes read out from the storage medium are written in the memory of a function expansion card inserted into the computer or a function expansion unit connected to the computer, and the CPU of the function expansion card or function expansion unit performs part or all of actual processing on the basis of the instructions of the program codes.
When the present invention is applied to the storage medium, program codes corresponding to the above-described procedures are stored in the storage medium.
The present invention is not limited to the above embodiments and various changes and modifications can be made within the spirit and scope of the present invention. Therefore, to apprise the public of the scope of the present invention, the following claims are made.
This application claims priority from Japanese Patent Application No. 2004-244126 filed on Aug. 24, 2004, which is hereby incorporated by reference herein.
Number | Date | Country | Kind |
---|---|---|---|
2004-244126 | Aug 2004 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
6144765 | Tamura et al. | Nov 2000 | A |
6181872 | Yamane et al. | Jan 2001 | B1 |
6212233 | Alexandre et al. | Apr 2001 | B1 |
6219381 | Sawada et al. | Apr 2001 | B1 |
6285825 | Miwa et al. | Sep 2001 | B1 |
6330392 | Nakatani et al. | Dec 2001 | B1 |
6542549 | Tan et al. | Apr 2003 | B1 |
6546051 | Ramaswamy | Apr 2003 | B2 |
6657637 | Inagaki et al. | Dec 2003 | B1 |
7139316 | Yoshinari | Nov 2006 | B2 |
7197072 | Hsu et al. | Mar 2007 | B1 |
7483488 | Hsu et al. | Jan 2009 | B1 |
20010012246 | Mitsuno | Aug 2001 | A1 |
20020114388 | Ueda et al. | Aug 2002 | A1 |
20020126752 | Kim | Sep 2002 | A1 |
20030031252 | Miyazawa | Feb 2003 | A1 |
20030053797 | Oshima et al. | Mar 2003 | A1 |
20030175012 | Okada et al. | Sep 2003 | A1 |
20030190146 | Gotoh et al. | Oct 2003 | A1 |
20030202784 | Yamauchi et al. | Oct 2003 | A1 |
Number | Date | Country |
---|---|---|
11-262000 | Sep 1999 | JP |
2002-158968 | May 2002 | JP |
Number | Date | Country | |
---|---|---|---|
20060044163 A1 | Mar 2006 | US |