Address reduction scheme implementing rotation algorithm

Abstract: In a circuit for rotating a digital image any multiple of ninety degrees, an addressing system is provided which reduces the number of address lines required. The rotation circuit relies on a memory configuration which can access each image pixel in memory individually, and this conventionally requires a large number of address lines. By taking advantage of the periodic nature of the data being accessed the number of address lines required can be reduced by partitioning the memory devices (RAM 0 ...... RAM 15) of the circuit into subgroups wherein the memory devices in each subgroup (e.g. RAM 0 .... RAM 3) share address lines (addr-e [3:2]) which are not shared by memory devices in any other subgroup, and wherein each memory device (e.g. RAM 0) in a subgroup is associated with a respective memory device (RAM 4, RAM 8, RAM 12) in each other subgroup and shares,with those respective memory devices address lines (addr- a [1:0]) which are not shared by any other memory devices.

Description: This invention relates to digital image handling and, more particularly, to 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 US Patent No. 5 111 192. That prior art method 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 writing the shifted data into, and then reading it 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, it will be assumed that the data will be reorganized while it is being read out from the buffer. To use a numerical example, the prior art 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 written 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. It is an object of the present invention to enable a reduction to be made in the number of address lines required for a circuit of the above-described type. The present invention provides a memory circuit into and out of which a data block can be written and read respectively 2 n bits at a time according to claim 1. Returning to the prior art example above, a circuit in accordance with the invention enables the number of address lines to be reduced 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 turn out to be the least 2 significant address lines,can be applied to each of the four RAM'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'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's 1, 5, 9 and 13, two to RAM's 2, 6, 10 and 14, and two to RAM's 3, 7, 11 and 15; results in a total of 16 address lines. The same set of address lines is also used when writing in or reading out data 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 written in or read out along diagonal or horizontal lines of the memory, the number of address lines can be reduced by a factor of four. By way of example only, an embodiment of the invention will be described with reference to the accompanying drawings, in which: 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 shows the arrangement of the addressing lines. Fig 6 identifies the address lines in tabular form. The drawings illustrate rotation 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 written 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 vertical lines of the original image are now horizontal, and the original horizontal 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's 0 - 3, block 1 in RAM's 4 - 7, etc. Now, because of the cyclical nature of the data, when diagonal lines of data are written in or read out, the least significant two bits for addressing the first RAM of all four blocks (i.e. RAM's 0, 4, 8 and 12) will be the same. So will the least significant two bits of RAM'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's 0, 4, 8 and 12, as shown by the lines addr-a [1:0] in Fig 5. Similarly, the two least significant lines can be shared by RAM's 1, 5, 9 and 13 (as shown by the lines addr-b [1:0], etc. Thus, eight lines are required. That can be seen more clearly by considering, for example, addresses 0000, 0100, 1000 and 1100 for the image bits in RAM's 0, 4, 8 and 12 and noting that, for those four addresses, the two least significant addressing lines are the same ("00"). 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's 0 - 3 have common lines (addr-e [3:2], RAM's 4 through 7 have common lines (addr-f [3:2], etc. Thus, eight lines are required. Again, that can be seen more clearly by considering, for example, addresses 1100, 1101, 1110 and 1111 for the image bits in RAM's 12, 13, 14 and 15 and noting that, for those four addresses, the two most significant addressing lines are the same ("11"). It will thus be seen that 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. Generally, in a similar manner, rotation of an image of 2 (n+m) bits by 2 (n+m) can be accomplished with a circuit comprising 2 n memory devices (each of 2 (n+2m) bits) with a total of number of address lines of (n-k) 2 (2-k) + k2 k + 2m, where k is a number such that the 2 n memory devices can be partitioned into subgroups of 2 k memory devices each, with the memory devices in each subgroup sharing (n-k) address lines which are not shared by any other memory devices in any other subgroups, and with the ith memory devices of all subgroups sharing k address lines not shared by any other memory devices. In the specific case illustrated in the drawings and described above, the image is 16 bits by 16 bits (i.e. 2 4 bits by 2 4 bits) and the circuit comprises 16 (i.e. 2 4 ) memory devices (RAM's 0 to 15) partitioned into subgroups of 4 (i.e. 2 2 ) memory devices each; so that n = 4, m = 0 and k = 2, and the number of address lines (as seen already) is 16. As a further example, suppose that the image is 32 bits by 32 bits and the circuit comprises 16 memory devices (each of 1 bit by 64 bits) partitioned into subgroups of 4 memory devices each. In that case n = 4, m = 1 and k = 2, and the number of address lines is 18.

Claims: A memory circuit into and out of which a data block can be written and read respectively 2 n bits at a time, comprising: memory devices, each having address inputs; and address lines for addressing the address inputs of the memory devices; the address lines including a specific number of address lines that are for addressing the same number of address inputs of all memory devices; characterised in that: the circuit includes 2 n memory devices (RAM 0 to RAM 15); said specific number of address lines and of address inputs being 2m; each memory device has n+2m address inputs and can store 2 (n+2m) bits of data; the 2 n memory devices include 2 (n-k) subgroups of 2 k memory devices each; the address lines include n-k address lines for each subgroup (addr-e[3:2], addr-f[3:2], addr-g[3:2], addr-h[3:2]); the n-k address lines for each subgroup being for addressing n-k address inputs of all the memory devices in the subgroup and not being for addressing any memory device in any other subgroup; and for each value of an integer i from 1 to 2 k , the address lines include k address lines (addr-a[1:0], addr-b[1:0], addr-c[1:0], addr-d[1:0]); the k address lines for each value of i being for addressing k address inputs of the i th memory devices of all the subgroups and not being for addressing any other memory devices; the total number of address lines being (n-k)2 (n-k) + k2 k + 2m; m being an integer greater than or equal to zero, k being an integer greater than zero and n being an integer greater thank.

Inventors: KADAKIA VINOD, KANG CHRISTINE, KADAKIA, VINOD, KANG, CHRISTINE
Applicants: XEROX CORP, XEROX CORPORATION
Application year: 1992
Main classification: G06F12
IPC codes: H04N1, G06F12, G06T1, G06T3, G09G5