Abstract:
In a circuit for rotating a digital image any multiple of ninety degrees, an addressing method which reduces the number of address lines required. The rotation circuit relies on a memory configuation which can access each image pixel in memory individually, and this normally requires a large number of address lines. This invention takes advantage of the periodic nature of the data being accessed to reduce the number of address lines required.

Description:
BACKGROUND OF THE INVENTION 
     This invention is in the field of digital image handling and, more particularly, is an improved circuit for the rotation of a digital image by a multiple of 90 degrees. 
     It is frequently necessary to rotate a digital image by multiples of 90 degrees, or to create the mirror images of these rotations. A method and circuit for producing these rotations at high speed without the necessity of special hardware is described in commonly owned patent applications Ser. No. 07/453,738 entitled &#34;Method to Rotate a Bitmap Image 90 Degrees&#34;, and Ser. No. 07/721,797, &#34;Parallel Rotation Algorithm&#34; which are incorporated herein by reference. 
     To use a numerical example, the method can be explained as the addition of the rotation of the bits within each 4 by 4 bit block and the rotation of the blocks of the whole image. To rotate bits within a block, the first 4 bit word is loaded into the first line of a 4 by 4 bit buffer. The next word is circularly rotated upward one bit and loaded into the second line of the buffer. The third word is circularly shifted two bits and loaded into the third line of the buffer and the fourth line is circularly shifted three bits and loaded into the fourth line of the buffer. At this point a vertical line in the original image is still a vertical line in the buffer, but a horizontal line in the original is now a diagonal line in the buffer. 
     Since the buffer is implemented from 4 by 1 bit devices, any bit in each device is addressable independently of the other devices, and a bit in one word in the buffer can be loaded into, or read from, any bit of the four words of memory. Therefore, if the bits in the buffer are addressed along diagonal lines parallel to the diagonal line in the buffer and read out as single 4-bit words, the diagonal line in the buffer will become a vertical line at the output. Continuing with addressing the bits along diagonal lines, the vertical line in the buffer will become a diagonal line at the output. The output four words are then shifted to line up the diagonal bits into a horizontal line. Since this line started as a vertical line, it can be seen that the 4 by 4 bit block has now been completely rotated 90 degrees. To rotate the blocks within the image, a simple addressing algorithm provides that each block of the original image is read into the correct block of the page buffer. 
     Of course, the algorithm can be scaled up to larger sizes. However, in these larger sizes, the number of address lines becomes excessive. For example, in a sixteen line by sixteen bit buffer implemented from 16 by 1 bit RAM devices, sixty-four address lines would be required. 
     SUMMARY OF THE INVENTION 
     As described in the referenced patents, the patented process is to circularly shift the data so that one of the two orthogonal directions in the original becomes a diagonal, to reorganize the data so that the diagonal becomes a line 90 degrees away from its original direction and the other original orthogonal direction becomes a diagonal, and circularly shift to line up the second diagonal to become a line 90 degrees away from its original direction. The reorganization of the data is accomplished by reading the shifted data into, and then out of, a buffer implemented from memory devices, and there is an option of either writing directly into the buffer along horizontal lines and reorganizing it as it is read out, or to reorganize it as it is written into the buffer, and reading it out directly in horizontal lines. For ease of explanation, for the remainder of this application it will be assumed that the data will be reorganized while it is being read out from the buffer. 
     This invention reduces the number of address lines for the above example from 64 to sixteen by taking advantage of the periodic nature of the addressing function. Specifically, if the buffer is divided into 4-bit by 4-bit blocks, then, during the reorganization of the shifted image data, the address of the bit to be accessed in each block is identical. For a numerical example, Let us assume that the bits to be addressed are bit 0 of RAM 0, bit 1 of RAM 1, . . . and bit 15 of RAM 15. If the entire buffer were divided into blocks of 4 by 4 bits, then four of the bits to be accessed first are bit 0 of block 0 of RAM 0, bit 0 of block 1 of RAM 4, bit 0 of block 2 of RAM 8, and bit 0 of block 3 of RAM 12. Since the bit (the 0 bit in this case) is the same in each 4 by 4 bit block, the same 2-bit address lines, which turns out to be the least 2 significant address lines, can be applied to each of the four RAM&#39;s. 
     Using this system of addressing, and continuing with the example, the following number of address lines are also necessary. Two address lines to the first four RAM&#39;s to specify the first 4-bit block, and similarly two to the second, two to the third and two to the fourth. Adding these to the two address lines to RAMS 0, 4, 8 and 12 to specify the first word in the block, and similarly two to RAM&#39;s 1, 5, 9 and 13, two to RAM&#39;s 2, 6, 10 and 14, and two to RAM&#39;s 3, 7, 11 and 15; results in a total of 16 address lines. 
     The same set of address lines is also used when reading data in or out along horizontal lines. Here, the four sets of least, and most, significant address lines will have the same data. 
     Using this system, which takes advantage of the fact that the bits are always read in or out along diagonal or horizontal lines of the memory, the number of address lines can be reduced by a factor of four. 
    
    
     BRIEF DESCRIPTIONS OF THE DRAWINGS 
     FIG. 1 is a diagram showing the arrangement of the original image data. 
     FIG. 2 is a diagram showing the arrangement of the data after the first shift. 
     FIG. 3 is a diagram showing the arrangement of the reorganized data after being loaded into the buffer. 
     FIG. 4 is a diagram showing the arrangement of the data after the second shift in its fully rotated form. 
     FIG. 5, comprising FIG 5A and FIG. 5B, shows the arrangement of the addressing lines. 
     FIG. 6 identifies the address lines in tabular form. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     The invention will be discussed using an example of a 16 by 16 bit image. FIG. 1 shows the organization of the original image, comprising sixteen lines, each having 16 bits. The first word, a horizontal line, is the sixteen bits along the bottom edge of the image, and each bit, from bit 0 to bit 15 resides in a separate RAM. The left edge of the image is vertical and consists of the first bit of every line, the entire vertical line being contained in RAM 0. 
     The first step is to circularly shift each horizontal line by the word number, resulting in the arrangement of FIG. 2. In this form, the original horizontal lines in the original are still horizontal, but the vertical lines in the original are now diagonal. 
     This data is now read into the buffer by loading each horizontal line of the FIG. 2 data into diagonal lines of the buffer to result in the arrangement of data shown in FIG. 3. Notice that at this point the horizontal lines of the original image are now vertical, and the original vertical lines are now diagonal. 
     The final step is to read out the buffer data, line by line, and circularly shift to the left by the word number, resulting in the data organization of FIG. 4, where the original horizontal lines are now vertical and the original vertical lines are now horizontal. This final result happens to the mirror image of a rotation of 90 degrees. Other rotations and their mirror images can be produced by varying the directions of the shifts and diagonals. 
     In addition, by choice of the designer, the reorganization of the data can be done while the data is loaded into the buffer, or when it is read out. In either case, one addressing step requires that the data be addressed one horizontal line at a time, and the other requires that the data be addressed on diagonal lines, and in either case, the bit number of the bit being addressed in each 4 bit block will be the same. This is shown in FIG. 5. 
     Each RAM is 16 by 1 bit to result in a total image size of 16 by 16 bits, and this image is divided into 4 by 4 bit blocks, block 0 in RAM&#39;s 0-3, block 1 in RAM&#39;s 4-7, etc. Now, because of the cyclical nature of the data, when diagonal lines of data are read in or out, the least significant two bits for addressing the first RAM of all four blocks will be the same. So will the least significant two bits of RAM&#39;s 1, 5, 9 and 13, etc. Therefore the least significant two addressing lines, shown here as lines 0 and 1, can be shared by RAM&#39;s 0, 4, 8 and 12, as shown in FIG. 5. Similarly, these two least significant lines can be shared by RAM&#39;s 1, 5, 9 and 13, etc. Thus, eight lines are required. 
     Similarly, the next two significant address lines are the ones that separate the buffer into 4 columns. These are labelled address lines 2 and 3. RAM&#39;s 0-3 have common lines, RAM&#39;s 4 through 7 have common lines, etc. Thus, eight lines are required. Therefore, a total of 16 lines are required to fully address the memory. This is shown in FIG. 5. 
     The address lines for each RAM are identified in tabular form in FIG. 6. Here, eight sets (a through h) of address lines, two lines (which may be lines 0, 1, 2 or 3) per set are identified. For example, RAM 0 is addressed by lines 3 and 2 of set e and lines 1 and 0 of set a, the sets being identified in FIG. 5. 
     The above is a description of a specific embodiment. This addressing scheme can be generalized for any size memory and image as follows. 
     The general description of the invention would be a circuit for transferring a data block of 2.sup.(n+m) bits by 2.sup.(n+m) bits into or out of memory devices along diagonal lines with said data block transfer taking place 2 n  bits at a time, comprising, 2 n  memory devices, numbered from i=0 to 2 n  -1, each memory device having n+2m address inputs and containing 2.sup.(n+2m) bits of data, said 2 n  memory devices partitioned into subgroups of 2 k  memory devices each, wherein the address lines of all memory devices in each subgroup share n-k address lines which are not shared by any other memory devices in any other subgroups, the ith memory devices of all subgroups share k address lines not shared by any other memory devices, and all memory devices share 2 m  address lines with the total number of address lines being (n-k)2.sup.(n-k) +k2 k  +2m. 
     While the invention has been described with reference to a specific embodiment, it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted for elements thereof without departing from the true spirit and scope of the invention. In addition, many modifications may be made without departing from the essential teachings of the invention.