1. Field of the Invention
The present invention relates to an image data processing apparatus, image data processing method, and program which perform the image data process of rotating a display image.
2. Description of the Related Art
Conventionally, an image data processing apparatus, which performs a rotation on a display image, needs a page memory for storing one-page image data of the display image before carrying out the rotation, and a page memory for storing one-page image data of the display image after the rotation. However, since the amount of data contained in an image has been growing due to increasing resolution of a display image, a page memory having a large storage capacity is necessary for the rotation of the display image. The page memory needs storage capacity for storing two-screen image data, resulting in a considerable increase in cost. As a solution to this problem, the following image data processing method which performs an image rotation on image data has been proposed. That is, a restart marker as a JPEG control code is added to JPEG compression-coded image data and compressed image data is decoded for each stripe having a predetermined width. Accordingly, a method for reducing the storage capacity of a buffer memory necessary for storing the decoded image data has been proposed.
The following method has also been proposed. An image data processing apparatus, which can perform a rotation on a display image, divides input image data into bands, rearranges the reading order of the band-divided image data in accordance with the rotation angle, and performs a compression process for each band. This eliminates the necessity of performing skip reading of compressed code in a decompression process for image data, thereby enabling a decompression process to be performed in real time.
However, a conventional image data processing apparatus such as a digital camera cannot decompress original image data that is compression-coded by a JPEG compression scheme, rotating the decompressed image data, and then recording the rotated image data.
An image data processing apparatus and a method therefore disclosed in patent reference 1 encode compressed image data for each stripe having a predetermined width. In contrast to the structure of typical JPEG-compressed image data, a player that can play back the image data for each stripe is necessary. Accordingly, there exists the problem that a typical digital camera or the like cannot play back the image data.
Similarly, in the image data processing apparatus and image data processing method disclosed in patent reference 2, a DMA interface controls to read out compressed image data from a buffer memory for each band in a decompression process for the image data. The DMA interface is selectively switched to provide the readout image data for a decompression unit to sequentially perform a decompression process. Accordingly, there is a need to rasterize all the compressed data in buffer memory for performing a decompression process. There is also a need to encode the compressed image data for each stripe having a predetermined width. In contrast to the structure of typical JPEG-compressed image data, a player that can play back the image data for each stripe is necessary. Consequently, again there exists a problem that a typical digital camera or the like cannot play back the image data.
The present invention has as its object to reduce the storage capacity of buffer memory for storing image data. The present invention also has as its object to perform a rotation on an image while reducing the storage capacity of buffer memory, and to enable a typical player and digital camera to play back image data while maintaining image data format compatibility.
According to an aspect of the present invention, there is provided an image data processing apparatus comprising:
a first storage unit adapted to store compressed image data;
a decompression unit adapted to decompress the image data read out from the first storage unit;
a second storage unit adapted to segment the image data obtained from the decompression unit into a plurality of image data of segmented area, sequentially perform a rotation process on the plurality of image data of segmented area, and store the rotated image data;
a compression unit adapted to compress the image data of segmented area read out from the second storage unit; and
a third storage unit adapted to sequentially store the image data of segmented area obtained from the compression unit.
According to another aspect of the present invention, there is provided An image data processing method comprising the steps of:
storing compressed image data in a first storage unit;
decompressing the image data read out from the first storage unit;
segmenting the image data obtained in the decompression step into a plurality of image data of segmented area;
sequentially performing a rotation process on the plurality of image data of segmented area,
storing the rotated image data in a second storage unit;
compressing the image data of segmented area read out from the second storage unit; and
storing, in a third storage unit, the image data of segmented area obtained in the compression step.
According to still another aspect of the present invention, there is provided An image data processing apparatus comprising:
a first storage unit adapted to store image data compressed for each block;
a decompression unit adapted to decompress, for the each block, the image data read out from the first storage unit;
a second storage unit adapted to segment the image data obtained from the decompression unit into a plurality of areas in an integer multiple for the each block, sequentially performing a rotation process on the image data of each segmented area in an integer multiple for the each block, and storing the rotated image data;
a compression unit adapted to compress the image data of the each area read out from the second storage unit; and
a third storage unit adapted to sequentially store the image of the each area obtained from the compression unit.
According to still another aspect of the present invention, there is provided An image data processing apparatus comprising:
a first storage unit adapted to store image data compressed for each block;
a decompression unit adapted to decompress, for the each block, the image data read out from the first storage unit;
a trimming unit adapted to trim, in an integer multiple for the each block, the image data obtained from the decompression unit;
a second storage unit adapted to sequentially perform, in an integer multiple for the each block, a rotation process on the image data obtained from the trimming unit, and store the rotated image data;
a compression unit adapted to compress the image data of the each area read out from the second storage unit; and
a third storage unit adapted to sequentially store the image data of the each area obtained from the compression unit.
According to still another aspect of the present invention, there is provided An image data processing apparatus comprising:
a first storage unit adapted to store image data compressed for each block;
a trimming designation unit adapted to designate trimming of the image data;
a decompression unit adapted to decompress, for the each block, the image data read out from the first storage unit;
a first trimming unit adapted to trim, in an integer multiple for the each block, the image data obtained from the decompression unit;
a second storage unit adapted to sequentially perform, in an integer multiple for the each block, a rotation process on the image data obtained from the first trimming unit, and store the rotated image data;
a second trimming unit adapted to trim a trimming area designated in the trimming designation unit, and read out the image data stored in the second storage unit;
a compression unit adapted to compress the image data trimmed in the second trimming unit; and
a third storage unit adapted to sequentially store the image data of the each area obtained from the compression unit.
According to still another aspect of the present invention, there is provided a program stored in a storage medium comprising codes which cause a computer to execute an image data processing method according to the above aspects.
According to the present invention, an image rotation for rotating image data makes it possible to reduce the storage capacity of a buffer memory for storing the image data. The image rotation also makes it possible to maintain image data format compatibility so that typical player, digital camera, and the like can play back the image data.
Further features of the present invention will become apparent from the following description of exemplary embodiments with reference to the attached drawings.
The first embodiment of the present invention will now be described with reference to
Reference numeral 101 denotes a system bus. The CPU 100 controls respective circuit blocks via the system bus 101. The CPU 100 uses part of a RAM (Random Access Memory) 103 as a work area in accordance with a program which is stored in a ROM (Read Only Memory) 102 to implement the embodiment. Reference numeral 104 denotes an image sensing unit. The image sensing unit 104 includes a lens system to which a CCD, stop, shutter mechanism, and the like are mounted, as is well known. Reference numeral 105 denotes a display unit for which an LCD (Liquid Crystal Display) or the like is used. The display unit 105 is used as a monitor for an object to be sensed or a monitor for playing back sensed image data. Reference numeral 106 denotes a recording medium such as a removable memory card incorporating a semiconductor memory device. The recording medium 106 is not limited to a semiconductor memory device, and other recording media are also available. A first buffer memory 108 temporarily stores part or all of image data compression-coded by JPEG (Joint Photographic Expert Group) or the like, which is read out from the recording medium 106 via a read circuit 107. The first buffer memory 108 comprises a conventional DRAM (Dynamic Random Access Memory).
A control circuit 109 for the first buffer memory 108 comprises a direct memory access controller (to be referred to as “DMAC” hereinafter) which sequentially DMA-transfers JPEG-compressed image data from the first buffer memory 108 to a decompression circuit 110. The decompression circuit 110 decodes the image data by decompressing the image data compression-coded by JPEG or the like.
Reference numeral 111 denotes a trimming circuit which extracts and outputs the whole image data or a rectangular image data area which is extracted from the image data decompressed in the decompression circuit 110.
A first control circuit 112 for second buffer memory is a DMAC for DMA-transferring the image data extracted in the trimming circuit 111 to the second buffer memory 113. The image sensing apparatus also includes a second control circuit 114 for the second buffer memory for controlling the second buffer memory 113. The second control circuit 114 for the second buffer memory comprises a DMAC for DMA-transferring the image data stored in the second buffer memory 113 to a compression circuit 115.
By a block coding process such as JPEG, the compression circuit 115 compression-codes the image data read out from the second buffer memory 113. Reference numeral 117 denotes a third buffer memory which stores part or all of the JPEG-compressed image data compression-coded in the compression circuit 115. A control circuit 116 for the third buffer memory controls the third buffer memory 117. The compressed image data output from the third buffer memory 117 is written in the recording medium 106 via a write circuit 118.
Note that it is possible to allocate the first buffer memory 108, second buffer memory 113 and third buffer memory 117 in the RAM 103. Also, another RAM can be provided independently, in which the first buffer memory 108, second buffer memory 113 and third buffer memory 117 can be allocated.
Reference symbols 2a to 2l of
In
In
In
Finally, in
On the other hand, in
In
In
Finally, in
In
In
Referring to
In step S604, the counter value h is incremented by 1 (h=h+1). In step S605, it is determined whether the counter value h is equal to the number M of pixels (words) of one-line image data (h=M). If it is determined that the counter value h is equal to the number M of pixels (words) of one-line image data, i.e., if one-line image data is processed, the process advances to step S606. In step S606, the counter value h is reset (h=0) and the counter value c is incremented by 1 (c=c+1).
In step S607, the number of lines is compared with the counter value c, and it is determined whether the counter value c is equal to the number N of lines of the image data in the rectangular area to be transferred (c=N). If it is determined that the counter value c is equal to the number N of lines of the image data in the rectangular area to be transferred, i.e., if image data of all lines in the rectangular area is transferred, the operation of the transfer process ends.
On the other hand, if it is determined in step S605 that the counter value h is not equal to the number M of pixels (words) of one-line image data and it is determined in step S607 that the counter value c is not equal to the number N of lines of the image data in the rectangular area to be transferred, the process returns to step S602. Image data of a next line is transferred. Such process makes it possible to achieve the two-dimensional data transfer of image data.
Referring to
In step S704, an offset value K is added to the counter value h (h=h+K). In step S705, it is determined whether the counter value h is equal to the number M of lines (h=M). If the counter value h is equal to the number M of lines, i.e., if one-line image data is processed from P1 to P2 vertically, the process advances to step S706. In step S706, the counter value h is reset (h=0) and the counter value c is incremented by 1 (c=c+1). In step S707, the number of pixels (words) is compared with the counter value c, and it is determined whether the counter value c is equal to the number N of pixels of the rectangular area to be transferred (c=N). If it is determined that the counter value c is equal to the number N of pixels of the rectangular area to be transferred, i.e., if image data of all lines is transferred, the operation of the process ends.
On the other hand, if it is determined in step S705 that the counter value h is not equal to the number M of lines and it is determined in step S707 that the counter value c is not equal to the number N of pixels of the rectangular area to be transferred, the process returns to step S702. Image data of a next line is transferred. This process makes it possible to achieve the two-dimensional data transfer including a 90° rotation.
Further, 4.5 MB are allocated to the second buffer memory 113, which is calculated by dividing the image area of 3,072 (horizontal)×2,304 (vertical) pixels in the YUV422 format (2 bytes per pixel) by three.
Assuming that the data amount is reduced to about ⅓ the original image data by performing a variable length coding, 5 MB are allocated to the third buffer memory 117 as the second JPEG-compressed image data area of 2,304 (horizontal)×3,072 (vertical) pixels.
The operation of an image rotation according to the first embodiment will now be described in detail on the basis of a flowchart in
When the process starts, the CPU 100 transfers the JPEG-compressed image data on the recording medium 106 to the first buffer memory 108 via the system bus 101 in step S1. In step S2, the CPU 100 reads out the horizontal and vertical sizes from the JPEG-compressed image data on the first buffer memory 108 to determine the data size of 3,072 (horizontal)×2,304 (vertical) pixels. In step S3, the CPU 100 obtains a capacity available in the second buffer memory 113.
The capacity available in the second buffer memory 113 is calculated by subtracting the capacity of the first buffer memory 108 and that of the third buffer memory 117 from the capacity of 16 MB of the DRAM. That is, 6 MB are allocated to the second buffer memory 113.
In step S3, the CPU 100 obtains, from the capacity available in the second buffer memory 113, the number (horizontal segmentation number; the “horizontal” direction herein being defined based on the pre-rotated image such as the image shown by the symbol 2a in
Therefore:
(the horizontal segmentation number)=3 where XN is set to 2 obtained by (the horizontal segmentation number)−1.
In step S4, the CPU 100 determines the designation of rotation angle of the image. If the 90° rotation shown in 2a to 2l of
In step S6, the trimming circuit 111 extracts the image data 202 (XN area) of two horizontal blocks or the first and second horizontal blocks, i.e., left 1,024×2,304 pixels shown in 4b of
In step S7, the first control circuit 112 for the second buffer memory performs a 90° rotation on the image data 202 of 1,024×2,304 pixels extracted in the trimming circuit 111, as shown in 4c of
The image data to be output undergoes the two-dimensional data transfer shown in
In step S8, the second control circuit 114 for the second buffer memory transfers the 90°-rotated image data of 2,304×1,024 pixels on the second buffer memory 113 to the compression circuit 115 in accordance with the flowchart of
The compression circuit 115 performs a block coding process on the basis of a predetermined quantization table. The compression circuit 115 transfers the JPEG-compressed image data to the third buffer memory 117 to generate the second JPEG-compressed image data shown in 2d of
In step S9, the CPU 100 determines XN=2, and the process advances to step S10. Since the process for one horizontal block ends, the CPU 100 calculates XN=XN−1 and sets XN=1 in step S10.
The process returns to step S4 to determine the rotation angle of the image. In this case, since the 90° rotation is designated as the preceding determination, the process repeats steps S5 to S8 to perform the operation shown in 2e to 2h of
In step S5, the control circuit 109 for the first buffer memory controls to DMA-transfer the JPEG-compressed image data from the first buffer memory 108 to the decompression circuit 110 as in step S5 described above. The decompression circuit 110 decompresses the JPEG-compressed image data for each block, and sequentially outputs raster data of 512×8 pixels for each block in the order of [0, 0] to [5, 0], [0, 1] to [5, 1], . . . , [0, 277] to [5, 277], as shown in 4a of
In step S6, the trimming circuit 111 discards the image data of two horizontal blocks or the first and second horizontal blocks, i.e., left 1,024×2,304 pixels, shown in 2e of
In step S7, the first control circuit 112 for the second buffer memory performs the 90° rotation shown in 2g of
In step S8, the second control circuit 114 for the second buffer memory transfers the 90°-rotated image data 213 of 2,304×1,024 pixels on the second buffer memory 113 to the compression circuit 115 in accordance with the flowchart of
In step S9, the CPU 100 determines XN=1, and the process advances to step S10. Since the process for two horizontal blocks ends, the CPU 100 calculates XN=XN−1 and sets XN=0 in step S10.
The process returns to step S4 to determine the specified rotation angle of the image. In this case, since the 90° rotation is designated as the preceding determination, the process repeats steps S5 to S8 to perform the operation shown in 2i to 2l of
In step S5, the control circuit 109 for the first buffer memory controls to DMA-transfer the identical JPEG-compressed image data from the first buffer memory 108 to the decompression circuit 110 as in step S5 described above. The decompression circuit 110 decompresses the JPEG-compressed image data for each block, and sequentially outputs raster data of 512×8 pixels for each block in the order of [0, 0] to [5, 0], [0, 1] to [5, 1], . . . , [0, 277] to [5, 277], as shown in 4a of
In step S6, the trimming circuit 111 discards the image data of four horizontal blocks or the first, second, third, and fourth horizontal blocks, i.e., left 2,048×2,304 pixels, shown in 2i of
In step S8, the second control circuit 114 for the second buffer memory transfers the 90°-rotated image data 223 of 2,304×1,024 pixels on the second buffer memory 113 to the compression circuit 115 in accordance with the flowchart of
In step S9, the CPU 100 determines XN=0, and the process advances to step S11. In step S11, the CPU 100 writes the JPEG-compressed image data of the third buffer memory 117 into the recording medium 106 so that the JPEG-compressed image data is transferred to the recording medium 106. With this process, it is possible to record the rotated JPEG-compressed image data even when there is no memory area to rasterize the JPEG-compressed image data.
The processes in steps S12 to S14 are performed in the same manner except that the specified rotation angle is different, and a description thereof will be omitted.
The embodiment, in which the rotated JPEG-compressed image data completes and then is transferred to the recording medium, has been described. However, it is also possible to have the following configuration. That is, the JPEG-compressed image data with a predetermined size completes, and then is sequentially transferred to the recording medium. The embodiment, in which the JPEG-compressed image data is read out from the recording medium and then undergoes a decompression process, has been explained. However, it is also possible to have the following configuration. That is, the JPEG-compressed image data with a predetermined size is read out, and then undergoes a decompression process to be sequentially read out.
The embodiment, in which the rotated JPEG-compressed image data completes and then is transferred to the recording medium, has been described. However, it is possible to have the following configuration.
That is, the JPEG-compressed image data is transferred to an external apparatus such as a printer via an interface or the like. The case in which each process is performed in a hardware has been described, but each process may be performed by software.
The second embodiment of the present invention will now be explained using
Reference symbols 11a and 11b in
Reference symbols 12a to 12d in
Similarly to the first embodiment,
A 2.5-MB of image area of 1,288 (horizontal)×1,024 (vertical) pixels in the YUV422 format (2 bytes per pixel) is allocated in the second buffer memory 113.
5.0 MB are allocated to the third buffer memory 117, similarly to the first embodiment.
An operation of rotation process according to the second embodiment will now be described in detail in accordance with a flowchart shown in
When the process starts, the CPU 100 transfers the JPEG-compressed image data on the recording medium 106 to the first buffer memory 108 via the system bus 101 in step S1301. In step S1302, the CPU 100 reads out the horizontal and vertical sizes from the JPEG-compressed image data on the first buffer memory 108 to determine the data size of 3,072 (horizontal)×2,304 (vertical) pixels. In step S1303, the CPU 100 obtains the capacity available in the second buffer memory 113.
The capacity available in the second buffer memory 113 is calculated by subtracting the capacity of the first buffer memory 108 and that of the third buffer memory 117 from the capacity of 16 MB of DRAM. Therefore, 6 MB are allocated to the second buffer memory 113.
That is, in step S1303, the CPU 100 obtains, from the capacity available in the second buffer memory 113, the number (horizontal segmentation number; the “horizontal” direction herein is defined based on the pre-rotated image such as the image shown by the symbol 2a in
therefore
(the horizontal segmentation number)=1
where XN is set to 0 obtained from (the horizontal segmentation number)−1.
In step S1304, the CPU 100 determines the designated rotation angle of the image. If the 90° rotation is designated, the process advances to step S1305. In step S1305, the first control circuit 112 for the second buffer memory controls to DMA-transfer the JPEG-compressed image data from the first buffer memory 108 to the decompression circuit 110. The decompression circuit 110 decompresses the JPEG-compressed image data for each block, and sequentially outputs raster data of 512×8 pixels for each block in the order of [0, 0] to [5, 0], [0, 1] to [5, 1], . . . , [0, 277] to [5, 277], as shown in 11a of
The process then advances to S1306. In step S1306, the trimming circuit 111 extracts the image data (XN area) of two horizontal blocks or the third and fourth horizontal blocks and 161 vertical blocks or the first to 161st vertical blocks, i.e., 1,024×1,288 pixels, shown in 12b of
The process advances to step S1307. In step S1307, the first control circuit 112 for the second buffer memory performs a 90° rotation shown in 12c of
The data to be output undergoes the two-dimensional data transfer shown in
In step S1308, the second control circuit 114 for the second buffer memory performs a process in accordance with the flowchart of
The compression circuit 115 performs a block coding process on the basis of a predetermined quantization table. The compression circuit 115 transfers the JPEG-compressed image data to the third buffer memory 117 to generate the second JPEG-compressed image data shown in 12d of
In step S1309, the CPU 100 determines XN=0, and the process advances to step S1311. In step S1311, the CPU 100 writes the JPEG-compressed image data on the third buffer memory 117 into the recording medium 106 so that the JPEG-compressed image data is transferred to the recording medium 106. With this process, it is possible to record the rotated JPEG-compressed image data even when there is no memory area to rasterize the JPEG-compressed image data. Note that the processes in steps S1312 to 1314 are performed in the same manner, and a description thereof will be omitted.
The object of the present invention is also achieved when a storage medium which records software program codes for implementing the functions of the above-described embodiments is supplied to a system or apparatus, and the computer (or the CPU or MPU) of the system or apparatus reads out and executes 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, and the storage medium which stores the program codes constitutes the present invention.
The storage medium for supplying the program codes includes a flexible disk, hard disk, optical disk, magneto-optical disk, CD-ROM, CD-R, magnetic tape, nonvolatile semiconductor memory card, and ROM.
The functions of the above-described embodiments are implemented when the computer executes the readout program codes. Also, the functions of the above-described embodiments are implemented when an OS (Operating System) or the like running on the computer performs some or all of actual processes on the basis of the instructions of the program codes.
Furthermore, the present invention includes a case in which, after the program codes read out from the storage medium are written in the memory of a function expansion board inserted into the computer or the memory of a function expansion unit connected to the computer, the CPU of the function expansion board or function expansion unit performs some or all of actual processes on the basis of the instructions of the program codes and thereby implements the functions of the above-described embodiments.
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. 2005-325296 filed on Nov. 9, 2005 and Japanese Patent Application No. 2006-240793 filed on Sep. 5, 2006, which are hereby incorporated by reference herein in their entirety.
Number | Date | Country | Kind |
---|---|---|---|
2005-325296 | Nov 2005 | JP | national |
2006-240793 | Sep 2006 | JP | national |
This application is a continuation of U.S. application Ser. No. 11/557,742, filed Nov. 8, 2006 (currently pending), which is incorporated by reference herein in its entirety, as if fully set forth herein, and claims the benefit of priority under 35 U.S.C. §119, based on Japanese Priority Application No. 2005-325296, filed Nov. 9, 2005 and Japanese Priority Application No. 2006-240793, filed Sep. 5, 2006, which are incorporated by reference herein in their entirety, as if fully set forth herein.
Number | Date | Country | |
---|---|---|---|
Parent | 11557742 | Nov 2006 | US |
Child | 13439744 | US |