Image processing device, image processing method, recording device, and program
The image processing device optimizes rotational processing by rearranging data reading and writing orders, addressing inefficiencies in existing devices to enhance processing speed and reduce memory access, achieving efficient rotational operations without a dedicated rotational unit.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- CANON KK
- Filing Date
- 2024-10-23
- Publication Date
- 2026-05-11
Smart Images

Figure 2026076073000001_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an image processing apparatus, an image processing method, a recording apparatus, and a program for recording an image on a recording medium.
Background Art
[0002] Conventionally, as a configuration of an image processing apparatus in a printer, a digital camera, or the like, a process of reading data from a main memory, performing a plurality of image processes, and then writing the data to the memory has been performed. At this time, even when the image processing unit requires only specific pixels, unnecessary data is read, resulting in a large data transfer amount and a long processing time.
[0003] Patent Document 1 discloses a configuration in which processing is performed using data obtained by adding peripheral data necessary for image processing as a basic unit. With such a configuration, it is possible to perform a plurality of image processes while reducing the data transfer amount without increasing the memory capacity.
Prior Art Documents
Patent Documents
[0004]
Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0005] In an image processing apparatus such as a copying machine, when performing 2-in-1 copying, 2-in-1 printing, or double-sided printing, rotation processing of 90 degrees, 180 degrees, or 270 degrees is performed on the input image. When using a rotation processing apparatus that performs rotation processing in addition to the image processing apparatus, reading and writing to the main memory occur in both the image processing apparatus and the rotation processing apparatus, so there is a possibility that the access bandwidth to the main memory will increase.
[0006] To address these challenges, the present invention aims to provide a device that performs rotational processing without using a rotational processing device. [Means for solving the problem]
[0007] The present invention comprises a first storage means, a second storage means, and a third storage means for storing image data; a first transfer means for reading the image data as a plurality of rectangular data corresponding to a plurality of rectangles obtained by dividing the image data in a first direction and a second direction orthogonal to the first direction, and writing them to the second storage means; an input means for reading the plurality of rectangular data from the second storage means and inputting it to an image processing unit; an output means for outputting the plurality of rectangular data that have undergone image processing from the image processing unit and writing them to the third storage means; and a second transfer means for reading the plurality of rectangular data from the third storage means and writing them to the first storage means, wherein (1) when no rotation processing is performed, the first transfer means reads the image data stored in the first storage means as rectangular data (2) When performing a rotation process to rotate by 90 degrees, the first transfer means reads the image data stored in the first storage means in the order in which the rectangular data are arranged in the first direction, and repeats the reading process in the order in which the rectangular data are arranged in the first direction along the second direction, and the input means reads the plurality of rectangular data stored in the second storage means in the order in which each pixel is read within each rectangular data in the first reading order, and the input means reads the plurality of rectangular data stored in the second storage means in the order in which the pixels are read within each rectangular data in the second reading order which is different from the first reading order. [Effects of the Invention]
[0008] With the above configuration, the present invention can provide a device that performs rotational processing without using a rotational processing device. [Brief explanation of the drawing]
[0009] [Figure 1] Image processing unit configuration diagram [Figure 2] Block diagram illustrating the prior art and the outline of this embodiment. [Figure 3] Conventional processing vs. processing with the new configuration [Figure 4] Image processing flowchart [Figure 5] Diagram of the reading order processing within a rectangle [Figure 6] Diagram illustrating the rotation process from 90 to 270 degrees. [Figure 7] Diagram illustrating the sequential reading process within a rectangle during 180-degree rotation. [Figure 8] Diagram illustrating the sequential reading process within a rectangle during a 270-degree rotation. [Figure 9] Diagram illustrating the conventional technology and its problems. [Figure 10] Diagram explaining burst boundary determination process [Figure 11] Image processing flowchart [Figure 12] Diagram showing processing with conventional technology and the new configuration. [Figure 13] A diagram showing data processing in the third embodiment. [Modes for carrying out the invention]
[0010] (First Embodiment) One embodiment of the present invention will be described below with reference to the drawings.
[0011] The configuration of the image processing device in this embodiment will be explained using the block diagram in Figure 1. The image processing device in this embodiment is a digital copier. A typical digital copier 1300 includes a scanner unit, a printer unit, a controller ASIC, main memory, and a CPU. The following describes each of these parts and their internal components.
[0012] The CPU 1301 controls the entire device. The scanner 1302 is a unit that optically scans a document to obtain digital image data. The scanner 1302 has a lighting unit, a line sensor, and an analog / digital conversion unit inside, and outputs the read image data as a luminance value digital signal in pixel units to the main memory 1330 described below. The input DMAC_A 1303 reads the above-mentioned read image data in bands from the main memory 1330 described below to the scanner image processing unit 1304 described below. Note that DMAC is an abbreviation for Direct Memory Access Controller.
[0013] The scanner image processing unit 1304 performs various image processes on the read image data. The output DMAC_A 1305 writes the processing result of the above-mentioned scanner image processing unit 1304 to the main memory 1330 in bands. The input DMAC_B 1313 reads image data in bands from the main memory 1330 described below to the print image processing unit 1314 described below. The print image processing unit 1314 performs various image processes on the image data read by the input DMAC_B 1313. The output DMAC_B 1315 writes the quantization data, which is the processing result of the above-mentioned print image processing unit 1314, to the main memory 1330 in bands.
[0014] The main memory 1330 is a main memory that temporarily stores image data and various control data, etc., and is usually composed of DRAM. The printing unit 1340 records an image on a recording medium by applying ink or toner based on the quantization data, which is the processing result of the print image processing unit 1314. The bus 1350 electrically connects the above-mentioned modules.
[0015] FIG. 2 is a block diagram showing the configuration of the printed image processing unit 1314 in the present embodiment. The main memory 101 stores image data and the like. The main memory 101 in this figure refers to the same one as the main memory 1330 in FIG. 1. The first transfer unit 102 reads out a plurality of rectangular image data with one rectangle as one unit from the main memory 101. In this specification, the rectangular image data refers to each of the input image data divided into a plurality in the main scanning direction (first direction) and the sub-scanning direction (second direction) orthogonal to the main scanning direction. Although details will be described later using FIG. 6, in the present embodiment, by controlling the reading order of the rectangular data units when reading out the plurality of rectangular image data and the reading order of each pixel within the rectangular data, the image can be rotated in 90-degree units.
[0016] The first intermediate memory 103 is a memory that temporarily stores the rectangular image data read by the first transfer unit 102, and has a capacity to store a plurality of rectangular image data with a size of b pixels in width and a pixels in height. The input unit 104 reads out the image data from the first intermediate memory 103 pixel by pixel and inputs it to the image processing unit 105. The image processing unit 105 performs spatial image processing on the image data input pixel by pixel. The output unit 106 writes the image data output pixel by pixel from the image processing unit 105 to the second intermediate memory 107. The second intermediate memory 107 temporarily stores the image data output pixel by pixel from the image processing unit 105 in units of rectangular image data. The second transfer unit 108 reads out the rectangular image data stored in the second intermediate memory 107 and writes the image after image processing to the main memory 101 in the main scanning direction (first direction).
[0017] Next, the operation regarding the rotation processing in the present embodiment will be described using FIGS. 3 to 5. First, FIGS. 3(a) to (d) show the rectangular image data and the processing direction in pixel units when the rotation processing is not performed. In the figure, the direction from left to right is the main scanning direction (first direction), the direction from top to bottom is the sub-scanning direction (second direction), the image data of one page is divided into a plurality of rectangles, and the processing is performed in rectangle units. The rectangles 209, 210, 211, and 212 in FIG. 3(a) are the divided rectangular image data.
[0018] On the other hand, Figures 3(e) to 3(h) show the 90-degree rotation process of this embodiment. The orientation of the letter "F" in the image indicates the rotation direction of the image data, and the images in Figures 3(f) to 3(h) are rotated 90 degrees from Figure 3(e).
[0019] Figure 3(a) shows image data 201 stored in the main memory 101. The first transfer unit 102 reads the rectangle 209 at the upper left corner of the image data and stores it in the first intermediate memory 103. The reading direction will be described later using Figure 5, but as shown in Figure 5(a), it is in the order of the main scanning direction (from left to right in the figure) to the sub-scanning direction. Figure 3(b) shows image data 202 stored in the first intermediate memory 103.
[0020] The input unit 104 then reads image data one pixel at a time from the first intermediate memory 103 and inputs it to the image processing unit 105. The direction in which data within the rectangle is read will be described later using Figure 5, but here, as shown in Figure 5(b), the data within the rectangle is read from the sub-scanning direction (from top to bottom) to the main scanning direction. The image processing unit 105 performs spatial image processing on the input image data and outputs the processing result one pixel at a time in the same direction as the input. The output unit 106 receives the output pixels from the image processing unit 105 one pixel at a time and writes them to the second intermediate memory 107. Figure 3(c) shows the image data 203 written to the second intermediate memory 107. The writing direction is from the sub-scanning direction of the input image to the main scanning direction.
[0021] Next, the second transfer unit 108 reads image data from the second intermediate memory 107 and writes it to the main memory 101. Figure 3(d) shows the image data 204 written to the main memory 101. The direction in which data within the rectangle is written is the same as in 401 in Figure 5, from the main scanning direction of the input image to the sub-scanning direction.
[0022] The series of processes described above, from Figure 3(a) to Figure 3(d), begins with rectangle 209 in the upper left of image data 201. The processes are then carried out in the order of rectangle 209, rectangle 210, rectangle 211, and rectangle 212, in the order of the main scanning direction (from left to right in the figure). Once rectangle 212 is processed, the process moves in the sub-scanning direction of the input image, and the same process is repeated for each rectangle, starting with the rectangle located below rectangle 209 (not shown) in the order of the main scanning direction (left to right). This process is carried out for multiple rectangles on one page.
[0023] Next, the rotation process of this embodiment will be explained using Figures 3(e) to 3(h). Here, we will show an example in which the image processing unit 105 shown in Figures 3(a) to 3(d) performs image processing while simultaneously performing a 90-degree rotation.
[0024] First, Figure 3(e) shows the process by which the first transfer unit 102 reads rectangular image data from the image data 205 stored in the main memory 101. First, the rectangle 216 at the lower left corner of the image data 205 is read and stored in the first intermediate memory 103. As shown in Figure 5(c), the direction in which the data within the rectangle is read is from the main scanning direction to the sub-scanning direction.
[0025] Figure 3(f) shows the process by which the input unit 104 reads rectangular image data in units from the image data 206 stored in the first intermediate memory 103 and inputs it to the image processing unit 105. Here, the direction in which the data within the rectangle is read corresponds to the state after a 90-degree rotation, as shown in Figure 5(d). Specifically, in the rectangular image data 404, one pixel at a time is read from the pixel at the lower left corner in the main scanning direction (from left to right in the figure), and then read in the reverse direction of the sub-scanning direction (from bottom to top). The rectangular image data 405 is obtained by rotating the rectangular image data 404 by 90 degrees. By reading within the rectangle in this order, it is possible to read it rotated by 90 degrees compared to the reading method in Figure 5(b).
[0026] Next, the image processing unit 105 performs spatial image processing on the input image data and outputs the processing results one pixel at a time in a direction rotated 90 degrees relative to the input. The output unit 106 receives the output pixels from the image processing unit 105 one by one and writes them to the second intermediate memory 107. Figure 3(g) shows the image data 207 written to the second intermediate memory. It is rotated 90 degrees relative to the input image, and is written in the sub-scanning direction (from top to bottom), and when one line is finished, the next line is written in the main scanning direction.
[0027] The second transfer unit 108 reads image data from the second intermediate memory 107 and writes it to the main memory 101 in rectangular units. Figure 3(h) shows the image data 208 rotated by 90 degrees. Each rectangular image data is written in the main scanning direction (from left to right), and when one line is completed, the next line in the sub-scanning direction is written. The operation of the second transfer unit 108 is the same as in Figure 5(1).
[0028] As described above, the 90-degree rotation process is performed by sequentially carrying out the series of operations shown in Figures 5(a) to (d), starting with rectangle 216 located at the lower left corner of image data 205 and moving toward rectangle 213 at the upper left corner. Furthermore, the same process is carried out for the group of rectangles (not shown) located to the right of the row of rectangles 216 to 213. By repeating this process, the 90-degree rotation can be achieved.
[0029] Figure 4 is a flowchart showing the processing of this embodiment, corresponding to the processing in Figures 3(e) to (h). In step S301, the initial value of the target rectangle for reading image data from the main memory 101 by the transfer unit 102 is set to the lower left corner of the input image (rectangle 216 in Figure 3). Then, the destination address for writing the target rectangle to the main memory 101 by the transfer unit 108 is set to the upper left corner of the output image (image data 208 in Figure 3).
[0030] In step S302, the first transfer unit 102 reads the image data of the rectangle of interest from the main memory 101 in line units from the main scan to the sub-scan direction and writes it to the first intermediate memory 103. In step S303, it is determined whether the reading in step S302 has been completed for one rectangle. If it has not been completed, the process returns to step S302. In steps S304 to S306, the input unit 104 reads the rectangular image data from the first intermediate memory 103 one pixel at a time in the order shown in Figure 5(d) below and inputs it to the image processing unit 105.
[0031] In step S307, the image processing unit 105 performs image processing on the image data input in step S305. It then outputs the image processing results one pixel at a time to the second intermediate memory 107. The output is performed in the order of the sub-scan after rotation followed by the main scan, and it is determined whether the output for one rectangle has been completed. If the output for one rectangle is completed, in step S308, the second transfer unit 108 reads from the second intermediate memory 107 in the order of the main scan after rotation followed by the sub-scan, and writes it to the position of the rectangle of interest, which is the output image area of the main memory 101.
[0032] After the second transfer unit 108 finishes writing in rectangular units, in step S309, the CPU determines whether the series of processes from reading to writing of the input image in vertical band units has been completed. A vertical band refers to multiple read rectangles in one column from the bottom edge to the top edge of the input image. Once the processing of one vertical band is completed, as shown in the image data 208 of Figure 3(h), the result of rotation and image processing of one horizontal band corresponding to one vertical band can be obtained. If the second transfer unit 108 determines in step S309 that the writing of one vertical band has not been completed, in step S310, the rectangle of interest in the input image is moved to the rectangle above it, and the rectangle of interest in the output image is moved to the rectangle to the right. Then the process returns to step S302.
[0033] If it is determined in step S309 that the writing of one vertical band unit has been completed, in step S311 the CPU determines whether the writing of all bands in the output unit (processing of the entire input image band by band) has been completed. All bands refer to the writing of one page. If it is determined that it has not been completed, in step S312 the first transfer unit 102 moves the area of interest of the input image that it will read from the main memory 101 to the bottom end of the vertical band to the right of the previous vertical band. Also, the second transfer unit 108 moves the destination address of the area of interest to which it will write the image data to the left end of the band one horizontal band below. Then, it returns to step S302 again. The above process is repeated until all bands have been completed.
[0034] Figure 5 is an illustrative diagram to explain in more detail the processing of rectangles 209 and 213 in Figure 3. Rectangular image data 401 and rectangular image data 402 are shown in the case where no rotation processing is performed. The arrows in rectangular image data 401 indicate the direction in which the read processing is performed for rectangles 209 to 212 in image data 201. From the image data stored in the main memory 101, the first transfer unit 102 reads from rectangle 209 located at the upper left corner of image data 201, starting from the pixel 406 at the upper left corner of the rectangle, in the main scanning direction (from left to right in the figure), and stores it in the first intermediate memory 103. After reading sequentially in the main scanning direction and reaching the pixel at the upper right corner, it moves to the leftmost pixel of the second row from the top and reads again along the main scanning direction. In this specification, this movement is referred to as reading in the order of main scanning direction to sub-scanning direction.
[0035] The input unit 104 then reads image data one pixel at a time from the first intermediate memory 103 within the rectangle and inputs it to the image processing unit 105. This reading from within the rectangle starts from the pixel 407 at the top left corner, as shown in the rectangular image data 402, and reads in the sub-scanning direction (the direction from top to bottom in the figure). Once it reaches the bottom pixel, it moves to the top pixel of the second row from the left and reads again along the sub-scanning direction. In this specification, this movement is referred to as reading in the order from the sub-scanning direction to the main scanning direction.
[0036] The image processing unit 105 performs spatial image processing on the input image data and outputs the processing results one pixel at a time in the same direction as the input.
[0037] Rectangular image data 403-405 are diagrams illustrating the pixel reading order in this embodiment. Rectangular image data 403 shows the processing direction from rectangle 216 to rectangle 213. Within each rectangle, the reading method is the same as shown in Figure 5(a). Rectangular image data 404-405 show the processing direction from rectangle 216 to rectangle 213. Rectangular image data 404 and rectangular image data 405 are the same, but rectangular image data 404 is the direction from the viewpoint of the first transfer unit 102, while rectangular image data 405 is the direction from the viewpoint of the image processing unit 105 after 90-degree rotation. For the image processing unit 105, rectangular image data 402 inputs one pixel at a time from the upper left corner of the rectangle before rotation, in the order of sub-scan to main scan of the input image. In contrast, rectangular image data 404 reads from the lower left corner pixel 408 of the input rectangle (the upper left corner pixel after 90-degree rotation) in the reverse direction from main scan to sub-scan of the input image and inputs it to the image processing unit 105. This means that the rectangular image data 405, which has been rotated by 90 degrees, is being input to the image processing unit 105.
[0038] In conventional processing, rectangular image data 402 reads out one pixel at a time from the top left, starting from the sub-scanning direction and moving in the main scanning direction of the input image. The image processing unit 105 then performs spatial image processing on the input image data and outputs the processing result one pixel at a time in the same direction as the input. In contrast, rectangular image data 404 outputs the processing result one pixel at a time in a direction rotated 90 degrees relative to the input direction.
[0039] The rectangular image data 409 is a diagram showing the direction when output to intermediate memory B by the output unit 106 from the image processing unit 105. The rectangular image data 410 is a diagram showing the direction when written to main memory 101 by the transfer unit B108 from intermediate memory B. The operation of rectangular image data 409 and rectangular image data 410 can be the same for both non-rotated and rotated cases. The above processing is performed on the rectangle of the entire input image.
[0040] In this way, the order in which rectangular units are read from the input image in the first transfer unit 102 is changed depending on whether a 90-degree rotation is performed or not, as shown in image data 201 and image data 206. Then, by changing the order in which pixels are input to the image processing unit in the input unit 104, as shown in rectangular image data 402 and rectangular image data 404 (rectangular image data 405), it is possible to choose whether or not to rotate. In other words, even in operations where it is necessary to use both 0-degree rotation and 90-degree rotation, both processes can be performed without preparing a separate rotation processing unit.
[0041] (Second embodiment) In the first embodiment described above, by changing the order of reading rectangular units from the main memory 101 and the order of reading pixel units from the first intermediate memory 103, rotation processing of 180 degrees and 270 degrees can be performed in the same way, not just 90 degrees.
[0042] Figure 6 illustrates a method for performing rotations of 90, 180, and 270 degrees, applying the first embodiment. Image data 501 shows the order in which the input image data is read out in rectangular units in Figure 3, 205. Image data 502 shows the order in which the rectangles are arranged after a 90-degree rotation in the processing of image data 206 in Figure 3.
[0043] Image data 503 shows the arrangement of rectangles after a 270-degree rotation in the processing of image data 206 in Figure 3. Image data 504 shows the arrangement of rectangles after a 180-degree rotation in the processing of image data 206 in Figure 3.
[0044] In this embodiment, the order of the blocks corresponding to the letters a to i in the image data 205 is rearranged according to the rotation angle, thereby supporting rotations of 90 degrees, 180 degrees, and 270 degrees.
[0045] The rectangular image data 601-605 in Figure 7 shows the processing of the rectangular image data 401-405 in Figure 5 with a 180-degree rotation, and the rectangular image data 701-705 in Figure 8 shows the processing of the rectangular image data 401-405 in Figure 5 with a 270-degree rotation.
[0046] When performing rotation processing at an arbitrary rotation angle, the system is configured such that, as shown in image data 502, 503, and 504, the order of pixels input from the input unit 104 to the image processing unit 105 in the processing of image data 206 corresponds to the alphabetical order of 205. This allows rotation processing to be performed without the need to prepare a separate rotation processing unit, even in operations that require the use of 90-degree, 180-degree, and 270-degree rotations.
[0047] (Third embodiment) Figure 9 illustrates the problems that arise when performing the operation during a 90-degree rotation in the first embodiment. Conventionally, when spatial image processing is performed in the image processing unit 105, the image is input to the image processing unit 105 with the surrounding data necessary for image processing added, and the processing unit outputs the image with the surrounding data removed. When this is applied to the 90-degree rotation processing in the second embodiment described above, the operation of the rectangular units into which the input image is divided is as shown in Figure 10. In this figure, image data 901 shows the positional relationship of the rectangles before rotation, and image data 902 and image data 903 show the positional relationship of the rectangles after rotation. In the 90-degree rotation processing, the order in which the rectangles are read in the first transfer unit 102 is first from the bottom to the top of the vertical column i of 901, and then from the bottom of the vertical column ii. Here, the overlapping parts of each rectangle i and ii correspond to the surrounding data.
[0048] In the embodiment described above, the rectangle size in the input image is set to horizontal b pixels × vertical a pixels, and a first intermediate memory 103 is provided with a capacity to store that number of pixel data. In the 90-degree rotation process and the 270-degree rotation process, this is input to the image processing unit 105 as rectangle data with a height of b pixels after rotation. However, when reading from the main memory 101 to the first intermediate memory 103 according to that height, the presence of the aforementioned peripheral data may prevent the read start address and the number of bytes read for each rectangle from matching the burst store line of the main memory 101. As a result, burst partitioning occurs in memory access, leading to reduced access efficiency and decreased transfer performance. In this embodiment, these problems are solved by the control shown in Figure 10. The following explanation will be given using Figures 10 and 11.
[0049] Figure 10 is an illustrative diagram showing the operation of this embodiment. Image data 901 shows whether the width of each rectangle processed consecutively in the input image crosses the burst boundary during the 90-degree rotation process in the first embodiment. The group of rectangles that are continuously input to the image processing unit 105 in the main scanning direction after rotation will be called a band. i, ii, and iii of image data 901 each represent the vertical band in the input image.
[0050] In order to perform spatial image processing in the image processing unit 105, it is necessary to input the peripheral image portion as well. For this reason, bands i, ii, and iii overlap in the main scanning direction, as shown in the image data 901.
[0051] Figure 13 is a diagram illustrating the details of this embodiment. Specifically, it is a cropped view of the nth band rectangle and its surroundings in the image data 901 of Figure 10. As an example, a main memory 101 with a burst length of 64 bytes contains a 24-bit RGB point-sequenced image (with a width of 64r pixels). When the number of pixels in the rotational sub-scan direction, which is the band height input to the image processing unit 105, is (x1 + x2 + x3) pixels, consisting of x1 pixel + x2 and x3 pixels above and below as peripheral data, the starting address of the upper left corner pixel of the input image is P (64-byte aligned). The readout start address of the nth band is expressed by the following formula. P + 64rk + (n-1) x 1 × 3 Here, k is an integer representing the number of lines from the top edge of the input image.
[0052] Furthermore, the end address of the read operation is expressed by the following formula. P + 64rk + (x² + nx¹ + x³) × 3 - 1
[0053] The values indicating which of the 64-byte blocks the leftmost and rightmost parts of the read width fall into, when counted from the leftmost part of the input image, can be calculated using the following formula. B1=QUOTIENT((n-1)x1×3,64) and B2=QUOTIENT((x2+nx1+x3)×3-1,64)
[0054] Here, QUOTIENT(a,b) is a function that finds the integer part of the quotient of the division a / b. The read width α = (B2 - B2 + 1) × 64 bytes.
[0055] Then, if we let L be the top-left corner and R be the top-right corner of the nth read rectangle from the left (n=0,1,2…), the address of L is P+3(n-1)x1, and the address LA obtained by truncating that address by 64 bytes alignment is as follows. LA=P+64B1=P+64×quotient(3(n-1),64)
[0056] Furthermore, the address of R is P+3(x2+nx1+x3)-1, and the address RA, which is obtained by rounding up that address 64 bytes aligned, is expressed by the following formula. RA=P+64B2+64=P+64×quotient(3(x2+nx1+x3),64)+64
[0057] Similarly, if we denote the addresses of the left and right ends of the m-th line (m=0,1,2…) of the same read rectangle as LA(m) and RA(m), then since the rectangle width is 64r pixels (192r bytes), LA(m)=P+64×quotient(3(n-1)x1,64)+192rm RA(m)=P+64×quotient(3(x2+nx1+x3),64)+64+192rm It can be expressed by the following formula.
[0058] In steps S1001, S1016, and S1018 of Figure 11, the first transfer unit 102 reads 64-byte units of data, including each line of the rectangular image, from the main memory 101, i.e., from LA(m) to RA(m) (m=0,1,2…), and stores them in the first intermediate memory 103. Here, the upper limit of m (number of lines in the read rectangle - 1) can be any amount that can be stored in the first intermediate memory 103.
[0059] Next, in step 1010 of Figure 11, in order to input the image stored in the first intermediate memory 103 to the image processing unit 105, the number of bytes to be deleted from the left edge before rotation on each line is M [bytes].
[0060] M = Address of L - LA0 = 64 × MOD((n-1) × 1 × 3, 64) Then, the image processing unit receives data for each line within the input rectangle, consisting of x2+x1+x3 pixels (3×(x2+nx1+x3) bytes), one pixel at a time.
[0061] (MOD(a,b) is a function that finds the remainder when argument a is divided by argument b.) example) When x1=12, x2=3, and x3=3, in band i, the width of one line is 64 bytes and the cut-out addresses are +0x0 to +0x35 for each line; in band ii, the width of one line is 128 bytes and the cut-out addresses are +0x24 to +0x59 for each line; and in band iii, the width of one line is 64 bytes and the cut-out addresses are +0x8 to +0x3d for each line.
[0062] Figure 11 is a flowchart showing the 90-degree rotation process in this embodiment. In step S1001, the first transfer unit 102 initially sets the rectangle of interest that it will read from the main memory 101 as the lower left corner of the input image, and the line read from the top within the rectangle as the k-th line (k=0). The second transfer unit 108 sets the rectangle of interest that it will write to the main memory 101 as the upper left corner of the output image.
[0063] In step S1002, the CPU calculates the left and right end addresses L and R of the k-th line from the top within the read rectangle of interest. Here, k is initialized to 0 in steps S1001, S1011, and S1013, when the read rectangle of interest is updated.
[0064] In step S1003, the CPU calculates the burst boundary addresses LA and RA, which include the left and right end addresses. Here, L, R, LA, and RA are updated every line.
[0065] Steps S1004 to S1005 involve the first transfer unit 102 reading from LA to RA-1 in burst access, writing to the first intermediate memory 103, and the CPU determining whether reading all lines within the rectangle has been completed.
[0066] If reading all lines within the rectangle is not completed in step S1005, then in step S1006, k = k + 1 is set, and the process returns to step S1002.
[0067] In step S1007, the input unit 104 extracts one pixel at a time from the (L-LA) byte of each line in the first intermediate memory 103 and inputs it to the image processing unit 105 in the order of the sub-scan after rotation to the main scan.
[0068] In steps S1008 to S1009, the image processing unit 105 performs image processing on the image input in step S1010, sorts the processing results pixel by pixel, and outputs them to memory 2_107 in the order of the rotated sub-scan to the main scan. The CPU then determines whether the output of one rectangle has been completed.
[0069] In step S1010, if the output of one rectangular area is completed in step S1009, the second transfer unit 108 reads from the second intermediate memory 107 in the order of main scan to sub scan after rotation processing and writes it to the rectangular area of interest in the output image area of the main memory 101.
[0070] In step S1011, after the second transfer unit 108 has finished writing in rectangular units, it determines whether it has finished writing the input image in vertical 1-band units. Here, a vertical 1-band refers to multiple read rectangles from the bottom edge to the top edge of the input image. Then, k is reset to 0.
[0071] If the writing process for each vertical band is not completed in step S1011, in step S1012, the first transfer unit 102 moves the target address of the rectangle of interest for reading image data from the main memory 101 to the next higher rectangle. Also, the second transfer unit 108 moves the target address of the rectangle of interest for writing image data to the next right rectangle and returns to 1002.
[0072] If the writing process for one vertical band is completed in step S1011, in step S1013 the CPU determines whether the writing of all bands (processing of the entire input image band by band) is complete.
[0073] If the entire band (entire page) of the transfer unit B108 has not finished writing in step S1012, the process proceeds to step S1014. In step S1014, the first transfer unit 102 moves the target rectangle read address for reading image data from the main memory 101 to the bottom end of the vertical band to the right of the previous vertical band. Also, the second transfer unit 108 moves the target rectangle write address for writing image data to the left end of the band one horizontal band below the previous one, and the process returns to step S1002. k is also reset to 0.
[0074] As described above, by always reading from the main memory in burst length units in the first transfer unit 102, it is possible to prevent a decrease in access speed due to burst division, even in cases of different angles such as 90-degree rotation processing or 270-degree rotation processing, and to perform processing at high speed.
[0075] (Fourth embodiment) In the first to third embodiments, rotation processing was performed by changing the pixel-level processing order in the first transfer unit 102 and the input unit 104 in Figure 2. However, by keeping the reading order of 102 and 104 unchanged from the conventional method, and changing the pixel-level processing order in the second intermediate memory 107 and the second transfer unit 108 in the same way as in the first embodiment, image processing and rotation processing can be performed simultaneously in the same manner.
[0076] In the first to third embodiments, after performing subsequent image processing on the band-unit output image after rotation, the band output image can be deleted, thus reducing the memory on the output side. On the other hand, in this embodiment, although page memory is required on the output side, the input image can be deleted from the top each time band processing is completed, thus reducing the page memory on the input side (before rotation).
[0077] Figure 12 is a diagram illustrating the processing of this embodiment. Images 1101 to 1104 are diagrams showing the processing direction of rectangles and pixels when no rotation processing is performed, similar to image data 201 to 204 in Figure 3. Images 1105 to 1108 are diagrams showing the processing direction of pixels when 90-degree rotation processing is performed simultaneously with image processing in the second intermediate memory 107 and the second transfer unit 108.
[0078] Images 1105 and 1106 are processed in the same way as image data 205 and image data 206.
[0079] Image 1107 shows that the output unit 106 receives the output pixels of the image processing unit 105 one by one and writes them to the second intermediate memory 107 in the order of sub-scanning direction to main-scanning direction of the input image.
[0080] In image 1108, image data is read from the second intermediate memory 107, and then written to the main memory 101 in the order of the main scan direction after rotation of the input image, followed by the reverse direction of the sub-scan.
[0081] The above series of processes from image 1105 to image 1108 are performed sequentially in the main scanning direction, starting from the top-left rectangle 1113 in image 1105, then images 1114, 1115, and 1116. Subsequently, the same process is repeated for each rectangle (not shown) in the sub-scanning direction of the input image, thereby processing the entire page of images.
[0082] The above describes an embodiment in which the series of processes from image 1105 to image 1108 perform a 90-degree rotation.
[0083] Thus, in this embodiment, when performing a 90-degree rotation, the order in which rectangular units are written out from the input image in the second transfer unit 108 is changed, as shown in images 1103 and 1108. Furthermore, the order in which pixels are input to the image processing unit in the output means 106 is changed, as shown in rectangular image data 402 and rectangular image data 404 (405). As a result, for systems that require page memory on the output side, the input image can be erased from the top each time band processing is completed, thus reducing the page memory on the input side before rotation. [Explanation of symbols]
[0084] 101 Main Memory 102 First Transfer Unit 103 First Intermediate Memory 104 Input section 105 Image Processing Unit 106 Output section 107 Second Intermediate Memory 108 Second Transfer Section
Claims
1. A first storage means, a second storage means, and a third storage means for storing image data, A first transfer means reads out the image data as a plurality of rectangular data corresponding to a plurality of rectangles obtained by dividing the image data in a first direction and a second direction orthogonal to the first direction, and writes it to the second storage means, An input means reads the plurality of rectangular data from the second storage means and inputs them to the image processing unit, An output means outputs the plurality of rectangular data that have undergone image processing from the image processing unit and writes them to the third storage means, A second transfer means reads the plurality of rectangular data from the third storage means and writes them to the first storage means, Equipped with, (1) If rotation is not performed, The first transfer means reads the image data stored in the first storage means in the order arranged in the first direction in rectangular data units, and repeats the reading process in the order arranged in the first direction along the second direction. The input means reads out the plurality of rectangular data stored in the second storage means in the first reading order, determining the order in which to read each pixel within each rectangular data. (2) When performing a rotation process that rotates by 90 degrees, The first transfer means reads the image data stored in the first storage means in the order arranged in the second direction in rectangular data units, and repeats the reading process in the order arranged in the second direction along the first direction. The image processing apparatus is characterized in that the input means reads out the plurality of rectangular data stored in the second storage means in a second reading order that is different from the first reading order, in which order each pixel is read out within each rectangular data.
2. The first reading order is a reading order in which the process of reading from the top pixel to the bottom pixel along the second direction in each rectangular data is repeated along the first direction. The image processing apparatus according to claim 1, characterized in that the second reading order is a reading order in which the process of reading from the leftmost pixel to the rightmost pixel along the first direction in each rectangular data is repeated along the direction opposite to the second direction.
3. The image processing apparatus according to claim 1, characterized in that the order in which each pixel of each rectangular data is read by the first transfer means when no rotation processing is performed is the same as the order in which each pixel of each rectangular data is read by the first transfer means when 90-degree rotation processing is performed.
4. The image processing apparatus according to claim 3, characterized in that the order in which each pixel of each rectangular data is read by the first transfer means is a reading order in which the process of reading from the leftmost pixel to the rightmost pixel along the first direction is repeated along the second direction.
5. The image processing apparatus according to claim 1, characterized in that the order in which each rectangular data output from the image processing unit by the output means is written to the third storage means when no rotation processing is performed is the same as the order in which each rectangular data output from the image processing unit by the output means is written to the third storage means when rotation processing is performed to rotate by 90 degrees.
6. The image processing apparatus according to claim 1, characterized in that the order in which each rectangular data read from the third storage means by the second transfer means is written to the first storage means when no rotation processing is performed is the same as the order in which each rectangular data read from the third storage means by the second transfer means is written to the first storage means when rotation processing is performed to rotate by 90 degrees.
7. The image processing apparatus according to claim 1, characterized in that the reading process by the first transfer means and the reading order by the input means are different depending on the angle when performing the rotation process.